-
-(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(window.document);
-(function () {
- 'use strict';
-
- function noop() { }
- function add_location(element, file, line, column, char) {
- element.__svelte_meta = {
- loc: { file, line, column, char }
- };
- }
- function run(fn) {
- return fn();
- }
- function blank_object() {
- return Object.create(null);
- }
- function run_all(fns) {
- fns.forEach(run);
- }
- function is_function(thing) {
- return typeof thing === 'function';
- }
- function safe_not_equal(a, b) {
- return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
- }
- function is_empty(obj) {
- return Object.keys(obj).length === 0;
- }
- function subscribe(store, ...callbacks) {
- if (store == null) {
- return noop;
- }
- const unsub = store.subscribe(...callbacks);
- return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
- }
- function get_store_value(store) {
- let value;
- subscribe(store, _ => value = _)();
- return value;
- }
- function action_destroyer(action_result) {
- return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;
- }
-
- function append(target, node) {
- target.appendChild(node);
- }
- function insert(target, node, anchor) {
- target.insertBefore(node, anchor || null);
- }
- function detach(node) {
- node.parentNode.removeChild(node);
- }
- function destroy_each(iterations, detaching) {
- for (let i = 0; i < iterations.length; i += 1) {
- if (iterations[i])
- iterations[i].d(detaching);
- }
- }
- function element(name) {
- return document.createElement(name);
- }
- function text(data) {
- return document.createTextNode(data);
- }
- function space() {
- return text(' ');
- }
- function empty() {
- return text('');
- }
- function listen(node, event, handler, options) {
- node.addEventListener(event, handler, options);
- return () => node.removeEventListener(event, handler, options);
- }
- function prevent_default(fn) {
- return function (event) {
- event.preventDefault();
- // @ts-ignore
- return fn.call(this, event);
- };
- }
- function stop_propagation(fn) {
- return function (event) {
- event.stopPropagation();
- // @ts-ignore
- return fn.call(this, event);
- };
- }
- function attr(node, attribute, value) {
- if (value == null)
- node.removeAttribute(attribute);
- else if (node.getAttribute(attribute) !== value)
- node.setAttribute(attribute, value);
- }
- function children(element) {
- return Array.from(element.childNodes);
- }
- function set_style(node, key, value, important) {
- node.style.setProperty(key, value, important ? 'important' : '');
- }
- function select_option(select, value) {
- for (let i = 0; i < select.options.length; i += 1) {
- const option = select.options[i];
- if (option.__value === value) {
- option.selected = true;
- return;
- }
- }
- }
- function toggle_class(element, name, toggle) {
- element.classList[toggle ? 'add' : 'remove'](name);
- }
- function custom_event(type, detail) {
- const e = document.createEvent('CustomEvent');
- e.initCustomEvent(type, false, false, detail);
- return e;
- }
-
- let current_component;
- function set_current_component(component) {
- current_component = component;
- }
- function get_current_component() {
- if (!current_component)
- throw new Error('Function called outside component initialization');
- return current_component;
- }
- function onMount(fn) {
- get_current_component().$$.on_mount.push(fn);
- }
-
- const dirty_components = [];
- const binding_callbacks = [];
- const render_callbacks = [];
- const flush_callbacks = [];
- const resolved_promise = Promise.resolve();
- let update_scheduled = false;
- function schedule_update() {
- if (!update_scheduled) {
- update_scheduled = true;
- resolved_promise.then(flush);
- }
- }
- function add_render_callback(fn) {
- render_callbacks.push(fn);
- }
- let flushing = false;
- const seen_callbacks = new Set();
- function flush() {
- if (flushing)
- return;
- flushing = true;
- do {
- // first, call beforeUpdate functions
- // and update components
- for (let i = 0; i < dirty_components.length; i += 1) {
- const component = dirty_components[i];
- set_current_component(component);
- update(component.$$);
- }
- set_current_component(null);
- dirty_components.length = 0;
- while (binding_callbacks.length)
- binding_callbacks.pop()();
- // then, once components are updated, call
- // afterUpdate functions. This may cause
- // subsequent updates...
- for (let i = 0; i < render_callbacks.length; i += 1) {
- const callback = render_callbacks[i];
- if (!seen_callbacks.has(callback)) {
- // ...so guard against infinite loops
- seen_callbacks.add(callback);
- callback();
- }
- }
- render_callbacks.length = 0;
- } while (dirty_components.length);
- while (flush_callbacks.length) {
- flush_callbacks.pop()();
- }
- update_scheduled = false;
- flushing = false;
- seen_callbacks.clear();
- }
- function update($$) {
- if ($$.fragment !== null) {
- $$.update();
- run_all($$.before_update);
- const dirty = $$.dirty;
- $$.dirty = [-1];
- $$.fragment && $$.fragment.p($$.ctx, dirty);
- $$.after_update.forEach(add_render_callback);
- }
- }
- const outroing = new Set();
- let outros;
- function group_outros() {
- outros = {
- r: 0,
- c: [],
- p: outros // parent group
- };
- }
- function check_outros() {
- if (!outros.r) {
- run_all(outros.c);
- }
- outros = outros.p;
- }
- function transition_in(block, local) {
- if (block && block.i) {
- outroing.delete(block);
- block.i(local);
- }
- }
- function transition_out(block, local, detach, callback) {
- if (block && block.o) {
- if (outroing.has(block))
- return;
- outroing.add(block);
- outros.c.push(() => {
- outroing.delete(block);
- if (callback) {
- if (detach)
- block.d(1);
- callback();
- }
- });
- block.o(local);
- }
- }
-
- const globals = (typeof window !== 'undefined'
- ? window
- : typeof globalThis !== 'undefined'
- ? globalThis
- : global);
- function create_component(block) {
- block && block.c();
- }
- function mount_component(component, target, anchor) {
- const { fragment, on_mount, on_destroy, after_update } = component.$$;
- fragment && fragment.m(target, anchor);
- // onMount happens before the initial afterUpdate
- add_render_callback(() => {
- const new_on_destroy = on_mount.map(run).filter(is_function);
- if (on_destroy) {
- on_destroy.push(...new_on_destroy);
- }
- else {
- // Edge case - component was destroyed immediately,
- // most likely as a result of a binding initialising
- run_all(new_on_destroy);
- }
- component.$$.on_mount = [];
- });
- after_update.forEach(add_render_callback);
- }
- function destroy_component(component, detaching) {
- const $$ = component.$$;
- if ($$.fragment !== null) {
- run_all($$.on_destroy);
- $$.fragment && $$.fragment.d(detaching);
- // TODO null out other refs, including component.$$ (but need to
- // preserve final state?)
- $$.on_destroy = $$.fragment = null;
- $$.ctx = [];
- }
- }
- function make_dirty(component, i) {
- if (component.$$.dirty[0] === -1) {
- dirty_components.push(component);
- schedule_update();
- component.$$.dirty.fill(0);
- }
- component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
- }
- function init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) {
- const parent_component = current_component;
- set_current_component(component);
- const prop_values = options.props || {};
- const $$ = component.$$ = {
- fragment: null,
- ctx: null,
- // state
- props,
- update: noop,
- not_equal,
- bound: blank_object(),
- // lifecycle
- on_mount: [],
- on_destroy: [],
- before_update: [],
- after_update: [],
- context: new Map(parent_component ? parent_component.$$.context : []),
- // everything else
- callbacks: blank_object(),
- dirty,
- skip_bound: false
- };
- let ready = false;
- $$.ctx = instance
- ? instance(component, prop_values, (i, ret, ...rest) => {
- const value = rest.length ? rest[0] : ret;
- if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
- if (!$$.skip_bound && $$.bound[i])
- $$.bound[i](value);
- if (ready)
- make_dirty(component, i);
- }
- return ret;
- })
- : [];
- $$.update();
- ready = true;
- run_all($$.before_update);
- // `false` as a special case of no DOM component
- $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
- if (options.target) {
- if (options.hydrate) {
- const nodes = children(options.target);
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- $$.fragment && $$.fragment.l(nodes);
- nodes.forEach(detach);
- }
- else {
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- $$.fragment && $$.fragment.c();
- }
- if (options.intro)
- transition_in(component.$$.fragment);
- mount_component(component, options.target, options.anchor);
- flush();
- }
- set_current_component(parent_component);
- }
- /**
- * Base class for Svelte components. Used when dev=false.
- */
- class SvelteComponent {
- $destroy() {
- destroy_component(this, 1);
- this.$destroy = noop;
- }
- $on(type, callback) {
- const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
- callbacks.push(callback);
- return () => {
- const index = callbacks.indexOf(callback);
- if (index !== -1)
- callbacks.splice(index, 1);
- };
- }
- $set($$props) {
- if (this.$$set && !is_empty($$props)) {
- this.$$.skip_bound = true;
- this.$$set($$props);
- this.$$.skip_bound = false;
- }
- }
- }
-
- function dispatch_dev(type, detail) {
- document.dispatchEvent(custom_event(type, Object.assign({ version: '3.31.2' }, detail)));
- }
- function append_dev(target, node) {
- dispatch_dev('SvelteDOMInsert', { target, node });
- append(target, node);
- }
- function insert_dev(target, node, anchor) {
- dispatch_dev('SvelteDOMInsert', { target, node, anchor });
- insert(target, node, anchor);
- }
- function detach_dev(node) {
- dispatch_dev('SvelteDOMRemove', { node });
- detach(node);
- }
- function listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) {
- const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];
- if (has_prevent_default)
- modifiers.push('preventDefault');
- if (has_stop_propagation)
- modifiers.push('stopPropagation');
- dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });
- const dispose = listen(node, event, handler, options);
- return () => {
- dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });
- dispose();
- };
- }
- function attr_dev(node, attribute, value) {
- attr(node, attribute, value);
- if (value == null)
- dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });
- else
- dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });
- }
- function prop_dev(node, property, value) {
- node[property] = value;
- dispatch_dev('SvelteDOMSetProperty', { node, property, value });
- }
- function set_data_dev(text, data) {
- data = '' + data;
- if (text.wholeText === data)
- return;
- dispatch_dev('SvelteDOMSetData', { node: text, data });
- text.data = data;
- }
- function validate_each_argument(arg) {
- if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
- let msg = '{#each} only iterates over array-like objects.';
- if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
- msg += ' You can use a spread to convert this iterable into an array.';
- }
- throw new Error(msg);
- }
- }
- function validate_slots(name, slot, keys) {
- for (const slot_key of Object.keys(slot)) {
- if (!~keys.indexOf(slot_key)) {
- console.warn(`<${name}> received an unexpected slot "${slot_key}".`);
- }
- }
- }
- /**
- * Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
- */
- class SvelteComponentDev extends SvelteComponent {
- constructor(options) {
- if (!options || (!options.target && !options.$$inline)) {
- throw new Error("'target' is a required option");
- }
- super();
- }
- $destroy() {
- super.$destroy();
- this.$destroy = () => {
- console.warn('Component was already destroyed'); // eslint-disable-line no-console
- };
- }
- $capture_state() { }
- $inject_state() { }
- }
-
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
-
- function createCommonjsModule(fn) {
- var module = { exports: {} };
- return fn(module, module.exports), module.exports;
- }
-
- /*!
- * jQuery JavaScript Library v3.5.1
- * https://jquery.com/
- *
- * Includes Sizzle.js
- * https://sizzlejs.com/
- *
- * Copyright JS Foundation and other contributors
- * Released under the MIT license
- * https://jquery.org/license
- *
- * Date: 2020-05-04T22:49Z
- */
-
- var jquery = createCommonjsModule(function (module) {
- ( function( global, factory ) {
-
- {
-
- // 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 );
- };
- }
-
- // Pass this if window is not defined yet
- } )( typeof window !== "undefined" ? window : commonjsGlobal, function( window, noGlobal ) {
-
- var arr = [];
-
- var getProto = Object.getPrototypeOf;
-
- var slice = arr.slice;
-
- var flat = arr.flat ? function( array ) {
- return arr.flat.call( array );
- } : function( array ) {
- return arr.concat.apply( [], array );
- };
-
-
- var push = arr.push;
-
- var indexOf = arr.indexOf;
-
- var class2type = {};
-
- var toString = class2type.toString;
-
- var hasOwn = class2type.hasOwnProperty;
-
- var fnToString = hasOwn.toString;
-
- var ObjectFunctionString = fnToString.call( Object );
-
- var support = {};
-
- var isFunction = function isFunction( obj ) {
-
- // Support: Chrome <=57, Firefox <=52
- // In some browsers, typeof returns "function" for HTML <object> elements
- // (i.e., `typeof document.createElement( "object" ) === "function"`).
- // We don't want to classify *any* DOM node as a function.
- return typeof obj === "function" && typeof obj.nodeType !== "number";
- };
-
-
- var isWindow = function isWindow( obj ) {
- return obj != null && obj === obj.window;
- };
-
-
- var document = window.document;
-
-
-
- var preservedScriptAttributes = {
- type: true,
- src: true,
- nonce: true,
- noModule: true
- };
-
- function DOMEval( code, node, doc ) {
- doc = doc || document;
-
- var i, val,
- script = doc.createElement( "script" );
-
- script.text = code;
- if ( node ) {
- for ( i in preservedScriptAttributes ) {
-
- // Support: Firefox 64+, Edge 18+
- // Some browsers don't support the "nonce" property on scripts.
- // On the other hand, just using `getAttribute` is not enough as
- // the `nonce` attribute is reset to an empty string whenever it
- // becomes browsing-context connected.
- // See https://github.com/whatwg/html/issues/2369
- // See https://html.spec.whatwg.org/#nonce-attributes
- // The `node.getAttribute` check was added for the sake of
- // `jQuery.globalEval` so that it can fake a nonce-containing node
- // via an object.
- val = node[ i ] || node.getAttribute && node.getAttribute( i );
- if ( val ) {
- script.setAttribute( i, val );
- }
- }
- }
- doc.head.appendChild( script ).parentNode.removeChild( script );
- }
-
-
- function toType( obj ) {
- if ( obj == null ) {
- return obj + "";
- }
-
- // Support: Android <=2.3 only (functionish RegExp)
- return typeof obj === "object" || typeof obj === "function" ?
- class2type[ toString.call( obj ) ] || "object" :
- typeof obj;
- }
- /* global Symbol */
- // Defining this global in .eslintrc.json would create a danger of using the global
- // unguarded in another place, it seems safer to define global only for this module
-
-
-
- var
- version = "3.5.1",
-
- // 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 );
- };
-
- jQuery.fn = jQuery.prototype = {
-
- // The current version of jQuery being used
- jquery: version,
-
- constructor: jQuery,
-
- // 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 all the elements in a clean array
- if ( num == null ) {
- return slice.call( this );
- }
-
- // Return just the one element from the set
- return num < 0 ? this[ num + this.length ] : this[ num ];
- },
-
- // 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;
-
- // 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 );
- },
-
- even: function() {
- return this.pushStack( jQuery.grep( this, function( _elem, i ) {
- return ( i + 1 ) % 2;
- } ) );
- },
-
- odd: function() {
- return this.pushStack( jQuery.grep( this, function( _elem, i ) {
- return i % 2;
- } ) );
- },
-
- 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: arr.sort,
- splice: arr.splice
- };
-
- jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, 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" && !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 ) {
- copy = options[ name ];
-
- // Prevent Object.prototype pollution
- // Prevent never-ending loop
- if ( name === "__proto__" || target === copy ) {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
- ( copyIsArray = Array.isArray( copy ) ) ) ) {
- src = target[ name ];
-
- // Ensure proper type for the source value
- if ( copyIsArray && !Array.isArray( src ) ) {
- clone = [];
- } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
- clone = {};
- } else {
- clone = src;
- }
- copyIsArray = false;
-
- // 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() {},
-
- isPlainObject: function( obj ) {
- var proto, Ctor;
-
- // Detect obvious negatives
- // Use toString instead of jQuery.type to catch host objects
- if ( !obj || toString.call( obj ) !== "[object Object]" ) {
- return false;
- }
-
- proto = getProto( obj );
-
- // Objects with no prototype (e.g., `Object.create( null )`) are plain
- if ( !proto ) {
- return true;
- }
-
- // Objects with prototype are plain iff they were constructed by a global Object function
- Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
- return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
- },
-
- isEmptyObject: function( obj ) {
- var name;
-
- for ( name in obj ) {
- return false;
- }
- return true;
- },
-
- // Evaluates a script in a provided context; falls back to the global one
- // if not specified.
- globalEval: function( code, options, doc ) {
- DOMEval( code, { nonce: options && options.nonce }, doc );
- },
-
- 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;
- },
-
- // 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 ) {
- return arr == null ? -1 : indexOf.call( arr, elem, i );
- },
-
- // Support: Android <=4.0 only, PhantomJS 1 only
- // push.apply(_, arraylike) throws on ancient WebKit
- merge: function( first, second ) {
- var len = +second.length,
- j = 0,
- i = first.length;
-
- for ( ; j < len; j++ ) {
- 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 flat( ret );
- },
-
- // A global GUID counter for objects
- guid: 1,
-
- // jQuery.support is not used in Core but other projects attach their
- // properties to it so it needs to exist.
- support: support
- } );
-
- if ( typeof Symbol === "function" ) {
- jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
- }
-
- // 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: real iOS 8.2 only (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 = toType( obj );
-
- if ( isFunction( obj ) || 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.3.5
- * https://sizzlejs.com/
- *
- * Copyright JS Foundation and other contributors
- * Released under the MIT license
- * https://js.foundation/
- *
- * Date: 2020-03-14
- */
- ( 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(),
- nonnativeSelectorCache = createCache(),
- sortOrder = function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- }
- return 0;
- },
-
- // Instance methods
- hasOwn = ( {} ).hasOwnProperty,
- arr = [],
- pop = arr.pop,
- pushNative = arr.push,
- push = arr.push,
- slice = arr.slice,
-
- // Use a stripped-down indexOf as it's faster than native
- // https://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]",
-
- // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
- identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
- "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
-
- // 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 +
- "*" ),
- rdescend = new RegExp( whitespace + "|>" ),
-
- 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" )
- },
-
- rhtml = /HTML$/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 = /[+~]/,
-
- // CSS escapes
- // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
- runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
- funescape = function( escape, nonHex ) {
- var high = "0x" + escape.slice( 1 ) - 0x10000;
-
- return nonHex ?
-
- // Strip the backslash prefix from a non-hex escape sequence
- nonHex :
-
- // Replace a hexadecimal escape sequence with the encoded Unicode code point
- // Support: IE <=11+
- // For values outside the Basic Multilingual Plane (BMP), manually construct a
- // surrogate pair
- high < 0 ?
- String.fromCharCode( high + 0x10000 ) :
- String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
- },
-
- // CSS string/identifier serialization
- // https://drafts.csswg.org/cssom/#common-serializing-idioms
- rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
- fcssescape = function( ch, asCodePoint ) {
- if ( asCodePoint ) {
-
- // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
- if ( ch === "\0" ) {
- return "\uFFFD";
- }
-
- // Control characters and (dependent upon position) numbers get escaped as code points
- return ch.slice( 0, -1 ) + "\\" +
- ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
- }
-
- // Other potentially-special ASCII characters get backslash-escaped
- return "\\" + ch;
- },
-
- // Used for iframes
- // See setDocument()
- // Removing the function wrapper causes a "Permission Denied"
- // error in IE
- unloadHandler = function() {
- setDocument();
- },
-
- inDisabledFieldset = addCombinator(
- function( elem ) {
- return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
- },
- { dir: "parentNode", next: "legend" }
- );
-
- // Optimize for push.apply( _, NodeList )
- try {
- push.apply(
- ( arr = slice.call( preferredDoc.childNodes ) ),
- preferredDoc.childNodes
- );
-
- // Support: Android<4.0
- // Detect silently failing push.apply
- // eslint-disable-next-line no-unused-expressions
- arr[ preferredDoc.childNodes.length ].nodeType;
- } catch ( e ) {
- push = { apply: arr.length ?
-
- // Leverage slice if possible
- function( target, els ) {
- pushNative.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, 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 ) {
- 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 &&
- !nonnativeSelectorCache[ selector + " " ] &&
- ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
-
- // Support: IE 8 only
- // Exclude object elements
- ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
-
- newSelector = selector;
- newContext = context;
-
- // qSA considers elements outside a scoping root when evaluating child or
- // descendant combinators, which is not what we want.
- // In such cases, we work around the behavior by prefixing every selector in the
- // list with an ID selector referencing the scope context.
- // The technique has to be used as well when a leading combinator is used
- // as such selectors are not recognized by querySelectorAll.
- // Thanks to Andrew Dupont for this technique.
- if ( nodeType === 1 &&
- ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
-
- // Expand context for sibling selectors
- newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
- context;
-
- // We can use :scope instead of the ID hack if the browser
- // supports it & if we're not changing the context.
- if ( newContext !== context || !support.scope ) {
-
- // Capture the context ID, setting it first if necessary
- if ( ( nid = context.getAttribute( "id" ) ) ) {
- nid = nid.replace( rcssescape, fcssescape );
- } else {
- context.setAttribute( "id", ( nid = expando ) );
- }
- }
-
- // Prefix every selector in the list
- groups = tokenize( selector );
- i = groups.length;
- while ( i-- ) {
- groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
- toSelector( groups[ i ] );
- }
- newSelector = groups.join( "," );
- }
-
- try {
- push.apply( results,
- newContext.querySelectorAll( newSelector )
- );
- return results;
- } catch ( qsaError ) {
- nonnativeSelectorCache( selector, true );
- } 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 element and returns a boolean result
- */
- function assert( fn ) {
- var el = document.createElement( "fieldset" );
-
- try {
- return !!fn( el );
- } catch ( e ) {
- return false;
- } finally {
-
- // Remove from its parent by default
- if ( el.parentNode ) {
- el.parentNode.removeChild( el );
- }
-
- // release memory in IE
- el = 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 &&
- a.sourceIndex - b.sourceIndex;
-
- // 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 :enabled/:disabled
- * @param {Boolean} disabled true for :disabled; false for :enabled
- */
- function createDisabledPseudo( disabled ) {
-
- // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
- return function( elem ) {
-
- // Only certain elements can match :enabled or :disabled
- // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
- // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
- if ( "form" in elem ) {
-
- // Check for inherited disabledness on relevant non-disabled elements:
- // * listed form-associated elements in a disabled fieldset
- // https://html.spec.whatwg.org/multipage/forms.html#category-listed
- // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
- // * option elements in a disabled optgroup
- // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
- // All such elements have a "form" property.
- if ( elem.parentNode && elem.disabled === false ) {
-
- // Option elements defer to a parent optgroup if present
- if ( "label" in elem ) {
- if ( "label" in elem.parentNode ) {
- return elem.parentNode.disabled === disabled;
- } else {
- return elem.disabled === disabled;
- }
- }
-
- // Support: IE 6 - 11
- // Use the isDisabled shortcut property to check for disabled fieldset ancestors
- return elem.isDisabled === disabled ||
-
- // Where there is no isDisabled, check manually
- /* jshint -W018 */
- elem.isDisabled !== !disabled &&
- inDisabledFieldset( elem ) === disabled;
- }
-
- return elem.disabled === disabled;
-
- // Try to winnow out elements that can't be disabled before trusting the disabled property.
- // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
- // even exist on them, let alone have a boolean value.
- } else if ( "label" in elem ) {
- return elem.disabled === disabled;
- }
-
- // Remaining elements are neither :enabled nor :disabled
- return false;
- };
- }
-
- /**
- * 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 ) {
- var namespace = elem.namespaceURI,
- docElem = ( elem.ownerDocument || elem ).documentElement;
-
- // Support: IE <=8
- // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
- // https://bugs.jquery.com/ticket/4833
- return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
- };
-
- /**
- * 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, subWindow,
- doc = node ? node.ownerDocument || node : preferredDoc;
-
- // Return early if doc is invalid or already selected
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- 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 12 - 18+
- // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- if ( preferredDoc != document &&
- ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
-
- // Support: IE 11, Edge
- if ( subWindow.addEventListener ) {
- subWindow.addEventListener( "unload", unloadHandler, false );
-
- // Support: IE 9 - 10 only
- } else if ( subWindow.attachEvent ) {
- subWindow.attachEvent( "onunload", unloadHandler );
- }
- }
-
- // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
- // Safari 4 - 5 only, Opera <=11.6 - 12.x only
- // IE/Edge & older browsers don't support the :scope pseudo-class.
- // Support: Safari 6.0 only
- // Safari 6.0 supports :scope but it's an alias of :root there.
- support.scope = assert( function( el ) {
- docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
- return typeof el.querySelectorAll !== "undefined" &&
- !el.querySelectorAll( ":scope fieldset div" ).length;
- } );
-
- /* Attributes
- ---------------------------------------------------------------------- */
-
- // Support: IE<8
- // Verify that getAttribute really returns attributes and not properties
- // (excepting IE8 booleans)
- support.attributes = assert( function( el ) {
- el.className = "i";
- return !el.getAttribute( "className" );
- } );
-
- /* getElement(s)By*
- ---------------------------------------------------------------------- */
-
- // Check if getElementsByTagName("*") returns only elements
- support.getElementsByTagName = assert( function( el ) {
- el.appendChild( document.createComment( "" ) );
- return !el.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 programmatically-set names,
- // so use a roundabout getElementsByName test
- support.getById = assert( function( el ) {
- docElem.appendChild( el ).id = expando;
- return !document.getElementsByName || !document.getElementsByName( expando ).length;
- } );
-
- // ID filter and find
- if ( support.getById ) {
- Expr.filter[ "ID" ] = function( id ) {
- var attrId = id.replace( runescape, funescape );
- return function( elem ) {
- return elem.getAttribute( "id" ) === attrId;
- };
- };
- Expr.find[ "ID" ] = function( id, context ) {
- if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
- var elem = context.getElementById( id );
- return elem ? [ elem ] : [];
- }
- };
- } else {
- 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;
- };
- };
-
- // Support: IE 6 - 7 only
- // getElementById is not reliable as a find shortcut
- Expr.find[ "ID" ] = function( id, context ) {
- if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
- var node, i, elems,
- elem = context.getElementById( id );
-
- if ( elem ) {
-
- // Verify the id attribute
- node = elem.getAttributeNode( "id" );
- if ( node && node.value === id ) {
- return [ elem ];
- }
-
- // Fall back on getElementsByName
- elems = context.getElementsByName( id );
- i = 0;
- while ( ( elem = elems[ i++ ] ) ) {
- node = elem.getAttributeNode( "id" );
- if ( node && node.value === id ) {
- return [ elem ];
- }
- }
- }
-
- return [];
- }
- };
- }
-
- // 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 https://bugs.jquery.com/ticket/13378
- rbuggyQSA = [];
-
- if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
-
- // Build QSA regex
- // Regex strategy adopted from Diego Perini
- assert( function( el ) {
-
- var input;
-
- // 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
- // https://bugs.jquery.com/ticket/12359
- docElem.appendChild( el ).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
- // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
- if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
- }
-
- // Support: IE8
- // Boolean attributes and "value" are not treated correctly
- if ( !el.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 ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
- rbuggyQSA.push( "~=" );
- }
-
- // Support: IE 11+, Edge 15 - 18+
- // IE 11/Edge don't find elements on a `[name='']` query in some cases.
- // Adding a temporary attribute to the document before the selection works
- // around the issue.
- // Interestingly, IE 10 & older don't seem to have the issue.
- input = document.createElement( "input" );
- input.setAttribute( "name", "" );
- el.appendChild( input );
- if ( !el.querySelectorAll( "[name='']" ).length ) {
- rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
- whitespace + "*(?:''|\"\")" );
- }
-
- // 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 ( !el.querySelectorAll( ":checked" ).length ) {
- rbuggyQSA.push( ":checked" );
- }
-
- // Support: Safari 8+, iOS 8+
- // https://bugs.webkit.org/show_bug.cgi?id=136851
- // In-page `selector#id sibling-combinator selector` fails
- if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
- rbuggyQSA.push( ".#.+[+~]" );
- }
-
- // Support: Firefox <=3.6 - 5 only
- // Old Firefox doesn't throw on a badly-escaped identifier.
- el.querySelectorAll( "\\\f" );
- rbuggyQSA.push( "[\\r\\n\\f]" );
- } );
-
- assert( function( el ) {
- el.innerHTML = "<a href='' disabled='disabled'></a>" +
- "<select disabled='disabled'><option/></select>";
-
- // Support: Windows 8 Native Apps
- // The type and name attributes are restricted during .innerHTML assignment
- var input = document.createElement( "input" );
- input.setAttribute( "type", "hidden" );
- el.appendChild( input ).setAttribute( "name", "D" );
-
- // Support: IE8
- // Enforce case-sensitivity of name attribute
- if ( el.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 ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
- rbuggyQSA.push( ":enabled", ":disabled" );
- }
-
- // Support: IE9-11+
- // IE's :disabled selector does not pick up the children of disabled fieldsets
- docElem.appendChild( el ).disabled = true;
- if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
- rbuggyQSA.push( ":enabled", ":disabled" );
- }
-
- // Support: Opera 10 - 11 only
- // Opera 10-11 does not throw on post-comma invalid pseudos
- el.querySelectorAll( "*,:x" );
- rbuggyQSA.push( ",.*:" );
- } );
- }
-
- if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
- docElem.webkitMatchesSelector ||
- docElem.mozMatchesSelector ||
- docElem.oMatchesSelector ||
- docElem.msMatchesSelector ) ) ) ) {
-
- assert( function( el ) {
-
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9)
- support.disconnectedMatch = matches.call( el, "*" );
-
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call( el, "[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
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- 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
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- if ( a == document || a.ownerDocument == preferredDoc &&
- contains( preferredDoc, a ) ) {
- return -1;
- }
-
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- 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 ) {
-
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- /* eslint-disable eqeqeq */
- return a == document ? -1 :
- b == document ? 1 :
- /* eslint-enable eqeqeq */
- 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
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- /* eslint-disable eqeqeq */
- ap[ i ] == preferredDoc ? -1 :
- bp[ i ] == preferredDoc ? 1 :
- /* eslint-enable eqeqeq */
- 0;
- };
-
- return document;
- };
-
- Sizzle.matches = function( expr, elements ) {
- return Sizzle( expr, null, null, elements );
- };
-
- Sizzle.matchesSelector = function( elem, expr ) {
- setDocument( elem );
-
- if ( support.matchesSelector && documentIsHTML &&
- !nonnativeSelectorCache[ 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 ) {
- nonnativeSelectorCache( expr, true );
- }
- }
-
- return Sizzle( expr, document, null, [ elem ] ).length > 0;
- };
-
- Sizzle.contains = function( context, elem ) {
-
- // Set document vars if needed
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- if ( ( context.ownerDocument || context ) != document ) {
- setDocument( context );
- }
- return contains( context, elem );
- };
-
- Sizzle.attr = function( elem, name ) {
-
- // Set document vars if needed
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- 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.escape = function( sel ) {
- return ( sel + "" ).replace( rcssescape, fcssescape );
- };
-
- 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 += "";
-
- /* eslint-disable max-len */
-
- 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;
- /* eslint-enable max-len */
-
- };
- },
-
- "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 || 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": createDisabledPseudo( false ),
- "disabled": createDisabledPseudo( 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 ) {
- // eslint-disable-next-line no-unused-expressions
- 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 > length ?
- 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,
- skip = combinator.next,
- key = skip || dir,
- checkNonElements = base && key === "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 );
- }
- }
- return false;
- } :
-
- // 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 ( skip && skip === elem.nodeName.toLowerCase() ) {
- elem = elem[ dir ] || elem;
- } else if ( ( oldCache = uniqueCache[ key ] ) &&
- 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[ key ] = newCache;
-
- // A match means we're done; a fail means we have to keep checking
- if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
- return true;
- }
- }
- }
- }
- }
- return false;
- };
- }
-
- 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 ) {
-
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- 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;
-
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- 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" &&
- 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( el ) {
-
- // Should return 1, but returns 4 (following)
- return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
- } );
-
- // Support: IE<8
- // Prevent attribute/property "interpolation"
- // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
- if ( !assert( function( el ) {
- el.innerHTML = "<a href='#'></a>";
- return el.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( el ) {
- el.innerHTML = "<input/>";
- el.firstChild.setAttribute( "value", "" );
- return el.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( el ) {
- return el.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;
-
- // Deprecated
- jQuery.expr[ ":" ] = jQuery.expr.pseudos;
- jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
- jQuery.text = Sizzle.getText;
- jQuery.isXMLDoc = Sizzle.isXML;
- jQuery.contains = Sizzle.contains;
- jQuery.escapeSelector = Sizzle.escape;
-
-
-
-
- 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;
-
-
-
- function nodeName( elem, name ) {
-
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
-
- }var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
-
-
-
- // Implement the identical functionality for filter and not
- function winnow( elements, qualifier, not ) {
- if ( isFunction( qualifier ) ) {
- return jQuery.grep( elements, function( elem, i ) {
- return !!qualifier.call( elem, i, elem ) !== not;
- } );
- }
-
- // Single element
- if ( qualifier.nodeType ) {
- return jQuery.grep( elements, function( elem ) {
- return ( elem === qualifier ) !== not;
- } );
- }
-
- // Arraylike of elements (jQuery, arguments, Array)
- if ( typeof qualifier !== "string" ) {
- return jQuery.grep( elements, function( elem ) {
- return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
- } );
- }
-
- // Filtered directly for both simple and complex selectors
- return jQuery.filter( qualifier, elements, not );
- }
-
- jQuery.filter = function( expr, elems, not ) {
- var elem = elems[ 0 ];
-
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
-
- if ( elems.length === 1 && elem.nodeType === 1 ) {
- return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
- }
-
- return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
- return elem.nodeType === 1;
- } ) );
- };
-
- jQuery.fn.extend( {
- find: function( selector ) {
- var i, ret,
- len = this.length,
- self = this;
-
- 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;
- }
- }
- } ) );
- }
-
- ret = this.pushStack( [] );
-
- for ( i = 0; i < len; i++ ) {
- jQuery.find( selector, self[ i ], ret );
- }
-
- return len > 1 ? jQuery.uniqueSort( ret ) : 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 <)
- // Shortcut simple #id case for speed
- rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
-
- init = jQuery.fn.init = function( selector, context, root ) {
- var match, elem;
-
- // HANDLE: $(""), $(null), $(undefined), $(false)
- if ( !selector ) {
- return this;
- }
-
- // Method 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[ 0 ] === "<" &&
- selector[ 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;
-
- // Option to run 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 ( 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 ] );
-
- if ( elem ) {
-
- // Inject the element directly into the jQuery object
- this[ 0 ] = elem;
- this.length = 1;
- }
- 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[ 0 ] = selector;
- this.length = 1;
- return this;
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( isFunction( selector ) ) {
- return root.ready !== undefined ?
- root.ready( selector ) :
-
- // Execute immediately if ready is not present
- selector( jQuery );
- }
-
- 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 targets = jQuery( target, this ),
- l = targets.length;
-
- return this.filter( function() {
- var i = 0;
- for ( ; i < l; i++ ) {
- if ( jQuery.contains( this, targets[ i ] ) ) {
- return true;
- }
- }
- } );
- },
-
- closest: function( selectors, context ) {
- var cur,
- i = 0,
- l = this.length,
- matched = [],
- targets = typeof selectors !== "string" && jQuery( selectors );
-
- // Positional selectors never match, since there's no _selection_ context
- if ( !rneedsContext.test( selectors ) ) {
- for ( ; i < l; i++ ) {
- for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
-
- // Always skip document fragments
- if ( cur.nodeType < 11 && ( targets ?
- targets.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 set
- 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 indexOf.call( jQuery( elem ), this[ 0 ] );
- }
-
- // Locate the position of the desired element
- return indexOf.call( this,
-
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[ 0 ] : elem
- );
- },
-
- 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 ) {
- while ( ( cur = cur[ dir ] ) && 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 ) {
- if ( elem.contentDocument != null &&
-
- // Support: IE 11+
- // <object> elements with no `data` attribute has an object
- // `contentDocument` with a `null` prototype.
- getProto( elem.contentDocument ) ) {
-
- return elem.contentDocument;
- }
-
- // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
- // Treat the template element as a regular one in browsers that
- // don't support it.
- if ( nodeName( elem, "template" ) ) {
- elem = elem.content || elem;
- }
-
- return jQuery.merge( [], elem.childNodes );
- }
- }, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var matched = jQuery.map( this, fn, until );
-
- if ( name.slice( -5 ) !== "Until" ) {
- selector = until;
- }
-
- if ( selector && typeof selector === "string" ) {
- matched = jQuery.filter( selector, matched );
- }
-
- if ( this.length > 1 ) {
-
- // Remove duplicates
- if ( !guaranteedUnique[ name ] ) {
- jQuery.uniqueSort( matched );
- }
-
- // Reverse order for parents* and prev-derivatives
- if ( rparentsprev.test( name ) ) {
- matched.reverse();
- }
- }
-
- return this.pushStack( matched );
- };
- } );
- var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
-
-
-
- // Convert String-formatted options into Object-formatted ones
- function createOptions( options ) {
- var object = {};
- jQuery.each( options.match( rnothtmlwhite ) || [], 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 = 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 ( isFunction( arg ) ) {
- if ( !options.unique || !self.has( arg ) ) {
- list.push( arg );
- }
- } else if ( arg && arg.length && toType( 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 = queue = [];
- if ( !memory && !firing ) {
- list = memory = "";
- }
- 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;
- };
-
-
- function Identity( v ) {
- return v;
- }
- function Thrower( ex ) {
- throw ex;
- }
-
- function adoptValue( value, resolve, reject, noValue ) {
- var method;
-
- try {
-
- // Check for promise aspect first to privilege synchronous behavior
- if ( value && isFunction( ( method = value.promise ) ) ) {
- method.call( value ).done( resolve ).fail( reject );
-
- // Other thenables
- } else if ( value && isFunction( ( method = value.then ) ) ) {
- method.call( value, resolve, reject );
-
- // Other non-thenables
- } else {
-
- // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
- // * false: [ value ].slice( 0 ) => resolve( value )
- // * true: [ value ].slice( 1 ) => resolve()
- resolve.apply( undefined, [ value ].slice( noValue ) );
- }
-
- // For Promises/A+, convert exceptions into rejections
- // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
- // Deferred#then to conditionally suppress rejection.
- } catch ( value ) {
-
- // Support: Android 4.0 only
- // Strict mode functions invoked without .call/.apply get global-object context
- reject.apply( undefined, [ value ] );
- }
- }
-
- jQuery.extend( {
-
- Deferred: function( func ) {
- var tuples = [
-
- // action, add listener, callbacks,
- // ... .then handlers, argument index, [final state]
- [ "notify", "progress", jQuery.Callbacks( "memory" ),
- jQuery.Callbacks( "memory" ), 2 ],
- [ "resolve", "done", jQuery.Callbacks( "once memory" ),
- jQuery.Callbacks( "once memory" ), 0, "resolved" ],
- [ "reject", "fail", jQuery.Callbacks( "once memory" ),
- jQuery.Callbacks( "once memory" ), 1, "rejected" ]
- ],
- state = "pending",
- promise = {
- state: function() {
- return state;
- },
- always: function() {
- deferred.done( arguments ).fail( arguments );
- return this;
- },
- "catch": function( fn ) {
- return promise.then( null, fn );
- },
-
- // Keep pipe for back-compat
- pipe: function( /* fnDone, fnFail, fnProgress */ ) {
- var fns = arguments;
-
- return jQuery.Deferred( function( newDefer ) {
- jQuery.each( tuples, function( _i, tuple ) {
-
- // Map tuples (progress, done, fail) to arguments (done, fail, progress)
- var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
-
- // deferred.progress(function() { bind to newDefer or newDefer.notify })
- // deferred.done(function() { bind to newDefer or newDefer.resolve })
- // deferred.fail(function() { bind to newDefer or newDefer.reject })
- deferred[ tuple[ 1 ] ]( function() {
- var returned = fn && fn.apply( this, arguments );
- if ( returned && isFunction( returned.promise ) ) {
- returned.promise()
- .progress( newDefer.notify )
- .done( newDefer.resolve )
- .fail( newDefer.reject );
- } else {
- newDefer[ tuple[ 0 ] + "With" ](
- this,
- fn ? [ returned ] : arguments
- );
- }
- } );
- } );
- fns = null;
- } ).promise();
- },
- then: function( onFulfilled, onRejected, onProgress ) {
- var maxDepth = 0;
- function resolve( depth, deferred, handler, special ) {
- return function() {
- var that = this,
- args = arguments,
- mightThrow = function() {
- var returned, then;
-
- // Support: Promises/A+ section 2.3.3.3.3
- // https://promisesaplus.com/#point-59
- // Ignore double-resolution attempts
- if ( depth < maxDepth ) {
- return;
- }
-
- returned = handler.apply( that, args );
-
- // Support: Promises/A+ section 2.3.1
- // https://promisesaplus.com/#point-48
- if ( returned === deferred.promise() ) {
- throw new TypeError( "Thenable self-resolution" );
- }
-
- // Support: Promises/A+ sections 2.3.3.1, 3.5
- // https://promisesaplus.com/#point-54
- // https://promisesaplus.com/#point-75
- // Retrieve `then` only once
- then = returned &&
-
- // Support: Promises/A+ section 2.3.4
- // https://promisesaplus.com/#point-64
- // Only check objects and functions for thenability
- ( typeof returned === "object" ||
- typeof returned === "function" ) &&
- returned.then;
-
- // Handle a returned thenable
- if ( isFunction( then ) ) {
-
- // Special processors (notify) just wait for resolution
- if ( special ) {
- then.call(
- returned,
- resolve( maxDepth, deferred, Identity, special ),
- resolve( maxDepth, deferred, Thrower, special )
- );
-
- // Normal processors (resolve) also hook into progress
- } else {
-
- // ...and disregard older resolution values
- maxDepth++;
-
- then.call(
- returned,
- resolve( maxDepth, deferred, Identity, special ),
- resolve( maxDepth, deferred, Thrower, special ),
- resolve( maxDepth, deferred, Identity,
- deferred.notifyWith )
- );
- }
-
- // Handle all other returned values
- } else {
-
- // Only substitute handlers pass on context
- // and multiple values (non-spec behavior)
- if ( handler !== Identity ) {
- that = undefined;
- args = [ returned ];
- }
-
- // Process the value(s)
- // Default process is resolve
- ( special || deferred.resolveWith )( that, args );
- }
- },
-
- // Only normal processors (resolve) catch and reject exceptions
- process = special ?
- mightThrow :
- function() {
- try {
- mightThrow();
- } catch ( e ) {
-
- if ( jQuery.Deferred.exceptionHook ) {
- jQuery.Deferred.exceptionHook( e,
- process.stackTrace );
- }
-
- // Support: Promises/A+ section 2.3.3.3.4.1
- // https://promisesaplus.com/#point-61
- // Ignore post-resolution exceptions
- if ( depth + 1 >= maxDepth ) {
-
- // Only substitute handlers pass on context
- // and multiple values (non-spec behavior)
- if ( handler !== Thrower ) {
- that = undefined;
- args = [ e ];
- }
-
- deferred.rejectWith( that, args );
- }
- }
- };
-
- // Support: Promises/A+ section 2.3.3.3.1
- // https://promisesaplus.com/#point-57
- // Re-resolve promises immediately to dodge false rejection from
- // subsequent errors
- if ( depth ) {
- process();
- } else {
-
- // Call an optional hook to record the stack, in case of exception
- // since it's otherwise lost when execution goes async
- if ( jQuery.Deferred.getStackHook ) {
- process.stackTrace = jQuery.Deferred.getStackHook();
- }
- window.setTimeout( process );
- }
- };
- }
-
- return jQuery.Deferred( function( newDefer ) {
-
- // progress_handlers.add( ... )
- tuples[ 0 ][ 3 ].add(
- resolve(
- 0,
- newDefer,
- isFunction( onProgress ) ?
- onProgress :
- Identity,
- newDefer.notifyWith
- )
- );
-
- // fulfilled_handlers.add( ... )
- tuples[ 1 ][ 3 ].add(
- resolve(
- 0,
- newDefer,
- isFunction( onFulfilled ) ?
- onFulfilled :
- Identity
- )
- );
-
- // rejected_handlers.add( ... )
- tuples[ 2 ][ 3 ].add(
- resolve(
- 0,
- newDefer,
- isFunction( onRejected ) ?
- onRejected :
- Thrower
- )
- );
- } ).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 = {};
-
- // Add list-specific methods
- jQuery.each( tuples, function( i, tuple ) {
- var list = tuple[ 2 ],
- stateString = tuple[ 5 ];
-
- // promise.progress = list.add
- // promise.done = list.add
- // promise.fail = list.add
- promise[ tuple[ 1 ] ] = list.add;
-
- // Handle state
- if ( stateString ) {
- list.add(
- function() {
-
- // state = "resolved" (i.e., fulfilled)
- // state = "rejected"
- state = stateString;
- },
-
- // rejected_callbacks.disable
- // fulfilled_callbacks.disable
- tuples[ 3 - i ][ 2 ].disable,
-
- // rejected_handlers.disable
- // fulfilled_handlers.disable
- tuples[ 3 - i ][ 3 ].disable,
-
- // progress_callbacks.lock
- tuples[ 0 ][ 2 ].lock,
-
- // progress_handlers.lock
- tuples[ 0 ][ 3 ].lock
- );
- }
-
- // progress_handlers.fire
- // fulfilled_handlers.fire
- // rejected_handlers.fire
- list.add( tuple[ 3 ].fire );
-
- // deferred.notify = function() { deferred.notifyWith(...) }
- // deferred.resolve = function() { deferred.resolveWith(...) }
- // deferred.reject = function() { deferred.rejectWith(...) }
- deferred[ tuple[ 0 ] ] = function() {
- deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
- return this;
- };
-
- // deferred.notifyWith = list.fireWith
- // deferred.resolveWith = list.fireWith
- // deferred.rejectWith = list.fireWith
- 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( singleValue ) {
- var
-
- // count of uncompleted subordinates
- remaining = arguments.length,
-
- // count of unprocessed arguments
- i = remaining,
-
- // subordinate fulfillment data
- resolveContexts = Array( i ),
- resolveValues = slice.call( arguments ),
-
- // the master Deferred
- master = jQuery.Deferred(),
-
- // subordinate callback factory
- updateFunc = function( i ) {
- return function( value ) {
- resolveContexts[ i ] = this;
- resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
- if ( !( --remaining ) ) {
- master.resolveWith( resolveContexts, resolveValues );
- }
- };
- };
-
- // Single- and empty arguments are adopted like Promise.resolve
- if ( remaining <= 1 ) {
- adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
- !remaining );
-
- // Use .then() to unwrap secondary thenables (cf. gh-3000)
- if ( master.state() === "pending" ||
- isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
-
- return master.then();
- }
- }
-
- // Multiple arguments are aggregated like Promise.all array elements
- while ( i-- ) {
- adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
- }
-
- return master.promise();
- }
- } );
-
-
- // These usually indicate a programmer mistake during development,
- // warn about them ASAP rather than swallowing them by default.
- var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
-
- jQuery.Deferred.exceptionHook = function( error, stack ) {
-
- // Support: IE 8 - 9 only
- // Console exists when dev tools are open, which can happen at any time
- if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
- window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
- }
- };
-
-
-
-
- jQuery.readyException = function( error ) {
- window.setTimeout( function() {
- throw error;
- } );
- };
-
-
-
-
- // The deferred used on DOM ready
- var readyList = jQuery.Deferred();
-
- jQuery.fn.ready = function( fn ) {
-
- readyList
- .then( fn )
-
- // Wrap jQuery.readyException in a function so that the lookup
- // happens at the time of error handling instead of callback
- // registration.
- .catch( function( error ) {
- jQuery.readyException( error );
- } );
-
- 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,
-
- // 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 ] );
- }
- } );
-
- jQuery.ready.then = readyList.then;
-
- // The ready event handler and self cleanup method
- function completed() {
- document.removeEventListener( "DOMContentLoaded", completed );
- window.removeEventListener( "load", completed );
- jQuery.ready();
- }
-
- // Catch cases where $(document).ready() is called
- // after the browser event has already occurred.
- // Support: IE <=9 - 10 only
- // 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 );
-
- } else {
-
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", completed );
-
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", completed );
- }
-
-
-
-
- // 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,
- len = elems.length,
- bulk = key == null;
-
- // Sets many values
- if ( toType( 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 ( !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 < len; i++ ) {
- fn(
- elems[ i ], key, raw ?
- value :
- value.call( elems[ i ], i, fn( elems[ i ], key ) )
- );
- }
- }
- }
-
- if ( chainable ) {
- return elems;
- }
-
- // Gets
- if ( bulk ) {
- return fn.call( elems );
- }
-
- return len ? fn( elems[ 0 ], key ) : emptyGet;
- };
-
-
- // Matches dashed string for camelizing
- var rmsPrefix = /^-ms-/,
- rdashAlpha = /-([a-z])/g;
-
- // Used by camelCase as callback to replace()
- function fcamelCase( _all, letter ) {
- return letter.toUpperCase();
- }
-
- // Convert dashed to camelCase; used by the css and data modules
- // Support: IE <=9 - 11, Edge 12 - 15
- // Microsoft forgot to hump their vendor prefix (#9572)
- function camelCase( string ) {
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
- }
- var acceptData = function( owner ) {
-
- // Accepts only:
- // - Node
- // - Node.ELEMENT_NODE
- // - Node.DOCUMENT_NODE
- // - Object
- // - Any
- return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
- };
-
-
-
-
- function Data() {
- this.expando = jQuery.expando + Data.uid++;
- }
-
- Data.uid = 1;
-
- Data.prototype = {
-
- cache: function( owner ) {
-
- // Check if the owner object already has a cache
- var value = owner[ this.expando ];
-
- // If not, create one
- if ( !value ) {
- value = {};
-
- // We can accept data for non-element nodes in modern browsers,
- // but we should not, see #8335.
- // Always return an empty object.
- if ( acceptData( owner ) ) {
-
- // If it is a node unlikely to be stringify-ed or looped over
- // use plain assignment
- if ( owner.nodeType ) {
- owner[ this.expando ] = value;
-
- // Otherwise secure it in a non-enumerable property
- // configurable must be true to allow the property to be
- // deleted when data is removed
- } else {
- Object.defineProperty( owner, this.expando, {
- value: value,
- configurable: true
- } );
- }
- }
- }
-
- return value;
- },
- set: function( owner, data, value ) {
- var prop,
- cache = this.cache( owner );
-
- // Handle: [ owner, key, value ] args
- // Always use camelCase key (gh-2257)
- if ( typeof data === "string" ) {
- cache[ camelCase( data ) ] = value;
-
- // Handle: [ owner, { properties } ] args
- } else {
-
- // Copy the properties one-by-one to the cache object
- for ( prop in data ) {
- cache[ camelCase( prop ) ] = data[ prop ];
- }
- }
- return cache;
- },
- get: function( owner, key ) {
- return key === undefined ?
- this.cache( owner ) :
-
- // Always use camelCase key (gh-2257)
- owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
- },
- access: function( owner, key, value ) {
-
- // In cases where either:
- //
- // 1. No key was specified
- // 2. A string key was specified, but no value provided
- //
- // Take the "read" path and allow the get method to determine
- // which value to return, respectively either:
- //
- // 1. The entire cache object
- // 2. The data stored at the key
- //
- if ( key === undefined ||
- ( ( key && typeof key === "string" ) && value === undefined ) ) {
-
- return this.get( owner, key );
- }
-
- // When the key is not a string, or both a key and value
- // are specified, set or extend (existing objects) with either:
- //
- // 1. An object of properties
- // 2. A key and value
- //
- this.set( owner, key, value );
-
- // Since the "set" path can have two possible entry points
- // return the expected data based on which path was taken[*]
- return value !== undefined ? value : key;
- },
- remove: function( owner, key ) {
- var i,
- cache = owner[ this.expando ];
-
- if ( cache === undefined ) {
- return;
- }
-
- if ( key !== undefined ) {
-
- // Support array or space separated string of keys
- if ( Array.isArray( key ) ) {
-
- // If key is an array of keys...
- // We always set camelCase keys, so remove that.
- key = key.map( camelCase );
- } else {
- key = camelCase( key );
-
- // If a key with the spaces exists, use it.
- // Otherwise, create an array by matching non-whitespace
- key = key in cache ?
- [ key ] :
- ( key.match( rnothtmlwhite ) || [] );
- }
-
- i = key.length;
-
- while ( i-- ) {
- delete cache[ key[ i ] ];
- }
- }
-
- // Remove the expando if there's no more data
- if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
-
- // Support: Chrome <=35 - 45
- // Webkit & Blink performance suffers when deleting properties
- // from DOM nodes, so set to undefined instead
- // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
- if ( owner.nodeType ) {
- owner[ this.expando ] = undefined;
- } else {
- delete owner[ this.expando ];
- }
- }
- },
- hasData: function( owner ) {
- var cache = owner[ this.expando ];
- return cache !== undefined && !jQuery.isEmptyObject( cache );
- }
- };
- var dataPriv = new Data();
-
- var dataUser = new Data();
-
-
-
- // Implementation Summary
- //
- // 1. Enforce API surface and semantic compatibility with 1.9.x branch
- // 2. Improve the module's maintainability by reducing the storage
- // paths to a single mechanism.
- // 3. Use the same single mechanism to support "private" and "user" data.
- // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
- // 5. Avoid exposing implementation details on user objects (eg. expando properties)
- // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
-
- var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
- rmultiDash = /[A-Z]/g;
-
- function getData( data ) {
- if ( data === "true" ) {
- return true;
- }
-
- if ( data === "false" ) {
- return false;
- }
-
- if ( data === "null" ) {
- return null;
- }
-
- // Only convert to a number if it doesn't change the string
- if ( data === +data + "" ) {
- return +data;
- }
-
- if ( rbrace.test( data ) ) {
- return JSON.parse( data );
- }
-
- return data;
- }
-
- function dataAttr( elem, key, data ) {
- var name;
-
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
- name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
- data = elem.getAttribute( name );
-
- if ( typeof data === "string" ) {
- try {
- data = getData( data );
- } catch ( e ) {}
-
- // Make sure we set the data so it isn't changed later
- dataUser.set( elem, key, data );
- } else {
- data = undefined;
- }
- }
- return data;
- }
-
- jQuery.extend( {
- hasData: function( elem ) {
- return dataUser.hasData( elem ) || dataPriv.hasData( elem );
- },
-
- data: function( elem, name, data ) {
- return dataUser.access( elem, name, data );
- },
-
- removeData: function( elem, name ) {
- dataUser.remove( elem, name );
- },
-
- // TODO: Now that all calls to _data and _removeData have been replaced
- // with direct calls to dataPriv methods, these can be deprecated.
- _data: function( elem, name, data ) {
- return dataPriv.access( elem, name, data );
- },
-
- _removeData: function( elem, name ) {
- dataPriv.remove( elem, name );
- }
- } );
-
- jQuery.fn.extend( {
- data: function( key, value ) {
- var i, name, data,
- elem = this[ 0 ],
- attrs = elem && elem.attributes;
-
- // Gets all values
- if ( key === undefined ) {
- if ( this.length ) {
- data = dataUser.get( elem );
-
- if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
- i = attrs.length;
- while ( i-- ) {
-
- // Support: IE 11 only
- // The attrs elements can be null (#14894)
- if ( attrs[ i ] ) {
- name = attrs[ i ].name;
- if ( name.indexOf( "data-" ) === 0 ) {
- name = camelCase( name.slice( 5 ) );
- dataAttr( elem, name, data[ name ] );
- }
- }
- }
- dataPriv.set( elem, "hasDataAttrs", true );
- }
- }
-
- return data;
- }
-
- // Sets multiple values
- if ( typeof key === "object" ) {
- return this.each( function() {
- dataUser.set( this, key );
- } );
- }
-
- return access( this, function( value ) {
- var data;
-
- // The calling jQuery object (element matches) is not empty
- // (and therefore has an element appears at this[ 0 ]) and the
- // `value` parameter was not undefined. An empty jQuery object
- // will result in `undefined` for elem = this[ 0 ] which will
- // throw an exception if an attempt to read a data cache is made.
- if ( elem && value === undefined ) {
-
- // Attempt to get data from the cache
- // The key will always be camelCased in Data
- data = dataUser.get( elem, key );
- if ( data !== undefined ) {
- return data;
- }
-
- // Attempt to "discover" the data in
- // HTML5 custom data-* attrs
- data = dataAttr( elem, key );
- if ( data !== undefined ) {
- return data;
- }
-
- // We tried really hard, but the data doesn't exist.
- return;
- }
-
- // Set the data...
- this.each( function() {
-
- // We always store the camelCased key
- dataUser.set( this, key, value );
- } );
- }, null, value, arguments.length > 1, null, true );
- },
-
- removeData: function( key ) {
- return this.each( function() {
- dataUser.remove( this, key );
- } );
- }
- } );
-
-
- jQuery.extend( {
- queue: function( elem, type, data ) {
- var queue;
-
- if ( elem ) {
- type = ( type || "fx" ) + "queue";
- queue = dataPriv.get( elem, type );
-
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !queue || Array.isArray( data ) ) {
- queue = dataPriv.access( 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 public - generate a queueHooks object, or return the current one
- _queueHooks: function( elem, type ) {
- var key = type + "queueHooks";
- return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
- empty: jQuery.Callbacks( "once memory" ).add( function() {
- dataPriv.remove( elem, [ type + "queue", 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 = dataPriv.get( elements[ i ], type + "queueHooks" );
- if ( tmp && tmp.empty ) {
- count++;
- tmp.empty.add( resolve );
- }
- }
- resolve();
- return defer.promise( obj );
- }
- } );
- var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
-
- var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
-
-
- var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
-
- var documentElement = document.documentElement;
-
-
-
- var isAttached = function( elem ) {
- return jQuery.contains( elem.ownerDocument, elem );
- },
- composed = { composed: true };
-
- // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
- // Check attachment across shadow DOM boundaries when possible (gh-3504)
- // Support: iOS 10.0-10.2 only
- // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
- // leading to errors. We need to check for `getRootNode`.
- if ( documentElement.getRootNode ) {
- isAttached = function( elem ) {
- return jQuery.contains( elem.ownerDocument, elem ) ||
- elem.getRootNode( composed ) === elem.ownerDocument;
- };
- }
- var isHiddenWithinTree = function( elem, el ) {
-
- // isHiddenWithinTree might be called from jQuery#filter function;
- // in that case, element will be second argument
- elem = el || elem;
-
- // Inline style trumps all
- return elem.style.display === "none" ||
- elem.style.display === "" &&
-
- // Otherwise, check computed style
- // Support: Firefox <=43 - 45
- // Disconnected elements can have computed display: none, so first confirm that elem is
- // in the document.
- isAttached( elem ) &&
-
- jQuery.css( elem, "display" ) === "none";
- };
-
-
-
- function adjustCSS( elem, prop, valueParts, tween ) {
- var adjusted, scale,
- 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 = elem.nodeType &&
- ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
- rcssNum.exec( jQuery.css( elem, prop ) );
-
- if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
-
- // Support: Firefox <=54
- // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
- initial = initial / 2;
-
- // Trust units reported by jQuery.css
- unit = unit || initialInUnit[ 3 ];
-
- // Iteratively approximate from a nonzero starting point
- initialInUnit = +initial || 1;
-
- while ( maxIterations-- ) {
-
- // Evaluate and update our best guess (doubling guesses that zero out).
- // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
- jQuery.style( elem, prop, initialInUnit + unit );
- if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
- maxIterations = 0;
- }
- initialInUnit = initialInUnit / scale;
-
- }
-
- initialInUnit = initialInUnit * 2;
- jQuery.style( elem, prop, initialInUnit + unit );
-
- // Make sure we update the tween properties later on
- valueParts = valueParts || [];
- }
-
- 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;
- }
-
-
- var defaultDisplayMap = {};
-
- function getDefaultDisplay( elem ) {
- var temp,
- doc = elem.ownerDocument,
- nodeName = elem.nodeName,
- display = defaultDisplayMap[ nodeName ];
-
- if ( display ) {
- return display;
- }
-
- temp = doc.body.appendChild( doc.createElement( nodeName ) );
- display = jQuery.css( temp, "display" );
-
- temp.parentNode.removeChild( temp );
-
- if ( display === "none" ) {
- display = "block";
- }
- defaultDisplayMap[ nodeName ] = display;
-
- return display;
- }
-
- function showHide( elements, show ) {
- var display, elem,
- values = [],
- index = 0,
- length = elements.length;
-
- // Determine new display value for elements that need to change
- for ( ; index < length; index++ ) {
- elem = elements[ index ];
- if ( !elem.style ) {
- continue;
- }
-
- display = elem.style.display;
- if ( show ) {
-
- // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
- // check is required in this first loop unless we have a nonempty display value (either
- // inline or about-to-be-restored)
- if ( display === "none" ) {
- values[ index ] = dataPriv.get( elem, "display" ) || null;
- if ( !values[ index ] ) {
- elem.style.display = "";
- }
- }
- if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
- values[ index ] = getDefaultDisplay( elem );
- }
- } else {
- if ( display !== "none" ) {
- values[ index ] = "none";
-
- // Remember what we're overwriting
- dataPriv.set( elem, "display", display );
- }
- }
- }
-
- // Set the display of the elements in a second loop to avoid constant reflow
- for ( index = 0; index < length; index++ ) {
- if ( values[ index ] != null ) {
- elements[ index ].style.display = values[ index ];
- }
- }
-
- return elements;
- }
-
- jQuery.fn.extend( {
- 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 ( isHiddenWithinTree( this ) ) {
- jQuery( this ).show();
- } else {
- jQuery( this ).hide();
- }
- } );
- }
- } );
- var rcheckableType = ( /^(?:checkbox|radio)$/i );
-
- var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
-
- var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
-
-
-
- ( function() {
- var fragment = document.createDocumentFragment(),
- div = fragment.appendChild( document.createElement( "div" ) ),
- input = document.createElement( "input" );
-
- // Support: Android 4.0 - 4.3 only
- // Check state lost if the name is set (#11217)
- // Support: Windows Web Apps (WWA)
- // `name` and `type` must use .setAttribute for WWA (#14901)
- input.setAttribute( "type", "radio" );
- input.setAttribute( "checked", "checked" );
- input.setAttribute( "name", "t" );
-
- div.appendChild( input );
-
- // Support: Android <=4.1 only
- // Older WebKit doesn't clone checked state correctly in fragments
- support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
- // Support: IE <=11 only
- // Make sure textarea (and checkbox) defaultValue is properly cloned
- div.innerHTML = "<textarea>x</textarea>";
- support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
-
- // Support: IE <=9 only
- // IE <=9 replaces <option> tags with their contents when inserted outside of
- // the select element.
- div.innerHTML = "<option></option>";
- support.option = !!div.lastChild;
- } )();
-
-
- // We have to close these tags to support XHTML (#13200)
- var wrapMap = {
-
- // XHTML parsers do not magically insert elements in the
- // same way that tag soup parsers do. So we cannot shorten
- // this by omitting <tbody> or other required elements.
- thead: [ 1, "<table>", "</table>" ],
- col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
- tr: [ 2, "<table><tbody>", "</tbody></table>" ],
- td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
-
- _default: [ 0, "", "" ]
- };
-
- wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
- wrapMap.th = wrapMap.td;
-
- // Support: IE <=9 only
- if ( !support.option ) {
- wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
- }
-
-
- function getAll( context, tag ) {
-
- // Support: IE <=9 - 11 only
- // Use typeof to avoid zero-argument method invocation on host objects (#15151)
- var ret;
-
- if ( typeof context.getElementsByTagName !== "undefined" ) {
- ret = context.getElementsByTagName( tag || "*" );
-
- } else if ( typeof context.querySelectorAll !== "undefined" ) {
- ret = context.querySelectorAll( tag || "*" );
-
- } else {
- ret = [];
- }
-
- if ( tag === undefined || tag && nodeName( context, tag ) ) {
- return jQuery.merge( [ context ], ret );
- }
-
- return ret;
- }
-
-
- // Mark scripts as having already been evaluated
- function setGlobalEval( elems, refElements ) {
- var i = 0,
- l = elems.length;
-
- for ( ; i < l; i++ ) {
- dataPriv.set(
- elems[ i ],
- "globalEval",
- !refElements || dataPriv.get( refElements[ i ], "globalEval" )
- );
- }
- }
-
-
- var rhtml = /<|&#?\w+;/;
-
- function buildFragment( elems, context, scripts, selection, ignored ) {
- var elem, tmp, tag, wrap, attached, j,
- fragment = context.createDocumentFragment(),
- nodes = [],
- i = 0,
- l = elems.length;
-
- for ( ; i < l; i++ ) {
- elem = elems[ i ];
-
- if ( elem || elem === 0 ) {
-
- // Add nodes directly
- if ( toType( elem ) === "object" ) {
-
- // Support: Android <=4.0 only, PhantomJS 1 only
- // push.apply(_, arraylike) throws on ancient WebKit
- 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 || fragment.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;
- }
-
- // Support: Android <=4.0 only, PhantomJS 1 only
- // push.apply(_, arraylike) throws on ancient WebKit
- jQuery.merge( nodes, tmp.childNodes );
-
- // Remember the top-level container
- tmp = fragment.firstChild;
-
- // Ensure the created nodes are orphaned (#12392)
- tmp.textContent = "";
- }
- }
- }
-
- // Remove wrapper from fragment
- fragment.textContent = "";
-
- 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;
- }
-
- attached = isAttached( elem );
-
- // Append to fragment
- tmp = getAll( fragment.appendChild( elem ), "script" );
-
- // Preserve script evaluation history
- if ( attached ) {
- setGlobalEval( tmp );
- }
-
- // Capture executables
- if ( scripts ) {
- j = 0;
- while ( ( elem = tmp[ j++ ] ) ) {
- if ( rscriptType.test( elem.type || "" ) ) {
- scripts.push( elem );
- }
- }
- }
- }
-
- return fragment;
- }
-
-
- var
- rkeyEvent = /^key/,
- rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
- rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
-
- function returnTrue() {
- return true;
- }
-
- function returnFalse() {
- return false;
- }
-
- // Support: IE <=9 - 11+
- // focus() and blur() are asynchronous, except when they are no-op.
- // So expect focus to be synchronous when the element is already active,
- // and blur to be synchronous when the element is not already active.
- // (focus and blur are always synchronous in other supported browsers,
- // this just defines when we can count on it).
- function expectSync( elem, type ) {
- return ( elem === safeActiveElement() ) === ( type === "focus" );
- }
-
- // Support: IE <=9 only
- // Accessing document.activeElement can throw unexpectedly
- // https://bugs.jquery.com/ticket/13393
- 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 handleObjIn, eventHandle, tmp,
- events, t, handleObj,
- special, handlers, type, namespaces, origType,
- elemData = dataPriv.get( elem );
-
- // Only attach events to objects that accept data
- if ( !acceptData( elem ) ) {
- 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;
- }
-
- // Ensure that invalid selectors throw exceptions at attach time
- // Evaluate against documentElement in case elem is a non-element node (e.g., document)
- if ( selector ) {
- jQuery.find.matchesSelector( documentElement, 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 = Object.create( null );
- }
- 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" && jQuery.event.triggered !== e.type ?
- jQuery.event.dispatch.apply( elem, arguments ) : undefined;
- };
- }
-
- // Handle multiple events separated by a space
- types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
- 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 if the special events handler returns false
- if ( !special.setup ||
- special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
-
- if ( elem.addEventListener ) {
- elem.addEventListener( 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;
- }
-
- },
-
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, selector, mappedTypes ) {
-
- var j, origCount, tmp,
- events, t, handleObj,
- special, handlers, type, namespaces, origType,
- elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
-
- if ( !elemData || !( events = elemData.events ) ) {
- return;
- }
-
- // Once for each type.namespace in types; type may be omitted
- types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
- 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 data and the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- dataPriv.remove( elem, "handle events" );
- }
- },
-
- dispatch: function( nativeEvent ) {
-
- var i, j, ret, matched, handleObj, handlerQueue,
- args = new Array( arguments.length ),
-
- // Make a writable jQuery.Event from the native event object
- event = jQuery.event.fix( nativeEvent ),
-
- handlers = (
- dataPriv.get( this, "events" ) || Object.create( null )
- )[ event.type ] || [],
- special = jQuery.event.special[ event.type ] || {};
-
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
- args[ 0 ] = event;
-
- for ( i = 1; i < arguments.length; i++ ) {
- args[ i ] = arguments[ i ];
- }
-
- 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() ) {
-
- // If the event is namespaced, then each handler is only invoked if it is
- // specially universal or its namespaces are a superset of the event's.
- if ( !event.rnamespace || handleObj.namespace === false ||
- 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, handleObj, sel, matchedHandlers, matchedSelectors,
- handlerQueue = [],
- delegateCount = handlers.delegateCount,
- cur = event.target;
-
- // Find delegate handlers
- if ( delegateCount &&
-
- // Support: IE <=9
- // Black-hole SVG <use> instance trees (trac-13180)
- cur.nodeType &&
-
- // Support: Firefox <=42
- // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
- // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
- // Support: IE 11 only
- // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
- !( event.type === "click" && event.button >= 1 ) ) {
-
- for ( ; cur !== this; cur = cur.parentNode || this ) {
-
- // Don't check non-elements (#13208)
- // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
- if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
- matchedHandlers = [];
- matchedSelectors = {};
- for ( i = 0; i < delegateCount; i++ ) {
- handleObj = handlers[ i ];
-
- // Don't conflict with Object.prototype properties (#13203)
- sel = handleObj.selector + " ";
-
- if ( matchedSelectors[ sel ] === undefined ) {
- matchedSelectors[ sel ] = handleObj.needsContext ?
- jQuery( sel, this ).index( cur ) > -1 :
- jQuery.find( sel, this, null, [ cur ] ).length;
- }
- if ( matchedSelectors[ sel ] ) {
- matchedHandlers.push( handleObj );
- }
- }
- if ( matchedHandlers.length ) {
- handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
- }
- }
- }
- }
-
- // Add the remaining (directly-bound) handlers
- cur = this;
- if ( delegateCount < handlers.length ) {
- handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
- }
-
- return handlerQueue;
- },
-
- addProp: function( name, hook ) {
- Object.defineProperty( jQuery.Event.prototype, name, {
- enumerable: true,
- configurable: true,
-
- get: isFunction( hook ) ?
- function() {
- if ( this.originalEvent ) {
- return hook( this.originalEvent );
- }
- } :
- function() {
- if ( this.originalEvent ) {
- return this.originalEvent[ name ];
- }
- },
-
- set: function( value ) {
- Object.defineProperty( this, name, {
- enumerable: true,
- configurable: true,
- writable: true,
- value: value
- } );
- }
- } );
- },
-
- fix: function( originalEvent ) {
- return originalEvent[ jQuery.expando ] ?
- originalEvent :
- new jQuery.Event( originalEvent );
- },
-
- special: {
- load: {
-
- // Prevent triggered image.load events from bubbling to window.load
- noBubble: true
- },
- click: {
-
- // Utilize native event to ensure correct state for checkable inputs
- setup: function( data ) {
-
- // For mutual compressibility with _default, replace `this` access with a local var.
- // `|| data` is dead code meant only to preserve the variable through minification.
- var el = this || data;
-
- // Claim the first handler
- if ( rcheckableType.test( el.type ) &&
- el.click && nodeName( el, "input" ) ) {
-
- // dataPriv.set( el, "click", ... )
- leverageNative( el, "click", returnTrue );
- }
-
- // Return false to allow normal processing in the caller
- return false;
- },
- trigger: function( data ) {
-
- // For mutual compressibility with _default, replace `this` access with a local var.
- // `|| data` is dead code meant only to preserve the variable through minification.
- var el = this || data;
-
- // Force setup before triggering a click
- if ( rcheckableType.test( el.type ) &&
- el.click && nodeName( el, "input" ) ) {
-
- leverageNative( el, "click" );
- }
-
- // Return non-false to allow normal event-path propagation
- return true;
- },
-
- // For cross-browser consistency, suppress native .click() on links
- // Also prevent it if we're currently inside a leveraged native-event stack
- _default: function( event ) {
- var target = event.target;
- return rcheckableType.test( target.type ) &&
- target.click && nodeName( target, "input" ) &&
- dataPriv.get( target, "click" ) ||
- nodeName( 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;
- }
- }
- }
- }
- };
-
- // Ensure the presence of an event listener that handles manually-triggered
- // synthetic events by interrupting progress until reinvoked in response to
- // *native* events that it fires directly, ensuring that state changes have
- // already occurred before other listeners are invoked.
- function leverageNative( el, type, expectSync ) {
-
- // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
- if ( !expectSync ) {
- if ( dataPriv.get( el, type ) === undefined ) {
- jQuery.event.add( el, type, returnTrue );
- }
- return;
- }
-
- // Register the controller as a special universal handler for all event namespaces
- dataPriv.set( el, type, false );
- jQuery.event.add( el, type, {
- namespace: false,
- handler: function( event ) {
- var notAsync, result,
- saved = dataPriv.get( this, type );
-
- if ( ( event.isTrigger & 1 ) && this[ type ] ) {
-
- // Interrupt processing of the outer synthetic .trigger()ed event
- // Saved data should be false in such cases, but might be a leftover capture object
- // from an async native handler (gh-4350)
- if ( !saved.length ) {
-
- // Store arguments for use when handling the inner native event
- // There will always be at least one argument (an event object), so this array
- // will not be confused with a leftover capture object.
- saved = slice.call( arguments );
- dataPriv.set( this, type, saved );
-
- // Trigger the native event and capture its result
- // Support: IE <=9 - 11+
- // focus() and blur() are asynchronous
- notAsync = expectSync( this, type );
- this[ type ]();
- result = dataPriv.get( this, type );
- if ( saved !== result || notAsync ) {
- dataPriv.set( this, type, false );
- } else {
- result = {};
- }
- if ( saved !== result ) {
-
- // Cancel the outer synthetic event
- event.stopImmediatePropagation();
- event.preventDefault();
- return result.value;
- }
-
- // If this is an inner synthetic event for an event with a bubbling surrogate
- // (focus or blur), assume that the surrogate already propagated from triggering the
- // native event and prevent that from happening again here.
- // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
- // bubbling surrogate propagates *after* the non-bubbling base), but that seems
- // less bad than duplication.
- } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
- event.stopPropagation();
- }
-
- // If this is a native event triggered above, everything is now in order
- // Fire an inner synthetic event with the original arguments
- } else if ( saved.length ) {
-
- // ...and capture the result
- dataPriv.set( this, type, {
- value: jQuery.event.trigger(
-
- // Support: IE <=9 - 11+
- // Extend with the prototype to reset the above stopImmediatePropagation()
- jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
- saved.slice( 1 ),
- this
- )
- } );
-
- // Abort handling of the native event
- event.stopImmediatePropagation();
- }
- }
- } );
- }
-
- jQuery.removeEvent = function( elem, type, handle ) {
-
- // This "if" is needed for plain objects
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, 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: Android <=2.3 only
- src.returnValue === false ?
- returnTrue :
- returnFalse;
-
- // Create target properties
- // Support: Safari <=6 - 7 only
- // Target should not be a text node (#504, #13143)
- this.target = ( src.target && src.target.nodeType === 3 ) ?
- src.target.parentNode :
- src.target;
-
- this.currentTarget = src.currentTarget;
- this.relatedTarget = src.relatedTarget;
-
- // 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 || Date.now();
-
- // Mark it as fixed
- this[ jQuery.expando ] = true;
- };
-
- // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
- // https://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,
- isSimulated: false,
-
- preventDefault: function() {
- var e = this.originalEvent;
-
- this.isDefaultPrevented = returnTrue;
-
- if ( e && !this.isSimulated ) {
- e.preventDefault();
- }
- },
- stopPropagation: function() {
- var e = this.originalEvent;
-
- this.isPropagationStopped = returnTrue;
-
- if ( e && !this.isSimulated ) {
- e.stopPropagation();
- }
- },
- stopImmediatePropagation: function() {
- var e = this.originalEvent;
-
- this.isImmediatePropagationStopped = returnTrue;
-
- if ( e && !this.isSimulated ) {
- e.stopImmediatePropagation();
- }
-
- this.stopPropagation();
- }
- };
-
- // Includes all common event props including KeyEvent and MouseEvent specific props
- jQuery.each( {
- altKey: true,
- bubbles: true,
- cancelable: true,
- changedTouches: true,
- ctrlKey: true,
- detail: true,
- eventPhase: true,
- metaKey: true,
- pageX: true,
- pageY: true,
- shiftKey: true,
- view: true,
- "char": true,
- code: true,
- charCode: true,
- key: true,
- keyCode: true,
- button: true,
- buttons: true,
- clientX: true,
- clientY: true,
- offsetX: true,
- offsetY: true,
- pointerId: true,
- pointerType: true,
- screenX: true,
- screenY: true,
- targetTouches: true,
- toElement: true,
- touches: true,
-
- which: function( event ) {
- var button = event.button;
-
- // Add which for key events
- if ( event.which == null && rkeyEvent.test( event.type ) ) {
- return event.charCode != null ? event.charCode : event.keyCode;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
- if ( button & 1 ) {
- return 1;
- }
-
- if ( button & 2 ) {
- return 3;
- }
-
- if ( button & 4 ) {
- return 2;
- }
-
- return 0;
- }
-
- return event.which;
- }
- }, jQuery.event.addProp );
-
- jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
- jQuery.event.special[ type ] = {
-
- // Utilize native event if possible so blur/focus sequence is correct
- setup: function() {
-
- // Claim the first handler
- // dataPriv.set( this, "focus", ... )
- // dataPriv.set( this, "blur", ... )
- leverageNative( this, type, expectSync );
-
- // Return false to allow normal processing in the caller
- return false;
- },
- trigger: function() {
-
- // Force setup before trigger
- leverageNative( this, type );
-
- // Return non-false to allow normal event-path propagation
- return true;
- },
-
- delegateType: delegateType
- };
- } );
-
- // 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://bugs.chromium.org/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;
- }
- };
- } );
-
- 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 );
- } );
- }
- } );
-
-
- var
-
- // Support: IE <=10 - 11, Edge 12 - 13 only
- // 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,
- rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
-
- // Prefer a tbody over its parent table for containing new rows
- function manipulationTarget( elem, content ) {
- if ( nodeName( elem, "table" ) &&
- nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
-
- return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
- }
-
- return elem;
- }
-
- // Replace/restore the type attribute of script elements for safe DOM manipulation
- function disableScript( elem ) {
- elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
- return elem;
- }
- function restoreScript( elem ) {
- if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
- elem.type = elem.type.slice( 5 );
- } else {
- elem.removeAttribute( "type" );
- }
-
- return elem;
- }
-
- function cloneCopyEvent( src, dest ) {
- var i, l, type, pdataOld, udataOld, udataCur, events;
-
- if ( dest.nodeType !== 1 ) {
- return;
- }
-
- // 1. Copy private data: events, handlers, etc.
- if ( dataPriv.hasData( src ) ) {
- pdataOld = dataPriv.get( src );
- events = pdataOld.events;
-
- if ( events ) {
- dataPriv.remove( dest, "handle events" );
-
- for ( type in events ) {
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
- jQuery.event.add( dest, type, events[ type ][ i ] );
- }
- }
- }
- }
-
- // 2. Copy user data
- if ( dataUser.hasData( src ) ) {
- udataOld = dataUser.access( src );
- udataCur = jQuery.extend( {}, udataOld );
-
- dataUser.set( dest, udataCur );
- }
- }
-
- // Fix IE bugs, see support tests
- function fixInput( src, dest ) {
- var nodeName = dest.nodeName.toLowerCase();
-
- // Fails to persist the checked state of a cloned checkbox or radio button.
- if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
- dest.checked = src.checked;
-
- // Fails to return the selected option to the default selected state when cloning options
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
- dest.defaultValue = src.defaultValue;
- }
- }
-
- function domManip( collection, args, callback, ignored ) {
-
- // Flatten any nested arrays
- args = flat( args );
-
- var fragment, first, scripts, hasScripts, node, doc,
- i = 0,
- l = collection.length,
- iNoClone = l - 1,
- value = args[ 0 ],
- valueIsFunction = isFunction( value );
-
- // We can't cloneNode fragments that contain checked, in WebKit
- if ( valueIsFunction ||
- ( l > 1 && typeof value === "string" &&
- !support.checkClone && rchecked.test( value ) ) ) {
- return collection.each( function( index ) {
- var self = collection.eq( index );
- if ( valueIsFunction ) {
- 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.0 only, PhantomJS 1 only
- // 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 || "" ) &&
- !dataPriv.access( node, "globalEval" ) &&
- jQuery.contains( doc, node ) ) {
-
- if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
-
- // Optional AJAX dependency, but won't run scripts if not present
- if ( jQuery._evalUrl && !node.noModule ) {
- jQuery._evalUrl( node.src, {
- nonce: node.nonce || node.getAttribute( "nonce" )
- }, doc );
- }
- } else {
- DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
- }
- }
- }
- }
- }
- }
-
- return collection;
- }
-
- function remove( elem, selector, keepData ) {
- var node,
- nodes = selector ? jQuery.filter( selector, elem ) : elem,
- i = 0;
-
- for ( ; ( node = nodes[ i ] ) != null; i++ ) {
- if ( !keepData && node.nodeType === 1 ) {
- jQuery.cleanData( getAll( node ) );
- }
-
- if ( node.parentNode ) {
- if ( keepData && isAttached( node ) ) {
- setGlobalEval( getAll( node, "script" ) );
- }
- node.parentNode.removeChild( node );
- }
- }
-
- return elem;
- }
-
- jQuery.extend( {
- htmlPrefilter: function( html ) {
- return html;
- },
-
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var i, l, srcElements, destElements,
- clone = elem.cloneNode( true ),
- inPage = isAttached( elem );
-
- // Fix IE cloning issues
- if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
- !jQuery.isXMLDoc( elem ) ) {
-
- // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
- destElements = getAll( clone );
- srcElements = getAll( elem );
-
- for ( i = 0, l = srcElements.length; i < l; i++ ) {
- fixInput( srcElements[ i ], 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, l = srcElements.length; i < l; i++ ) {
- cloneCopyEvent( srcElements[ i ], destElements[ i ] );
- }
- } else {
- cloneCopyEvent( elem, clone );
- }
- }
-
- // Preserve script evaluation history
- destElements = getAll( clone, "script" );
- if ( destElements.length > 0 ) {
- setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
- }
-
- // Return the cloned set
- return clone;
- },
-
- cleanData: function( elems ) {
- var data, elem, type,
- special = jQuery.event.special,
- i = 0;
-
- for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
- if ( acceptData( elem ) ) {
- if ( ( data = elem[ dataPriv.expando ] ) ) {
- 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 );
- }
- }
- }
-
- // Support: Chrome <=35 - 45+
- // Assign undefined instead of using delete, see Data#remove
- elem[ dataPriv.expando ] = undefined;
- }
- if ( elem[ dataUser.expando ] ) {
-
- // Support: Chrome <=35 - 45+
- // Assign undefined instead of using delete, see Data#remove
- elem[ dataUser.expando ] = undefined;
- }
- }
- }
- }
- } );
-
- jQuery.fn.extend( {
- 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().each( function() {
- if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
- this.textContent = 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++ ) {
- if ( elem.nodeType === 1 ) {
-
- // Prevent memory leaks
- jQuery.cleanData( getAll( elem, false ) );
-
- // Remove any remaining nodes
- elem.textContent = "";
- }
- }
-
- 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 && elem.nodeType === 1 ) {
- return elem.innerHTML;
- }
-
- // See if we can take a shortcut and just use innerHTML
- if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
- !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
-
- value = jQuery.htmlPrefilter( value );
-
- try {
- for ( ; i < l; i++ ) {
- elem = this[ i ] || {};
-
- // Remove element nodes and prevent memory leaks
- 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,
- ret = [],
- insert = jQuery( selector ),
- last = insert.length - 1,
- i = 0;
-
- for ( ; i <= last; i++ ) {
- elems = i === last ? this : this.clone( true );
- jQuery( insert[ i ] )[ original ]( elems );
-
- // Support: Android <=4.0 only, PhantomJS 1 only
- // .get() because push.apply(_, arraylike) throws on ancient WebKit
- push.apply( ret, elems.get() );
- }
-
- return this.pushStack( ret );
- };
- } );
- var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
-
- var getStyles = function( elem ) {
-
- // Support: IE <=11 only, 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 );
- };
-
- var swap = function( elem, options, callback ) {
- 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.call( elem );
-
- // Revert the old values
- for ( name in options ) {
- elem.style[ name ] = old[ name ];
- }
-
- return ret;
- };
-
-
- var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
-
-
-
- ( function() {
-
- // Executing both pixelPosition & boxSizingReliable tests require only one layout
- // so they're executed at the same time to save the second computation.
- function computeStyleTests() {
-
- // This is a singleton, we need to execute it only once
- if ( !div ) {
- return;
- }
-
- container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
- "margin-top:1px;padding:0;border:0";
- div.style.cssText =
- "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
- "margin:auto;border:1px;padding:1px;" +
- "width:60%;top:1%";
- documentElement.appendChild( container ).appendChild( div );
-
- var divStyle = window.getComputedStyle( div );
- pixelPositionVal = divStyle.top !== "1%";
-
- // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
- reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
-
- // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
- // Some styles come back with percentage values, even though they shouldn't
- div.style.right = "60%";
- pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
-
- // Support: IE 9 - 11 only
- // Detect misreporting of content dimensions for box-sizing:border-box elements
- boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
-
- // Support: IE 9 only
- // Detect overflow:scroll screwiness (gh-3699)
- // Support: Chrome <=64
- // Don't get tricked when zoom affects offsetWidth (gh-4029)
- div.style.position = "absolute";
- scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
-
- documentElement.removeChild( container );
-
- // Nullify the div so it wouldn't be stored in the memory and
- // it will also be a sign that checks already performed
- div = null;
- }
-
- function roundPixelMeasures( measure ) {
- return Math.round( parseFloat( measure ) );
- }
-
- var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
- reliableTrDimensionsVal, reliableMarginLeftVal,
- container = document.createElement( "div" ),
- div = document.createElement( "div" );
-
- // Finish early in limited (non-browser) environments
- if ( !div.style ) {
- return;
- }
-
- // Support: IE <=9 - 11 only
- // Style of cloned element affects source element cloned (#8908)
- div.style.backgroundClip = "content-box";
- div.cloneNode( true ).style.backgroundClip = "";
- support.clearCloneStyle = div.style.backgroundClip === "content-box";
-
- jQuery.extend( support, {
- boxSizingReliable: function() {
- computeStyleTests();
- return boxSizingReliableVal;
- },
- pixelBoxStyles: function() {
- computeStyleTests();
- return pixelBoxStylesVal;
- },
- pixelPosition: function() {
- computeStyleTests();
- return pixelPositionVal;
- },
- reliableMarginLeft: function() {
- computeStyleTests();
- return reliableMarginLeftVal;
- },
- scrollboxSize: function() {
- computeStyleTests();
- return scrollboxSizeVal;
- },
-
- // Support: IE 9 - 11+, Edge 15 - 18+
- // IE/Edge misreport `getComputedStyle` of table rows with width/height
- // set in CSS while `offset*` properties report correct values.
- // Behavior in IE 9 is more subtle than in newer versions & it passes
- // some versions of this test; make sure not to make it pass there!
- reliableTrDimensions: function() {
- var table, tr, trChild, trStyle;
- if ( reliableTrDimensionsVal == null ) {
- table = document.createElement( "table" );
- tr = document.createElement( "tr" );
- trChild = document.createElement( "div" );
-
- table.style.cssText = "position:absolute;left:-11111px";
- tr.style.height = "1px";
- trChild.style.height = "9px";
-
- documentElement
- .appendChild( table )
- .appendChild( tr )
- .appendChild( trChild );
-
- trStyle = window.getComputedStyle( tr );
- reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;
-
- documentElement.removeChild( table );
- }
- return reliableTrDimensionsVal;
- }
- } );
- } )();
-
-
- function curCSS( elem, name, computed ) {
- var width, minWidth, maxWidth, ret,
-
- // Support: Firefox 51+
- // Retrieving style before computed somehow
- // fixes an issue with getting wrong values
- // on detached elements
- style = elem.style;
-
- computed = computed || getStyles( elem );
-
- // getPropertyValue is needed for:
- // .css('filter') (IE 9 only, #12537)
- // .css('--customProperty) (#3144)
- if ( computed ) {
- ret = computed.getPropertyValue( name ) || computed[ name ];
-
- if ( ret === "" && !isAttached( elem ) ) {
- ret = jQuery.style( elem, name );
- }
-
- // A tribute to the "awesome hack by Dean Edwards"
- // Android Browser returns percentage for some values,
- // but width seems to be reliably pixels.
- // This is against the CSSOM draft spec:
- // https://drafts.csswg.org/cssom/#resolved-values
- if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.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;
- }
- }
-
- return ret !== undefined ?
-
- // Support: IE <=9 - 11 only
- // IE returns zIndex value as an integer.
- ret + "" :
- ret;
- }
-
-
- 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 cssPrefixes = [ "Webkit", "Moz", "ms" ],
- emptyStyle = document.createElement( "div" ).style,
- vendorProps = {};
-
- // Return a vendor-prefixed property or undefined
- function vendorPropName( name ) {
-
- // Check for vendor prefixed names
- var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
- i = cssPrefixes.length;
-
- while ( i-- ) {
- name = cssPrefixes[ i ] + capName;
- if ( name in emptyStyle ) {
- return name;
- }
- }
- }
-
- // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
- function finalPropName( name ) {
- var final = jQuery.cssProps[ name ] || vendorProps[ name ];
-
- if ( final ) {
- return final;
- }
- if ( name in emptyStyle ) {
- return name;
- }
- return vendorProps[ name ] = vendorPropName( name ) || name;
- }
-
-
- var
-
- // 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]).+)/,
- rcustomProp = /^--/,
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
- cssNormalTransform = {
- letterSpacing: "0",
- fontWeight: "400"
- };
-
- function setPositiveNumber( _elem, value, subtract ) {
-
- // Any relative (+/-) values have already been
- // normalized at this point
- var matches = rcssNum.exec( value );
- return matches ?
-
- // Guard against undefined "subtract", e.g., when used as in cssHooks
- Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
- value;
- }
-
- function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
- var i = dimension === "width" ? 1 : 0,
- extra = 0,
- delta = 0;
-
- // Adjustment may not be necessary
- if ( box === ( isBorderBox ? "border" : "content" ) ) {
- return 0;
- }
-
- for ( ; i < 4; i += 2 ) {
-
- // Both box models exclude margin
- if ( box === "margin" ) {
- delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
- }
-
- // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
- if ( !isBorderBox ) {
-
- // Add padding
- delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
-
- // For "border" or "margin", add border
- if ( box !== "padding" ) {
- delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
-
- // But still keep track of it otherwise
- } else {
- extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
- }
-
- // If we get here with a border-box (content + padding + border), we're seeking "content" or
- // "padding" or "margin"
- } else {
-
- // For "content", subtract padding
- if ( box === "content" ) {
- delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
- }
-
- // For "content" or "padding", subtract border
- if ( box !== "margin" ) {
- delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
- }
- }
- }
-
- // Account for positive content-box scroll gutter when requested by providing computedVal
- if ( !isBorderBox && computedVal >= 0 ) {
-
- // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
- // Assuming integer scroll gutter, subtract the rest and round down
- delta += Math.max( 0, Math.ceil(
- elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
- computedVal -
- delta -
- extra -
- 0.5
-
- // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
- // Use an explicit zero to avoid NaN (gh-3964)
- ) ) || 0;
- }
-
- return delta;
- }
-
- function getWidthOrHeight( elem, dimension, extra ) {
-
- // Start with computed style
- var styles = getStyles( elem ),
-
- // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
- // Fake content-box until we know it's needed to know the true value.
- boxSizingNeeded = !support.boxSizingReliable() || extra,
- isBorderBox = boxSizingNeeded &&
- jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
- valueIsBorderBox = isBorderBox,
-
- val = curCSS( elem, dimension, styles ),
- offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
-
- // Support: Firefox <=54
- // Return a confounding non-pixel value or feign ignorance, as appropriate.
- if ( rnumnonpx.test( val ) ) {
- if ( !extra ) {
- return val;
- }
- val = "auto";
- }
-
-
- // Support: IE 9 - 11 only
- // Use offsetWidth/offsetHeight for when box sizing is unreliable.
- // In those cases, the computed value can be trusted to be border-box.
- if ( ( !support.boxSizingReliable() && isBorderBox ||
-
- // Support: IE 10 - 11+, Edge 15 - 18+
- // IE/Edge misreport `getComputedStyle` of table rows with width/height
- // set in CSS while `offset*` properties report correct values.
- // Interestingly, in some cases IE 9 doesn't suffer from this issue.
- !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
-
- // Fall back to offsetWidth/offsetHeight when value is "auto"
- // This happens for inline elements with no explicit setting (gh-3571)
- val === "auto" ||
-
- // Support: Android <=4.1 - 4.3 only
- // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
- !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
-
- // Make sure the element is visible & connected
- elem.getClientRects().length ) {
-
- isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
-
- // Where available, offsetWidth/offsetHeight approximate border box dimensions.
- // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
- // retrieved value as a content box dimension.
- valueIsBorderBox = offsetProp in elem;
- if ( valueIsBorderBox ) {
- val = elem[ offsetProp ];
- }
- }
-
- // Normalize "" and auto
- val = parseFloat( val ) || 0;
-
- // Adjust for the element's box model
- return ( val +
- boxModelAdjustment(
- elem,
- dimension,
- extra || ( isBorderBox ? "border" : "content" ),
- valueIsBorderBox,
- styles,
-
- // Provide the current computed size to request scroll gutter calculation (gh-3589)
- val
- )
- ) + "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,
- "gridArea": true,
- "gridColumn": true,
- "gridColumnEnd": true,
- "gridColumnStart": true,
- "gridRow": true,
- "gridRowEnd": true,
- "gridRowStart": 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: {},
-
- // 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 = camelCase( name ),
- isCustomProp = rcustomProp.test( name ),
- style = elem.style;
-
- // Make sure that we're working with the right name. We don't
- // want to query the value if it is a CSS custom property
- // since they are user-defined.
- if ( !isCustomProp ) {
- name = finalPropName( origName );
- }
-
- // Gets hook for the prefixed version, then 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 (#7116)
- if ( value == null || value !== value ) {
- return;
- }
-
- // If a number was passed in, add the unit (except for certain CSS properties)
- // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
- // "px" to a few hardcoded values.
- if ( type === "number" && !isCustomProp ) {
- value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
- }
-
- // background-* props affect original clone's values
- 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 ) {
-
- if ( isCustomProp ) {
- style.setProperty( name, value );
- } else {
- style[ name ] = value;
- }
- }
-
- } 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 val, num, hooks,
- origName = camelCase( name ),
- isCustomProp = rcustomProp.test( name );
-
- // Make sure that we're working with the right name. We don't
- // want to modify the value if it is a CSS custom property
- // since they are user-defined.
- if ( !isCustomProp ) {
- name = finalPropName( origName );
- }
-
- // Try prefixed name followed by the unprefixed name
- 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 ];
- }
-
- // Make numeric 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, dimension ) {
- jQuery.cssHooks[ dimension ] = {
- get: function( elem, computed, extra ) {
- if ( computed ) {
-
- // Certain elements can have dimension info if we invisibly show them
- // but it must have a current display style that would benefit
- return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
-
- // Support: Safari 8+
- // Table columns in Safari have non-zero offsetWidth & zero
- // getBoundingClientRect().width unless display is changed.
- // Support: IE <=11 only
- // Running getBoundingClientRect on a disconnected node
- // in IE throws an error.
- ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
- swap( elem, cssShow, function() {
- return getWidthOrHeight( elem, dimension, extra );
- } ) :
- getWidthOrHeight( elem, dimension, extra );
- }
- },
-
- set: function( elem, value, extra ) {
- var matches,
- styles = getStyles( elem ),
-
- // Only read styles.position if the test has a chance to fail
- // to avoid forcing a reflow.
- scrollboxSizeBuggy = !support.scrollboxSize() &&
- styles.position === "absolute",
-
- // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
- boxSizingNeeded = scrollboxSizeBuggy || extra,
- isBorderBox = boxSizingNeeded &&
- jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
- subtract = extra ?
- boxModelAdjustment(
- elem,
- dimension,
- extra,
- isBorderBox,
- styles
- ) :
- 0;
-
- // Account for unreliable border-box dimensions by comparing offset* to computed and
- // faking a content-box to get border and padding (gh-3699)
- if ( isBorderBox && scrollboxSizeBuggy ) {
- subtract -= Math.ceil(
- elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
- parseFloat( styles[ dimension ] ) -
- boxModelAdjustment( elem, dimension, "border", false, styles ) -
- 0.5
- );
- }
-
- // Convert to pixels if value adjustment is needed
- if ( subtract && ( matches = rcssNum.exec( value ) ) &&
- ( matches[ 3 ] || "px" ) !== "px" ) {
-
- elem.style[ dimension ] = value;
- value = jQuery.css( elem, dimension );
- }
-
- return setPositiveNumber( elem, value, subtract );
- }
- };
- } );
-
- jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
- function( elem, computed ) {
- if ( computed ) {
- return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
- elem.getBoundingClientRect().left -
- swap( elem, { marginLeft: 0 }, function() {
- return elem.getBoundingClientRect().left;
- } )
- ) + "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 ( prefix !== "margin" ) {
- 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 ( Array.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 );
- }
- } );
-
-
- 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.
- // 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 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 && (
- jQuery.cssHooks[ tween.prop ] ||
- tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
- } else {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
- }
- };
-
- // Support: IE <=9 only
- // 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, inProgress,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rrun = /queueHooks$/;
-
- function schedule() {
- if ( inProgress ) {
- if ( document.hidden === false && window.requestAnimationFrame ) {
- window.requestAnimationFrame( schedule );
- } else {
- window.setTimeout( schedule, jQuery.fx.interval );
- }
-
- jQuery.fx.tick();
- }
- }
-
- // Animations created synchronously will run synchronously
- function createFxNow() {
- window.setTimeout( function() {
- fxNow = undefined;
- } );
- return ( fxNow = Date.now() );
- }
-
- // Generate parameters to create a standard animation
- function genFx( type, includeWidth ) {
- var which,
- i = 0,
- attrs = { height: type };
-
- // If we include width, step value is 1 to do all cssExpand values,
- // otherwise 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 ) {
- var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
- isBox = "width" in props || "height" in props,
- anim = this,
- orig = {},
- style = elem.style,
- hidden = elem.nodeType && isHiddenWithinTree( elem ),
- dataShow = dataPriv.get( elem, "fxshow" );
-
- // Queue-skipping animations hijack the fx hooks
- 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() {
-
- // Ensure the complete handler is called before this completes
- anim.always( function() {
- hooks.unqueued--;
- if ( !jQuery.queue( elem, "fx" ).length ) {
- hooks.empty.fire();
- }
- } );
- } );
- }
-
- // Detect show/hide animations
- for ( prop in props ) {
- value = props[ prop ];
- if ( rfxtypes.test( value ) ) {
- delete props[ prop ];
- toggle = toggle || value === "toggle";
- if ( value === ( hidden ? "hide" : "show" ) ) {
-
- // Pretend to be hidden if this is a "show" and
- // there is still data from a stopped show/hide
- if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
- hidden = true;
-
- // Ignore all other no-op show/hide data
- } else {
- continue;
- }
- }
- orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
- }
- }
-
- // Bail out if this is a no-op like .hide().hide()
- propTween = !jQuery.isEmptyObject( props );
- if ( !propTween && jQuery.isEmptyObject( orig ) ) {
- return;
- }
-
- // Restrict "overflow" and "display" styles during box animations
- if ( isBox && elem.nodeType === 1 ) {
-
- // Support: IE <=9 - 11, Edge 12 - 15
- // Record all 3 overflow attributes because IE does not infer the shorthand
- // from identically-valued overflowX and overflowY and Edge just mirrors
- // the overflowX value there.
- opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
-
- // Identify a display type, preferring old show/hide data over the CSS cascade
- restoreDisplay = dataShow && dataShow.display;
- if ( restoreDisplay == null ) {
- restoreDisplay = dataPriv.get( elem, "display" );
- }
- display = jQuery.css( elem, "display" );
- if ( display === "none" ) {
- if ( restoreDisplay ) {
- display = restoreDisplay;
- } else {
-
- // Get nonempty value(s) by temporarily forcing visibility
- showHide( [ elem ], true );
- restoreDisplay = elem.style.display || restoreDisplay;
- display = jQuery.css( elem, "display" );
- showHide( [ elem ] );
- }
- }
-
- // Animate inline elements as inline-block
- if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
- if ( jQuery.css( elem, "float" ) === "none" ) {
-
- // Restore the original display value at the end of pure show/hide animations
- if ( !propTween ) {
- anim.done( function() {
- style.display = restoreDisplay;
- } );
- if ( restoreDisplay == null ) {
- display = style.display;
- restoreDisplay = display === "none" ? "" : display;
- }
- }
- style.display = "inline-block";
- }
- }
- }
-
- if ( opts.overflow ) {
- style.overflow = "hidden";
- anim.always( function() {
- style.overflow = opts.overflow[ 0 ];
- style.overflowX = opts.overflow[ 1 ];
- style.overflowY = opts.overflow[ 2 ];
- } );
- }
-
- // Implement show/hide animations
- propTween = false;
- for ( prop in orig ) {
-
- // General show/hide setup for this element animation
- if ( !propTween ) {
- if ( dataShow ) {
- if ( "hidden" in dataShow ) {
- hidden = dataShow.hidden;
- }
- } else {
- dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
- }
-
- // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
- if ( toggle ) {
- dataShow.hidden = !hidden;
- }
-
- // Show elements before animating them
- if ( hidden ) {
- showHide( [ elem ], true );
- }
-
- /* eslint-disable no-loop-func */
-
- anim.done( function() {
-
- /* eslint-enable no-loop-func */
-
- // The final step of a "hide" animation is actually hiding the element
- if ( !hidden ) {
- showHide( [ elem ] );
- }
- dataPriv.remove( elem, "fxshow" );
- for ( prop in orig ) {
- jQuery.style( elem, prop, orig[ prop ] );
- }
- } );
- }
-
- // Per-property setup
- propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
- if ( !( prop in dataShow ) ) {
- dataShow[ prop ] = propTween.start;
- if ( hidden ) {
- propTween.end = propTween.start;
- propTween.start = 0;
- }
- }
- }
- }
-
- function propFilter( props, specialEasing ) {
- var index, name, easing, value, hooks;
-
- // camelCase, specialEasing and expand cssHook pass
- for ( index in props ) {
- name = camelCase( index );
- easing = specialEasing[ name ];
- value = props[ index ];
- if ( Array.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 won't overwrite existing keys.
- // Reusing 'index' 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 only
- // 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 there's more to do, yield
- if ( percent < 1 && length ) {
- return remaining;
- }
-
- // If this was an empty animation, synthesize a final progress notification
- if ( !length ) {
- deferred.notifyWith( elem, [ animation, 1, 0 ] );
- }
-
- // Resolve the animation and report its conclusion
- 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 ( isFunction( result.stop ) ) {
- jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
- result.stop.bind( result );
- }
- return result;
- }
- }
-
- jQuery.map( props, createTween, animation );
-
- if ( isFunction( animation.opts.start ) ) {
- animation.opts.start.call( elem, animation );
- }
-
- // Attach callbacks from options
- animation
- .progress( animation.opts.progress )
- .done( animation.opts.done, animation.opts.complete )
- .fail( animation.opts.fail )
- .always( animation.opts.always );
-
- jQuery.fx.timer(
- jQuery.extend( tick, {
- elem: elem,
- anim: animation,
- queue: animation.opts.queue
- } )
- );
-
- return animation;
- }
-
- 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 ( isFunction( props ) ) {
- callback = props;
- props = [ "*" ];
- } else {
- props = props.match( rnothtmlwhite );
- }
-
- 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 ||
- isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !isFunction( easing ) && easing
- };
-
- // Go to the end state if fx are off
- if ( jQuery.fx.off ) {
- opt.duration = 0;
-
- } else {
- if ( typeof opt.duration !== "number" ) {
- if ( opt.duration in jQuery.fx.speeds ) {
- opt.duration = jQuery.fx.speeds[ opt.duration ];
-
- } else {
- 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 ( 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( isHiddenWithinTree ).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 || dataPriv.get( 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 ) {
- this.queue( type || "fx", [] );
- }
-
- return this.each( function() {
- var dequeue = true,
- index = type != null && type + "queueHooks",
- timers = jQuery.timers,
- data = dataPriv.get( 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 = dataPriv.get( 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,
- i = 0,
- timers = jQuery.timers;
-
- fxNow = Date.now();
-
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
-
- // Run the timer and safely remove it when done (allowing for external removal)
- 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 );
- jQuery.fx.start();
- };
-
- jQuery.fx.interval = 13;
- jQuery.fx.start = function() {
- if ( inProgress ) {
- return;
- }
-
- inProgress = true;
- schedule();
- };
-
- jQuery.fx.stop = function() {
- inProgress = null;
- };
-
- jQuery.fx.speeds = {
- slow: 600,
- fast: 200,
-
- // Default speed
- _default: 400
- };
-
-
- // Based off of the plugin by Clint Helfers, with permission.
- // https://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 input = document.createElement( "input" ),
- select = document.createElement( "select" ),
- opt = select.appendChild( document.createElement( "option" ) );
-
- input.type = "checkbox";
-
- // Support: Android <=4.3 only
- // Default value for a checkbox should be "on"
- support.checkOn = input.value !== "";
-
- // Support: IE <=11 only
- // Must access selectedIndex to make default options select
- support.optSelected = opt.selected;
-
- // Support: IE <=11 only
- // An input loses its value after becoming a radio
- input = document.createElement( "input" );
- input.value = "t";
- input.type = "radio";
- support.radioValue = input.value === "t";
- } )();
-
-
- var boolHook,
- attrHandle = jQuery.expr.attrHandle;
-
- 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 );
- }
-
- // Attribute hooks are determined by the lowercase version
- // Grab necessary hook if one is defined
- if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
- hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
- ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
- }
-
- 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" &&
- nodeName( elem, "input" ) ) {
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- }
- },
-
- removeAttr: function( elem, value ) {
- var name,
- i = 0,
-
- // Attribute names can contain non-HTML whitespace characters
- // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
- attrNames = value && value.match( rnothtmlwhite );
-
- if ( attrNames && elem.nodeType === 1 ) {
- while ( ( name = attrNames[ i++ ] ) ) {
- elem.removeAttribute( name );
- }
- }
- }
- } );
-
- // 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 {
- elem.setAttribute( name, name );
- }
- return name;
- }
- };
-
- jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
- var getter = attrHandle[ name ] || jQuery.find.attr;
-
- attrHandle[ name ] = function( elem, name, isXML ) {
- var ret, handle,
- lowercaseName = name.toLowerCase();
-
- if ( !isXML ) {
-
- // Avoid an infinite loop by temporarily removing this function from the getter
- handle = attrHandle[ lowercaseName ];
- attrHandle[ lowercaseName ] = ret;
- ret = getter( elem, name, isXML ) != null ?
- lowercaseName :
- null;
- attrHandle[ lowercaseName ] = handle;
- }
- return ret;
- };
- } );
-
-
-
-
- var rfocusable = /^(?:input|select|textarea|button)$/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 ) {
- return this.each( function() {
- delete this[ jQuery.propFix[ name ] || name ];
- } );
- }
- } );
-
- 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 ) {
-
- // Support: IE <=9 - 11 only
- // elem.tabIndex doesn't always return the
- // correct value when it hasn't been explicitly set
- // https://web.archive.org/web/20141116233347/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" );
-
- if ( tabindex ) {
- return parseInt( tabindex, 10 );
- }
-
- if (
- rfocusable.test( elem.nodeName ) ||
- rclickable.test( elem.nodeName ) &&
- elem.href
- ) {
- return 0;
- }
-
- return -1;
- }
- }
- },
-
- propFix: {
- "for": "htmlFor",
- "class": "className"
- }
- } );
-
- // Support: IE <=11 only
- // 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
- // eslint rule "no-unused-expressions" is disabled for this code
- // since it considers such accessions noop
- if ( !support.optSelected ) {
- jQuery.propHooks.selected = {
- get: function( elem ) {
-
- /* eslint no-unused-expressions: "off" */
-
- var parent = elem.parentNode;
- if ( parent && parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- return null;
- },
- set: function( elem ) {
-
- /* eslint no-unused-expressions: "off" */
-
- 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;
- } );
-
-
-
-
- // Strip and collapse whitespace according to HTML spec
- // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
- function stripAndCollapse( value ) {
- var tokens = value.match( rnothtmlwhite ) || [];
- return tokens.join( " " );
- }
-
-
- function getClass( elem ) {
- return elem.getAttribute && elem.getAttribute( "class" ) || "";
- }
-
- function classesToArray( value ) {
- if ( Array.isArray( value ) ) {
- return value;
- }
- if ( typeof value === "string" ) {
- return value.match( rnothtmlwhite ) || [];
- }
- return [];
- }
-
- jQuery.fn.extend( {
- addClass: function( value ) {
- var classes, elem, cur, curValue, clazz, j, finalValue,
- i = 0;
-
- if ( isFunction( value ) ) {
- return this.each( function( j ) {
- jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
- } );
- }
-
- classes = classesToArray( value );
-
- if ( classes.length ) {
- while ( ( elem = this[ i++ ] ) ) {
- curValue = getClass( elem );
- cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
-
- if ( cur ) {
- j = 0;
- while ( ( clazz = classes[ j++ ] ) ) {
- if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
- cur += clazz + " ";
- }
- }
-
- // Only assign if different to avoid unneeded rendering.
- finalValue = stripAndCollapse( cur );
- if ( curValue !== finalValue ) {
- elem.setAttribute( "class", finalValue );
- }
- }
- }
- }
-
- return this;
- },
-
- removeClass: function( value ) {
- var classes, elem, cur, curValue, clazz, j, finalValue,
- i = 0;
-
- if ( isFunction( value ) ) {
- return this.each( function( j ) {
- jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
- } );
- }
-
- if ( !arguments.length ) {
- return this.attr( "class", "" );
- }
-
- classes = classesToArray( value );
-
- if ( classes.length ) {
- while ( ( elem = this[ i++ ] ) ) {
- curValue = getClass( elem );
-
- // This expression is here for better compressibility (see addClass)
- cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
-
- 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 = stripAndCollapse( cur );
- if ( curValue !== finalValue ) {
- elem.setAttribute( "class", finalValue );
- }
- }
- }
- }
-
- return this;
- },
-
- toggleClass: function( value, stateVal ) {
- var type = typeof value,
- isValidValue = type === "string" || Array.isArray( value );
-
- if ( typeof stateVal === "boolean" && isValidValue ) {
- return stateVal ? this.addClass( value ) : this.removeClass( value );
- }
-
- if ( 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 ( isValidValue ) {
-
- // Toggle individual class names
- i = 0;
- self = jQuery( this );
- classNames = classesToArray( value );
-
- 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
- dataPriv.set( 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.
- if ( this.setAttribute ) {
- this.setAttribute( "class",
- className || value === false ?
- "" :
- dataPriv.get( this, "__className__" ) || ""
- );
- }
- }
- } );
- },
-
- hasClass: function( selector ) {
- var className, elem,
- i = 0;
-
- className = " " + selector + " ";
- while ( ( elem = this[ i++ ] ) ) {
- if ( elem.nodeType === 1 &&
- ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
- return true;
- }
- }
-
- return false;
- }
- } );
-
-
-
-
- var rreturn = /\r/g;
-
- jQuery.fn.extend( {
- val: function( value ) {
- var hooks, ret, valueIsFunction,
- 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;
-
- // Handle most common string cases
- if ( typeof ret === "string" ) {
- return ret.replace( rreturn, "" );
- }
-
- // Handle cases where value is null/undef or number
- return ret == null ? "" : ret;
- }
-
- return;
- }
-
- valueIsFunction = isFunction( value );
-
- return this.each( function( i ) {
- var val;
-
- if ( this.nodeType !== 1 ) {
- return;
- }
-
- if ( valueIsFunction ) {
- 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 ( Array.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: IE <=10 - 11 only
- // option.text throws exceptions (#14686, #14858)
- // Strip and collapse whitespace
- // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
- stripAndCollapse( jQuery.text( elem ) );
- }
- },
- select: {
- get: function( elem ) {
- var value, option, i,
- options = elem.options,
- index = elem.selectedIndex,
- one = elem.type === "select-one",
- values = one ? null : [],
- max = one ? index + 1 : options.length;
-
- if ( index < 0 ) {
- i = max;
-
- } else {
- i = one ? index : 0;
- }
-
- // Loop through all the selected options
- for ( ; i < max; i++ ) {
- option = options[ i ];
-
- // Support: IE <=9 only
- // IE8-9 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
- !option.disabled &&
- ( !option.parentNode.disabled ||
- !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 ];
-
- /* eslint-disable no-cond-assign */
-
- if ( option.selected =
- jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
- ) {
- optionSet = true;
- }
-
- /* eslint-enable no-cond-assign */
- }
-
- // Force browsers to behave consistently when non-matching value is set
- if ( !optionSet ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- }
- } );
-
- // Radios and checkboxes getter/setter
- jQuery.each( [ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- set: function( elem, value ) {
- if ( Array.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;
- };
- }
- } );
-
-
-
-
- // Return jQuery for attributes-only inclusion
-
-
- support.focusin = "onfocusin" in window;
-
-
- var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
- stopPropagationCallback = function( e ) {
- e.stopPropagation();
- };
-
- jQuery.extend( jQuery.event, {
-
- trigger: function( event, data, elem, onlyHandlers ) {
-
- var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
- eventPath = [ elem || document ],
- type = hasOwn.call( event, "type" ) ? event.type : event,
- namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
-
- cur = lastElement = 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 && !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() ) {
- lastElement = cur;
- event.type = i > 1 ?
- bubbleType :
- special.bindType || type;
-
- // jQuery handler
- handle = (
- dataPriv.get( cur, "events" ) || Object.create( null )
- )[ event.type ] &&
- dataPriv.get( 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 as the event.
- // Don't do default actions on window, that's where global variables be (#6170)
- if ( ontype && isFunction( elem[ type ] ) && !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;
-
- if ( event.isPropagationStopped() ) {
- lastElement.addEventListener( type, stopPropagationCallback );
- }
-
- elem[ type ]();
-
- if ( event.isPropagationStopped() ) {
- lastElement.removeEventListener( type, stopPropagationCallback );
- }
-
- jQuery.event.triggered = undefined;
-
- if ( tmp ) {
- elem[ ontype ] = tmp;
- }
- }
- }
- }
-
- return event.result;
- },
-
- // Piggyback on a donor event to simulate a different one
- // Used only for `focus(in | out)` events
- simulate: function( type, elem, event ) {
- var e = jQuery.extend(
- new jQuery.Event(),
- event,
- {
- type: type,
- isSimulated: true
- }
- );
-
- jQuery.event.trigger( e, null, elem );
- }
-
- } );
-
- jQuery.fn.extend( {
-
- 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 );
- }
- }
- } );
-
-
- // Support: Firefox <=44
- // Firefox doesn't have focus(in | out) events
- // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
- //
- // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
- // 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://bugs.chromium.org/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() {
-
- // Handle: regular nodes (via `this.ownerDocument`), window
- // (via `this.document`) & document (via `this`).
- var doc = this.ownerDocument || this.document || this,
- attaches = dataPriv.access( doc, fix );
-
- if ( !attaches ) {
- doc.addEventListener( orig, handler, true );
- }
- dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
- },
- teardown: function() {
- var doc = this.ownerDocument || this.document || this,
- attaches = dataPriv.access( doc, fix ) - 1;
-
- if ( !attaches ) {
- doc.removeEventListener( orig, handler, true );
- dataPriv.remove( doc, fix );
-
- } else {
- dataPriv.access( doc, fix, attaches );
- }
- }
- };
- } );
- }
- var location = window.location;
-
- var nonce = { guid: Date.now() };
-
- var rquery = ( /\?/ );
-
-
-
- // Cross-browser xml parsing
- jQuery.parseXML = function( data ) {
- var xml;
- if ( !data || typeof data !== "string" ) {
- return null;
- }
-
- // Support: IE 9 - 11 only
- // IE throws on parseFromString with invalid input.
- try {
- xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
- } catch ( e ) {
- xml = undefined;
- }
-
- if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
- jQuery.error( "Invalid XML: " + data );
- }
- return xml;
- };
-
-
- var
- 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 ( Array.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 && toType( 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, valueOrFunction ) {
-
- // If value is a function, invoke it and use its return value
- var value = isFunction( valueOrFunction ) ?
- valueOrFunction() :
- valueOrFunction;
-
- s[ s.length ] = encodeURIComponent( key ) + "=" +
- encodeURIComponent( value == null ? "" : value );
- };
-
- if ( a == null ) {
- return "";
- }
-
- // If an array was passed in, assume that it is an array of form elements.
- if ( Array.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( "&" );
- };
-
- 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();
-
- if ( val == null ) {
- return null;
- }
-
- if ( Array.isArray( val ) ) {
- return jQuery.map( val, function( val ) {
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- } );
- }
-
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- } ).get();
- }
- } );
-
-
- var
- r20 = /%20/g,
- rhash = /#.*$/,
- rantiCache = /([?&])_=[^&]*/,
- rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
-
- // #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
- rnoContent = /^(?:GET|HEAD)$/,
- rprotocol = /^\/\//,
-
- /* 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( "*" ),
-
- // Anchor tag for parsing the document origin
- originAnchor = document.createElement( "a" );
- originAnchor.href = location.href;
-
- // 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( rnothtmlwhite ) || [];
-
- if ( isFunction( func ) ) {
-
- // For each dataType in the dataTypeExpression
- while ( ( dataType = dataTypes[ i++ ] ) ) {
-
- // Prepend if requested
- if ( dataType[ 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 key, deep,
- 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 ct, type, finalDataType, firstDataType,
- 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 ) {
- 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: location.href,
- type: "GET",
- isLocal: rlocalProtocol.test( location.protocol ),
- 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": JSON.parse,
-
- // 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 transport,
-
- // URL without anti-cache param
- cacheURL,
-
- // Response headers
- responseHeadersString,
- responseHeaders,
-
- // timeout handle
- timeoutTimer,
-
- // Url cleanup var
- urlAnchor,
-
- // Request state (becomes false upon send and true upon completion)
- completed,
-
- // To know if global events are to be dispatched
- fireGlobals,
-
- // Loop variable
- i,
-
- // uncached part of the url
- uncached,
-
- // 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 = {},
-
- // Default abort message
- strAbort = "canceled",
-
- // Fake xhr
- jqXHR = {
- readyState: 0,
-
- // Builds headers hashtable if needed
- getResponseHeader: function( key ) {
- var match;
- if ( completed ) {
- if ( !responseHeaders ) {
- responseHeaders = {};
- while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
- responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
- ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
- .concat( match[ 2 ] );
- }
- }
- match = responseHeaders[ key.toLowerCase() + " " ];
- }
- return match == null ? null : match.join( ", " );
- },
-
- // Raw string
- getAllResponseHeaders: function() {
- return completed ? responseHeadersString : null;
- },
-
- // Caches the header
- setRequestHeader: function( name, value ) {
- if ( completed == null ) {
- name = requestHeadersNames[ name.toLowerCase() ] =
- requestHeadersNames[ name.toLowerCase() ] || name;
- requestHeaders[ name ] = value;
- }
- return this;
- },
-
- // Overrides response content-type header
- overrideMimeType: function( type ) {
- if ( completed == null ) {
- s.mimeType = type;
- }
- return this;
- },
-
- // Status-dependent callbacks
- statusCode: function( map ) {
- var code;
- if ( map ) {
- if ( completed ) {
-
- // Execute the appropriate callbacks
- jqXHR.always( map[ jqXHR.status ] );
- } else {
-
- // Lazy-add the new callbacks in a way that preserves old ones
- for ( code in map ) {
- statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
- }
- }
- }
- 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 );
-
- // Add protocol if not provided (prefilters might expect it)
- // 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 || location.href ) + "" )
- .replace( rprotocol, location.protocol + "//" );
-
- // Alias method option to type as per ticket #12004
- s.type = options.method || options.type || s.method || s.type;
-
- // Extract dataTypes list
- s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
-
- // A cross-domain request is in order when the origin doesn't match the current origin.
- if ( s.crossDomain == null ) {
- urlAnchor = document.createElement( "a" );
-
- // Support: IE <=8 - 11, Edge 12 - 15
- // IE throws exception on accessing the href property if url is malformed,
- // e.g. http://example.com:80x/
- try {
- urlAnchor.href = s.url;
-
- // Support: IE <=8 - 11 only
- // Anchor's host property isn't correctly set when s.url is relative
- urlAnchor.href = urlAnchor.href;
- s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
- urlAnchor.protocol + "//" + urlAnchor.host;
- } catch ( e ) {
-
- // If there is an error parsing the URL, assume it is crossDomain,
- // it can be rejected by the transport if it is invalid
- s.crossDomain = true;
- }
- }
-
- // 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 ( completed ) {
- 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
- // Remove hash to simplify url manipulation
- cacheURL = s.url.replace( rhash, "" );
-
- // More options handling for requests with no content
- if ( !s.hasContent ) {
-
- // Remember the hash so we can put it back
- uncached = s.url.slice( cacheURL.length );
-
- // If data is available and should be processed, append data to url
- if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
- cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
-
- // #9682: remove data so that it's not used in an eventual retry
- delete s.data;
- }
-
- // Add or update anti-cache param if needed
- if ( s.cache === false ) {
- cacheURL = cacheURL.replace( rantiCache, "$1" );
- uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
- uncached;
- }
-
- // Put hash and anti-cache on the URL that will be requested (gh-1732)
- s.url = cacheURL + uncached;
-
- // Change '%20' to '+' if this is encoded form body content (gh-2658)
- } else if ( s.data && s.processData &&
- ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
- s.data = s.data.replace( r20, "+" );
- }
-
- // 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 || completed ) ) {
-
- // Abort if not done already and return
- return jqXHR.abort();
- }
-
- // Aborting is no longer a cancellation
- strAbort = "abort";
-
- // Install callbacks on deferreds
- completeDeferred.add( s.complete );
- jqXHR.done( s.success );
- jqXHR.fail( s.error );
-
- // 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 ( completed ) {
- return jqXHR;
- }
-
- // Timeout
- if ( s.async && s.timeout > 0 ) {
- timeoutTimer = window.setTimeout( function() {
- jqXHR.abort( "timeout" );
- }, s.timeout );
- }
-
- try {
- completed = false;
- transport.send( requestHeaders, done );
- } catch ( e ) {
-
- // Rethrow post-completion exceptions
- if ( completed ) {
- throw e;
- }
-
- // Propagate others as results
- done( -1, e );
- }
- }
-
- // Callback for when everything is done
- function done( status, nativeStatusText, responses, headers ) {
- var isSuccess, success, error, response, modified,
- statusText = nativeStatusText;
-
- // Ignore repeat invocations
- if ( completed ) {
- return;
- }
-
- completed = true;
-
- // 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 );
- }
-
- // Use a noop converter for missing script
- if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
- s.converters[ "text script" ] = function() {};
- }
-
- // 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 {
-
- // Extract error from statusText and normalize 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 ( 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.ajaxPrefilter( function( s ) {
- var i;
- for ( i in s.headers ) {
- if ( i.toLowerCase() === "content-type" ) {
- s.contentType = s.headers[ i ] || "";
- }
- }
- } );
-
-
- jQuery._evalUrl = function( url, options, doc ) {
- 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,
-
- // Only evaluate the response if it is successful (gh-4126)
- // dataFilter is not invoked for failure responses, so using it instead
- // of the default converter is kludgy but it works.
- converters: {
- "text script": function() {}
- },
- dataFilter: function( response ) {
- jQuery.globalEval( response, options, doc );
- }
- } );
- };
-
-
- jQuery.fn.extend( {
- wrapAll: function( html ) {
- var wrap;
-
- if ( this[ 0 ] ) {
- if ( isFunction( html ) ) {
- html = html.call( this[ 0 ] );
- }
-
- // The elements to wrap the target around
- 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.firstElementChild ) {
- elem = elem.firstElementChild;
- }
-
- return elem;
- } ).append( this );
- }
-
- return this;
- },
-
- wrapInner: function( html ) {
- if ( 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 htmlIsFunction = isFunction( html );
-
- return this.each( function( i ) {
- jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
- } );
- },
-
- unwrap: function( selector ) {
- this.parent( selector ).not( "body" ).each( function() {
- jQuery( this ).replaceWith( this.childNodes );
- } );
- return this;
- }
- } );
-
-
- jQuery.expr.pseudos.hidden = function( elem ) {
- return !jQuery.expr.pseudos.visible( elem );
- };
- jQuery.expr.pseudos.visible = function( elem ) {
- return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
- };
-
-
-
-
- jQuery.ajaxSettings.xhr = function() {
- try {
- return new window.XMLHttpRequest();
- } catch ( e ) {}
- };
-
- var xhrSuccessStatus = {
-
- // File protocol always yields status code 0, assume 200
- 0: 200,
-
- // Support: IE <=9 only
- // #1450: sometimes IE returns 1223 when it should be 204
- 1223: 204
- },
- xhrSupported = jQuery.ajaxSettings.xhr();
-
- support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
- support.ajax = xhrSupported = !!xhrSupported;
-
- jQuery.ajaxTransport( function( options ) {
- var callback, errorCallback;
-
- // Cross domain only allowed if supported through XMLHttpRequest
- if ( support.cors || xhrSupported && !options.crossDomain ) {
- return {
- send: function( headers, complete ) {
- var i,
- xhr = options.xhr();
-
- 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 ) {
- xhr.setRequestHeader( i, headers[ i ] );
- }
-
- // Callback
- callback = function( type ) {
- return function() {
- if ( callback ) {
- callback = errorCallback = xhr.onload =
- xhr.onerror = xhr.onabort = xhr.ontimeout =
- xhr.onreadystatechange = null;
-
- if ( type === "abort" ) {
- xhr.abort();
- } else if ( type === "error" ) {
-
- // Support: IE <=9 only
- // On a manual native abort, IE9 throws
- // errors on any property access that is not readyState
- if ( typeof xhr.status !== "number" ) {
- complete( 0, "error" );
- } else {
- complete(
-
- // File: protocol always yields status 0; see #8605, #14207
- xhr.status,
- xhr.statusText
- );
- }
- } else {
- complete(
- xhrSuccessStatus[ xhr.status ] || xhr.status,
- xhr.statusText,
-
- // Support: IE <=9 only
- // IE9 has no XHR2 but throws on binary (trac-11426)
- // For XHR2 non-text, let the caller handle it (gh-2498)
- ( xhr.responseType || "text" ) !== "text" ||
- typeof xhr.responseText !== "string" ?
- { binary: xhr.response } :
- { text: xhr.responseText },
- xhr.getAllResponseHeaders()
- );
- }
- }
- };
- };
-
- // Listen to events
- xhr.onload = callback();
- errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
-
- // Support: IE 9 only
- // Use onreadystatechange to replace onabort
- // to handle uncaught aborts
- if ( xhr.onabort !== undefined ) {
- xhr.onabort = errorCallback;
- } else {
- xhr.onreadystatechange = function() {
-
- // Check readyState before timeout as it changes
- if ( xhr.readyState === 4 ) {
-
- // Allow onerror to be called first,
- // but that will not handle a native abort
- // Also, save errorCallback to a variable
- // as xhr.onerror cannot be accessed
- window.setTimeout( function() {
- if ( callback ) {
- errorCallback();
- }
- } );
- }
- };
- }
-
- // Create the abort callback
- callback = callback( "abort" );
-
- try {
-
- // Do send the request (this may raise an exception)
- xhr.send( options.hasContent && options.data || null );
- } catch ( e ) {
-
- // #14683: Only rethrow if this hasn't been notified as an error yet
- if ( callback ) {
- throw e;
- }
- }
- },
-
- abort: function() {
- if ( callback ) {
- callback();
- }
- }
- };
- }
- } );
-
-
-
-
- // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
- jQuery.ajaxPrefilter( function( s ) {
- if ( s.crossDomain ) {
- s.contents.script = false;
- }
- } );
-
- // 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 crossDomain
- jQuery.ajaxPrefilter( "script", function( s ) {
- if ( s.cache === undefined ) {
- s.cache = false;
- }
- if ( s.crossDomain ) {
- s.type = "GET";
- }
- } );
-
- // Bind script tag hack transport
- jQuery.ajaxTransport( "script", function( s ) {
-
- // This transport only deals with cross domain or forced-by-attrs requests
- if ( s.crossDomain || s.scriptAttrs ) {
- var script, callback;
- return {
- send: function( _, complete ) {
- script = jQuery( "<script>" )
- .attr( s.scriptAttrs || {} )
- .prop( { charset: s.scriptCharset, src: s.url } )
- .on( "load error", callback = function( evt ) {
- script.remove();
- callback = null;
- if ( evt ) {
- complete( evt.type === "error" ? 404 : 200, evt.type );
- }
- } );
-
- // Use native DOM manipulation to avoid our domManip AJAX trickery
- document.head.appendChild( script[ 0 ] );
- },
- abort: function() {
- if ( callback ) {
- callback();
- }
- }
- };
- }
- } );
-
-
-
-
- var oldCallbacks = [],
- rjsonp = /(=)\?(?=&|$)|\?\?/;
-
- // Default jsonp settings
- jQuery.ajaxSetup( {
- jsonp: "callback",
- jsonpCallback: function() {
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
- 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 = 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 && isFunction( overwritten ) ) {
- overwritten( responseContainer[ 0 ] );
- }
-
- responseContainer = overwritten = undefined;
- } );
-
- // Delegate to script
- return "script";
- }
- } );
-
-
-
-
- // Support: Safari 8 only
- // In Safari 8 documents created via document.implementation.createHTMLDocument
- // collapse sibling forms: the second one becomes a child of the first one.
- // Because of that, this security measure has to be disabled in Safari 8.
- // https://bugs.webkit.org/show_bug.cgi?id=137337
- support.createHTMLDocument = ( function() {
- var body = document.implementation.createHTMLDocument( "" ).body;
- body.innerHTML = "<form></form><form></form>";
- return body.childNodes.length === 2;
- } )();
-
-
- // Argument "data" should be 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 ( typeof data !== "string" ) {
- return [];
- }
- if ( typeof context === "boolean" ) {
- keepScripts = context;
- context = false;
- }
-
- var base, parsed, scripts;
-
- if ( !context ) {
-
- // Stop scripts or inline event handlers from being executed immediately
- // by using document.implementation
- if ( support.createHTMLDocument ) {
- context = document.implementation.createHTMLDocument( "" );
-
- // Set the base href for the created document
- // so any parsed elements with URLs
- // are based on the document's URL (gh-2965)
- base = context.createElement( "base" );
- base.href = document.location.href;
- context.head.appendChild( base );
- } else {
- context = document;
- }
- }
-
- 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 );
- };
-
-
- /**
- * Load a url into a page
- */
- jQuery.fn.load = function( url, params, callback ) {
- var selector, type, response,
- self = this,
- off = url.indexOf( " " );
-
- if ( off > -1 ) {
- selector = stripAndCollapse( url.slice( off ) );
- url = url.slice( 0, off );
- }
-
- // If it's a function
- if ( 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;
- };
-
-
-
-
- jQuery.expr.pseudos.animated = function( elem ) {
- return jQuery.grep( jQuery.timers, function( fn ) {
- return elem === fn.elem;
- } ).length;
- };
-
-
-
-
- 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" ) &&
- ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -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 ( 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 {
- if ( typeof props.top === "number" ) {
- props.top += "px";
- }
- if ( typeof props.left === "number" ) {
- props.left += "px";
- }
- curElem.css( props );
- }
- }
- };
-
- jQuery.fn.extend( {
-
- // offset() relates an element's border box to the document origin
- offset: function( options ) {
-
- // Preserve chaining for setter
- if ( arguments.length ) {
- return options === undefined ?
- this :
- this.each( function( i ) {
- jQuery.offset.setOffset( this, options, i );
- } );
- }
-
- var rect, win,
- elem = this[ 0 ];
-
- if ( !elem ) {
- return;
- }
-
- // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
- // Support: IE <=11 only
- // Running getBoundingClientRect on a
- // disconnected node in IE throws an error
- if ( !elem.getClientRects().length ) {
- return { top: 0, left: 0 };
- }
-
- // Get document-relative position by adding viewport scroll to viewport-relative gBCR
- rect = elem.getBoundingClientRect();
- win = elem.ownerDocument.defaultView;
- return {
- top: rect.top + win.pageYOffset,
- left: rect.left + win.pageXOffset
- };
- },
-
- // position() relates an element's margin box to its offset parent's padding box
- // This corresponds to the behavior of CSS absolute positioning
- position: function() {
- if ( !this[ 0 ] ) {
- return;
- }
-
- var offsetParent, offset, doc,
- elem = this[ 0 ],
- parentOffset = { top: 0, left: 0 };
-
- // position:fixed elements are offset from the viewport, which itself always has zero offset
- if ( jQuery.css( elem, "position" ) === "fixed" ) {
-
- // Assume position:fixed implies availability of getBoundingClientRect
- offset = elem.getBoundingClientRect();
-
- } else {
- offset = this.offset();
-
- // Account for the *real* offset parent, which can be the document or its root element
- // when a statically positioned element is identified
- doc = elem.ownerDocument;
- offsetParent = elem.offsetParent || doc.documentElement;
- while ( offsetParent &&
- ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
- jQuery.css( offsetParent, "position" ) === "static" ) {
-
- offsetParent = offsetParent.parentNode;
- }
- if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
-
- // Incorporate borders into its offset, since they are outside its content origin
- parentOffset = jQuery( offsetParent ).offset();
- parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
- parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
- }
- }
-
- // Subtract parent offsets and element margins
- return {
- top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
- left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
- };
- },
-
- // This method will return documentElement in the following cases:
- // 1) For the element inside the iframe without offsetParent, this method will return
- // documentElement of the parent window
- // 2) For the hidden or detached element
- // 3) For body or html element, i.e. in case of the html node - it will return itself
- //
- // but those exceptions were never presented as a real life use-cases
- // and might be considered as more preferable results.
- //
- // This logic, however, is not guaranteed and can change at any point in the future
- offsetParent: function() {
- return this.map( function() {
- var offsetParent = this.offsetParent;
-
- while ( offsetParent && 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 = "pageYOffset" === prop;
-
- jQuery.fn[ method ] = function( val ) {
- return access( this, function( elem, method, val ) {
-
- // Coalesce documents and windows
- var win;
- if ( isWindow( elem ) ) {
- win = elem;
- } else if ( elem.nodeType === 9 ) {
- win = elem.defaultView;
- }
-
- if ( val === undefined ) {
- return win ? win[ prop ] : elem[ method ];
- }
-
- if ( win ) {
- win.scrollTo(
- !top ? val : win.pageXOffset,
- top ? val : win.pageYOffset
- );
-
- } else {
- elem[ method ] = val;
- }
- }, method, val, arguments.length );
- };
- } );
-
- // Support: Safari <=7 - 9.1, Chrome <=37 - 49
- // Add the top/left cssHooks using jQuery.fn.position
- // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
- // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
- // getComputedStyle returns percent when specified for top/left/bottom/right;
- // rather than make the css module depend on the offset module, 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 ( isWindow( elem ) ) {
-
- // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
- return funcName.indexOf( "outer" ) === 0 ?
- elem[ "inner" + name ] :
- 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
- 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 );
- };
- } );
- } );
-
-
- jQuery.each( [
- "ajaxStart",
- "ajaxStop",
- "ajaxComplete",
- "ajaxError",
- "ajaxSuccess",
- "ajaxSend"
- ], function( _i, type ) {
- jQuery.fn[ type ] = function( fn ) {
- return this.on( type, fn );
- };
- } );
-
-
-
-
- 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 );
- },
-
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
- } );
-
- jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
- "change select submit keydown keypress keyup 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 );
- };
- } );
-
-
-
-
- // Support: Android <=4.0 only
- // Make sure we trim BOM and NBSP
- var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
-
- // Bind a function to a context, optionally partially applying any
- // arguments.
- // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
- // However, it is not slated for removal any time soon
- jQuery.proxy = function( fn, context ) {
- var tmp, args, proxy;
-
- 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 ( !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;
- };
-
- jQuery.holdReady = function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- };
- jQuery.isArray = Array.isArray;
- jQuery.parseJSON = JSON.parse;
- jQuery.nodeName = nodeName;
- jQuery.isFunction = isFunction;
- jQuery.isWindow = isWindow;
- jQuery.camelCase = camelCase;
- jQuery.type = toType;
-
- jQuery.now = Date.now;
-
- jQuery.isNumeric = function( obj ) {
-
- // As of jQuery 3.0, isNumeric is limited to
- // strings and numbers (primitives or objects)
- // that can be coerced to finite numbers (gh-2662)
- var type = jQuery.type( obj );
- return ( type === "number" || type === "string" ) &&
-
- // parseFloat NaNs numeric-cast false positives ("")
- // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
- // subtraction forces infinities to NaN
- !isNaN( obj - parseFloat( obj ) );
- };
-
- jQuery.trim = function( text ) {
- return text == null ?
- "" :
- ( text + "" ).replace( rtrim, "" );
- };
-
-
-
-
- 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 ( typeof noGlobal === "undefined" ) {
- window.jQuery = window.$ = jQuery;
- }
-
-
-
-
- return jQuery;
- } );
- });
-
- var jquery$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), jquery, {
- 'default': jquery
- }));
-
- /*!
- * Bootstrap v4.6.0 (https://getbootstrap.com/)
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- */
-
- createCommonjsModule(function (module, exports) {
- (function (global, factory) {
- factory(exports, jquery) ;
- }(commonjsGlobal, (function (exports, $) {
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
-
- var $__default = /*#__PURE__*/_interopDefaultLegacy($);
-
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
-
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- return Constructor;
- }
-
- function _extends() {
- _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
-
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
-
- return target;
- };
-
- return _extends.apply(this, arguments);
- }
-
- function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- subClass.__proto__ = superClass;
- }
-
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v4.6.0): util.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- * --------------------------------------------------------------------------
- */
- /**
- * ------------------------------------------------------------------------
- * Private TransitionEnd Helpers
- * ------------------------------------------------------------------------
- */
-
- var TRANSITION_END = 'transitionend';
- var MAX_UID = 1000000;
- var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
-
- function toType(obj) {
- if (obj === null || typeof obj === 'undefined') {
- return "" + obj;
- }
-
- return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
- }
-
- function getSpecialTransitionEndEvent() {
- return {
- bindType: TRANSITION_END,
- delegateType: TRANSITION_END,
- handle: function handle(event) {
- if ($__default['default'](event.target).is(this)) {
- return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
- }
-
- return undefined;
- }
- };
- }
-
- function transitionEndEmulator(duration) {
- var _this = this;
-
- var called = false;
- $__default['default'](this).one(Util.TRANSITION_END, function () {
- called = true;
- });
- setTimeout(function () {
- if (!called) {
- Util.triggerTransitionEnd(_this);
- }
- }, duration);
- return this;
- }
-
- function setTransitionEndSupport() {
- $__default['default'].fn.emulateTransitionEnd = transitionEndEmulator;
- $__default['default'].event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
- }
- /**
- * --------------------------------------------------------------------------
- * Public Util Api
- * --------------------------------------------------------------------------
- */
-
-
- var Util = {
- TRANSITION_END: 'bsTransitionEnd',
- getUID: function getUID(prefix) {
- do {
- prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
- } while (document.getElementById(prefix));
-
- return prefix;
- },
- getSelectorFromElement: function getSelectorFromElement(element) {
- var selector = element.getAttribute('data-target');
-
- if (!selector || selector === '#') {
- var hrefAttr = element.getAttribute('href');
- selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
- }
-
- try {
- return document.querySelector(selector) ? selector : null;
- } catch (_) {
- return null;
- }
- },
- getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
- if (!element) {
- return 0;
- } // Get transition-duration of the element
-
-
- var transitionDuration = $__default['default'](element).css('transition-duration');
- var transitionDelay = $__default['default'](element).css('transition-delay');
- var floatTransitionDuration = parseFloat(transitionDuration);
- var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
-
- if (!floatTransitionDuration && !floatTransitionDelay) {
- return 0;
- } // If multiple durations are defined, take the first
-
-
- transitionDuration = transitionDuration.split(',')[0];
- transitionDelay = transitionDelay.split(',')[0];
- return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
- },
- reflow: function reflow(element) {
- return element.offsetHeight;
- },
- triggerTransitionEnd: function triggerTransitionEnd(element) {
- $__default['default'](element).trigger(TRANSITION_END);
- },
- supportsTransitionEnd: function supportsTransitionEnd() {
- return Boolean(TRANSITION_END);
- },
- isElement: function isElement(obj) {
- return (obj[0] || obj).nodeType;
- },
- typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
- for (var property in configTypes) {
- if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
- var expectedTypes = configTypes[property];
- var value = config[property];
- var valueType = value && Util.isElement(value) ? 'element' : toType(value);
-
- if (!new RegExp(expectedTypes).test(valueType)) {
- throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
- }
- }
- }
- },
- findShadowRoot: function findShadowRoot(element) {
- if (!document.documentElement.attachShadow) {
- return null;
- } // Can find the shadow root otherwise it'll return the document
-
-
- if (typeof element.getRootNode === 'function') {
- var root = element.getRootNode();
- return root instanceof ShadowRoot ? root : null;
- }
-
- if (element instanceof ShadowRoot) {
- return element;
- } // when we don't find a shadow root
-
-
- if (!element.parentNode) {
- return null;
- }
-
- return Util.findShadowRoot(element.parentNode);
- },
- jQueryDetection: function jQueryDetection() {
- if (typeof $__default['default'] === 'undefined') {
- throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
- }
-
- var version = $__default['default'].fn.jquery.split(' ')[0].split('.');
- var minMajor = 1;
- var ltMajor = 2;
- var minMinor = 9;
- var minPatch = 1;
- var maxMajor = 4;
-
- if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
- throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
- }
- }
- };
- Util.jQueryDetection();
- setTransitionEndSupport();
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME = 'alert';
- var VERSION = '4.6.0';
- var DATA_KEY = 'bs.alert';
- var EVENT_KEY = "." + DATA_KEY;
- var DATA_API_KEY = '.data-api';
- var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME];
- var SELECTOR_DISMISS = '[data-dismiss="alert"]';
- var EVENT_CLOSE = "close" + EVENT_KEY;
- var EVENT_CLOSED = "closed" + EVENT_KEY;
- var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
- var CLASS_NAME_ALERT = 'alert';
- var CLASS_NAME_FADE = 'fade';
- var CLASS_NAME_SHOW = 'show';
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Alert = /*#__PURE__*/function () {
- function Alert(element) {
- this._element = element;
- } // Getters
-
-
- var _proto = Alert.prototype;
-
- // Public
- _proto.close = function close(element) {
- var rootElement = this._element;
-
- if (element) {
- rootElement = this._getRootElement(element);
- }
-
- var customEvent = this._triggerCloseEvent(rootElement);
-
- if (customEvent.isDefaultPrevented()) {
- return;
- }
-
- this._removeElement(rootElement);
- };
-
- _proto.dispose = function dispose() {
- $__default['default'].removeData(this._element, DATA_KEY);
- this._element = null;
- } // Private
- ;
-
- _proto._getRootElement = function _getRootElement(element) {
- var selector = Util.getSelectorFromElement(element);
- var parent = false;
-
- if (selector) {
- parent = document.querySelector(selector);
- }
-
- if (!parent) {
- parent = $__default['default'](element).closest("." + CLASS_NAME_ALERT)[0];
- }
-
- return parent;
- };
-
- _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
- var closeEvent = $__default['default'].Event(EVENT_CLOSE);
- $__default['default'](element).trigger(closeEvent);
- return closeEvent;
- };
-
- _proto._removeElement = function _removeElement(element) {
- var _this = this;
-
- $__default['default'](element).removeClass(CLASS_NAME_SHOW);
-
- if (!$__default['default'](element).hasClass(CLASS_NAME_FADE)) {
- this._destroyElement(element);
-
- return;
- }
-
- var transitionDuration = Util.getTransitionDurationFromElement(element);
- $__default['default'](element).one(Util.TRANSITION_END, function (event) {
- return _this._destroyElement(element, event);
- }).emulateTransitionEnd(transitionDuration);
- };
-
- _proto._destroyElement = function _destroyElement(element) {
- $__default['default'](element).detach().trigger(EVENT_CLOSED).remove();
- } // Static
- ;
-
- Alert._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var $element = $__default['default'](this);
- var data = $element.data(DATA_KEY);
-
- if (!data) {
- data = new Alert(this);
- $element.data(DATA_KEY, data);
- }
-
- if (config === 'close') {
- data[config](this);
- }
- });
- };
-
- Alert._handleDismiss = function _handleDismiss(alertInstance) {
- return function (event) {
- if (event) {
- event.preventDefault();
- }
-
- alertInstance.close(this);
- };
- };
-
- _createClass(Alert, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION;
- }
- }]);
-
- return Alert;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'](document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
- $__default['default'].fn[NAME] = Alert._jQueryInterface;
- $__default['default'].fn[NAME].Constructor = Alert;
-
- $__default['default'].fn[NAME].noConflict = function () {
- $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT;
- return Alert._jQueryInterface;
- };
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$1 = 'button';
- var VERSION$1 = '4.6.0';
- var DATA_KEY$1 = 'bs.button';
- var EVENT_KEY$1 = "." + DATA_KEY$1;
- var DATA_API_KEY$1 = '.data-api';
- var JQUERY_NO_CONFLICT$1 = $__default['default'].fn[NAME$1];
- var CLASS_NAME_ACTIVE = 'active';
- var CLASS_NAME_BUTTON = 'btn';
- var CLASS_NAME_FOCUS = 'focus';
- var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
- var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]';
- var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
- var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn';
- var SELECTOR_INPUT = 'input:not([type="hidden"])';
- var SELECTOR_ACTIVE = '.active';
- var SELECTOR_BUTTON = '.btn';
- var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
- var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1);
- var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$1 + DATA_API_KEY$1;
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Button = /*#__PURE__*/function () {
- function Button(element) {
- this._element = element;
- this.shouldAvoidTriggerChange = false;
- } // Getters
-
-
- var _proto = Button.prototype;
-
- // Public
- _proto.toggle = function toggle() {
- var triggerChangeEvent = true;
- var addAriaPressed = true;
- var rootElement = $__default['default'](this._element).closest(SELECTOR_DATA_TOGGLES)[0];
-
- if (rootElement) {
- var input = this._element.querySelector(SELECTOR_INPUT);
-
- if (input) {
- if (input.type === 'radio') {
- if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
- triggerChangeEvent = false;
- } else {
- var activeElement = rootElement.querySelector(SELECTOR_ACTIVE);
-
- if (activeElement) {
- $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE);
- }
- }
- }
-
- if (triggerChangeEvent) {
- // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
- if (input.type === 'checkbox' || input.type === 'radio') {
- input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
- }
-
- if (!this.shouldAvoidTriggerChange) {
- $__default['default'](input).trigger('change');
- }
- }
-
- input.focus();
- addAriaPressed = false;
- }
- }
-
- if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
- if (addAriaPressed) {
- this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
- }
-
- if (triggerChangeEvent) {
- $__default['default'](this._element).toggleClass(CLASS_NAME_ACTIVE);
- }
- }
- };
-
- _proto.dispose = function dispose() {
- $__default['default'].removeData(this._element, DATA_KEY$1);
- this._element = null;
- } // Static
- ;
-
- Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) {
- return this.each(function () {
- var $element = $__default['default'](this);
- var data = $element.data(DATA_KEY$1);
-
- if (!data) {
- data = new Button(this);
- $element.data(DATA_KEY$1, data);
- }
-
- data.shouldAvoidTriggerChange = avoidTriggerChange;
-
- if (config === 'toggle') {
- data[config]();
- }
- });
- };
-
- _createClass(Button, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$1;
- }
- }]);
-
- return Button;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'](document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
- var button = event.target;
- var initialButton = button;
-
- if (!$__default['default'](button).hasClass(CLASS_NAME_BUTTON)) {
- button = $__default['default'](button).closest(SELECTOR_BUTTON)[0];
- }
-
- if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
- event.preventDefault(); // work around Firefox bug #1540995
- } else {
- var inputBtn = button.querySelector(SELECTOR_INPUT);
-
- if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
- event.preventDefault(); // work around Firefox bug #1540995
-
- return;
- }
-
- if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') {
- Button._jQueryInterface.call($__default['default'](button), 'toggle', initialButton.tagName === 'INPUT');
- }
- }
- }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
- var button = $__default['default'](event.target).closest(SELECTOR_BUTTON)[0];
- $__default['default'](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type));
- });
- $__default['default'](window).on(EVENT_LOAD_DATA_API, function () {
- // ensure correct active class is set to match the controls' actual values/states
- // find all checkboxes/readio buttons inside data-toggle groups
- var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS));
-
- for (var i = 0, len = buttons.length; i < len; i++) {
- var button = buttons[i];
- var input = button.querySelector(SELECTOR_INPUT);
-
- if (input.checked || input.hasAttribute('checked')) {
- button.classList.add(CLASS_NAME_ACTIVE);
- } else {
- button.classList.remove(CLASS_NAME_ACTIVE);
- }
- } // find all button toggles
-
-
- buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
-
- for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
- var _button = buttons[_i];
-
- if (_button.getAttribute('aria-pressed') === 'true') {
- _button.classList.add(CLASS_NAME_ACTIVE);
- } else {
- _button.classList.remove(CLASS_NAME_ACTIVE);
- }
- }
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
- $__default['default'].fn[NAME$1] = Button._jQueryInterface;
- $__default['default'].fn[NAME$1].Constructor = Button;
-
- $__default['default'].fn[NAME$1].noConflict = function () {
- $__default['default'].fn[NAME$1] = JQUERY_NO_CONFLICT$1;
- return Button._jQueryInterface;
- };
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$2 = 'carousel';
- var VERSION$2 = '4.6.0';
- var DATA_KEY$2 = 'bs.carousel';
- var EVENT_KEY$2 = "." + DATA_KEY$2;
- var DATA_API_KEY$2 = '.data-api';
- var JQUERY_NO_CONFLICT$2 = $__default['default'].fn[NAME$2];
- var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
-
- var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
-
- var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
-
- var SWIPE_THRESHOLD = 40;
- var Default = {
- interval: 5000,
- keyboard: true,
- slide: false,
- pause: 'hover',
- wrap: true,
- touch: true
- };
- var DefaultType = {
- interval: '(number|boolean)',
- keyboard: 'boolean',
- slide: '(boolean|string)',
- pause: '(string|boolean)',
- wrap: 'boolean',
- touch: 'boolean'
- };
- var DIRECTION_NEXT = 'next';
- var DIRECTION_PREV = 'prev';
- var DIRECTION_LEFT = 'left';
- var DIRECTION_RIGHT = 'right';
- var EVENT_SLIDE = "slide" + EVENT_KEY$2;
- var EVENT_SLID = "slid" + EVENT_KEY$2;
- var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
- var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
- var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
- var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
- var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
- var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
- var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
- var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
- var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
- var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
- var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
- var CLASS_NAME_CAROUSEL = 'carousel';
- var CLASS_NAME_ACTIVE$1 = 'active';
- var CLASS_NAME_SLIDE = 'slide';
- var CLASS_NAME_RIGHT = 'carousel-item-right';
- var CLASS_NAME_LEFT = 'carousel-item-left';
- var CLASS_NAME_NEXT = 'carousel-item-next';
- var CLASS_NAME_PREV = 'carousel-item-prev';
- var CLASS_NAME_POINTER_EVENT = 'pointer-event';
- var SELECTOR_ACTIVE$1 = '.active';
- var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
- var SELECTOR_ITEM = '.carousel-item';
- var SELECTOR_ITEM_IMG = '.carousel-item img';
- var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
- var SELECTOR_INDICATORS = '.carousel-indicators';
- var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
- var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
- var PointerType = {
- TOUCH: 'touch',
- PEN: 'pen'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Carousel = /*#__PURE__*/function () {
- function Carousel(element, config) {
- this._items = null;
- this._interval = null;
- this._activeElement = null;
- this._isPaused = false;
- this._isSliding = false;
- this.touchTimeout = null;
- this.touchStartX = 0;
- this.touchDeltaX = 0;
- this._config = this._getConfig(config);
- this._element = element;
- this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
- this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
- this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
-
- this._addEventListeners();
- } // Getters
-
-
- var _proto = Carousel.prototype;
-
- // Public
- _proto.next = function next() {
- if (!this._isSliding) {
- this._slide(DIRECTION_NEXT);
- }
- };
-
- _proto.nextWhenVisible = function nextWhenVisible() {
- var $element = $__default['default'](this._element); // Don't call next when the page isn't visible
- // or the carousel or its parent isn't visible
-
- if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') {
- this.next();
- }
- };
-
- _proto.prev = function prev() {
- if (!this._isSliding) {
- this._slide(DIRECTION_PREV);
- }
- };
-
- _proto.pause = function pause(event) {
- if (!event) {
- this._isPaused = true;
- }
-
- if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
- Util.triggerTransitionEnd(this._element);
- this.cycle(true);
- }
-
- clearInterval(this._interval);
- this._interval = null;
- };
-
- _proto.cycle = function cycle(event) {
- if (!event) {
- this._isPaused = false;
- }
-
- if (this._interval) {
- clearInterval(this._interval);
- this._interval = null;
- }
-
- if (this._config.interval && !this._isPaused) {
- this._updateInterval();
-
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
- }
- };
-
- _proto.to = function to(index) {
- var _this = this;
-
- this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
-
- var activeIndex = this._getItemIndex(this._activeElement);
-
- if (index > this._items.length - 1 || index < 0) {
- return;
- }
-
- if (this._isSliding) {
- $__default['default'](this._element).one(EVENT_SLID, function () {
- return _this.to(index);
- });
- return;
- }
-
- if (activeIndex === index) {
- this.pause();
- this.cycle();
- return;
- }
-
- var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
-
- this._slide(direction, this._items[index]);
- };
-
- _proto.dispose = function dispose() {
- $__default['default'](this._element).off(EVENT_KEY$2);
- $__default['default'].removeData(this._element, DATA_KEY$2);
- this._items = null;
- this._config = null;
- this._element = null;
- this._interval = null;
- this._isPaused = null;
- this._isSliding = null;
- this._activeElement = null;
- this._indicatorsElement = null;
- } // Private
- ;
-
- _proto._getConfig = function _getConfig(config) {
- config = _extends({}, Default, config);
- Util.typeCheckConfig(NAME$2, config, DefaultType);
- return config;
- };
-
- _proto._handleSwipe = function _handleSwipe() {
- var absDeltax = Math.abs(this.touchDeltaX);
-
- if (absDeltax <= SWIPE_THRESHOLD) {
- return;
- }
-
- var direction = absDeltax / this.touchDeltaX;
- this.touchDeltaX = 0; // swipe left
-
- if (direction > 0) {
- this.prev();
- } // swipe right
-
-
- if (direction < 0) {
- this.next();
- }
- };
-
- _proto._addEventListeners = function _addEventListeners() {
- var _this2 = this;
-
- if (this._config.keyboard) {
- $__default['default'](this._element).on(EVENT_KEYDOWN, function (event) {
- return _this2._keydown(event);
- });
- }
-
- if (this._config.pause === 'hover') {
- $__default['default'](this._element).on(EVENT_MOUSEENTER, function (event) {
- return _this2.pause(event);
- }).on(EVENT_MOUSELEAVE, function (event) {
- return _this2.cycle(event);
- });
- }
-
- if (this._config.touch) {
- this._addTouchEventListeners();
- }
- };
-
- _proto._addTouchEventListeners = function _addTouchEventListeners() {
- var _this3 = this;
-
- if (!this._touchSupported) {
- return;
- }
-
- var start = function start(event) {
- if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
- _this3.touchStartX = event.originalEvent.clientX;
- } else if (!_this3._pointerEvent) {
- _this3.touchStartX = event.originalEvent.touches[0].clientX;
- }
- };
-
- var move = function move(event) {
- // ensure swiping with one touch and not pinching
- if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
- _this3.touchDeltaX = 0;
- } else {
- _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
- }
- };
-
- var end = function end(event) {
- if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
- _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
- }
-
- _this3._handleSwipe();
-
- if (_this3._config.pause === 'hover') {
- // If it's a touch-enabled device, mouseenter/leave are fired as
- // part of the mouse compatibility events on first tap - the carousel
- // would stop cycling until user tapped out of it;
- // here, we listen for touchend, explicitly pause the carousel
- // (as if it's the second time we tap on it, mouseenter compat event
- // is NOT fired) and after a timeout (to allow for mouse compatibility
- // events to fire) we explicitly restart cycling
- _this3.pause();
-
- if (_this3.touchTimeout) {
- clearTimeout(_this3.touchTimeout);
- }
-
- _this3.touchTimeout = setTimeout(function (event) {
- return _this3.cycle(event);
- }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
- }
- };
-
- $__default['default'](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
- return e.preventDefault();
- });
-
- if (this._pointerEvent) {
- $__default['default'](this._element).on(EVENT_POINTERDOWN, function (event) {
- return start(event);
- });
- $__default['default'](this._element).on(EVENT_POINTERUP, function (event) {
- return end(event);
- });
-
- this._element.classList.add(CLASS_NAME_POINTER_EVENT);
- } else {
- $__default['default'](this._element).on(EVENT_TOUCHSTART, function (event) {
- return start(event);
- });
- $__default['default'](this._element).on(EVENT_TOUCHMOVE, function (event) {
- return move(event);
- });
- $__default['default'](this._element).on(EVENT_TOUCHEND, function (event) {
- return end(event);
- });
- }
- };
-
- _proto._keydown = function _keydown(event) {
- if (/input|textarea/i.test(event.target.tagName)) {
- return;
- }
-
- switch (event.which) {
- case ARROW_LEFT_KEYCODE:
- event.preventDefault();
- this.prev();
- break;
-
- case ARROW_RIGHT_KEYCODE:
- event.preventDefault();
- this.next();
- break;
- }
- };
-
- _proto._getItemIndex = function _getItemIndex(element) {
- this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
- return this._items.indexOf(element);
- };
-
- _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
- var isNextDirection = direction === DIRECTION_NEXT;
- var isPrevDirection = direction === DIRECTION_PREV;
-
- var activeIndex = this._getItemIndex(activeElement);
-
- var lastItemIndex = this._items.length - 1;
- var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
-
- if (isGoingToWrap && !this._config.wrap) {
- return activeElement;
- }
-
- var delta = direction === DIRECTION_PREV ? -1 : 1;
- var itemIndex = (activeIndex + delta) % this._items.length;
- return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
- };
-
- _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
- var targetIndex = this._getItemIndex(relatedTarget);
-
- var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
-
- var slideEvent = $__default['default'].Event(EVENT_SLIDE, {
- relatedTarget: relatedTarget,
- direction: eventDirectionName,
- from: fromIndex,
- to: targetIndex
- });
- $__default['default'](this._element).trigger(slideEvent);
- return slideEvent;
- };
-
- _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
- if (this._indicatorsElement) {
- var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1));
- $__default['default'](indicators).removeClass(CLASS_NAME_ACTIVE$1);
-
- var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
-
- if (nextIndicator) {
- $__default['default'](nextIndicator).addClass(CLASS_NAME_ACTIVE$1);
- }
- }
- };
-
- _proto._updateInterval = function _updateInterval() {
- var element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM);
-
- if (!element) {
- return;
- }
-
- var elementInterval = parseInt(element.getAttribute('data-interval'), 10);
-
- if (elementInterval) {
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
- this._config.interval = elementInterval;
- } else {
- this._config.interval = this._config.defaultInterval || this._config.interval;
- }
- };
-
- _proto._slide = function _slide(direction, element) {
- var _this4 = this;
-
- var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
-
- var activeElementIndex = this._getItemIndex(activeElement);
-
- var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
-
- var nextElementIndex = this._getItemIndex(nextElement);
-
- var isCycling = Boolean(this._interval);
- var directionalClassName;
- var orderClassName;
- var eventDirectionName;
-
- if (direction === DIRECTION_NEXT) {
- directionalClassName = CLASS_NAME_LEFT;
- orderClassName = CLASS_NAME_NEXT;
- eventDirectionName = DIRECTION_LEFT;
- } else {
- directionalClassName = CLASS_NAME_RIGHT;
- orderClassName = CLASS_NAME_PREV;
- eventDirectionName = DIRECTION_RIGHT;
- }
-
- if (nextElement && $__default['default'](nextElement).hasClass(CLASS_NAME_ACTIVE$1)) {
- this._isSliding = false;
- return;
- }
-
- var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
-
- if (slideEvent.isDefaultPrevented()) {
- return;
- }
-
- if (!activeElement || !nextElement) {
- // Some weirdness is happening, so we bail
- return;
- }
-
- this._isSliding = true;
-
- if (isCycling) {
- this.pause();
- }
-
- this._setActiveIndicatorElement(nextElement);
-
- this._activeElement = nextElement;
- var slidEvent = $__default['default'].Event(EVENT_SLID, {
- relatedTarget: nextElement,
- direction: eventDirectionName,
- from: activeElementIndex,
- to: nextElementIndex
- });
-
- if ($__default['default'](this._element).hasClass(CLASS_NAME_SLIDE)) {
- $__default['default'](nextElement).addClass(orderClassName);
- Util.reflow(nextElement);
- $__default['default'](activeElement).addClass(directionalClassName);
- $__default['default'](nextElement).addClass(directionalClassName);
- var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
- $__default['default'](activeElement).one(Util.TRANSITION_END, function () {
- $__default['default'](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$1);
- $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE$1 + " " + orderClassName + " " + directionalClassName);
- _this4._isSliding = false;
- setTimeout(function () {
- return $__default['default'](_this4._element).trigger(slidEvent);
- }, 0);
- }).emulateTransitionEnd(transitionDuration);
- } else {
- $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE$1);
- $__default['default'](nextElement).addClass(CLASS_NAME_ACTIVE$1);
- this._isSliding = false;
- $__default['default'](this._element).trigger(slidEvent);
- }
-
- if (isCycling) {
- this.cycle();
- }
- } // Static
- ;
-
- Carousel._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $__default['default'](this).data(DATA_KEY$2);
-
- var _config = _extends({}, Default, $__default['default'](this).data());
-
- if (typeof config === 'object') {
- _config = _extends({}, _config, config);
- }
-
- var action = typeof config === 'string' ? config : _config.slide;
-
- if (!data) {
- data = new Carousel(this, _config);
- $__default['default'](this).data(DATA_KEY$2, data);
- }
-
- if (typeof config === 'number') {
- data.to(config);
- } else if (typeof action === 'string') {
- if (typeof data[action] === 'undefined') {
- throw new TypeError("No method named \"" + action + "\"");
- }
-
- data[action]();
- } else if (_config.interval && _config.ride) {
- data.pause();
- data.cycle();
- }
- });
- };
-
- Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
- var selector = Util.getSelectorFromElement(this);
-
- if (!selector) {
- return;
- }
-
- var target = $__default['default'](selector)[0];
-
- if (!target || !$__default['default'](target).hasClass(CLASS_NAME_CAROUSEL)) {
- return;
- }
-
- var config = _extends({}, $__default['default'](target).data(), $__default['default'](this).data());
-
- var slideIndex = this.getAttribute('data-slide-to');
-
- if (slideIndex) {
- config.interval = false;
- }
-
- Carousel._jQueryInterface.call($__default['default'](target), config);
-
- if (slideIndex) {
- $__default['default'](target).data(DATA_KEY$2).to(slideIndex);
- }
-
- event.preventDefault();
- };
-
- _createClass(Carousel, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$2;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default;
- }
- }]);
-
- return Carousel;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'](document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
- $__default['default'](window).on(EVENT_LOAD_DATA_API$1, function () {
- var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
-
- for (var i = 0, len = carousels.length; i < len; i++) {
- var $carousel = $__default['default'](carousels[i]);
-
- Carousel._jQueryInterface.call($carousel, $carousel.data());
- }
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
- $__default['default'].fn[NAME$2] = Carousel._jQueryInterface;
- $__default['default'].fn[NAME$2].Constructor = Carousel;
-
- $__default['default'].fn[NAME$2].noConflict = function () {
- $__default['default'].fn[NAME$2] = JQUERY_NO_CONFLICT$2;
- return Carousel._jQueryInterface;
- };
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$3 = 'collapse';
- var VERSION$3 = '4.6.0';
- var DATA_KEY$3 = 'bs.collapse';
- var EVENT_KEY$3 = "." + DATA_KEY$3;
- var DATA_API_KEY$3 = '.data-api';
- var JQUERY_NO_CONFLICT$3 = $__default['default'].fn[NAME$3];
- var Default$1 = {
- toggle: true,
- parent: ''
- };
- var DefaultType$1 = {
- toggle: 'boolean',
- parent: '(string|element)'
- };
- var EVENT_SHOW = "show" + EVENT_KEY$3;
- var EVENT_SHOWN = "shown" + EVENT_KEY$3;
- var EVENT_HIDE = "hide" + EVENT_KEY$3;
- var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
- var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
- var CLASS_NAME_SHOW$1 = 'show';
- var CLASS_NAME_COLLAPSE = 'collapse';
- var CLASS_NAME_COLLAPSING = 'collapsing';
- var CLASS_NAME_COLLAPSED = 'collapsed';
- var DIMENSION_WIDTH = 'width';
- var DIMENSION_HEIGHT = 'height';
- var SELECTOR_ACTIVES = '.show, .collapsing';
- var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Collapse = /*#__PURE__*/function () {
- function Collapse(element, config) {
- this._isTransitioning = false;
- this._element = element;
- this._config = this._getConfig(config);
- this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
- var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$1));
-
- for (var i = 0, len = toggleList.length; i < len; i++) {
- var elem = toggleList[i];
- var selector = Util.getSelectorFromElement(elem);
- var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
- return foundElem === element;
- });
-
- if (selector !== null && filterElement.length > 0) {
- this._selector = selector;
-
- this._triggerArray.push(elem);
- }
- }
-
- this._parent = this._config.parent ? this._getParent() : null;
-
- if (!this._config.parent) {
- this._addAriaAndCollapsedClass(this._element, this._triggerArray);
- }
-
- if (this._config.toggle) {
- this.toggle();
- }
- } // Getters
-
-
- var _proto = Collapse.prototype;
-
- // Public
- _proto.toggle = function toggle() {
- if ($__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
- this.hide();
- } else {
- this.show();
- }
- };
-
- _proto.show = function show() {
- var _this = this;
-
- if (this._isTransitioning || $__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
- return;
- }
-
- var actives;
- var activesData;
-
- if (this._parent) {
- actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
- if (typeof _this._config.parent === 'string') {
- return elem.getAttribute('data-parent') === _this._config.parent;
- }
-
- return elem.classList.contains(CLASS_NAME_COLLAPSE);
- });
-
- if (actives.length === 0) {
- actives = null;
- }
- }
-
- if (actives) {
- activesData = $__default['default'](actives).not(this._selector).data(DATA_KEY$3);
-
- if (activesData && activesData._isTransitioning) {
- return;
- }
- }
-
- var startEvent = $__default['default'].Event(EVENT_SHOW);
- $__default['default'](this._element).trigger(startEvent);
-
- if (startEvent.isDefaultPrevented()) {
- return;
- }
-
- if (actives) {
- Collapse._jQueryInterface.call($__default['default'](actives).not(this._selector), 'hide');
-
- if (!activesData) {
- $__default['default'](actives).data(DATA_KEY$3, null);
- }
- }
-
- var dimension = this._getDimension();
-
- $__default['default'](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
- this._element.style[dimension] = 0;
-
- if (this._triggerArray.length) {
- $__default['default'](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
- }
-
- this.setTransitioning(true);
-
- var complete = function complete() {
- $__default['default'](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
- _this._element.style[dimension] = '';
-
- _this.setTransitioning(false);
-
- $__default['default'](_this._element).trigger(EVENT_SHOWN);
- };
-
- var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
- var scrollSize = "scroll" + capitalizedDimension;
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- this._element.style[dimension] = this._element[scrollSize] + "px";
- };
-
- _proto.hide = function hide() {
- var _this2 = this;
-
- if (this._isTransitioning || !$__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
- return;
- }
-
- var startEvent = $__default['default'].Event(EVENT_HIDE);
- $__default['default'](this._element).trigger(startEvent);
-
- if (startEvent.isDefaultPrevented()) {
- return;
- }
-
- var dimension = this._getDimension();
-
- this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
- Util.reflow(this._element);
- $__default['default'](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
- var triggerArrayLength = this._triggerArray.length;
-
- if (triggerArrayLength > 0) {
- for (var i = 0; i < triggerArrayLength; i++) {
- var trigger = this._triggerArray[i];
- var selector = Util.getSelectorFromElement(trigger);
-
- if (selector !== null) {
- var $elem = $__default['default']([].slice.call(document.querySelectorAll(selector)));
-
- if (!$elem.hasClass(CLASS_NAME_SHOW$1)) {
- $__default['default'](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
- }
- }
- }
- }
-
- this.setTransitioning(true);
-
- var complete = function complete() {
- _this2.setTransitioning(false);
-
- $__default['default'](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
- };
-
- this._element.style[dimension] = '';
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- };
-
- _proto.setTransitioning = function setTransitioning(isTransitioning) {
- this._isTransitioning = isTransitioning;
- };
-
- _proto.dispose = function dispose() {
- $__default['default'].removeData(this._element, DATA_KEY$3);
- this._config = null;
- this._parent = null;
- this._element = null;
- this._triggerArray = null;
- this._isTransitioning = null;
- } // Private
- ;
-
- _proto._getConfig = function _getConfig(config) {
- config = _extends({}, Default$1, config);
- config.toggle = Boolean(config.toggle); // Coerce string values
-
- Util.typeCheckConfig(NAME$3, config, DefaultType$1);
- return config;
- };
-
- _proto._getDimension = function _getDimension() {
- var hasWidth = $__default['default'](this._element).hasClass(DIMENSION_WIDTH);
- return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
- };
-
- _proto._getParent = function _getParent() {
- var _this3 = this;
-
- var parent;
-
- if (Util.isElement(this._config.parent)) {
- parent = this._config.parent; // It's a jQuery object
-
- if (typeof this._config.parent.jquery !== 'undefined') {
- parent = this._config.parent[0];
- }
- } else {
- parent = document.querySelector(this._config.parent);
- }
-
- var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
- var children = [].slice.call(parent.querySelectorAll(selector));
- $__default['default'](children).each(function (i, element) {
- _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
- });
- return parent;
- };
-
- _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
- var isOpen = $__default['default'](element).hasClass(CLASS_NAME_SHOW$1);
-
- if (triggerArray.length) {
- $__default['default'](triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
- }
- } // Static
- ;
-
- Collapse._getTargetFromElement = function _getTargetFromElement(element) {
- var selector = Util.getSelectorFromElement(element);
- return selector ? document.querySelector(selector) : null;
- };
-
- Collapse._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var $element = $__default['default'](this);
- var data = $element.data(DATA_KEY$3);
-
- var _config = _extends({}, Default$1, $element.data(), typeof config === 'object' && config ? config : {});
-
- if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
- _config.toggle = false;
- }
-
- if (!data) {
- data = new Collapse(this, _config);
- $element.data(DATA_KEY$3, data);
- }
-
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
-
- data[config]();
- }
- });
- };
-
- _createClass(Collapse, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$3;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$1;
- }
- }]);
-
- return Collapse;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'](document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
- // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
- if (event.currentTarget.tagName === 'A') {
- event.preventDefault();
- }
-
- var $trigger = $__default['default'](this);
- var selector = Util.getSelectorFromElement(this);
- var selectors = [].slice.call(document.querySelectorAll(selector));
- $__default['default'](selectors).each(function () {
- var $target = $__default['default'](this);
- var data = $target.data(DATA_KEY$3);
- var config = data ? 'toggle' : $trigger.data();
-
- Collapse._jQueryInterface.call($target, config);
- });
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
- $__default['default'].fn[NAME$3] = Collapse._jQueryInterface;
- $__default['default'].fn[NAME$3].Constructor = Collapse;
-
- $__default['default'].fn[NAME$3].noConflict = function () {
- $__default['default'].fn[NAME$3] = JQUERY_NO_CONFLICT$3;
- return Collapse._jQueryInterface;
- };
-
- /**!
- * @fileOverview Kickass library to create and place poppers near their reference elements.
- * @version 1.16.1
- * @license
- * Copyright (c) 2016 Federico Zivolo and contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
- var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
-
- var timeoutDuration = function () {
- var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
- for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
- if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
- return 1;
- }
- }
- return 0;
- }();
-
- function microtaskDebounce(fn) {
- var called = false;
- return function () {
- if (called) {
- return;
- }
- called = true;
- window.Promise.resolve().then(function () {
- called = false;
- fn();
- });
- };
- }
-
- function taskDebounce(fn) {
- var scheduled = false;
- return function () {
- if (!scheduled) {
- scheduled = true;
- setTimeout(function () {
- scheduled = false;
- fn();
- }, timeoutDuration);
- }
- };
- }
-
- var supportsMicroTasks = isBrowser && window.Promise;
-
- /**
- * Create a debounced version of a method, that's asynchronously deferred
- * but called in the minimum time possible.
- *
- * @method
- * @memberof Popper.Utils
- * @argument {Function} fn
- * @returns {Function}
- */
- var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
-
- /**
- * Check if the given variable is a function
- * @method
- * @memberof Popper.Utils
- * @argument {Any} functionToCheck - variable to check
- * @returns {Boolean} answer to: is a function?
- */
- function isFunction(functionToCheck) {
- var getType = {};
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
- }
-
- /**
- * Get CSS computed property of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Eement} element
- * @argument {String} property
- */
- function getStyleComputedProperty(element, property) {
- if (element.nodeType !== 1) {
- return [];
- }
- // NOTE: 1 DOM access here
- var window = element.ownerDocument.defaultView;
- var css = window.getComputedStyle(element, null);
- return property ? css[property] : css;
- }
-
- /**
- * Returns the parentNode or the host of the element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} parent
- */
- function getParentNode(element) {
- if (element.nodeName === 'HTML') {
- return element;
- }
- return element.parentNode || element.host;
- }
-
- /**
- * Returns the scrolling parent of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} scroll parent
- */
- function getScrollParent(element) {
- // Return body, `getScroll` will take care to get the correct `scrollTop` from it
- if (!element) {
- return document.body;
- }
-
- switch (element.nodeName) {
- case 'HTML':
- case 'BODY':
- return element.ownerDocument.body;
- case '#document':
- return element.body;
- }
-
- // Firefox want us to check `-x` and `-y` variations as well
-
- var _getStyleComputedProp = getStyleComputedProperty(element),
- overflow = _getStyleComputedProp.overflow,
- overflowX = _getStyleComputedProp.overflowX,
- overflowY = _getStyleComputedProp.overflowY;
-
- if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
- return element;
- }
-
- return getScrollParent(getParentNode(element));
- }
-
- /**
- * Returns the reference node of the reference object, or the reference object itself.
- * @method
- * @memberof Popper.Utils
- * @param {Element|Object} reference - the reference element (the popper will be relative to this)
- * @returns {Element} parent
- */
- function getReferenceNode(reference) {
- return reference && reference.referenceNode ? reference.referenceNode : reference;
- }
-
- var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
- var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
-
- /**
- * Determines if the browser is Internet Explorer
- * @method
- * @memberof Popper.Utils
- * @param {Number} version to check
- * @returns {Boolean} isIE
- */
- function isIE(version) {
- if (version === 11) {
- return isIE11;
- }
- if (version === 10) {
- return isIE10;
- }
- return isIE11 || isIE10;
- }
-
- /**
- * Returns the offset parent of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} offset parent
- */
- function getOffsetParent(element) {
- if (!element) {
- return document.documentElement;
- }
-
- var noOffsetParent = isIE(10) ? document.body : null;
-
- // NOTE: 1 DOM access here
- var offsetParent = element.offsetParent || null;
- // Skip hidden elements which don't have an offsetParent
- while (offsetParent === noOffsetParent && element.nextElementSibling) {
- offsetParent = (element = element.nextElementSibling).offsetParent;
- }
-
- var nodeName = offsetParent && offsetParent.nodeName;
-
- if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
- return element ? element.ownerDocument.documentElement : document.documentElement;
- }
-
- // .offsetParent will return the closest TH, TD or TABLE in case
- // no offsetParent is present, I hate this job...
- if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
- return getOffsetParent(offsetParent);
- }
-
- return offsetParent;
- }
-
- function isOffsetContainer(element) {
- var nodeName = element.nodeName;
-
- if (nodeName === 'BODY') {
- return false;
- }
- return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
- }
-
- /**
- * Finds the root node (document, shadowDOM root) of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} node
- * @returns {Element} root node
- */
- function getRoot(node) {
- if (node.parentNode !== null) {
- return getRoot(node.parentNode);
- }
-
- return node;
- }
-
- /**
- * Finds the offset parent common to the two provided nodes
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element1
- * @argument {Element} element2
- * @returns {Element} common offset parent
- */
- function findCommonOffsetParent(element1, element2) {
- // This check is needed to avoid errors in case one of the elements isn't defined for any reason
- if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
- return document.documentElement;
- }
-
- // Here we make sure to give as "start" the element that comes first in the DOM
- var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
- var start = order ? element1 : element2;
- var end = order ? element2 : element1;
-
- // Get common ancestor container
- var range = document.createRange();
- range.setStart(start, 0);
- range.setEnd(end, 0);
- var commonAncestorContainer = range.commonAncestorContainer;
-
- // Both nodes are inside #document
-
- if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
- if (isOffsetContainer(commonAncestorContainer)) {
- return commonAncestorContainer;
- }
-
- return getOffsetParent(commonAncestorContainer);
- }
-
- // one of the nodes is inside shadowDOM, find which one
- var element1root = getRoot(element1);
- if (element1root.host) {
- return findCommonOffsetParent(element1root.host, element2);
- } else {
- return findCommonOffsetParent(element1, getRoot(element2).host);
- }
- }
-
- /**
- * Gets the scroll value of the given element in the given side (top and left)
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @argument {String} side `top` or `left`
- * @returns {number} amount of scrolled pixels
- */
- function getScroll(element) {
- var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
-
- var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
- var nodeName = element.nodeName;
-
- if (nodeName === 'BODY' || nodeName === 'HTML') {
- var html = element.ownerDocument.documentElement;
- var scrollingElement = element.ownerDocument.scrollingElement || html;
- return scrollingElement[upperSide];
- }
-
- return element[upperSide];
- }
-
- /*
- * Sum or subtract the element scroll values (left and top) from a given rect object
- * @method
- * @memberof Popper.Utils
- * @param {Object} rect - Rect object you want to change
- * @param {HTMLElement} element - The element from the function reads the scroll values
- * @param {Boolean} subtract - set to true if you want to subtract the scroll values
- * @return {Object} rect - The modifier rect object
- */
- function includeScroll(rect, element) {
- var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- var scrollTop = getScroll(element, 'top');
- var scrollLeft = getScroll(element, 'left');
- var modifier = subtract ? -1 : 1;
- rect.top += scrollTop * modifier;
- rect.bottom += scrollTop * modifier;
- rect.left += scrollLeft * modifier;
- rect.right += scrollLeft * modifier;
- return rect;
- }
-
- /*
- * Helper to detect borders of a given element
- * @method
- * @memberof Popper.Utils
- * @param {CSSStyleDeclaration} styles
- * Result of `getStyleComputedProperty` on the given element
- * @param {String} axis - `x` or `y`
- * @return {number} borders - The borders size of the given axis
- */
-
- function getBordersSize(styles, axis) {
- var sideA = axis === 'x' ? 'Left' : 'Top';
- var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
-
- return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
- }
-
- function getSize(axis, body, html, computedStyle) {
- return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
- }
-
- function getWindowSizes(document) {
- var body = document.body;
- var html = document.documentElement;
- var computedStyle = isIE(10) && getComputedStyle(html);
-
- return {
- height: getSize('Height', body, html, computedStyle),
- width: getSize('Width', body, html, computedStyle)
- };
- }
-
- var classCallCheck = function (instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- };
-
- var createClass = function () {
- function defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
-
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
-
-
-
-
-
- var defineProperty = function (obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
-
- return obj;
- };
-
- var _extends$1 = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
-
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
-
- return target;
- };
-
- /**
- * Given element offsets, generate an output similar to getBoundingClientRect
- * @method
- * @memberof Popper.Utils
- * @argument {Object} offsets
- * @returns {Object} ClientRect like output
- */
- function getClientRect(offsets) {
- return _extends$1({}, offsets, {
- right: offsets.left + offsets.width,
- bottom: offsets.top + offsets.height
- });
- }
-
- /**
- * Get bounding client rect of given element
- * @method
- * @memberof Popper.Utils
- * @param {HTMLElement} element
- * @return {Object} client rect
- */
- function getBoundingClientRect(element) {
- var rect = {};
-
- // IE10 10 FIX: Please, don't ask, the element isn't
- // considered in DOM in some circumstances...
- // This isn't reproducible in IE10 compatibility mode of IE11
- try {
- if (isIE(10)) {
- rect = element.getBoundingClientRect();
- var scrollTop = getScroll(element, 'top');
- var scrollLeft = getScroll(element, 'left');
- rect.top += scrollTop;
- rect.left += scrollLeft;
- rect.bottom += scrollTop;
- rect.right += scrollLeft;
- } else {
- rect = element.getBoundingClientRect();
- }
- } catch (e) {}
-
- var result = {
- left: rect.left,
- top: rect.top,
- width: rect.right - rect.left,
- height: rect.bottom - rect.top
- };
-
- // subtract scrollbar size from sizes
- var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
- var width = sizes.width || element.clientWidth || result.width;
- var height = sizes.height || element.clientHeight || result.height;
-
- var horizScrollbar = element.offsetWidth - width;
- var vertScrollbar = element.offsetHeight - height;
-
- // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
- // we make this check conditional for performance reasons
- if (horizScrollbar || vertScrollbar) {
- var styles = getStyleComputedProperty(element);
- horizScrollbar -= getBordersSize(styles, 'x');
- vertScrollbar -= getBordersSize(styles, 'y');
-
- result.width -= horizScrollbar;
- result.height -= vertScrollbar;
- }
-
- return getClientRect(result);
- }
-
- function getOffsetRectRelativeToArbitraryNode(children, parent) {
- var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- var isIE10 = isIE(10);
- var isHTML = parent.nodeName === 'HTML';
- var childrenRect = getBoundingClientRect(children);
- var parentRect = getBoundingClientRect(parent);
- var scrollParent = getScrollParent(children);
-
- var styles = getStyleComputedProperty(parent);
- var borderTopWidth = parseFloat(styles.borderTopWidth);
- var borderLeftWidth = parseFloat(styles.borderLeftWidth);
-
- // In cases where the parent is fixed, we must ignore negative scroll in offset calc
- if (fixedPosition && isHTML) {
- parentRect.top = Math.max(parentRect.top, 0);
- parentRect.left = Math.max(parentRect.left, 0);
- }
- var offsets = getClientRect({
- top: childrenRect.top - parentRect.top - borderTopWidth,
- left: childrenRect.left - parentRect.left - borderLeftWidth,
- width: childrenRect.width,
- height: childrenRect.height
- });
- offsets.marginTop = 0;
- offsets.marginLeft = 0;
-
- // Subtract margins of documentElement in case it's being used as parent
- // we do this only on HTML because it's the only element that behaves
- // differently when margins are applied to it. The margins are included in
- // the box of the documentElement, in the other cases not.
- if (!isIE10 && isHTML) {
- var marginTop = parseFloat(styles.marginTop);
- var marginLeft = parseFloat(styles.marginLeft);
-
- offsets.top -= borderTopWidth - marginTop;
- offsets.bottom -= borderTopWidth - marginTop;
- offsets.left -= borderLeftWidth - marginLeft;
- offsets.right -= borderLeftWidth - marginLeft;
-
- // Attach marginTop and marginLeft because in some circumstances we may need them
- offsets.marginTop = marginTop;
- offsets.marginLeft = marginLeft;
- }
-
- if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
- offsets = includeScroll(offsets, parent);
- }
-
- return offsets;
- }
-
- function getViewportOffsetRectRelativeToArtbitraryNode(element) {
- var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- var html = element.ownerDocument.documentElement;
- var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
- var width = Math.max(html.clientWidth, window.innerWidth || 0);
- var height = Math.max(html.clientHeight, window.innerHeight || 0);
-
- var scrollTop = !excludeScroll ? getScroll(html) : 0;
- var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
-
- var offset = {
- top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
- left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
- width: width,
- height: height
- };
-
- return getClientRect(offset);
- }
-
- /**
- * Check if the given element is fixed or is inside a fixed parent
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @argument {Element} customContainer
- * @returns {Boolean} answer to "isFixed?"
- */
- function isFixed(element) {
- var nodeName = element.nodeName;
- if (nodeName === 'BODY' || nodeName === 'HTML') {
- return false;
- }
- if (getStyleComputedProperty(element, 'position') === 'fixed') {
- return true;
- }
- var parentNode = getParentNode(element);
- if (!parentNode) {
- return false;
- }
- return isFixed(parentNode);
- }
-
- /**
- * Finds the first parent of an element that has a transformed property defined
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} first transformed parent or documentElement
- */
-
- function getFixedPositionOffsetParent(element) {
- // This check is needed to avoid errors in case one of the elements isn't defined for any reason
- if (!element || !element.parentElement || isIE()) {
- return document.documentElement;
- }
- var el = element.parentElement;
- while (el && getStyleComputedProperty(el, 'transform') === 'none') {
- el = el.parentElement;
- }
- return el || document.documentElement;
- }
-
- /**
- * Computed the boundaries limits and return them
- * @method
- * @memberof Popper.Utils
- * @param {HTMLElement} popper
- * @param {HTMLElement} reference
- * @param {number} padding
- * @param {HTMLElement} boundariesElement - Element used to define the boundaries
- * @param {Boolean} fixedPosition - Is in fixed position mode
- * @returns {Object} Coordinates of the boundaries
- */
- function getBoundaries(popper, reference, padding, boundariesElement) {
- var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
-
- // NOTE: 1 DOM access here
-
- var boundaries = { top: 0, left: 0 };
- var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
-
- // Handle viewport case
- if (boundariesElement === 'viewport') {
- boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
- } else {
- // Handle other cases based on DOM element used as boundaries
- var boundariesNode = void 0;
- if (boundariesElement === 'scrollParent') {
- boundariesNode = getScrollParent(getParentNode(reference));
- if (boundariesNode.nodeName === 'BODY') {
- boundariesNode = popper.ownerDocument.documentElement;
- }
- } else if (boundariesElement === 'window') {
- boundariesNode = popper.ownerDocument.documentElement;
- } else {
- boundariesNode = boundariesElement;
- }
-
- var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
-
- // In case of HTML, we need a different computation
- if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
- var _getWindowSizes = getWindowSizes(popper.ownerDocument),
- height = _getWindowSizes.height,
- width = _getWindowSizes.width;
-
- boundaries.top += offsets.top - offsets.marginTop;
- boundaries.bottom = height + offsets.top;
- boundaries.left += offsets.left - offsets.marginLeft;
- boundaries.right = width + offsets.left;
- } else {
- // for all the other DOM elements, this one is good
- boundaries = offsets;
- }
- }
-
- // Add paddings
- padding = padding || 0;
- var isPaddingNumber = typeof padding === 'number';
- boundaries.left += isPaddingNumber ? padding : padding.left || 0;
- boundaries.top += isPaddingNumber ? padding : padding.top || 0;
- boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
- boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
-
- return boundaries;
- }
-
- function getArea(_ref) {
- var width = _ref.width,
- height = _ref.height;
-
- return width * height;
- }
-
- /**
- * Utility used to transform the `auto` placement to the placement with more
- * available space.
- * @method
- * @memberof Popper.Utils
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
- var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
-
- if (placement.indexOf('auto') === -1) {
- return placement;
- }
-
- var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
-
- var rects = {
- top: {
- width: boundaries.width,
- height: refRect.top - boundaries.top
- },
- right: {
- width: boundaries.right - refRect.right,
- height: boundaries.height
- },
- bottom: {
- width: boundaries.width,
- height: boundaries.bottom - refRect.bottom
- },
- left: {
- width: refRect.left - boundaries.left,
- height: boundaries.height
- }
- };
-
- var sortedAreas = Object.keys(rects).map(function (key) {
- return _extends$1({
- key: key
- }, rects[key], {
- area: getArea(rects[key])
- });
- }).sort(function (a, b) {
- return b.area - a.area;
- });
-
- var filteredAreas = sortedAreas.filter(function (_ref2) {
- var width = _ref2.width,
- height = _ref2.height;
- return width >= popper.clientWidth && height >= popper.clientHeight;
- });
-
- var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
-
- var variation = placement.split('-')[1];
-
- return computedPlacement + (variation ? '-' + variation : '');
- }
-
- /**
- * Get offsets to the reference element
- * @method
- * @memberof Popper.Utils
- * @param {Object} state
- * @param {Element} popper - the popper element
- * @param {Element} reference - the reference element (the popper will be relative to this)
- * @param {Element} fixedPosition - is in fixed position mode
- * @returns {Object} An object containing the offsets which will be applied to the popper
- */
- function getReferenceOffsets(state, popper, reference) {
- var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
-
- var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
- return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
- }
-
- /**
- * Get the outer sizes of the given element (offset size + margins)
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Object} object containing width and height properties
- */
- function getOuterSizes(element) {
- var window = element.ownerDocument.defaultView;
- var styles = window.getComputedStyle(element);
- var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
- var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
- var result = {
- width: element.offsetWidth + y,
- height: element.offsetHeight + x
- };
- return result;
- }
-
- /**
- * Get the opposite placement of the given one
- * @method
- * @memberof Popper.Utils
- * @argument {String} placement
- * @returns {String} flipped placement
- */
- function getOppositePlacement(placement) {
- var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
- return placement.replace(/left|right|bottom|top/g, function (matched) {
- return hash[matched];
- });
- }
-
- /**
- * Get offsets to the popper
- * @method
- * @memberof Popper.Utils
- * @param {Object} position - CSS position the Popper will get applied
- * @param {HTMLElement} popper - the popper element
- * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
- * @param {String} placement - one of the valid placement options
- * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
- */
- function getPopperOffsets(popper, referenceOffsets, placement) {
- placement = placement.split('-')[0];
-
- // Get popper node sizes
- var popperRect = getOuterSizes(popper);
-
- // Add position, width and height to our offsets object
- var popperOffsets = {
- width: popperRect.width,
- height: popperRect.height
- };
-
- // depending by the popper placement we have to compute its offsets slightly differently
- var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
- var mainSide = isHoriz ? 'top' : 'left';
- var secondarySide = isHoriz ? 'left' : 'top';
- var measurement = isHoriz ? 'height' : 'width';
- var secondaryMeasurement = !isHoriz ? 'height' : 'width';
-
- popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
- if (placement === secondarySide) {
- popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
- } else {
- popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
- }
-
- return popperOffsets;
- }
-
- /**
- * Mimics the `find` method of Array
- * @method
- * @memberof Popper.Utils
- * @argument {Array} arr
- * @argument prop
- * @argument value
- * @returns index or -1
- */
- function find(arr, check) {
- // use native find if supported
- if (Array.prototype.find) {
- return arr.find(check);
- }
-
- // use `filter` to obtain the same behavior of `find`
- return arr.filter(check)[0];
- }
-
- /**
- * Return the index of the matching object
- * @method
- * @memberof Popper.Utils
- * @argument {Array} arr
- * @argument prop
- * @argument value
- * @returns index or -1
- */
- function findIndex(arr, prop, value) {
- // use native findIndex if supported
- if (Array.prototype.findIndex) {
- return arr.findIndex(function (cur) {
- return cur[prop] === value;
- });
- }
-
- // use `find` + `indexOf` if `findIndex` isn't supported
- var match = find(arr, function (obj) {
- return obj[prop] === value;
- });
- return arr.indexOf(match);
- }
-
- /**
- * Loop trough the list of modifiers and run them in order,
- * each of them will then edit the data object.
- * @method
- * @memberof Popper.Utils
- * @param {dataObject} data
- * @param {Array} modifiers
- * @param {String} ends - Optional modifier name used as stopper
- * @returns {dataObject}
- */
- function runModifiers(modifiers, data, ends) {
- var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
-
- modifiersToRun.forEach(function (modifier) {
- if (modifier['function']) {
- // eslint-disable-line dot-notation
- console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
- }
- var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
- if (modifier.enabled && isFunction(fn)) {
- // Add properties to offsets to make them a complete clientRect object
- // we do this before each modifier to make sure the previous one doesn't
- // mess with these values
- data.offsets.popper = getClientRect(data.offsets.popper);
- data.offsets.reference = getClientRect(data.offsets.reference);
-
- data = fn(data, modifier);
- }
- });
-
- return data;
- }
-
- /**
- * Updates the position of the popper, computing the new offsets and applying
- * the new style.<br />
- * Prefer `scheduleUpdate` over `update` because of performance reasons.
- * @method
- * @memberof Popper
- */
- function update() {
- // if popper is destroyed, don't perform any further update
- if (this.state.isDestroyed) {
- return;
- }
-
- var data = {
- instance: this,
- styles: {},
- arrowStyles: {},
- attributes: {},
- flipped: false,
- offsets: {}
- };
-
- // compute reference element offsets
- data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
-
- // compute auto placement, store placement inside the data object,
- // modifiers will be able to edit `placement` if needed
- // and refer to originalPlacement to know the original value
- data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
-
- // store the computed placement inside `originalPlacement`
- data.originalPlacement = data.placement;
-
- data.positionFixed = this.options.positionFixed;
-
- // compute the popper offsets
- data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
-
- data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
-
- // run the modifiers
- data = runModifiers(this.modifiers, data);
-
- // the first `update` will call `onCreate` callback
- // the other ones will call `onUpdate` callback
- if (!this.state.isCreated) {
- this.state.isCreated = true;
- this.options.onCreate(data);
- } else {
- this.options.onUpdate(data);
- }
- }
-
- /**
- * Helper used to know if the given modifier is enabled.
- * @method
- * @memberof Popper.Utils
- * @returns {Boolean}
- */
- function isModifierEnabled(modifiers, modifierName) {
- return modifiers.some(function (_ref) {
- var name = _ref.name,
- enabled = _ref.enabled;
- return enabled && name === modifierName;
- });
- }
-
- /**
- * Get the prefixed supported property name
- * @method
- * @memberof Popper.Utils
- * @argument {String} property (camelCase)
- * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
- */
- function getSupportedPropertyName(property) {
- var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
- var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
-
- for (var i = 0; i < prefixes.length; i++) {
- var prefix = prefixes[i];
- var toCheck = prefix ? '' + prefix + upperProp : property;
- if (typeof document.body.style[toCheck] !== 'undefined') {
- return toCheck;
- }
- }
- return null;
- }
-
- /**
- * Destroys the popper.
- * @method
- * @memberof Popper
- */
- function destroy() {
- this.state.isDestroyed = true;
-
- // touch DOM only if `applyStyle` modifier is enabled
- if (isModifierEnabled(this.modifiers, 'applyStyle')) {
- this.popper.removeAttribute('x-placement');
- this.popper.style.position = '';
- this.popper.style.top = '';
- this.popper.style.left = '';
- this.popper.style.right = '';
- this.popper.style.bottom = '';
- this.popper.style.willChange = '';
- this.popper.style[getSupportedPropertyName('transform')] = '';
- }
-
- this.disableEventListeners();
-
- // remove the popper if user explicitly asked for the deletion on destroy
- // do not use `remove` because IE11 doesn't support it
- if (this.options.removeOnDestroy) {
- this.popper.parentNode.removeChild(this.popper);
- }
- return this;
- }
-
- /**
- * Get the window associated with the element
- * @argument {Element} element
- * @returns {Window}
- */
- function getWindow(element) {
- var ownerDocument = element.ownerDocument;
- return ownerDocument ? ownerDocument.defaultView : window;
- }
-
- function attachToScrollParents(scrollParent, event, callback, scrollParents) {
- var isBody = scrollParent.nodeName === 'BODY';
- var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
- target.addEventListener(event, callback, { passive: true });
-
- if (!isBody) {
- attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
- }
- scrollParents.push(target);
- }
-
- /**
- * Setup needed event listeners used to update the popper position
- * @method
- * @memberof Popper.Utils
- * @private
- */
- function setupEventListeners(reference, options, state, updateBound) {
- // Resize event listener on window
- state.updateBound = updateBound;
- getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
-
- // Scroll event listener on scroll parents
- var scrollElement = getScrollParent(reference);
- attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
- state.scrollElement = scrollElement;
- state.eventsEnabled = true;
-
- return state;
- }
-
- /**
- * It will add resize/scroll events and start recalculating
- * position of the popper element when they are triggered.
- * @method
- * @memberof Popper
- */
- function enableEventListeners() {
- if (!this.state.eventsEnabled) {
- this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
- }
- }
-
- /**
- * Remove event listeners used to update the popper position
- * @method
- * @memberof Popper.Utils
- * @private
- */
- function removeEventListeners(reference, state) {
- // Remove resize event listener on window
- getWindow(reference).removeEventListener('resize', state.updateBound);
-
- // Remove scroll event listener on scroll parents
- state.scrollParents.forEach(function (target) {
- target.removeEventListener('scroll', state.updateBound);
- });
-
- // Reset state
- state.updateBound = null;
- state.scrollParents = [];
- state.scrollElement = null;
- state.eventsEnabled = false;
- return state;
- }
-
- /**
- * It will remove resize/scroll events and won't recalculate popper position
- * when they are triggered. It also won't trigger `onUpdate` callback anymore,
- * unless you call `update` method manually.
- * @method
- * @memberof Popper
- */
- function disableEventListeners() {
- if (this.state.eventsEnabled) {
- cancelAnimationFrame(this.scheduleUpdate);
- this.state = removeEventListeners(this.reference, this.state);
- }
- }
-
- /**
- * Tells if a given input is a number
- * @method
- * @memberof Popper.Utils
- * @param {*} input to check
- * @return {Boolean}
- */
- function isNumeric(n) {
- return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
- }
-
- /**
- * Set the style to the given popper
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element - Element to apply the style to
- * @argument {Object} styles
- * Object with a list of properties and values which will be applied to the element
- */
- function setStyles(element, styles) {
- Object.keys(styles).forEach(function (prop) {
- var unit = '';
- // add unit if the value is numeric and is one of the following
- if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
- unit = 'px';
- }
- element.style[prop] = styles[prop] + unit;
- });
- }
-
- /**
- * Set the attributes to the given popper
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element - Element to apply the attributes to
- * @argument {Object} styles
- * Object with a list of properties and values which will be applied to the element
- */
- function setAttributes(element, attributes) {
- Object.keys(attributes).forEach(function (prop) {
- var value = attributes[prop];
- if (value !== false) {
- element.setAttribute(prop, attributes[prop]);
- } else {
- element.removeAttribute(prop);
- }
- });
- }
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} data.styles - List of style properties - values to apply to popper element
- * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The same data object
- */
- function applyStyle(data) {
- // any property present in `data.styles` will be applied to the popper,
- // in this way we can make the 3rd party modifiers add custom styles to it
- // Be aware, modifiers could override the properties defined in the previous
- // lines of this modifier!
- setStyles(data.instance.popper, data.styles);
-
- // any property present in `data.attributes` will be applied to the popper,
- // they will be set as HTML attributes of the element
- setAttributes(data.instance.popper, data.attributes);
-
- // if arrowElement is defined and arrowStyles has some properties
- if (data.arrowElement && Object.keys(data.arrowStyles).length) {
- setStyles(data.arrowElement, data.arrowStyles);
- }
-
- return data;
- }
-
- /**
- * Set the x-placement attribute before everything else because it could be used
- * to add margins to the popper margins needs to be calculated to get the
- * correct popper offsets.
- * @method
- * @memberof Popper.modifiers
- * @param {HTMLElement} reference - The reference element used to position the popper
- * @param {HTMLElement} popper - The HTML element used as popper
- * @param {Object} options - Popper.js options
- */
- function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
- // compute reference element offsets
- var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
-
- // compute auto placement, store placement inside the data object,
- // modifiers will be able to edit `placement` if needed
- // and refer to originalPlacement to know the original value
- var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
-
- popper.setAttribute('x-placement', placement);
-
- // Apply `position` to popper before anything else because
- // without the position applied we can't guarantee correct computations
- setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
-
- return options;
- }
-
- /**
- * @function
- * @memberof Popper.Utils
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Boolean} shouldRound - If the offsets should be rounded at all
- * @returns {Object} The popper's position offsets rounded
- *
- * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
- * good as it can be within reason.
- * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
- *
- * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
- * as well on High DPI screens).
- *
- * Firefox prefers no rounding for positioning and does not have blurriness on
- * high DPI screens.
- *
- * Only horizontal placement and left/right values need to be considered.
- */
- function getRoundedOffsets(data, shouldRound) {
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
- var round = Math.round,
- floor = Math.floor;
-
- var noRound = function noRound(v) {
- return v;
- };
-
- var referenceWidth = round(reference.width);
- var popperWidth = round(popper.width);
-
- var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
- var isVariation = data.placement.indexOf('-') !== -1;
- var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
- var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
-
- var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
- var verticalToInteger = !shouldRound ? noRound : round;
-
- return {
- left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
- top: verticalToInteger(popper.top),
- bottom: verticalToInteger(popper.bottom),
- right: horizontalToInteger(popper.right)
- };
- }
-
- var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function computeStyle(data, options) {
- var x = options.x,
- y = options.y;
- var popper = data.offsets.popper;
-
- // Remove this legacy support in Popper.js v2
-
- var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
- return modifier.name === 'applyStyle';
- }).gpuAcceleration;
- if (legacyGpuAccelerationOption !== undefined) {
- console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
- }
- var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
-
- var offsetParent = getOffsetParent(data.instance.popper);
- var offsetParentRect = getBoundingClientRect(offsetParent);
-
- // Styles
- var styles = {
- position: popper.position
- };
-
- var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
-
- var sideA = x === 'bottom' ? 'top' : 'bottom';
- var sideB = y === 'right' ? 'left' : 'right';
-
- // if gpuAcceleration is set to `true` and transform is supported,
- // we use `translate3d` to apply the position to the popper we
- // automatically use the supported prefixed version if needed
- var prefixedProperty = getSupportedPropertyName('transform');
-
- // now, let's make a step back and look at this code closely (wtf?)
- // If the content of the popper grows once it's been positioned, it
- // may happen that the popper gets misplaced because of the new content
- // overflowing its reference element
- // To avoid this problem, we provide two options (x and y), which allow
- // the consumer to define the offset origin.
- // If we position a popper on top of a reference element, we can set
- // `x` to `top` to make the popper grow towards its top instead of
- // its bottom.
- var left = void 0,
- top = void 0;
- if (sideA === 'bottom') {
- // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
- // and not the bottom of the html element
- if (offsetParent.nodeName === 'HTML') {
- top = -offsetParent.clientHeight + offsets.bottom;
- } else {
- top = -offsetParentRect.height + offsets.bottom;
- }
- } else {
- top = offsets.top;
- }
- if (sideB === 'right') {
- if (offsetParent.nodeName === 'HTML') {
- left = -offsetParent.clientWidth + offsets.right;
- } else {
- left = -offsetParentRect.width + offsets.right;
- }
- } else {
- left = offsets.left;
- }
- if (gpuAcceleration && prefixedProperty) {
- styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
- styles[sideA] = 0;
- styles[sideB] = 0;
- styles.willChange = 'transform';
- } else {
- // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
- var invertTop = sideA === 'bottom' ? -1 : 1;
- var invertLeft = sideB === 'right' ? -1 : 1;
- styles[sideA] = top * invertTop;
- styles[sideB] = left * invertLeft;
- styles.willChange = sideA + ', ' + sideB;
- }
-
- // Attributes
- var attributes = {
- 'x-placement': data.placement
- };
-
- // Update `data` attributes, styles and arrowStyles
- data.attributes = _extends$1({}, attributes, data.attributes);
- data.styles = _extends$1({}, styles, data.styles);
- data.arrowStyles = _extends$1({}, data.offsets.arrow, data.arrowStyles);
-
- return data;
- }
-
- /**
- * Helper used to know if the given modifier depends from another one.<br />
- * It checks if the needed modifier is listed and enabled.
- * @method
- * @memberof Popper.Utils
- * @param {Array} modifiers - list of modifiers
- * @param {String} requestingName - name of requesting modifier
- * @param {String} requestedName - name of requested modifier
- * @returns {Boolean}
- */
- function isModifierRequired(modifiers, requestingName, requestedName) {
- var requesting = find(modifiers, function (_ref) {
- var name = _ref.name;
- return name === requestingName;
- });
-
- var isRequired = !!requesting && modifiers.some(function (modifier) {
- return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
- });
-
- if (!isRequired) {
- var _requesting = '`' + requestingName + '`';
- var requested = '`' + requestedName + '`';
- console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
- }
- return isRequired;
- }
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function arrow(data, options) {
- var _data$offsets$arrow;
-
- // arrow depends on keepTogether in order to work
- if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
- return data;
- }
-
- var arrowElement = options.element;
-
- // if arrowElement is a string, suppose it's a CSS selector
- if (typeof arrowElement === 'string') {
- arrowElement = data.instance.popper.querySelector(arrowElement);
-
- // if arrowElement is not found, don't run the modifier
- if (!arrowElement) {
- return data;
- }
- } else {
- // if the arrowElement isn't a query selector we must check that the
- // provided DOM node is child of its popper node
- if (!data.instance.popper.contains(arrowElement)) {
- console.warn('WARNING: `arrow.element` must be child of its popper element!');
- return data;
- }
- }
-
- var placement = data.placement.split('-')[0];
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
-
- var isVertical = ['left', 'right'].indexOf(placement) !== -1;
-
- var len = isVertical ? 'height' : 'width';
- var sideCapitalized = isVertical ? 'Top' : 'Left';
- var side = sideCapitalized.toLowerCase();
- var altSide = isVertical ? 'left' : 'top';
- var opSide = isVertical ? 'bottom' : 'right';
- var arrowElementSize = getOuterSizes(arrowElement)[len];
-
- //
- // extends keepTogether behavior making sure the popper and its
- // reference have enough pixels in conjunction
- //
-
- // top/left side
- if (reference[opSide] - arrowElementSize < popper[side]) {
- data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
- }
- // bottom/right side
- if (reference[side] + arrowElementSize > popper[opSide]) {
- data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
- }
- data.offsets.popper = getClientRect(data.offsets.popper);
-
- // compute center of the popper
- var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
-
- // Compute the sideValue using the updated popper offsets
- // take popper margin in account because we don't have this info available
- var css = getStyleComputedProperty(data.instance.popper);
- var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
- var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
- var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
-
- // prevent arrowElement from being placed not contiguously to its popper
- sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
-
- data.arrowElement = arrowElement;
- data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
-
- return data;
- }
-
- /**
- * Get the opposite placement variation of the given one
- * @method
- * @memberof Popper.Utils
- * @argument {String} placement variation
- * @returns {String} flipped placement variation
- */
- function getOppositeVariation(variation) {
- if (variation === 'end') {
- return 'start';
- } else if (variation === 'start') {
- return 'end';
- }
- return variation;
- }
-
- /**
- * List of accepted placements to use as values of the `placement` option.<br />
- * Valid placements are:
- * - `auto`
- * - `top`
- * - `right`
- * - `bottom`
- * - `left`
- *
- * Each placement can have a variation from this list:
- * - `-start`
- * - `-end`
- *
- * Variations are interpreted easily if you think of them as the left to right
- * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
- * is right.<br />
- * Vertically (`left` and `right`), `start` is top and `end` is bottom.
- *
- * Some valid examples are:
- * - `top-end` (on top of reference, right aligned)
- * - `right-start` (on right of reference, top aligned)
- * - `bottom` (on bottom, centered)
- * - `auto-end` (on the side with more space available, alignment depends by placement)
- *
- * @static
- * @type {Array}
- * @enum {String}
- * @readonly
- * @method placements
- * @memberof Popper
- */
- var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
-
- // Get rid of `auto` `auto-start` and `auto-end`
- var validPlacements = placements.slice(3);
-
- /**
- * Given an initial placement, returns all the subsequent placements
- * clockwise (or counter-clockwise).
- *
- * @method
- * @memberof Popper.Utils
- * @argument {String} placement - A valid placement (it accepts variations)
- * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
- * @returns {Array} placements including their variations
- */
- function clockwise(placement) {
- var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- var index = validPlacements.indexOf(placement);
- var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
- return counter ? arr.reverse() : arr;
- }
-
- var BEHAVIORS = {
- FLIP: 'flip',
- CLOCKWISE: 'clockwise',
- COUNTERCLOCKWISE: 'counterclockwise'
- };
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function flip(data, options) {
- // if `inner` modifier is enabled, we can't use the `flip` modifier
- if (isModifierEnabled(data.instance.modifiers, 'inner')) {
- return data;
- }
-
- if (data.flipped && data.placement === data.originalPlacement) {
- // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
- return data;
- }
-
- var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
-
- var placement = data.placement.split('-')[0];
- var placementOpposite = getOppositePlacement(placement);
- var variation = data.placement.split('-')[1] || '';
-
- var flipOrder = [];
-
- switch (options.behavior) {
- case BEHAVIORS.FLIP:
- flipOrder = [placement, placementOpposite];
- break;
- case BEHAVIORS.CLOCKWISE:
- flipOrder = clockwise(placement);
- break;
- case BEHAVIORS.COUNTERCLOCKWISE:
- flipOrder = clockwise(placement, true);
- break;
- default:
- flipOrder = options.behavior;
- }
-
- flipOrder.forEach(function (step, index) {
- if (placement !== step || flipOrder.length === index + 1) {
- return data;
- }
-
- placement = data.placement.split('-')[0];
- placementOpposite = getOppositePlacement(placement);
-
- var popperOffsets = data.offsets.popper;
- var refOffsets = data.offsets.reference;
-
- // using floor because the reference offsets may contain decimals we are not going to consider here
- var floor = Math.floor;
- var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
-
- var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
- var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
- var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
- var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
-
- var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
-
- // flip the variation if required
- var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
-
- // flips variation if reference element overflows boundaries
- var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
-
- // flips variation if popper content overflows boundaries
- var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
-
- var flippedVariation = flippedVariationByRef || flippedVariationByContent;
-
- if (overlapsRef || overflowsBoundaries || flippedVariation) {
- // this boolean to detect any flip loop
- data.flipped = true;
-
- if (overlapsRef || overflowsBoundaries) {
- placement = flipOrder[index + 1];
- }
-
- if (flippedVariation) {
- variation = getOppositeVariation(variation);
- }
-
- data.placement = placement + (variation ? '-' + variation : '');
-
- // this object contains `position`, we want to preserve it along with
- // any additional property we may add in the future
- data.offsets.popper = _extends$1({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
-
- data = runModifiers(data.instance.modifiers, data, 'flip');
- }
- });
- return data;
- }
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function keepTogether(data) {
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
-
- var placement = data.placement.split('-')[0];
- var floor = Math.floor;
- var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
- var side = isVertical ? 'right' : 'bottom';
- var opSide = isVertical ? 'left' : 'top';
- var measurement = isVertical ? 'width' : 'height';
-
- if (popper[side] < floor(reference[opSide])) {
- data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
- }
- if (popper[opSide] > floor(reference[side])) {
- data.offsets.popper[opSide] = floor(reference[side]);
- }
-
- return data;
- }
-
- /**
- * Converts a string containing value + unit into a px value number
- * @function
- * @memberof {modifiers~offset}
- * @private
- * @argument {String} str - Value + unit string
- * @argument {String} measurement - `height` or `width`
- * @argument {Object} popperOffsets
- * @argument {Object} referenceOffsets
- * @returns {Number|String}
- * Value in pixels, or original string if no values were extracted
- */
- function toValue(str, measurement, popperOffsets, referenceOffsets) {
- // separate value from unit
- var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
- var value = +split[1];
- var unit = split[2];
-
- // If it's not a number it's an operator, I guess
- if (!value) {
- return str;
- }
-
- if (unit.indexOf('%') === 0) {
- var element = void 0;
- switch (unit) {
- case '%p':
- element = popperOffsets;
- break;
- case '%':
- case '%r':
- default:
- element = referenceOffsets;
- }
-
- var rect = getClientRect(element);
- return rect[measurement] / 100 * value;
- } else if (unit === 'vh' || unit === 'vw') {
- // if is a vh or vw, we calculate the size based on the viewport
- var size = void 0;
- if (unit === 'vh') {
- size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
- } else {
- size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
- }
- return size / 100 * value;
- } else {
- // if is an explicit pixel unit, we get rid of the unit and keep the value
- // if is an implicit unit, it's px, and we return just the value
- return value;
- }
- }
-
- /**
- * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
- * @function
- * @memberof {modifiers~offset}
- * @private
- * @argument {String} offset
- * @argument {Object} popperOffsets
- * @argument {Object} referenceOffsets
- * @argument {String} basePlacement
- * @returns {Array} a two cells array with x and y offsets in numbers
- */
- function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
- var offsets = [0, 0];
-
- // Use height if placement is left or right and index is 0 otherwise use width
- // in this way the first offset will use an axis and the second one
- // will use the other one
- var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
-
- // Split the offset string to obtain a list of values and operands
- // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
- var fragments = offset.split(/(\+|\-)/).map(function (frag) {
- return frag.trim();
- });
-
- // Detect if the offset string contains a pair of values or a single one
- // they could be separated by comma or space
- var divider = fragments.indexOf(find(fragments, function (frag) {
- return frag.search(/,|\s/) !== -1;
- }));
-
- if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
- console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
- }
-
- // If divider is found, we divide the list of values and operands to divide
- // them by ofset X and Y.
- var splitRegex = /\s*,\s*|\s+/;
- var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
-
- // Convert the values with units to absolute pixels to allow our computations
- ops = ops.map(function (op, index) {
- // Most of the units rely on the orientation of the popper
- var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
- var mergeWithPrevious = false;
- return op
- // This aggregates any `+` or `-` sign that aren't considered operators
- // e.g.: 10 + +5 => [10, +, +5]
- .reduce(function (a, b) {
- if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
- a[a.length - 1] = b;
- mergeWithPrevious = true;
- return a;
- } else if (mergeWithPrevious) {
- a[a.length - 1] += b;
- mergeWithPrevious = false;
- return a;
- } else {
- return a.concat(b);
- }
- }, [])
- // Here we convert the string values into number values (in px)
- .map(function (str) {
- return toValue(str, measurement, popperOffsets, referenceOffsets);
- });
- });
-
- // Loop trough the offsets arrays and execute the operations
- ops.forEach(function (op, index) {
- op.forEach(function (frag, index2) {
- if (isNumeric(frag)) {
- offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
- }
- });
- });
- return offsets;
- }
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @argument {Number|String} options.offset=0
- * The offset value as described in the modifier description
- * @returns {Object} The data object, properly modified
- */
- function offset(data, _ref) {
- var offset = _ref.offset;
- var placement = data.placement,
- _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
-
- var basePlacement = placement.split('-')[0];
-
- var offsets = void 0;
- if (isNumeric(+offset)) {
- offsets = [+offset, 0];
- } else {
- offsets = parseOffset(offset, popper, reference, basePlacement);
- }
-
- if (basePlacement === 'left') {
- popper.top += offsets[0];
- popper.left -= offsets[1];
- } else if (basePlacement === 'right') {
- popper.top += offsets[0];
- popper.left += offsets[1];
- } else if (basePlacement === 'top') {
- popper.left += offsets[0];
- popper.top -= offsets[1];
- } else if (basePlacement === 'bottom') {
- popper.left += offsets[0];
- popper.top += offsets[1];
- }
-
- data.popper = popper;
- return data;
- }
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function preventOverflow(data, options) {
- var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
-
- // If offsetParent is the reference element, we really want to
- // go one step up and use the next offsetParent as reference to
- // avoid to make this modifier completely useless and look like broken
- if (data.instance.reference === boundariesElement) {
- boundariesElement = getOffsetParent(boundariesElement);
- }
-
- // NOTE: DOM access here
- // resets the popper's position so that the document size can be calculated excluding
- // the size of the popper element itself
- var transformProp = getSupportedPropertyName('transform');
- var popperStyles = data.instance.popper.style; // assignment to help minification
- var top = popperStyles.top,
- left = popperStyles.left,
- transform = popperStyles[transformProp];
-
- popperStyles.top = '';
- popperStyles.left = '';
- popperStyles[transformProp] = '';
-
- var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
-
- // NOTE: DOM access here
- // restores the original style properties after the offsets have been computed
- popperStyles.top = top;
- popperStyles.left = left;
- popperStyles[transformProp] = transform;
-
- options.boundaries = boundaries;
-
- var order = options.priority;
- var popper = data.offsets.popper;
-
- var check = {
- primary: function primary(placement) {
- var value = popper[placement];
- if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
- value = Math.max(popper[placement], boundaries[placement]);
- }
- return defineProperty({}, placement, value);
- },
- secondary: function secondary(placement) {
- var mainSide = placement === 'right' ? 'left' : 'top';
- var value = popper[mainSide];
- if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
- value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
- }
- return defineProperty({}, mainSide, value);
- }
- };
-
- order.forEach(function (placement) {
- var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
- popper = _extends$1({}, popper, check[side](placement));
- });
-
- data.offsets.popper = popper;
-
- return data;
- }
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function shift(data) {
- var placement = data.placement;
- var basePlacement = placement.split('-')[0];
- var shiftvariation = placement.split('-')[1];
-
- // if shift shiftvariation is specified, run the modifier
- if (shiftvariation) {
- var _data$offsets = data.offsets,
- reference = _data$offsets.reference,
- popper = _data$offsets.popper;
-
- var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
- var side = isVertical ? 'left' : 'top';
- var measurement = isVertical ? 'width' : 'height';
-
- var shiftOffsets = {
- start: defineProperty({}, side, reference[side]),
- end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
- };
-
- data.offsets.popper = _extends$1({}, popper, shiftOffsets[shiftvariation]);
- }
-
- return data;
- }
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function hide(data) {
- if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
- return data;
- }
-
- var refRect = data.offsets.reference;
- var bound = find(data.instance.modifiers, function (modifier) {
- return modifier.name === 'preventOverflow';
- }).boundaries;
-
- if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
- // Avoid unnecessary DOM access if visibility hasn't changed
- if (data.hide === true) {
- return data;
- }
-
- data.hide = true;
- data.attributes['x-out-of-boundaries'] = '';
- } else {
- // Avoid unnecessary DOM access if visibility hasn't changed
- if (data.hide === false) {
- return data;
- }
-
- data.hide = false;
- data.attributes['x-out-of-boundaries'] = false;
- }
-
- return data;
- }
-
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function inner(data) {
- var placement = data.placement;
- var basePlacement = placement.split('-')[0];
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
-
- var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
-
- var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
-
- popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
-
- data.placement = getOppositePlacement(placement);
- data.offsets.popper = getClientRect(popper);
-
- return data;
- }
-
- /**
- * Modifier function, each modifier can have a function of this type assigned
- * to its `fn` property.<br />
- * These functions will be called on each update, this means that you must
- * make sure they are performant enough to avoid performance bottlenecks.
- *
- * @function ModifierFn
- * @argument {dataObject} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {dataObject} The data object, properly modified
- */
-
- /**
- * Modifiers are plugins used to alter the behavior of your poppers.<br />
- * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
- * needed by the library.
- *
- * Usually you don't want to override the `order`, `fn` and `onLoad` props.
- * All the other properties are configurations that could be tweaked.
- * @namespace modifiers
- */
- var modifiers = {
- /**
- * Modifier used to shift the popper on the start or end of its reference
- * element.<br />
- * It will read the variation of the `placement` property.<br />
- * It can be one either `-end` or `-start`.
- * @memberof modifiers
- * @inner
- */
- shift: {
- /** @prop {number} order=100 - Index used to define the order of execution */
- order: 100,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: shift
- },
-
- /**
- * The `offset` modifier can shift your popper on both its axis.
- *
- * It accepts the following units:
- * - `px` or unit-less, interpreted as pixels
- * - `%` or `%r`, percentage relative to the length of the reference element
- * - `%p`, percentage relative to the length of the popper element
- * - `vw`, CSS viewport width unit
- * - `vh`, CSS viewport height unit
- *
- * For length is intended the main axis relative to the placement of the popper.<br />
- * This means that if the placement is `top` or `bottom`, the length will be the
- * `width`. In case of `left` or `right`, it will be the `height`.
- *
- * You can provide a single value (as `Number` or `String`), or a pair of values
- * as `String` divided by a comma or one (or more) white spaces.<br />
- * The latter is a deprecated method because it leads to confusion and will be
- * removed in v2.<br />
- * Additionally, it accepts additions and subtractions between different units.
- * Note that multiplications and divisions aren't supported.
- *
- * Valid examples are:
- * ```
- * 10
- * '10%'
- * '10, 10'
- * '10%, 10'
- * '10 + 10%'
- * '10 - 5vh + 3%'
- * '-10px + 5vh, 5px - 6%'
- * ```
- * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
- * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
- * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
- *
- * @memberof modifiers
- * @inner
- */
- offset: {
- /** @prop {number} order=200 - Index used to define the order of execution */
- order: 200,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: offset,
- /** @prop {Number|String} offset=0
- * The offset value as described in the modifier description
- */
- offset: 0
- },
-
- /**
- * Modifier used to prevent the popper from being positioned outside the boundary.
- *
- * A scenario exists where the reference itself is not within the boundaries.<br />
- * We can say it has "escaped the boundaries" — or just "escaped".<br />
- * In this case we need to decide whether the popper should either:
- *
- * - detach from the reference and remain "trapped" in the boundaries, or
- * - if it should ignore the boundary and "escape with its reference"
- *
- * When `escapeWithReference` is set to`true` and reference is completely
- * outside its boundaries, the popper will overflow (or completely leave)
- * the boundaries in order to remain attached to the edge of the reference.
- *
- * @memberof modifiers
- * @inner
- */
- preventOverflow: {
- /** @prop {number} order=300 - Index used to define the order of execution */
- order: 300,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: preventOverflow,
- /**
- * @prop {Array} [priority=['left','right','top','bottom']]
- * Popper will try to prevent overflow following these priorities by default,
- * then, it could overflow on the left and on top of the `boundariesElement`
- */
- priority: ['left', 'right', 'top', 'bottom'],
- /**
- * @prop {number} padding=5
- * Amount of pixel used to define a minimum distance between the boundaries
- * and the popper. This makes sure the popper always has a little padding
- * between the edges of its container
- */
- padding: 5,
- /**
- * @prop {String|HTMLElement} boundariesElement='scrollParent'
- * Boundaries used by the modifier. Can be `scrollParent`, `window`,
- * `viewport` or any DOM element.
- */
- boundariesElement: 'scrollParent'
- },
-
- /**
- * Modifier used to make sure the reference and its popper stay near each other
- * without leaving any gap between the two. Especially useful when the arrow is
- * enabled and you want to ensure that it points to its reference element.
- * It cares only about the first axis. You can still have poppers with margin
- * between the popper and its reference element.
- * @memberof modifiers
- * @inner
- */
- keepTogether: {
- /** @prop {number} order=400 - Index used to define the order of execution */
- order: 400,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: keepTogether
- },
-
- /**
- * This modifier is used to move the `arrowElement` of the popper to make
- * sure it is positioned between the reference element and its popper element.
- * It will read the outer size of the `arrowElement` node to detect how many
- * pixels of conjunction are needed.
- *
- * It has no effect if no `arrowElement` is provided.
- * @memberof modifiers
- * @inner
- */
- arrow: {
- /** @prop {number} order=500 - Index used to define the order of execution */
- order: 500,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: arrow,
- /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
- element: '[x-arrow]'
- },
-
- /**
- * Modifier used to flip the popper's placement when it starts to overlap its
- * reference element.
- *
- * Requires the `preventOverflow` modifier before it in order to work.
- *
- * **NOTE:** this modifier will interrupt the current update cycle and will
- * restart it if it detects the need to flip the placement.
- * @memberof modifiers
- * @inner
- */
- flip: {
- /** @prop {number} order=600 - Index used to define the order of execution */
- order: 600,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: flip,
- /**
- * @prop {String|Array} behavior='flip'
- * The behavior used to change the popper's placement. It can be one of
- * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
- * placements (with optional variations)
- */
- behavior: 'flip',
- /**
- * @prop {number} padding=5
- * The popper will flip if it hits the edges of the `boundariesElement`
- */
- padding: 5,
- /**
- * @prop {String|HTMLElement} boundariesElement='viewport'
- * The element which will define the boundaries of the popper position.
- * The popper will never be placed outside of the defined boundaries
- * (except if `keepTogether` is enabled)
- */
- boundariesElement: 'viewport',
- /**
- * @prop {Boolean} flipVariations=false
- * The popper will switch placement variation between `-start` and `-end` when
- * the reference element overlaps its boundaries.
- *
- * The original placement should have a set variation.
- */
- flipVariations: false,
- /**
- * @prop {Boolean} flipVariationsByContent=false
- * The popper will switch placement variation between `-start` and `-end` when
- * the popper element overlaps its reference boundaries.
- *
- * The original placement should have a set variation.
- */
- flipVariationsByContent: false
- },
-
- /**
- * Modifier used to make the popper flow toward the inner of the reference element.
- * By default, when this modifier is disabled, the popper will be placed outside
- * the reference element.
- * @memberof modifiers
- * @inner
- */
- inner: {
- /** @prop {number} order=700 - Index used to define the order of execution */
- order: 700,
- /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
- enabled: false,
- /** @prop {ModifierFn} */
- fn: inner
- },
-
- /**
- * Modifier used to hide the popper when its reference element is outside of the
- * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
- * be used to hide with a CSS selector the popper when its reference is
- * out of boundaries.
- *
- * Requires the `preventOverflow` modifier before it in order to work.
- * @memberof modifiers
- * @inner
- */
- hide: {
- /** @prop {number} order=800 - Index used to define the order of execution */
- order: 800,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: hide
- },
-
- /**
- * Computes the style that will be applied to the popper element to gets
- * properly positioned.
- *
- * Note that this modifier will not touch the DOM, it just prepares the styles
- * so that `applyStyle` modifier can apply it. This separation is useful
- * in case you need to replace `applyStyle` with a custom implementation.
- *
- * This modifier has `850` as `order` value to maintain backward compatibility
- * with previous versions of Popper.js. Expect the modifiers ordering method
- * to change in future major versions of the library.
- *
- * @memberof modifiers
- * @inner
- */
- computeStyle: {
- /** @prop {number} order=850 - Index used to define the order of execution */
- order: 850,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: computeStyle,
- /**
- * @prop {Boolean} gpuAcceleration=true
- * If true, it uses the CSS 3D transformation to position the popper.
- * Otherwise, it will use the `top` and `left` properties
- */
- gpuAcceleration: true,
- /**
- * @prop {string} [x='bottom']
- * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
- * Change this if your popper should grow in a direction different from `bottom`
- */
- x: 'bottom',
- /**
- * @prop {string} [x='left']
- * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
- * Change this if your popper should grow in a direction different from `right`
- */
- y: 'right'
- },
-
- /**
- * Applies the computed styles to the popper element.
- *
- * All the DOM manipulations are limited to this modifier. This is useful in case
- * you want to integrate Popper.js inside a framework or view library and you
- * want to delegate all the DOM manipulations to it.
- *
- * Note that if you disable this modifier, you must make sure the popper element
- * has its position set to `absolute` before Popper.js can do its work!
- *
- * Just disable this modifier and define your own to achieve the desired effect.
- *
- * @memberof modifiers
- * @inner
- */
- applyStyle: {
- /** @prop {number} order=900 - Index used to define the order of execution */
- order: 900,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: applyStyle,
- /** @prop {Function} */
- onLoad: applyStyleOnLoad,
- /**
- * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
- * @prop {Boolean} gpuAcceleration=true
- * If true, it uses the CSS 3D transformation to position the popper.
- * Otherwise, it will use the `top` and `left` properties
- */
- gpuAcceleration: undefined
- }
- };
-
- /**
- * The `dataObject` is an object containing all the information used by Popper.js.
- * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
- * @name dataObject
- * @property {Object} data.instance The Popper.js instance
- * @property {String} data.placement Placement applied to popper
- * @property {String} data.originalPlacement Placement originally defined on init
- * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
- * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
- * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
- * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
- * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
- * @property {Object} data.boundaries Offsets of the popper boundaries
- * @property {Object} data.offsets The measurements of popper, reference and arrow elements
- * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
- * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
- * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
- */
-
- /**
- * Default options provided to Popper.js constructor.<br />
- * These can be overridden using the `options` argument of Popper.js.<br />
- * To override an option, simply pass an object with the same
- * structure of the `options` object, as the 3rd argument. For example:
- * ```
- * new Popper(ref, pop, {
- * modifiers: {
- * preventOverflow: { enabled: false }
- * }
- * })
- * ```
- * @type {Object}
- * @static
- * @memberof Popper
- */
- var Defaults = {
- /**
- * Popper's placement.
- * @prop {Popper.placements} placement='bottom'
- */
- placement: 'bottom',
-
- /**
- * Set this to true if you want popper to position it self in 'fixed' mode
- * @prop {Boolean} positionFixed=false
- */
- positionFixed: false,
-
- /**
- * Whether events (resize, scroll) are initially enabled.
- * @prop {Boolean} eventsEnabled=true
- */
- eventsEnabled: true,
-
- /**
- * Set to true if you want to automatically remove the popper when
- * you call the `destroy` method.
- * @prop {Boolean} removeOnDestroy=false
- */
- removeOnDestroy: false,
-
- /**
- * Callback called when the popper is created.<br />
- * By default, it is set to no-op.<br />
- * Access Popper.js instance with `data.instance`.
- * @prop {onCreate}
- */
- onCreate: function onCreate() {},
-
- /**
- * Callback called when the popper is updated. This callback is not called
- * on the initialization/creation of the popper, but only on subsequent
- * updates.<br />
- * By default, it is set to no-op.<br />
- * Access Popper.js instance with `data.instance`.
- * @prop {onUpdate}
- */
- onUpdate: function onUpdate() {},
-
- /**
- * List of modifiers used to modify the offsets before they are applied to the popper.
- * They provide most of the functionalities of Popper.js.
- * @prop {modifiers}
- */
- modifiers: modifiers
- };
-
- /**
- * @callback onCreate
- * @param {dataObject} data
- */
-
- /**
- * @callback onUpdate
- * @param {dataObject} data
- */
-
- // Utils
- // Methods
- var Popper = function () {
- /**
- * Creates a new Popper.js instance.
- * @class Popper
- * @param {Element|referenceObject} reference - The reference element used to position the popper
- * @param {Element} popper - The HTML / XML element used as the popper
- * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
- * @return {Object} instance - The generated Popper.js instance
- */
- function Popper(reference, popper) {
- var _this = this;
-
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- classCallCheck(this, Popper);
-
- this.scheduleUpdate = function () {
- return requestAnimationFrame(_this.update);
- };
-
- // make update() debounced, so that it only runs at most once-per-tick
- this.update = debounce(this.update.bind(this));
-
- // with {} we create a new object with the options inside it
- this.options = _extends$1({}, Popper.Defaults, options);
-
- // init state
- this.state = {
- isDestroyed: false,
- isCreated: false,
- scrollParents: []
- };
-
- // get reference and popper elements (allow jQuery wrappers)
- this.reference = reference && reference.jquery ? reference[0] : reference;
- this.popper = popper && popper.jquery ? popper[0] : popper;
-
- // Deep merge modifiers options
- this.options.modifiers = {};
- Object.keys(_extends$1({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
- _this.options.modifiers[name] = _extends$1({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
- });
-
- // Refactoring modifiers' list (Object => Array)
- this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
- return _extends$1({
- name: name
- }, _this.options.modifiers[name]);
- })
- // sort the modifiers by order
- .sort(function (a, b) {
- return a.order - b.order;
- });
-
- // modifiers have the ability to execute arbitrary code when Popper.js get inited
- // such code is executed in the same order of its modifier
- // they could add new properties to their options configuration
- // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
- this.modifiers.forEach(function (modifierOptions) {
- if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
- modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
- }
- });
-
- // fire the first update to position the popper in the right place
- this.update();
-
- var eventsEnabled = this.options.eventsEnabled;
- if (eventsEnabled) {
- // setup event listeners, they will take care of update the position in specific situations
- this.enableEventListeners();
- }
-
- this.state.eventsEnabled = eventsEnabled;
- }
-
- // We can't use class properties because they don't get listed in the
- // class prototype and break stuff like Sinon stubs
-
-
- createClass(Popper, [{
- key: 'update',
- value: function update$$1() {
- return update.call(this);
- }
- }, {
- key: 'destroy',
- value: function destroy$$1() {
- return destroy.call(this);
- }
- }, {
- key: 'enableEventListeners',
- value: function enableEventListeners$$1() {
- return enableEventListeners.call(this);
- }
- }, {
- key: 'disableEventListeners',
- value: function disableEventListeners$$1() {
- return disableEventListeners.call(this);
- }
-
- /**
- * Schedules an update. It will run on the next UI update available.
- * @method scheduleUpdate
- * @memberof Popper
- */
-
-
- /**
- * Collection of utilities useful when writing custom modifiers.
- * Starting from version 1.7, this method is available only if you
- * include `popper-utils.js` before `popper.js`.
- *
- * **DEPRECATION**: This way to access PopperUtils is deprecated
- * and will be removed in v2! Use the PopperUtils module directly instead.
- * Due to the high instability of the methods contained in Utils, we can't
- * guarantee them to follow semver. Use them at your own risk!
- * @static
- * @private
- * @type {Object}
- * @deprecated since version 1.8
- * @member Utils
- * @memberof Popper
- */
-
- }]);
- return Popper;
- }();
-
- /**
- * The `referenceObject` is an object that provides an interface compatible with Popper.js
- * and lets you use it as replacement of a real DOM node.<br />
- * You can use this method to position a popper relatively to a set of coordinates
- * in case you don't have a DOM node to use as reference.
- *
- * ```
- * new Popper(referenceObject, popperNode);
- * ```
- *
- * NB: This feature isn't supported in Internet Explorer 10.
- * @name referenceObject
- * @property {Function} data.getBoundingClientRect
- * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
- * @property {number} data.clientWidth
- * An ES6 getter that will return the width of the virtual reference element.
- * @property {number} data.clientHeight
- * An ES6 getter that will return the height of the virtual reference element.
- */
-
-
- Popper.Utils = (typeof window !== 'undefined' ? window : commonjsGlobal).PopperUtils;
- Popper.placements = placements;
- Popper.Defaults = Defaults;
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$4 = 'dropdown';
- var VERSION$4 = '4.6.0';
- var DATA_KEY$4 = 'bs.dropdown';
- var EVENT_KEY$4 = "." + DATA_KEY$4;
- var DATA_API_KEY$4 = '.data-api';
- var JQUERY_NO_CONFLICT$4 = $__default['default'].fn[NAME$4];
- var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
-
- var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
-
- var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
-
- var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
-
- var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
-
- var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
-
- var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
- var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
- var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
- var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
- var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
- var EVENT_CLICK = "click" + EVENT_KEY$4;
- var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
- var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
- var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
- var CLASS_NAME_DISABLED = 'disabled';
- var CLASS_NAME_SHOW$2 = 'show';
- var CLASS_NAME_DROPUP = 'dropup';
- var CLASS_NAME_DROPRIGHT = 'dropright';
- var CLASS_NAME_DROPLEFT = 'dropleft';
- var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
- var CLASS_NAME_POSITION_STATIC = 'position-static';
- var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
- var SELECTOR_FORM_CHILD = '.dropdown form';
- var SELECTOR_MENU = '.dropdown-menu';
- var SELECTOR_NAVBAR_NAV = '.navbar-nav';
- var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
- var PLACEMENT_TOP = 'top-start';
- var PLACEMENT_TOPEND = 'top-end';
- var PLACEMENT_BOTTOM = 'bottom-start';
- var PLACEMENT_BOTTOMEND = 'bottom-end';
- var PLACEMENT_RIGHT = 'right-start';
- var PLACEMENT_LEFT = 'left-start';
- var Default$2 = {
- offset: 0,
- flip: true,
- boundary: 'scrollParent',
- reference: 'toggle',
- display: 'dynamic',
- popperConfig: null
- };
- var DefaultType$2 = {
- offset: '(number|string|function)',
- flip: 'boolean',
- boundary: '(string|element)',
- reference: '(string|element)',
- display: 'string',
- popperConfig: '(null|object)'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Dropdown = /*#__PURE__*/function () {
- function Dropdown(element, config) {
- this._element = element;
- this._popper = null;
- this._config = this._getConfig(config);
- this._menu = this._getMenuElement();
- this._inNavbar = this._detectNavbar();
-
- this._addEventListeners();
- } // Getters
-
-
- var _proto = Dropdown.prototype;
-
- // Public
- _proto.toggle = function toggle() {
- if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED)) {
- return;
- }
-
- var isActive = $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2);
-
- Dropdown._clearMenus();
-
- if (isActive) {
- return;
- }
-
- this.show(true);
- };
-
- _proto.show = function show(usePopper) {
- if (usePopper === void 0) {
- usePopper = false;
- }
-
- if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2)) {
- return;
- }
-
- var relatedTarget = {
- relatedTarget: this._element
- };
- var showEvent = $__default['default'].Event(EVENT_SHOW$1, relatedTarget);
-
- var parent = Dropdown._getParentFromElement(this._element);
-
- $__default['default'](parent).trigger(showEvent);
-
- if (showEvent.isDefaultPrevented()) {
- return;
- } // Totally disable Popper for Dropdowns in Navbar
-
-
- if (!this._inNavbar && usePopper) {
- /**
- * Check for Popper dependency
- * Popper - https://popper.js.org
- */
- if (typeof Popper === 'undefined') {
- throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
- }
-
- var referenceElement = this._element;
-
- if (this._config.reference === 'parent') {
- referenceElement = parent;
- } else if (Util.isElement(this._config.reference)) {
- referenceElement = this._config.reference; // Check if it's jQuery element
-
- if (typeof this._config.reference.jquery !== 'undefined') {
- referenceElement = this._config.reference[0];
- }
- } // If boundary is not `scrollParent`, then set position to `static`
- // to allow the menu to "escape" the scroll parent's boundaries
- // https://github.com/twbs/bootstrap/issues/24251
-
-
- if (this._config.boundary !== 'scrollParent') {
- $__default['default'](parent).addClass(CLASS_NAME_POSITION_STATIC);
- }
-
- this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
- } // If this is a touch-enabled device we add extra
- // empty mouseover listeners to the body's immediate children;
- // only needed because of broken event delegation on iOS
- // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
-
-
- if ('ontouchstart' in document.documentElement && $__default['default'](parent).closest(SELECTOR_NAVBAR_NAV).length === 0) {
- $__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop);
- }
-
- this._element.focus();
-
- this._element.setAttribute('aria-expanded', true);
-
- $__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW$2);
- $__default['default'](parent).toggleClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_SHOWN$1, relatedTarget));
- };
-
- _proto.hide = function hide() {
- if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || !$__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2)) {
- return;
- }
-
- var relatedTarget = {
- relatedTarget: this._element
- };
- var hideEvent = $__default['default'].Event(EVENT_HIDE$1, relatedTarget);
-
- var parent = Dropdown._getParentFromElement(this._element);
-
- $__default['default'](parent).trigger(hideEvent);
-
- if (hideEvent.isDefaultPrevented()) {
- return;
- }
-
- if (this._popper) {
- this._popper.destroy();
- }
-
- $__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW$2);
- $__default['default'](parent).toggleClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_HIDDEN$1, relatedTarget));
- };
-
- _proto.dispose = function dispose() {
- $__default['default'].removeData(this._element, DATA_KEY$4);
- $__default['default'](this._element).off(EVENT_KEY$4);
- this._element = null;
- this._menu = null;
-
- if (this._popper !== null) {
- this._popper.destroy();
-
- this._popper = null;
- }
- };
-
- _proto.update = function update() {
- this._inNavbar = this._detectNavbar();
-
- if (this._popper !== null) {
- this._popper.scheduleUpdate();
- }
- } // Private
- ;
-
- _proto._addEventListeners = function _addEventListeners() {
- var _this = this;
-
- $__default['default'](this._element).on(EVENT_CLICK, function (event) {
- event.preventDefault();
- event.stopPropagation();
-
- _this.toggle();
- });
- };
-
- _proto._getConfig = function _getConfig(config) {
- config = _extends({}, this.constructor.Default, $__default['default'](this._element).data(), config);
- Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
- return config;
- };
-
- _proto._getMenuElement = function _getMenuElement() {
- if (!this._menu) {
- var parent = Dropdown._getParentFromElement(this._element);
-
- if (parent) {
- this._menu = parent.querySelector(SELECTOR_MENU);
- }
- }
-
- return this._menu;
- };
-
- _proto._getPlacement = function _getPlacement() {
- var $parentDropdown = $__default['default'](this._element.parentNode);
- var placement = PLACEMENT_BOTTOM; // Handle dropup
-
- if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
- placement = $__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
- } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
- placement = PLACEMENT_RIGHT;
- } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
- placement = PLACEMENT_LEFT;
- } else if ($__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
- placement = PLACEMENT_BOTTOMEND;
- }
-
- return placement;
- };
-
- _proto._detectNavbar = function _detectNavbar() {
- return $__default['default'](this._element).closest('.navbar').length > 0;
- };
-
- _proto._getOffset = function _getOffset() {
- var _this2 = this;
-
- var offset = {};
-
- if (typeof this._config.offset === 'function') {
- offset.fn = function (data) {
- data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
- return data;
- };
- } else {
- offset.offset = this._config.offset;
- }
-
- return offset;
- };
-
- _proto._getPopperConfig = function _getPopperConfig() {
- var popperConfig = {
- placement: this._getPlacement(),
- modifiers: {
- offset: this._getOffset(),
- flip: {
- enabled: this._config.flip
- },
- preventOverflow: {
- boundariesElement: this._config.boundary
- }
- }
- }; // Disable Popper if we have a static display
-
- if (this._config.display === 'static') {
- popperConfig.modifiers.applyStyle = {
- enabled: false
- };
- }
-
- return _extends({}, popperConfig, this._config.popperConfig);
- } // Static
- ;
-
- Dropdown._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $__default['default'](this).data(DATA_KEY$4);
-
- var _config = typeof config === 'object' ? config : null;
-
- if (!data) {
- data = new Dropdown(this, _config);
- $__default['default'](this).data(DATA_KEY$4, data);
- }
-
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
-
- data[config]();
- }
- });
- };
-
- Dropdown._clearMenus = function _clearMenus(event) {
- if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
- return;
- }
-
- var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2));
-
- for (var i = 0, len = toggles.length; i < len; i++) {
- var parent = Dropdown._getParentFromElement(toggles[i]);
-
- var context = $__default['default'](toggles[i]).data(DATA_KEY$4);
- var relatedTarget = {
- relatedTarget: toggles[i]
- };
-
- if (event && event.type === 'click') {
- relatedTarget.clickEvent = event;
- }
-
- if (!context) {
- continue;
- }
-
- var dropdownMenu = context._menu;
-
- if (!$__default['default'](parent).hasClass(CLASS_NAME_SHOW$2)) {
- continue;
- }
-
- if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $__default['default'].contains(parent, event.target)) {
- continue;
- }
-
- var hideEvent = $__default['default'].Event(EVENT_HIDE$1, relatedTarget);
- $__default['default'](parent).trigger(hideEvent);
-
- if (hideEvent.isDefaultPrevented()) {
- continue;
- } // If this is a touch-enabled device we remove the extra
- // empty mouseover listeners we added for iOS support
-
-
- if ('ontouchstart' in document.documentElement) {
- $__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop);
- }
-
- toggles[i].setAttribute('aria-expanded', 'false');
-
- if (context._popper) {
- context._popper.destroy();
- }
-
- $__default['default'](dropdownMenu).removeClass(CLASS_NAME_SHOW$2);
- $__default['default'](parent).removeClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_HIDDEN$1, relatedTarget));
- }
- };
-
- Dropdown._getParentFromElement = function _getParentFromElement(element) {
- var parent;
- var selector = Util.getSelectorFromElement(element);
-
- if (selector) {
- parent = document.querySelector(selector);
- }
-
- return parent || element.parentNode;
- } // eslint-disable-next-line complexity
- ;
-
- Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
- // If not input/textarea:
- // - And not a key in REGEXP_KEYDOWN => not a dropdown command
- // If input/textarea:
- // - If space key => not a dropdown command
- // - If key is other than escape
- // - If key is not up or down => not a dropdown command
- // - If trigger inside the menu => not a dropdown command
- if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $__default['default'](event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
- return;
- }
-
- if (this.disabled || $__default['default'](this).hasClass(CLASS_NAME_DISABLED)) {
- return;
- }
-
- var parent = Dropdown._getParentFromElement(this);
-
- var isActive = $__default['default'](parent).hasClass(CLASS_NAME_SHOW$2);
-
- if (!isActive && event.which === ESCAPE_KEYCODE) {
- return;
- }
-
- event.preventDefault();
- event.stopPropagation();
-
- if (!isActive || event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE) {
- if (event.which === ESCAPE_KEYCODE) {
- $__default['default'](parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus');
- }
-
- $__default['default'](this).trigger('click');
- return;
- }
-
- var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) {
- return $__default['default'](item).is(':visible');
- });
-
- if (items.length === 0) {
- return;
- }
-
- var index = items.indexOf(event.target);
-
- if (event.which === ARROW_UP_KEYCODE && index > 0) {
- // Up
- index--;
- }
-
- if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
- // Down
- index++;
- }
-
- if (index < 0) {
- index = 0;
- }
-
- items[index].focus();
- };
-
- _createClass(Dropdown, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$4;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$2;
- }
- }, {
- key: "DefaultType",
- get: function get() {
- return DefaultType$2;
- }
- }]);
-
- return Dropdown;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'](document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$4 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
- event.preventDefault();
- event.stopPropagation();
-
- Dropdown._jQueryInterface.call($__default['default'](this), 'toggle');
- }).on(EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
- e.stopPropagation();
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
- $__default['default'].fn[NAME$4] = Dropdown._jQueryInterface;
- $__default['default'].fn[NAME$4].Constructor = Dropdown;
-
- $__default['default'].fn[NAME$4].noConflict = function () {
- $__default['default'].fn[NAME$4] = JQUERY_NO_CONFLICT$4;
- return Dropdown._jQueryInterface;
- };
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$5 = 'modal';
- var VERSION$5 = '4.6.0';
- var DATA_KEY$5 = 'bs.modal';
- var EVENT_KEY$5 = "." + DATA_KEY$5;
- var DATA_API_KEY$5 = '.data-api';
- var JQUERY_NO_CONFLICT$5 = $__default['default'].fn[NAME$5];
- var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
-
- var Default$3 = {
- backdrop: true,
- keyboard: true,
- focus: true,
- show: true
- };
- var DefaultType$3 = {
- backdrop: '(boolean|string)',
- keyboard: 'boolean',
- focus: 'boolean',
- show: 'boolean'
- };
- var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
- var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
- var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
- var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
- var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
- var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
- var EVENT_RESIZE = "resize" + EVENT_KEY$5;
- var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
- var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
- var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
- var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
- var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
- var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
- var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
- var CLASS_NAME_BACKDROP = 'modal-backdrop';
- var CLASS_NAME_OPEN = 'modal-open';
- var CLASS_NAME_FADE$1 = 'fade';
- var CLASS_NAME_SHOW$3 = 'show';
- var CLASS_NAME_STATIC = 'modal-static';
- var SELECTOR_DIALOG = '.modal-dialog';
- var SELECTOR_MODAL_BODY = '.modal-body';
- var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
- var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
- var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
- var SELECTOR_STICKY_CONTENT = '.sticky-top';
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Modal = /*#__PURE__*/function () {
- function Modal(element, config) {
- this._config = this._getConfig(config);
- this._element = element;
- this._dialog = element.querySelector(SELECTOR_DIALOG);
- this._backdrop = null;
- this._isShown = false;
- this._isBodyOverflowing = false;
- this._ignoreBackdropClick = false;
- this._isTransitioning = false;
- this._scrollbarWidth = 0;
- } // Getters
-
-
- var _proto = Modal.prototype;
-
- // Public
- _proto.toggle = function toggle(relatedTarget) {
- return this._isShown ? this.hide() : this.show(relatedTarget);
- };
-
- _proto.show = function show(relatedTarget) {
- var _this = this;
-
- if (this._isShown || this._isTransitioning) {
- return;
- }
-
- if ($__default['default'](this._element).hasClass(CLASS_NAME_FADE$1)) {
- this._isTransitioning = true;
- }
-
- var showEvent = $__default['default'].Event(EVENT_SHOW$2, {
- relatedTarget: relatedTarget
- });
- $__default['default'](this._element).trigger(showEvent);
-
- if (this._isShown || showEvent.isDefaultPrevented()) {
- return;
- }
-
- this._isShown = true;
-
- this._checkScrollbar();
-
- this._setScrollbar();
-
- this._adjustDialog();
-
- this._setEscapeEvent();
-
- this._setResizeEvent();
-
- $__default['default'](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
- return _this.hide(event);
- });
- $__default['default'](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () {
- $__default['default'](_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) {
- if ($__default['default'](event.target).is(_this._element)) {
- _this._ignoreBackdropClick = true;
- }
- });
- });
-
- this._showBackdrop(function () {
- return _this._showElement(relatedTarget);
- });
- };
-
- _proto.hide = function hide(event) {
- var _this2 = this;
-
- if (event) {
- event.preventDefault();
- }
-
- if (!this._isShown || this._isTransitioning) {
- return;
- }
-
- var hideEvent = $__default['default'].Event(EVENT_HIDE$2);
- $__default['default'](this._element).trigger(hideEvent);
-
- if (!this._isShown || hideEvent.isDefaultPrevented()) {
- return;
- }
-
- this._isShown = false;
- var transition = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1);
-
- if (transition) {
- this._isTransitioning = true;
- }
-
- this._setEscapeEvent();
-
- this._setResizeEvent();
-
- $__default['default'](document).off(EVENT_FOCUSIN);
- $__default['default'](this._element).removeClass(CLASS_NAME_SHOW$3);
- $__default['default'](this._element).off(EVENT_CLICK_DISMISS);
- $__default['default'](this._dialog).off(EVENT_MOUSEDOWN_DISMISS);
-
- if (transition) {
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $__default['default'](this._element).one(Util.TRANSITION_END, function (event) {
- return _this2._hideModal(event);
- }).emulateTransitionEnd(transitionDuration);
- } else {
- this._hideModal();
- }
- };
-
- _proto.dispose = function dispose() {
- [window, this._element, this._dialog].forEach(function (htmlElement) {
- return $__default['default'](htmlElement).off(EVENT_KEY$5);
- });
- /**
- * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
- * Do not move `document` in `htmlElements` array
- * It will remove `EVENT_CLICK_DATA_API` event that should remain
- */
-
- $__default['default'](document).off(EVENT_FOCUSIN);
- $__default['default'].removeData(this._element, DATA_KEY$5);
- this._config = null;
- this._element = null;
- this._dialog = null;
- this._backdrop = null;
- this._isShown = null;
- this._isBodyOverflowing = null;
- this._ignoreBackdropClick = null;
- this._isTransitioning = null;
- this._scrollbarWidth = null;
- };
-
- _proto.handleUpdate = function handleUpdate() {
- this._adjustDialog();
- } // Private
- ;
-
- _proto._getConfig = function _getConfig(config) {
- config = _extends({}, Default$3, config);
- Util.typeCheckConfig(NAME$5, config, DefaultType$3);
- return config;
- };
-
- _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
- var _this3 = this;
-
- var hideEventPrevented = $__default['default'].Event(EVENT_HIDE_PREVENTED);
- $__default['default'](this._element).trigger(hideEventPrevented);
-
- if (hideEventPrevented.isDefaultPrevented()) {
- return;
- }
-
- var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
-
- if (!isModalOverflowing) {
- this._element.style.overflowY = 'hidden';
- }
-
- this._element.classList.add(CLASS_NAME_STATIC);
-
- var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog);
- $__default['default'](this._element).off(Util.TRANSITION_END);
- $__default['default'](this._element).one(Util.TRANSITION_END, function () {
- _this3._element.classList.remove(CLASS_NAME_STATIC);
-
- if (!isModalOverflowing) {
- $__default['default'](_this3._element).one(Util.TRANSITION_END, function () {
- _this3._element.style.overflowY = '';
- }).emulateTransitionEnd(_this3._element, modalTransitionDuration);
- }
- }).emulateTransitionEnd(modalTransitionDuration);
-
- this._element.focus();
- };
-
- _proto._showElement = function _showElement(relatedTarget) {
- var _this4 = this;
-
- var transition = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1);
- var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
-
- if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
- // Don't move modal's DOM position
- document.body.appendChild(this._element);
- }
-
- this._element.style.display = 'block';
-
- this._element.removeAttribute('aria-hidden');
-
- this._element.setAttribute('aria-modal', true);
-
- this._element.setAttribute('role', 'dialog');
-
- if ($__default['default'](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
- modalBody.scrollTop = 0;
- } else {
- this._element.scrollTop = 0;
- }
-
- if (transition) {
- Util.reflow(this._element);
- }
-
- $__default['default'](this._element).addClass(CLASS_NAME_SHOW$3);
-
- if (this._config.focus) {
- this._enforceFocus();
- }
-
- var shownEvent = $__default['default'].Event(EVENT_SHOWN$2, {
- relatedTarget: relatedTarget
- });
-
- var transitionComplete = function transitionComplete() {
- if (_this4._config.focus) {
- _this4._element.focus();
- }
-
- _this4._isTransitioning = false;
- $__default['default'](_this4._element).trigger(shownEvent);
- };
-
- if (transition) {
- var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
- $__default['default'](this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
- } else {
- transitionComplete();
- }
- };
-
- _proto._enforceFocus = function _enforceFocus() {
- var _this5 = this;
-
- $__default['default'](document).off(EVENT_FOCUSIN) // Guard against infinite focus loop
- .on(EVENT_FOCUSIN, function (event) {
- if (document !== event.target && _this5._element !== event.target && $__default['default'](_this5._element).has(event.target).length === 0) {
- _this5._element.focus();
- }
- });
- };
-
- _proto._setEscapeEvent = function _setEscapeEvent() {
- var _this6 = this;
-
- if (this._isShown) {
- $__default['default'](this._element).on(EVENT_KEYDOWN_DISMISS, function (event) {
- if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
- event.preventDefault();
-
- _this6.hide();
- } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
- _this6._triggerBackdropTransition();
- }
- });
- } else if (!this._isShown) {
- $__default['default'](this._element).off(EVENT_KEYDOWN_DISMISS);
- }
- };
-
- _proto._setResizeEvent = function _setResizeEvent() {
- var _this7 = this;
-
- if (this._isShown) {
- $__default['default'](window).on(EVENT_RESIZE, function (event) {
- return _this7.handleUpdate(event);
- });
- } else {
- $__default['default'](window).off(EVENT_RESIZE);
- }
- };
-
- _proto._hideModal = function _hideModal() {
- var _this8 = this;
-
- this._element.style.display = 'none';
-
- this._element.setAttribute('aria-hidden', true);
-
- this._element.removeAttribute('aria-modal');
-
- this._element.removeAttribute('role');
-
- this._isTransitioning = false;
-
- this._showBackdrop(function () {
- $__default['default'](document.body).removeClass(CLASS_NAME_OPEN);
-
- _this8._resetAdjustments();
-
- _this8._resetScrollbar();
-
- $__default['default'](_this8._element).trigger(EVENT_HIDDEN$2);
- });
- };
-
- _proto._removeBackdrop = function _removeBackdrop() {
- if (this._backdrop) {
- $__default['default'](this._backdrop).remove();
- this._backdrop = null;
- }
- };
-
- _proto._showBackdrop = function _showBackdrop(callback) {
- var _this9 = this;
-
- var animate = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : '';
-
- if (this._isShown && this._config.backdrop) {
- this._backdrop = document.createElement('div');
- this._backdrop.className = CLASS_NAME_BACKDROP;
-
- if (animate) {
- this._backdrop.classList.add(animate);
- }
-
- $__default['default'](this._backdrop).appendTo(document.body);
- $__default['default'](this._element).on(EVENT_CLICK_DISMISS, function (event) {
- if (_this9._ignoreBackdropClick) {
- _this9._ignoreBackdropClick = false;
- return;
- }
-
- if (event.target !== event.currentTarget) {
- return;
- }
-
- if (_this9._config.backdrop === 'static') {
- _this9._triggerBackdropTransition();
- } else {
- _this9.hide();
- }
- });
-
- if (animate) {
- Util.reflow(this._backdrop);
- }
-
- $__default['default'](this._backdrop).addClass(CLASS_NAME_SHOW$3);
-
- if (!callback) {
- return;
- }
-
- if (!animate) {
- callback();
- return;
- }
-
- var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
- $__default['default'](this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
- } else if (!this._isShown && this._backdrop) {
- $__default['default'](this._backdrop).removeClass(CLASS_NAME_SHOW$3);
-
- var callbackRemove = function callbackRemove() {
- _this9._removeBackdrop();
-
- if (callback) {
- callback();
- }
- };
-
- if ($__default['default'](this._element).hasClass(CLASS_NAME_FADE$1)) {
- var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
-
- $__default['default'](this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
- } else {
- callbackRemove();
- }
- } else if (callback) {
- callback();
- }
- } // ----------------------------------------------------------------------
- // the following methods are used to handle overflowing modals
- // todo (fat): these should probably be refactored out of modal.js
- // ----------------------------------------------------------------------
- ;
-
- _proto._adjustDialog = function _adjustDialog() {
- var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
-
- if (!this._isBodyOverflowing && isModalOverflowing) {
- this._element.style.paddingLeft = this._scrollbarWidth + "px";
- }
-
- if (this._isBodyOverflowing && !isModalOverflowing) {
- this._element.style.paddingRight = this._scrollbarWidth + "px";
- }
- };
-
- _proto._resetAdjustments = function _resetAdjustments() {
- this._element.style.paddingLeft = '';
- this._element.style.paddingRight = '';
- };
-
- _proto._checkScrollbar = function _checkScrollbar() {
- var rect = document.body.getBoundingClientRect();
- this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
- this._scrollbarWidth = this._getScrollbarWidth();
- };
-
- _proto._setScrollbar = function _setScrollbar() {
- var _this10 = this;
-
- if (this._isBodyOverflowing) {
- // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
- // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
- var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
- var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding
-
- $__default['default'](fixedContent).each(function (index, element) {
- var actualPadding = element.style.paddingRight;
- var calculatedPadding = $__default['default'](element).css('padding-right');
- $__default['default'](element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
- }); // Adjust sticky content margin
-
- $__default['default'](stickyContent).each(function (index, element) {
- var actualMargin = element.style.marginRight;
- var calculatedMargin = $__default['default'](element).css('margin-right');
- $__default['default'](element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
- }); // Adjust body padding
-
- var actualPadding = document.body.style.paddingRight;
- var calculatedPadding = $__default['default'](document.body).css('padding-right');
- $__default['default'](document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
- }
-
- $__default['default'](document.body).addClass(CLASS_NAME_OPEN);
- };
-
- _proto._resetScrollbar = function _resetScrollbar() {
- // Restore fixed content padding
- var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
- $__default['default'](fixedContent).each(function (index, element) {
- var padding = $__default['default'](element).data('padding-right');
- $__default['default'](element).removeData('padding-right');
- element.style.paddingRight = padding ? padding : '';
- }); // Restore sticky content
-
- var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT));
- $__default['default'](elements).each(function (index, element) {
- var margin = $__default['default'](element).data('margin-right');
-
- if (typeof margin !== 'undefined') {
- $__default['default'](element).css('margin-right', margin).removeData('margin-right');
- }
- }); // Restore body padding
-
- var padding = $__default['default'](document.body).data('padding-right');
- $__default['default'](document.body).removeData('padding-right');
- document.body.style.paddingRight = padding ? padding : '';
- };
-
- _proto._getScrollbarWidth = function _getScrollbarWidth() {
- // thx d.walsh
- var scrollDiv = document.createElement('div');
- scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
- document.body.appendChild(scrollDiv);
- var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
- document.body.removeChild(scrollDiv);
- return scrollbarWidth;
- } // Static
- ;
-
- Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
- return this.each(function () {
- var data = $__default['default'](this).data(DATA_KEY$5);
-
- var _config = _extends({}, Default$3, $__default['default'](this).data(), typeof config === 'object' && config ? config : {});
-
- if (!data) {
- data = new Modal(this, _config);
- $__default['default'](this).data(DATA_KEY$5, data);
- }
-
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
-
- data[config](relatedTarget);
- } else if (_config.show) {
- data.show(relatedTarget);
- }
- });
- };
-
- _createClass(Modal, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$5;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$3;
- }
- }]);
-
- return Modal;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'](document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
- var _this11 = this;
-
- var target;
- var selector = Util.getSelectorFromElement(this);
-
- if (selector) {
- target = document.querySelector(selector);
- }
-
- var config = $__default['default'](target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $__default['default'](target).data(), $__default['default'](this).data());
-
- if (this.tagName === 'A' || this.tagName === 'AREA') {
- event.preventDefault();
- }
-
- var $target = $__default['default'](target).one(EVENT_SHOW$2, function (showEvent) {
- if (showEvent.isDefaultPrevented()) {
- // Only register focus restorer if modal will actually get shown
- return;
- }
-
- $target.one(EVENT_HIDDEN$2, function () {
- if ($__default['default'](_this11).is(':visible')) {
- _this11.focus();
- }
- });
- });
-
- Modal._jQueryInterface.call($__default['default'](target), config, this);
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
- $__default['default'].fn[NAME$5] = Modal._jQueryInterface;
- $__default['default'].fn[NAME$5].Constructor = Modal;
-
- $__default['default'].fn[NAME$5].noConflict = function () {
- $__default['default'].fn[NAME$5] = JQUERY_NO_CONFLICT$5;
- return Modal._jQueryInterface;
- };
-
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v4.6.0): tools/sanitizer.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- * --------------------------------------------------------------------------
- */
- 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', 'srcset', '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,[\d+/a-z]+=*$/i;
-
- function allowedAttribute(attr, allowedAttributeList) {
- var attrName = attr.nodeName.toLowerCase();
-
- if (allowedAttributeList.indexOf(attrName) !== -1) {
- if (uriAttrs.indexOf(attrName) !== -1) {
- return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
- }
-
- return true;
- }
-
- var regExp = allowedAttributeList.filter(function (attrRegex) {
- return attrRegex instanceof RegExp;
- }); // Check if a regular expression validates the attribute.
-
- for (var i = 0, len = regExp.length; i < len; 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);
- }
-
- var domParser = new window.DOMParser();
- var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
- var whitelistKeys = Object.keys(whiteList);
- var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
-
- var _loop = function _loop(i, len) {
- var el = elements[i];
- var elName = el.nodeName.toLowerCase();
-
- if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
- el.parentNode.removeChild(el);
- return "continue";
- }
-
- var attributeList = [].slice.call(el.attributes);
- var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
- attributeList.forEach(function (attr) {
- if (!allowedAttribute(attr, whitelistedAttributes)) {
- el.removeAttribute(attr.nodeName);
- }
- });
- };
-
- for (var i = 0, len = elements.length; i < len; i++) {
- var _ret = _loop(i);
-
- if (_ret === "continue") continue;
- }
-
- return createdDocument.body.innerHTML;
- }
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$6 = 'tooltip';
- var VERSION$6 = '4.6.0';
- var DATA_KEY$6 = 'bs.tooltip';
- var EVENT_KEY$6 = "." + DATA_KEY$6;
- var JQUERY_NO_CONFLICT$6 = $__default['default'].fn[NAME$6];
- var CLASS_PREFIX = 'bs-tooltip';
- var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
- var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
- var DefaultType$4 = {
- animation: 'boolean',
- template: 'string',
- title: '(string|element|function)',
- trigger: 'string',
- delay: '(number|object)',
- html: 'boolean',
- selector: '(string|boolean)',
- placement: '(string|function)',
- offset: '(number|string|function)',
- container: '(string|element|boolean)',
- fallbackPlacement: '(string|array)',
- boundary: '(string|element)',
- customClass: '(string|function)',
- sanitize: 'boolean',
- sanitizeFn: '(null|function)',
- whiteList: 'object',
- popperConfig: '(null|object)'
- };
- var AttachmentMap = {
- AUTO: 'auto',
- TOP: 'top',
- RIGHT: 'right',
- BOTTOM: 'bottom',
- LEFT: 'left'
- };
- var Default$4 = {
- animation: true,
- template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
- trigger: 'hover focus',
- title: '',
- delay: 0,
- html: false,
- selector: false,
- placement: 'top',
- offset: 0,
- container: false,
- fallbackPlacement: 'flip',
- boundary: 'scrollParent',
- customClass: '',
- sanitize: true,
- sanitizeFn: null,
- whiteList: DefaultWhitelist,
- popperConfig: null
- };
- var HOVER_STATE_SHOW = 'show';
- var HOVER_STATE_OUT = 'out';
- var Event = {
- HIDE: "hide" + EVENT_KEY$6,
- HIDDEN: "hidden" + EVENT_KEY$6,
- SHOW: "show" + EVENT_KEY$6,
- SHOWN: "shown" + EVENT_KEY$6,
- INSERTED: "inserted" + EVENT_KEY$6,
- CLICK: "click" + EVENT_KEY$6,
- FOCUSIN: "focusin" + EVENT_KEY$6,
- FOCUSOUT: "focusout" + EVENT_KEY$6,
- MOUSEENTER: "mouseenter" + EVENT_KEY$6,
- MOUSELEAVE: "mouseleave" + EVENT_KEY$6
- };
- var CLASS_NAME_FADE$2 = 'fade';
- var CLASS_NAME_SHOW$4 = 'show';
- var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
- var SELECTOR_ARROW = '.arrow';
- var TRIGGER_HOVER = 'hover';
- var TRIGGER_FOCUS = 'focus';
- var TRIGGER_CLICK = 'click';
- var TRIGGER_MANUAL = 'manual';
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Tooltip = /*#__PURE__*/function () {
- function Tooltip(element, config) {
- if (typeof Popper === 'undefined') {
- throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
- } // private
-
-
- this._isEnabled = true;
- this._timeout = 0;
- this._hoverState = '';
- this._activeTrigger = {};
- this._popper = null; // Protected
-
- this.element = element;
- this.config = this._getConfig(config);
- this.tip = null;
-
- this._setListeners();
- } // Getters
-
-
- var _proto = Tooltip.prototype;
-
- // Public
- _proto.enable = function enable() {
- this._isEnabled = true;
- };
-
- _proto.disable = function disable() {
- this._isEnabled = false;
- };
-
- _proto.toggleEnabled = function toggleEnabled() {
- this._isEnabled = !this._isEnabled;
- };
-
- _proto.toggle = function toggle(event) {
- if (!this._isEnabled) {
- return;
- }
-
- if (event) {
- var dataKey = this.constructor.DATA_KEY;
- var context = $__default['default'](event.currentTarget).data(dataKey);
-
- if (!context) {
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
- $__default['default'](event.currentTarget).data(dataKey, context);
- }
-
- context._activeTrigger.click = !context._activeTrigger.click;
-
- if (context._isWithActiveTrigger()) {
- context._enter(null, context);
- } else {
- context._leave(null, context);
- }
- } else {
- if ($__default['default'](this.getTipElement()).hasClass(CLASS_NAME_SHOW$4)) {
- this._leave(null, this);
-
- return;
- }
-
- this._enter(null, this);
- }
- };
-
- _proto.dispose = function dispose() {
- clearTimeout(this._timeout);
- $__default['default'].removeData(this.element, this.constructor.DATA_KEY);
- $__default['default'](this.element).off(this.constructor.EVENT_KEY);
- $__default['default'](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
-
- if (this.tip) {
- $__default['default'](this.tip).remove();
- }
-
- this._isEnabled = null;
- this._timeout = null;
- this._hoverState = null;
- this._activeTrigger = null;
-
- if (this._popper) {
- this._popper.destroy();
- }
-
- this._popper = null;
- this.element = null;
- this.config = null;
- this.tip = null;
- };
-
- _proto.show = function show() {
- var _this = this;
-
- if ($__default['default'](this.element).css('display') === 'none') {
- throw new Error('Please use show on visible elements');
- }
-
- var showEvent = $__default['default'].Event(this.constructor.Event.SHOW);
-
- if (this.isWithContent() && this._isEnabled) {
- $__default['default'](this.element).trigger(showEvent);
- var shadowRoot = Util.findShadowRoot(this.element);
- var isInTheDom = $__default['default'].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
-
- if (showEvent.isDefaultPrevented() || !isInTheDom) {
- return;
- }
-
- var tip = this.getTipElement();
- var tipId = Util.getUID(this.constructor.NAME);
- tip.setAttribute('id', tipId);
- this.element.setAttribute('aria-describedby', tipId);
- this.setContent();
-
- if (this.config.animation) {
- $__default['default'](tip).addClass(CLASS_NAME_FADE$2);
- }
-
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
-
- var attachment = this._getAttachment(placement);
-
- this.addAttachmentClass(attachment);
-
- var container = this._getContainer();
-
- $__default['default'](tip).data(this.constructor.DATA_KEY, this);
-
- if (!$__default['default'].contains(this.element.ownerDocument.documentElement, this.tip)) {
- $__default['default'](tip).appendTo(container);
- }
-
- $__default['default'](this.element).trigger(this.constructor.Event.INSERTED);
- this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
- $__default['default'](tip).addClass(CLASS_NAME_SHOW$4);
- $__default['default'](tip).addClass(this.config.customClass); // If this is a touch-enabled device we add extra
- // empty mouseover listeners to the body's immediate children;
- // only needed because of broken event delegation on iOS
- // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
-
- if ('ontouchstart' in document.documentElement) {
- $__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop);
- }
-
- var complete = function complete() {
- if (_this.config.animation) {
- _this._fixTransition();
- }
-
- var prevHoverState = _this._hoverState;
- _this._hoverState = null;
- $__default['default'](_this.element).trigger(_this.constructor.Event.SHOWN);
-
- if (prevHoverState === HOVER_STATE_OUT) {
- _this._leave(null, _this);
- }
- };
-
- if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE$2)) {
- var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
- $__default['default'](this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
- }
- };
-
- _proto.hide = function hide(callback) {
- var _this2 = this;
-
- var tip = this.getTipElement();
- var hideEvent = $__default['default'].Event(this.constructor.Event.HIDE);
-
- var complete = function complete() {
- if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
- tip.parentNode.removeChild(tip);
- }
-
- _this2._cleanTipClass();
-
- _this2.element.removeAttribute('aria-describedby');
-
- $__default['default'](_this2.element).trigger(_this2.constructor.Event.HIDDEN);
-
- if (_this2._popper !== null) {
- _this2._popper.destroy();
- }
-
- if (callback) {
- callback();
- }
- };
-
- $__default['default'](this.element).trigger(hideEvent);
-
- if (hideEvent.isDefaultPrevented()) {
- return;
- }
-
- $__default['default'](tip).removeClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
- // empty mouseover listeners we added for iOS support
-
- if ('ontouchstart' in document.documentElement) {
- $__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop);
- }
-
- this._activeTrigger[TRIGGER_CLICK] = false;
- this._activeTrigger[TRIGGER_FOCUS] = false;
- this._activeTrigger[TRIGGER_HOVER] = false;
-
- if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE$2)) {
- var transitionDuration = Util.getTransitionDurationFromElement(tip);
- $__default['default'](tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
-
- this._hoverState = '';
- };
-
- _proto.update = function update() {
- if (this._popper !== null) {
- this._popper.scheduleUpdate();
- }
- } // Protected
- ;
-
- _proto.isWithContent = function isWithContent() {
- return Boolean(this.getTitle());
- };
-
- _proto.addAttachmentClass = function addAttachmentClass(attachment) {
- $__default['default'](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
- };
-
- _proto.getTipElement = function getTipElement() {
- this.tip = this.tip || $__default['default'](this.config.template)[0];
- return this.tip;
- };
-
- _proto.setContent = function setContent() {
- var tip = this.getTipElement();
- this.setElementContent($__default['default'](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());
- $__default['default'](tip).removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$4);
- };
-
- _proto.setElementContent = function setElementContent($element, content) {
- if (typeof content === 'object' && (content.nodeType || content.jquery)) {
- // Content is a DOM node or a jQuery
- if (this.config.html) {
- if (!$__default['default'](content).parent().is($element)) {
- $element.empty().append(content);
- }
- } else {
- $element.text($__default['default'](content).text());
- }
-
- return;
- }
-
- if (this.config.html) {
- if (this.config.sanitize) {
- content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
- }
-
- $element.html(content);
- } else {
- $element.text(content);
- }
- };
-
- _proto.getTitle = function getTitle() {
- var title = this.element.getAttribute('data-original-title');
-
- if (!title) {
- title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
- }
-
- return title;
- } // Private
- ;
-
- _proto._getPopperConfig = function _getPopperConfig(attachment) {
- var _this3 = this;
-
- var defaultBsConfig = {
- placement: attachment,
- modifiers: {
- offset: this._getOffset(),
- flip: {
- behavior: this.config.fallbackPlacement
- },
- arrow: {
- element: SELECTOR_ARROW
- },
- preventOverflow: {
- boundariesElement: this.config.boundary
- }
- },
- onCreate: function onCreate(data) {
- if (data.originalPlacement !== data.placement) {
- _this3._handlePopperPlacementChange(data);
- }
- },
- onUpdate: function onUpdate(data) {
- return _this3._handlePopperPlacementChange(data);
- }
- };
- return _extends({}, defaultBsConfig, this.config.popperConfig);
- };
-
- _proto._getOffset = function _getOffset() {
- var _this4 = this;
-
- var offset = {};
-
- if (typeof this.config.offset === 'function') {
- offset.fn = function (data) {
- data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
- return data;
- };
- } else {
- offset.offset = this.config.offset;
- }
-
- return offset;
- };
-
- _proto._getContainer = function _getContainer() {
- if (this.config.container === false) {
- return document.body;
- }
-
- if (Util.isElement(this.config.container)) {
- return $__default['default'](this.config.container);
- }
-
- return $__default['default'](document).find(this.config.container);
- };
-
- _proto._getAttachment = function _getAttachment(placement) {
- return AttachmentMap[placement.toUpperCase()];
- };
-
- _proto._setListeners = function _setListeners() {
- var _this5 = this;
-
- var triggers = this.config.trigger.split(' ');
- triggers.forEach(function (trigger) {
- if (trigger === 'click') {
- $__default['default'](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
- return _this5.toggle(event);
- });
- } else if (trigger !== TRIGGER_MANUAL) {
- var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
- var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
- $__default['default'](_this5.element).on(eventIn, _this5.config.selector, function (event) {
- return _this5._enter(event);
- }).on(eventOut, _this5.config.selector, function (event) {
- return _this5._leave(event);
- });
- }
- });
-
- this._hideModalHandler = function () {
- if (_this5.element) {
- _this5.hide();
- }
- };
-
- $__default['default'](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
-
- if (this.config.selector) {
- this.config = _extends({}, this.config, {
- trigger: 'manual',
- selector: ''
- });
- } else {
- this._fixTitle();
- }
- };
-
- _proto._fixTitle = function _fixTitle() {
- var titleType = typeof this.element.getAttribute('data-original-title');
-
- if (this.element.getAttribute('title') || titleType !== 'string') {
- this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
- this.element.setAttribute('title', '');
- }
- };
-
- _proto._enter = function _enter(event, context) {
- var dataKey = this.constructor.DATA_KEY;
- context = context || $__default['default'](event.currentTarget).data(dataKey);
-
- if (!context) {
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
- $__default['default'](event.currentTarget).data(dataKey, context);
- }
-
- if (event) {
- context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
- }
-
- if ($__default['default'](context.getTipElement()).hasClass(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
- context._hoverState = HOVER_STATE_SHOW;
- return;
- }
-
- clearTimeout(context._timeout);
- context._hoverState = HOVER_STATE_SHOW;
-
- if (!context.config.delay || !context.config.delay.show) {
- context.show();
- return;
- }
-
- context._timeout = setTimeout(function () {
- if (context._hoverState === HOVER_STATE_SHOW) {
- context.show();
- }
- }, context.config.delay.show);
- };
-
- _proto._leave = function _leave(event, context) {
- var dataKey = this.constructor.DATA_KEY;
- context = context || $__default['default'](event.currentTarget).data(dataKey);
-
- if (!context) {
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
- $__default['default'](event.currentTarget).data(dataKey, context);
- }
-
- if (event) {
- context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
- }
-
- if (context._isWithActiveTrigger()) {
- return;
- }
-
- clearTimeout(context._timeout);
- context._hoverState = HOVER_STATE_OUT;
-
- if (!context.config.delay || !context.config.delay.hide) {
- context.hide();
- return;
- }
-
- context._timeout = setTimeout(function () {
- if (context._hoverState === HOVER_STATE_OUT) {
- context.hide();
- }
- }, context.config.delay.hide);
- };
-
- _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
- for (var trigger in this._activeTrigger) {
- if (this._activeTrigger[trigger]) {
- return true;
- }
- }
-
- return false;
- };
-
- _proto._getConfig = function _getConfig(config) {
- var dataAttributes = $__default['default'](this.element).data();
- Object.keys(dataAttributes).forEach(function (dataAttr) {
- if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
- delete dataAttributes[dataAttr];
- }
- });
- config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
-
- if (typeof config.delay === 'number') {
- config.delay = {
- show: config.delay,
- hide: config.delay
- };
- }
-
- if (typeof config.title === 'number') {
- config.title = config.title.toString();
- }
-
- if (typeof config.content === 'number') {
- config.content = config.content.toString();
- }
-
- Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
-
- if (config.sanitize) {
- config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
- }
-
- return config;
- };
-
- _proto._getDelegateConfig = function _getDelegateConfig() {
- var config = {};
-
- if (this.config) {
- for (var key in this.config) {
- if (this.constructor.Default[key] !== this.config[key]) {
- config[key] = this.config[key];
- }
- }
- }
-
- return config;
- };
-
- _proto._cleanTipClass = function _cleanTipClass() {
- var $tip = $__default['default'](this.getTipElement());
- var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
-
- if (tabClass !== null && tabClass.length) {
- $tip.removeClass(tabClass.join(''));
- }
- };
-
- _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
- this.tip = popperData.instance.popper;
-
- this._cleanTipClass();
-
- this.addAttachmentClass(this._getAttachment(popperData.placement));
- };
-
- _proto._fixTransition = function _fixTransition() {
- var tip = this.getTipElement();
- var initConfigAnimation = this.config.animation;
-
- if (tip.getAttribute('x-placement') !== null) {
- return;
- }
-
- $__default['default'](tip).removeClass(CLASS_NAME_FADE$2);
- this.config.animation = false;
- this.hide();
- this.show();
- this.config.animation = initConfigAnimation;
- } // Static
- ;
-
- Tooltip._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var $element = $__default['default'](this);
- var data = $element.data(DATA_KEY$6);
-
- var _config = typeof config === 'object' && config;
-
- if (!data && /dispose|hide/.test(config)) {
- return;
- }
-
- if (!data) {
- data = new Tooltip(this, _config);
- $element.data(DATA_KEY$6, data);
- }
-
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
-
- data[config]();
- }
- });
- };
-
- _createClass(Tooltip, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$6;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$4;
- }
- }, {
- key: "NAME",
- get: function get() {
- return NAME$6;
- }
- }, {
- key: "DATA_KEY",
- get: function get() {
- return DATA_KEY$6;
- }
- }, {
- key: "Event",
- get: function get() {
- return Event;
- }
- }, {
- key: "EVENT_KEY",
- get: function get() {
- return EVENT_KEY$6;
- }
- }, {
- key: "DefaultType",
- get: function get() {
- return DefaultType$4;
- }
- }]);
-
- return Tooltip;
- }();
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'].fn[NAME$6] = Tooltip._jQueryInterface;
- $__default['default'].fn[NAME$6].Constructor = Tooltip;
-
- $__default['default'].fn[NAME$6].noConflict = function () {
- $__default['default'].fn[NAME$6] = JQUERY_NO_CONFLICT$6;
- return Tooltip._jQueryInterface;
- };
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$7 = 'popover';
- var VERSION$7 = '4.6.0';
- var DATA_KEY$7 = 'bs.popover';
- var EVENT_KEY$7 = "." + DATA_KEY$7;
- var JQUERY_NO_CONFLICT$7 = $__default['default'].fn[NAME$7];
- var CLASS_PREFIX$1 = 'bs-popover';
- var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
-
- var Default$5 = _extends({}, Tooltip.Default, {
- placement: 'right',
- trigger: 'click',
- content: '',
- template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
- });
-
- var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
- content: '(string|element|function)'
- });
-
- var CLASS_NAME_FADE$3 = 'fade';
- var CLASS_NAME_SHOW$5 = 'show';
- var SELECTOR_TITLE = '.popover-header';
- var SELECTOR_CONTENT = '.popover-body';
- var Event$1 = {
- HIDE: "hide" + EVENT_KEY$7,
- HIDDEN: "hidden" + EVENT_KEY$7,
- SHOW: "show" + EVENT_KEY$7,
- SHOWN: "shown" + EVENT_KEY$7,
- INSERTED: "inserted" + EVENT_KEY$7,
- CLICK: "click" + EVENT_KEY$7,
- FOCUSIN: "focusin" + EVENT_KEY$7,
- FOCUSOUT: "focusout" + EVENT_KEY$7,
- MOUSEENTER: "mouseenter" + EVENT_KEY$7,
- MOUSELEAVE: "mouseleave" + EVENT_KEY$7
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Popover = /*#__PURE__*/function (_Tooltip) {
- _inheritsLoose(Popover, _Tooltip);
-
- function Popover() {
- return _Tooltip.apply(this, arguments) || this;
- }
-
- var _proto = Popover.prototype;
-
- // Overrides
- _proto.isWithContent = function isWithContent() {
- return this.getTitle() || this._getContent();
- };
-
- _proto.addAttachmentClass = function addAttachmentClass(attachment) {
- $__default['default'](this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
- };
-
- _proto.getTipElement = function getTipElement() {
- this.tip = this.tip || $__default['default'](this.config.template)[0];
- return this.tip;
- };
-
- _proto.setContent = function setContent() {
- var $tip = $__default['default'](this.getTipElement()); // We use append for html objects to maintain js events
-
- this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle());
-
- var content = this._getContent();
-
- if (typeof content === 'function') {
- content = content.call(this.element);
- }
-
- this.setElementContent($tip.find(SELECTOR_CONTENT), content);
- $tip.removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$5);
- } // Private
- ;
-
- _proto._getContent = function _getContent() {
- return this.element.getAttribute('data-content') || this.config.content;
- };
-
- _proto._cleanTipClass = function _cleanTipClass() {
- var $tip = $__default['default'](this.getTipElement());
- var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
-
- if (tabClass !== null && tabClass.length > 0) {
- $tip.removeClass(tabClass.join(''));
- }
- } // Static
- ;
-
- Popover._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $__default['default'](this).data(DATA_KEY$7);
-
- var _config = typeof config === 'object' ? config : null;
-
- if (!data && /dispose|hide/.test(config)) {
- return;
- }
-
- if (!data) {
- data = new Popover(this, _config);
- $__default['default'](this).data(DATA_KEY$7, data);
- }
-
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
-
- data[config]();
- }
- });
- };
-
- _createClass(Popover, null, [{
- key: "VERSION",
- // Getters
- get: function get() {
- return VERSION$7;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$5;
- }
- }, {
- key: "NAME",
- get: function get() {
- return NAME$7;
- }
- }, {
- key: "DATA_KEY",
- get: function get() {
- return DATA_KEY$7;
- }
- }, {
- key: "Event",
- get: function get() {
- return Event$1;
- }
- }, {
- key: "EVENT_KEY",
- get: function get() {
- return EVENT_KEY$7;
- }
- }, {
- key: "DefaultType",
- get: function get() {
- return DefaultType$5;
- }
- }]);
-
- return Popover;
- }(Tooltip);
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'].fn[NAME$7] = Popover._jQueryInterface;
- $__default['default'].fn[NAME$7].Constructor = Popover;
-
- $__default['default'].fn[NAME$7].noConflict = function () {
- $__default['default'].fn[NAME$7] = JQUERY_NO_CONFLICT$7;
- return Popover._jQueryInterface;
- };
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$8 = 'scrollspy';
- var VERSION$8 = '4.6.0';
- var DATA_KEY$8 = 'bs.scrollspy';
- var EVENT_KEY$8 = "." + DATA_KEY$8;
- var DATA_API_KEY$6 = '.data-api';
- var JQUERY_NO_CONFLICT$8 = $__default['default'].fn[NAME$8];
- var Default$6 = {
- offset: 10,
- method: 'auto',
- target: ''
- };
- var DefaultType$6 = {
- offset: 'number',
- method: 'string',
- target: '(string|element)'
- };
- var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
- var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
- var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
- var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
- var CLASS_NAME_ACTIVE$2 = 'active';
- var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
- var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
- var SELECTOR_NAV_LINKS = '.nav-link';
- var SELECTOR_NAV_ITEMS = '.nav-item';
- var SELECTOR_LIST_ITEMS = '.list-group-item';
- var SELECTOR_DROPDOWN = '.dropdown';
- var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item';
- var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
- var METHOD_OFFSET = 'offset';
- var METHOD_POSITION = 'position';
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var ScrollSpy = /*#__PURE__*/function () {
- function ScrollSpy(element, config) {
- var _this = this;
-
- this._element = element;
- this._scrollElement = element.tagName === 'BODY' ? window : element;
- this._config = this._getConfig(config);
- this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS);
- this._offsets = [];
- this._targets = [];
- this._activeTarget = null;
- this._scrollHeight = 0;
- $__default['default'](this._scrollElement).on(EVENT_SCROLL, function (event) {
- return _this._process(event);
- });
- this.refresh();
-
- this._process();
- } // Getters
-
-
- var _proto = ScrollSpy.prototype;
-
- // Public
- _proto.refresh = function refresh() {
- var _this2 = this;
-
- var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
- var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
- var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
- this._offsets = [];
- this._targets = [];
- this._scrollHeight = this._getScrollHeight();
- var targets = [].slice.call(document.querySelectorAll(this._selector));
- targets.map(function (element) {
- var target;
- var targetSelector = Util.getSelectorFromElement(element);
-
- if (targetSelector) {
- target = document.querySelector(targetSelector);
- }
-
- if (target) {
- var targetBCR = target.getBoundingClientRect();
-
- if (targetBCR.width || targetBCR.height) {
- // TODO (fat): remove sketch reliance on jQuery position/offset
- return [$__default['default'](target)[offsetMethod]().top + offsetBase, targetSelector];
- }
- }
-
- return null;
- }).filter(function (item) {
- return item;
- }).sort(function (a, b) {
- return a[0] - b[0];
- }).forEach(function (item) {
- _this2._offsets.push(item[0]);
-
- _this2._targets.push(item[1]);
- });
- };
-
- _proto.dispose = function dispose() {
- $__default['default'].removeData(this._element, DATA_KEY$8);
- $__default['default'](this._scrollElement).off(EVENT_KEY$8);
- this._element = null;
- this._scrollElement = null;
- this._config = null;
- this._selector = null;
- this._offsets = null;
- this._targets = null;
- this._activeTarget = null;
- this._scrollHeight = null;
- } // Private
- ;
-
- _proto._getConfig = function _getConfig(config) {
- config = _extends({}, Default$6, typeof config === 'object' && config ? config : {});
-
- if (typeof config.target !== 'string' && Util.isElement(config.target)) {
- var id = $__default['default'](config.target).attr('id');
-
- if (!id) {
- id = Util.getUID(NAME$8);
- $__default['default'](config.target).attr('id', id);
- }
-
- config.target = "#" + id;
- }
-
- Util.typeCheckConfig(NAME$8, config, DefaultType$6);
- return config;
- };
-
- _proto._getScrollTop = function _getScrollTop() {
- return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
- };
-
- _proto._getScrollHeight = function _getScrollHeight() {
- return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
- };
-
- _proto._getOffsetHeight = function _getOffsetHeight() {
- return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
- };
-
- _proto._process = function _process() {
- var scrollTop = this._getScrollTop() + this._config.offset;
-
- var scrollHeight = this._getScrollHeight();
-
- var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
-
- if (this._scrollHeight !== scrollHeight) {
- this.refresh();
- }
-
- if (scrollTop >= maxScroll) {
- var target = this._targets[this._targets.length - 1];
-
- if (this._activeTarget !== target) {
- this._activate(target);
- }
-
- return;
- }
-
- if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
- this._activeTarget = null;
-
- this._clear();
-
- return;
- }
-
- for (var i = this._offsets.length; i--;) {
- var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
-
- if (isActiveTarget) {
- this._activate(this._targets[i]);
- }
- }
- };
-
- _proto._activate = function _activate(target) {
- this._activeTarget = target;
-
- this._clear();
-
- var queries = this._selector.split(',').map(function (selector) {
- return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
- });
-
- var $link = $__default['default']([].slice.call(document.querySelectorAll(queries.join(','))));
-
- if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
- $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE$2);
- $link.addClass(CLASS_NAME_ACTIVE$2);
- } else {
- // Set triggered link as active
- $link.addClass(CLASS_NAME_ACTIVE$2); // Set triggered links parents as active
- // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
-
- $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$2); // Handle special case when .nav-link is inside .nav-item
-
- $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$2);
- }
-
- $__default['default'](this._scrollElement).trigger(EVENT_ACTIVATE, {
- relatedTarget: target
- });
- };
-
- _proto._clear = function _clear() {
- [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
- return node.classList.contains(CLASS_NAME_ACTIVE$2);
- }).forEach(function (node) {
- return node.classList.remove(CLASS_NAME_ACTIVE$2);
- });
- } // Static
- ;
-
- ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $__default['default'](this).data(DATA_KEY$8);
-
- var _config = typeof config === 'object' && config;
-
- if (!data) {
- data = new ScrollSpy(this, _config);
- $__default['default'](this).data(DATA_KEY$8, data);
- }
-
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
-
- data[config]();
- }
- });
- };
-
- _createClass(ScrollSpy, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$8;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$6;
- }
- }]);
-
- return ScrollSpy;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'](window).on(EVENT_LOAD_DATA_API$2, function () {
- var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY));
- var scrollSpysLength = scrollSpys.length;
-
- for (var i = scrollSpysLength; i--;) {
- var $spy = $__default['default'](scrollSpys[i]);
-
- ScrollSpy._jQueryInterface.call($spy, $spy.data());
- }
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
- $__default['default'].fn[NAME$8] = ScrollSpy._jQueryInterface;
- $__default['default'].fn[NAME$8].Constructor = ScrollSpy;
-
- $__default['default'].fn[NAME$8].noConflict = function () {
- $__default['default'].fn[NAME$8] = JQUERY_NO_CONFLICT$8;
- return ScrollSpy._jQueryInterface;
- };
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$9 = 'tab';
- var VERSION$9 = '4.6.0';
- var DATA_KEY$9 = 'bs.tab';
- var EVENT_KEY$9 = "." + DATA_KEY$9;
- var DATA_API_KEY$7 = '.data-api';
- var JQUERY_NO_CONFLICT$9 = $__default['default'].fn[NAME$9];
- var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
- var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
- var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
- var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
- var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
- var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
- var CLASS_NAME_ACTIVE$3 = 'active';
- var CLASS_NAME_DISABLED$1 = 'disabled';
- var CLASS_NAME_FADE$4 = 'fade';
- var CLASS_NAME_SHOW$6 = 'show';
- var SELECTOR_DROPDOWN$1 = '.dropdown';
- var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
- var SELECTOR_ACTIVE$2 = '.active';
- var SELECTOR_ACTIVE_UL = '> li > .active';
- var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
- var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
- var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active';
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Tab = /*#__PURE__*/function () {
- function Tab(element) {
- this._element = element;
- } // Getters
-
-
- var _proto = Tab.prototype;
-
- // Public
- _proto.show = function show() {
- var _this = this;
-
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default['default'](this._element).hasClass(CLASS_NAME_ACTIVE$3) || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED$1)) {
- return;
- }
-
- var target;
- var previous;
- var listElement = $__default['default'](this._element).closest(SELECTOR_NAV_LIST_GROUP$1)[0];
- var selector = Util.getSelectorFromElement(this._element);
-
- if (listElement) {
- var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
- previous = $__default['default'].makeArray($__default['default'](listElement).find(itemSelector));
- previous = previous[previous.length - 1];
- }
-
- var hideEvent = $__default['default'].Event(EVENT_HIDE$3, {
- relatedTarget: this._element
- });
- var showEvent = $__default['default'].Event(EVENT_SHOW$3, {
- relatedTarget: previous
- });
-
- if (previous) {
- $__default['default'](previous).trigger(hideEvent);
- }
-
- $__default['default'](this._element).trigger(showEvent);
-
- if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
- return;
- }
-
- if (selector) {
- target = document.querySelector(selector);
- }
-
- this._activate(this._element, listElement);
-
- var complete = function complete() {
- var hiddenEvent = $__default['default'].Event(EVENT_HIDDEN$3, {
- relatedTarget: _this._element
- });
- var shownEvent = $__default['default'].Event(EVENT_SHOWN$3, {
- relatedTarget: previous
- });
- $__default['default'](previous).trigger(hiddenEvent);
- $__default['default'](_this._element).trigger(shownEvent);
- };
-
- if (target) {
- this._activate(target, target.parentNode, complete);
- } else {
- complete();
- }
- };
-
- _proto.dispose = function dispose() {
- $__default['default'].removeData(this._element, DATA_KEY$9);
- this._element = null;
- } // Private
- ;
-
- _proto._activate = function _activate(element, container, callback) {
- var _this2 = this;
-
- var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $__default['default'](container).find(SELECTOR_ACTIVE_UL) : $__default['default'](container).children(SELECTOR_ACTIVE$2);
- var active = activeElements[0];
- var isTransitioning = callback && active && $__default['default'](active).hasClass(CLASS_NAME_FADE$4);
-
- var complete = function complete() {
- return _this2._transitionComplete(element, active, callback);
- };
-
- if (active && isTransitioning) {
- var transitionDuration = Util.getTransitionDurationFromElement(active);
- $__default['default'](active).removeClass(CLASS_NAME_SHOW$6).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
- };
-
- _proto._transitionComplete = function _transitionComplete(element, active, callback) {
- if (active) {
- $__default['default'](active).removeClass(CLASS_NAME_ACTIVE$3);
- var dropdownChild = $__default['default'](active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0];
-
- if (dropdownChild) {
- $__default['default'](dropdownChild).removeClass(CLASS_NAME_ACTIVE$3);
- }
-
- if (active.getAttribute('role') === 'tab') {
- active.setAttribute('aria-selected', false);
- }
- }
-
- $__default['default'](element).addClass(CLASS_NAME_ACTIVE$3);
-
- if (element.getAttribute('role') === 'tab') {
- element.setAttribute('aria-selected', true);
- }
-
- Util.reflow(element);
-
- if (element.classList.contains(CLASS_NAME_FADE$4)) {
- element.classList.add(CLASS_NAME_SHOW$6);
- }
-
- if (element.parentNode && $__default['default'](element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) {
- var dropdownElement = $__default['default'](element).closest(SELECTOR_DROPDOWN$1)[0];
-
- if (dropdownElement) {
- var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE$1));
- $__default['default'](dropdownToggleList).addClass(CLASS_NAME_ACTIVE$3);
- }
-
- element.setAttribute('aria-expanded', true);
- }
-
- if (callback) {
- callback();
- }
- } // Static
- ;
-
- Tab._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var $this = $__default['default'](this);
- var data = $this.data(DATA_KEY$9);
-
- if (!data) {
- data = new Tab(this);
- $this.data(DATA_KEY$9, data);
- }
-
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
-
- data[config]();
- }
- });
- };
-
- _createClass(Tab, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$9;
- }
- }]);
-
- return Tab;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'](document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
- event.preventDefault();
-
- Tab._jQueryInterface.call($__default['default'](this), 'show');
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
- $__default['default'].fn[NAME$9] = Tab._jQueryInterface;
- $__default['default'].fn[NAME$9].Constructor = Tab;
-
- $__default['default'].fn[NAME$9].noConflict = function () {
- $__default['default'].fn[NAME$9] = JQUERY_NO_CONFLICT$9;
- return Tab._jQueryInterface;
- };
-
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
-
- var NAME$a = 'toast';
- var VERSION$a = '4.6.0';
- var DATA_KEY$a = 'bs.toast';
- var EVENT_KEY$a = "." + DATA_KEY$a;
- var JQUERY_NO_CONFLICT$a = $__default['default'].fn[NAME$a];
- var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
- var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
- var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
- var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
- var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
- var CLASS_NAME_FADE$5 = 'fade';
- var CLASS_NAME_HIDE = 'hide';
- var CLASS_NAME_SHOW$7 = 'show';
- var CLASS_NAME_SHOWING = 'showing';
- var DefaultType$7 = {
- animation: 'boolean',
- autohide: 'boolean',
- delay: 'number'
- };
- var Default$7 = {
- animation: true,
- autohide: true,
- delay: 500
- };
- var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
- var Toast = /*#__PURE__*/function () {
- function Toast(element, config) {
- this._element = element;
- this._config = this._getConfig(config);
- this._timeout = null;
-
- this._setListeners();
- } // Getters
-
-
- var _proto = Toast.prototype;
-
- // Public
- _proto.show = function show() {
- var _this = this;
-
- var showEvent = $__default['default'].Event(EVENT_SHOW$4);
- $__default['default'](this._element).trigger(showEvent);
-
- if (showEvent.isDefaultPrevented()) {
- return;
- }
-
- this._clearTimeout();
-
- if (this._config.animation) {
- this._element.classList.add(CLASS_NAME_FADE$5);
- }
-
- var complete = function complete() {
- _this._element.classList.remove(CLASS_NAME_SHOWING);
-
- _this._element.classList.add(CLASS_NAME_SHOW$7);
-
- $__default['default'](_this._element).trigger(EVENT_SHOWN$4);
-
- if (_this._config.autohide) {
- _this._timeout = setTimeout(function () {
- _this.hide();
- }, _this._config.delay);
- }
- };
-
- this._element.classList.remove(CLASS_NAME_HIDE);
-
- Util.reflow(this._element);
-
- this._element.classList.add(CLASS_NAME_SHOWING);
-
- if (this._config.animation) {
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
- };
-
- _proto.hide = function hide() {
- if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) {
- return;
- }
-
- var hideEvent = $__default['default'].Event(EVENT_HIDE$4);
- $__default['default'](this._element).trigger(hideEvent);
-
- if (hideEvent.isDefaultPrevented()) {
- return;
- }
-
- this._close();
- };
-
- _proto.dispose = function dispose() {
- this._clearTimeout();
-
- if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
- this._element.classList.remove(CLASS_NAME_SHOW$7);
- }
-
- $__default['default'](this._element).off(EVENT_CLICK_DISMISS$1);
- $__default['default'].removeData(this._element, DATA_KEY$a);
- this._element = null;
- this._config = null;
- } // Private
- ;
-
- _proto._getConfig = function _getConfig(config) {
- config = _extends({}, Default$7, $__default['default'](this._element).data(), typeof config === 'object' && config ? config : {});
- Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
- return config;
- };
-
- _proto._setListeners = function _setListeners() {
- var _this2 = this;
-
- $__default['default'](this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
- return _this2.hide();
- });
- };
-
- _proto._close = function _close() {
- var _this3 = this;
-
- var complete = function complete() {
- _this3._element.classList.add(CLASS_NAME_HIDE);
-
- $__default['default'](_this3._element).trigger(EVENT_HIDDEN$4);
- };
-
- this._element.classList.remove(CLASS_NAME_SHOW$7);
-
- if (this._config.animation) {
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
- };
-
- _proto._clearTimeout = function _clearTimeout() {
- clearTimeout(this._timeout);
- this._timeout = null;
- } // Static
- ;
-
- Toast._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var $element = $__default['default'](this);
- var data = $element.data(DATA_KEY$a);
-
- var _config = typeof config === 'object' && config;
-
- if (!data) {
- data = new Toast(this, _config);
- $element.data(DATA_KEY$a, data);
- }
-
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
-
- data[config](this);
- }
- });
- };
-
- _createClass(Toast, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$a;
- }
- }, {
- key: "DefaultType",
- get: function get() {
- return DefaultType$7;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$7;
- }
- }]);
-
- return Toast;
- }();
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
-
- $__default['default'].fn[NAME$a] = Toast._jQueryInterface;
- $__default['default'].fn[NAME$a].Constructor = Toast;
-
- $__default['default'].fn[NAME$a].noConflict = function () {
- $__default['default'].fn[NAME$a] = JQUERY_NO_CONFLICT$a;
- return Toast._jQueryInterface;
- };
-
- exports.Alert = Alert;
- exports.Button = Button;
- exports.Carousel = Carousel;
- exports.Collapse = Collapse;
- exports.Dropdown = Dropdown;
- exports.Modal = Modal;
- exports.Popover = Popover;
- exports.Scrollspy = ScrollSpy;
- exports.Tab = Tab;
- exports.Toast = Toast;
- exports.Tooltip = Tooltip;
- exports.Util = Util;
-
- Object.defineProperty(exports, '__esModule', { value: true });
-
- })));
-
- });
-
- const subscriber_queue = [];
- /**
- * Create a `Writable` store that allows both updating and reading by subscription.
- * @param {*=}value initial value
- * @param {StartStopNotifier=}start start and stop notifications for subscriptions
- */
- function writable(value, start = noop) {
- let stop;
- const subscribers = [];
- function set(new_value) {
- if (safe_not_equal(value, new_value)) {
- value = new_value;
- if (stop) { // store is ready
- const run_queue = !subscriber_queue.length;
- for (let i = 0; i < subscribers.length; i += 1) {
- const s = subscribers[i];
- s[1]();
- subscriber_queue.push(s, value);
- }
- if (run_queue) {
- for (let i = 0; i < subscriber_queue.length; i += 2) {
- subscriber_queue[i][0](subscriber_queue[i + 1]);
- }
- subscriber_queue.length = 0;
- }
- }
- }
- }
- function update(fn) {
- set(fn(value));
- }
- function subscribe(run, invalidate = noop) {
- const subscriber = [run, invalidate];
- subscribers.push(subscriber);
- if (subscribers.length === 1) {
- stop = start(set) || noop;
- }
- run(value);
- return () => {
- const index = subscribers.indexOf(subscriber);
- if (index !== -1) {
- subscribers.splice(index, 1);
- }
- if (subscribers.length === 0) {
- stop();
- stop = null;
- }
- };
- }
- return { set, update, subscribe };
- }
-
- const map_store = writable();
- const results_store = writable();
- const current_result_store = writable();
- const current_request_latlon = writable();
- const last_updated_store = writable();
-
- /* src/components/Header.svelte generated by Svelte v3.31.2 */
- const file = "src/components/Header.svelte";
-
- // (76:8) {#if last_updated}
- function create_if_block(ctx) {
- let div;
- let t0;
- let a0;
- let t1;
- let a0_href_value;
- let t2;
- let span0;
- let t3;
- let a1;
- let t4;
- let a1_href_value;
- let t5;
- let t6;
- let span1;
- let t7_value = /*last_updated*/ ctx[0].date + "";
- let t7;
-
- const block = {
- c: function create() {
- div = element("div");
- t0 = text("Data from ");
- a0 = element("a");
- t1 = text("API request");
- t2 = space();
- span0 = element("span");
- t3 = text("(");
- a1 = element("a");
- t4 = text("debug output");
- t5 = text(")");
- t6 = text("\n Data last updated: ");
- span1 = element("span");
- t7 = text(t7_value);
- attr_dev(a0, "href", a0_href_value = /*last_updated*/ ctx[0].api_request_url);
- attr_dev(a0, "class", "svelte-1hjkg8o");
- add_location(a0, file, 77, 22, 1413);
- attr_dev(a1, "href", a1_href_value = /*last_updated*/ ctx[0].api_request_url_debug);
- attr_dev(a1, "class", "svelte-1hjkg8o");
- add_location(a1, file, 78, 42, 1512);
- attr_dev(span0, "id", "api-request-debug");
- add_location(span0, file, 78, 12, 1482);
- attr_dev(div, "id", "api-request");
- add_location(div, file, 76, 10, 1368);
- attr_dev(span1, "id", "data-date");
- add_location(span1, file, 80, 29, 1630);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div, anchor);
- append_dev(div, t0);
- append_dev(div, a0);
- append_dev(a0, t1);
- append_dev(div, t2);
- append_dev(div, span0);
- append_dev(span0, t3);
- append_dev(span0, a1);
- append_dev(a1, t4);
- append_dev(span0, t5);
- insert_dev(target, t6, anchor);
- insert_dev(target, span1, anchor);
- append_dev(span1, t7);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*last_updated*/ 1 && a0_href_value !== (a0_href_value = /*last_updated*/ ctx[0].api_request_url)) {
- attr_dev(a0, "href", a0_href_value);
- }
-
- if (dirty & /*last_updated*/ 1 && a1_href_value !== (a1_href_value = /*last_updated*/ ctx[0].api_request_url_debug)) {
- attr_dev(a1, "href", a1_href_value);
- }
-
- if (dirty & /*last_updated*/ 1 && t7_value !== (t7_value = /*last_updated*/ ctx[0].date + "")) set_data_dev(t7, t7_value);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div);
- if (detaching) detach_dev(t6);
- if (detaching) detach_dev(span1);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block.name,
- type: "if",
- source: "(76:8) {#if last_updated}",
- ctx
- });
-
- return block;
- }
-
- function create_fragment(ctx) {
- let header;
- let div9;
- let div1;
- let div0;
- let a0;
- let img;
- let img_src_value;
- let t0;
- let h1;
- let t2;
- let div4;
- let div3;
- let div2;
- let t4;
- let t5;
- let div8;
- let div7;
- let button;
- let t7;
- let div6;
- let a1;
- let t9;
- let a2;
- let t11;
- let a3;
- let t13;
- let a4;
- let t15;
- let a5;
- let t17;
- let div5;
- let t18;
- let a6;
- let if_block = /*last_updated*/ ctx[0] && create_if_block(ctx);
-
- const block = {
- c: function create() {
- header = element("header");
- div9 = element("div");
- div1 = element("div");
- div0 = element("div");
- a0 = element("a");
- img = element("img");
- t0 = space();
- h1 = element("h1");
- h1.textContent = "Nominatim";
- t2 = space();
- div4 = element("div");
- div3 = element("div");
- div2 = element("div");
- div2.textContent = "loading...";
- t4 = space();
- if (if_block) if_block.c();
- t5 = space();
- div8 = element("div");
- div7 = element("div");
- button = element("button");
- button.textContent = "About & Help";
- t7 = space();
- div6 = element("div");
- a1 = element("a");
- a1.textContent = "API Reference";
- t9 = space();
- a2 = element("a");
- a2.textContent = "FAQ";
- t11 = space();
- a3 = element("a");
- a3.textContent = "OpenStreetMap Help";
- t13 = space();
- a4 = element("a");
- a4.textContent = "Nominatim on Github";
- t15 = space();
- a5 = element("a");
- a5.textContent = "This frontend on Github";
- t17 = space();
- div5 = element("div");
- t18 = space();
- a6 = element("a");
- a6.textContent = "Report problem with results";
- attr_dev(img, "alt", "logo");
- if (img.src !== (img_src_value = "images/osm_logo.120px.png")) attr_dev(img, "src", img_src_value);
- attr_dev(img, "width", "30");
- attr_dev(img, "height", "30");
- attr_dev(img, "class", "svelte-1hjkg8o");
- add_location(img, file, 67, 10, 1075);
- attr_dev(h1, "class", "svelte-1hjkg8o");
- add_location(h1, file, 68, 10, 1158);
- attr_dev(a0, "href", "search.html");
- attr_dev(a0, "class", "svelte-1hjkg8o");
- add_location(a0, file, 66, 8, 1042);
- attr_dev(div0, "class", "brand svelte-1hjkg8o");
- add_location(div0, file, 65, 6, 1014);
- attr_dev(div1, "class", "col-4");
- add_location(div1, file, 64, 4, 988);
- attr_dev(div2, "id", "loading");
- attr_dev(div2, "class", "svelte-1hjkg8o");
- add_location(div2, file, 74, 8, 1296);
- attr_dev(div3, "id", "last-updated");
- attr_dev(div3, "class", "text-center svelte-1hjkg8o");
- add_location(div3, file, 73, 6, 1244);
- attr_dev(div4, "class", "col-4");
- add_location(div4, file, 72, 4, 1218);
- attr_dev(button, "class", "dropdown-toggle btn btn-sm btn-outline-secondary");
- attr_dev(button, "data-toggle", "dropdown");
- attr_dev(button, "role", "button");
- attr_dev(button, "aria-haspopup", "true");
- attr_dev(button, "aria-expanded", "false");
- add_location(button, file, 86, 8, 1788);
- attr_dev(a1, "class", "dropdown-item svelte-1hjkg8o");
- attr_dev(a1, "href", "https://nominatim.org/release-docs/develop/api/Overview/");
- attr_dev(a1, "target", "_blank");
- add_location(a1, file, 90, 10, 2045);
- attr_dev(a2, "class", "dropdown-item svelte-1hjkg8o");
- attr_dev(a2, "href", "https://nominatim.org/release-docs/develop/api/Faq/");
- attr_dev(a2, "target", "_blank");
- add_location(a2, file, 91, 10, 2178);
- attr_dev(a3, "class", "dropdown-item svelte-1hjkg8o");
- attr_dev(a3, "href", "https://help.openstreetmap.org/tags/nominatim/");
- add_location(a3, file, 92, 10, 2296);
- attr_dev(a4, "class", "dropdown-item svelte-1hjkg8o");
- attr_dev(a4, "href", "https://github.com/osm-search/Nominatim");
- add_location(a4, file, 93, 10, 2408);
- attr_dev(a5, "class", "dropdown-item svelte-1hjkg8o");
- attr_dev(a5, "href", "https://github.com/osm-search/nominatim-ui");
- add_location(a5, file, 94, 10, 2514);
- attr_dev(div5, "class", "dropdown-divider");
- add_location(div5, file, 95, 10, 2627);
- attr_dev(a6, "class", "dropdown-item svelte-1hjkg8o");
- attr_dev(a6, "href", "#");
- attr_dev(a6, "data-toggle", "modal");
- attr_dev(a6, "data-target", "#report-modal");
- add_location(a6, file, 96, 10, 2674);
- attr_dev(div6, "class", "dropdown-menu dropdown-menu-right svelte-1hjkg8o");
- add_location(div6, file, 89, 8, 1987);
- attr_dev(div7, "class", "dropdown");
- add_location(div7, file, 85, 6, 1757);
- attr_dev(div8, "class", "col-4 text-right");
- add_location(div8, file, 84, 4, 1720);
- attr_dev(div9, "class", "row");
- add_location(div9, file, 63, 2, 966);
- attr_dev(header, "class", "container-fluid svelte-1hjkg8o");
- add_location(header, file, 62, 0, 931);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- insert_dev(target, header, anchor);
- append_dev(header, div9);
- append_dev(div9, div1);
- append_dev(div1, div0);
- append_dev(div0, a0);
- append_dev(a0, img);
- append_dev(a0, t0);
- append_dev(a0, h1);
- append_dev(div9, t2);
- append_dev(div9, div4);
- append_dev(div4, div3);
- append_dev(div3, div2);
- append_dev(div3, t4);
- if (if_block) if_block.m(div3, null);
- append_dev(div9, t5);
- append_dev(div9, div8);
- append_dev(div8, div7);
- append_dev(div7, button);
- append_dev(div7, t7);
- append_dev(div7, div6);
- append_dev(div6, a1);
- append_dev(div6, t9);
- append_dev(div6, a2);
- append_dev(div6, t11);
- append_dev(div6, a3);
- append_dev(div6, t13);
- append_dev(div6, a4);
- append_dev(div6, t15);
- append_dev(div6, a5);
- append_dev(div6, t17);
- append_dev(div6, div5);
- append_dev(div6, t18);
- append_dev(div6, a6);
- },
- p: function update(ctx, [dirty]) {
- if (/*last_updated*/ ctx[0]) {
- if (if_block) {
- if_block.p(ctx, dirty);
- } else {
- if_block = create_if_block(ctx);
- if_block.c();
- if_block.m(div3, null);
- }
- } else if (if_block) {
- if_block.d(1);
- if_block = null;
- }
- },
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(header);
- if (if_block) if_block.d();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("Header", slots, []);
- let last_updated;
-
- last_updated_store.subscribe(data => {
- if (!data) {
- return;
- }
-
- $$invalidate(0, last_updated = data);
- });
-
- const writable_props = [];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Header> was created with unknown prop '${key}'`);
- });
-
- $$self.$capture_state = () => ({ last_updated_store, last_updated });
-
- $$self.$inject_state = $$props => {
- if ("last_updated" in $$props) $$invalidate(0, last_updated = $$props.last_updated);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [last_updated];
- }
-
- class Header extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance, create_fragment, safe_not_equal, {});
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "Header",
- options,
- id: create_fragment.name
- });
- }
- }
-
- /* src/components/Footer.svelte generated by Svelte v3.31.2 */
-
- const file$1 = "src/components/Footer.svelte";
-
- function create_fragment$1(ctx) {
- let footer;
- let p0;
- let t1;
- let p1;
- let t2;
- let a;
- let t4;
-
- const block = {
- c: function create() {
- footer = element("footer");
- p0 = element("p");
- p0.textContent = "Addresses and postcodes are approximate";
- t1 = space();
- p1 = element("p");
- t2 = text("© ");
- a = element("a");
- a.textContent = "OpenStreetMap";
- t4 = text(" contributors");
- attr_dev(p0, "class", "disclaimer svelte-1f2bd8l");
- add_location(p0, file$1, 12, 2, 141);
- attr_dev(a, "href", "https://osm.org/copyright");
- add_location(a, file$1, 16, 11, 250);
- attr_dev(p1, "class", "copyright svelte-1f2bd8l");
- add_location(p1, file$1, 15, 2, 217);
- attr_dev(footer, "class", "svelte-1f2bd8l");
- add_location(footer, file$1, 11, 0, 130);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- insert_dev(target, footer, anchor);
- append_dev(footer, p0);
- append_dev(footer, t1);
- append_dev(footer, p1);
- append_dev(p1, t2);
- append_dev(p1, a);
- append_dev(p1, t4);
- },
- p: noop,
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(footer);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$1.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance$1($$self, $$props) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("Footer", slots, []);
- const writable_props = [];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Footer> was created with unknown prop '${key}'`);
- });
-
- return [];
- }
-
- class Footer extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$1, create_fragment$1, safe_not_equal, {});
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "Footer",
- options,
- id: create_fragment$1.name
- });
- }
- }
-
- /* src/App.svelte generated by Svelte v3.31.2 */
- const file$2 = "src/App.svelte";
-
- function create_fragment$2(ctx) {
- let header;
- let t0;
- let div;
- let t1;
- let footer;
- let current;
- header = new Header({ $$inline: true });
- footer = new Footer({ $$inline: true });
-
- const block = {
- c: function create() {
- create_component(header.$$.fragment);
- t0 = space();
- div = element("div");
- t1 = space();
- create_component(footer.$$.fragment);
- attr_dev(div, "id", "main");
- add_location(div, file$2, 10, 0, 297);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- mount_component(header, target, anchor);
- insert_dev(target, t0, anchor);
- insert_dev(target, div, anchor);
- insert_dev(target, t1, anchor);
- mount_component(footer, target, anchor);
- current = true;
- },
- p: noop,
- i: function intro(local) {
- if (current) return;
- transition_in(header.$$.fragment, local);
- transition_in(footer.$$.fragment, local);
- current = true;
- },
- o: function outro(local) {
- transition_out(header.$$.fragment, local);
- transition_out(footer.$$.fragment, local);
- current = false;
- },
- d: function destroy(detaching) {
- destroy_component(header, detaching);
- if (detaching) detach_dev(t0);
- if (detaching) detach_dev(div);
- if (detaching) detach_dev(t1);
- destroy_component(footer, detaching);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$2.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance$2($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("App", slots, []);
- const writable_props = [];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<App> was created with unknown prop '${key}'`);
- });
-
- $$self.$capture_state = () => ({ jquery: jquery$1, Header, Footer });
- return [];
- }
-
- class App extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$2, create_fragment$2, safe_not_equal, {});
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "App",
- options,
- id: create_fragment$2.name
- });
- }
- }
-
- var get_config_value_1 = get_config_value;
-
-
- const Nominatim_Config_Defaults = {
- Nominatim_API_Endpoint: 'http://localhost/nominatim/',
- Images_Base_Url: 'mapicons/',
- Search_AreaPolygons: 1,
- Reverse_Default_Search_Zoom: 18,
- Map_Default_Lat: 20.0,
- Map_Default_Lon: 0.0,
- Map_Default_Zoom: 2,
- Map_Tile_URL: 'https://{s}.tile.osm.org/{z}/{x}/{y}.png',
- Map_Tile_Attribution: '<a href="https://osm.org/copyright">OpenStreetMap contributors</a>'
- };
-
- function get_config_value(str, default_val) {
- var value = ((typeof Nominatim_Config !== 'undefined')
- && (typeof Nominatim_Config[str] !== 'undefined'))
- ? Nominatim_Config[str]
- : Nominatim_Config_Defaults[str];
- return (typeof value !== 'undefined' ? value : default_val);
- }
-
- async function fetch_from_api(endpoint_name, params, callback) {
- var api_url = generate_nominatim_api_url(endpoint_name, params);
-
- document.getElementById('loading').style.display = 'block';
- await fetch(api_url)
- .then(response => response.json())
- .then(data => {
- callback(data);
- document.getElementById('loading').style.display = 'none';
- });
-
-
- fetch(generate_nominatim_api_url('status', {format: 'json'}))
- .then(response => response.json())
- .then(data => {
- let last_updated = {
- api_request_url: api_url,
- api_request_url_debug: api_url + '&debug=1',
- date: data.data_updated
- };
- last_updated_store.set(last_updated);
- });
- }
-
- function generate_nominatim_api_url(endpoint_name, params) {
- return get_config_value_1('Nominatim_API_Endpoint') + endpoint_name + '.php?'
- + Object.keys(clean_up_parameters(params)).map( (k) => {
- return encodeURIComponent(k) + '=' + encodeURIComponent(params[k])
- }).join('&');
- }
-
- /*!
- * Serialize all form data into a SearchParams string
- * (c) 2020 Chris Ferdinandi, MIT License, https://gomakethings.com
- * @param {Node} form The form to serialize
- * @return {String} The serialized form data
- */
- function serialize_form(form) {
- var arr = [];
- Array.prototype.slice.call(form.elements).forEach(function (field) {
- if (!field.name || field.disabled || ['file', 'reset', 'submit', 'button'].indexOf(field.type) > -1) return;
- // if (field.type === 'select-multiple') {
- // Array.prototype.slice.call(field.options).forEach(function (option) {
- // if (!option.selected) return;
- // arr.push(encodeURIComponent(field.name) + '=' + encodeURIComponent(option.value));
- // });
- // return;
- // }
- if (['checkbox', 'radio'].indexOf(field.type) >-1 && !field.checked) return;
- if (typeof(field.value) === 'undefined') return;
- arr.push(encodeURIComponent(field.name) + '=' + encodeURIComponent(field.value));
- });
- return arr.join('&');
- }
-
- // remove any URL paramters with empty values
- // '&empty=&filled=value' => 'filled=value'
- function clean_up_url_parameters(url) {
- var url_params = new URLSearchParams(url);
- var to_delete = []; // deleting inside loop would skip iterations
- url_params.forEach(function (value, key) {
- if (value === '') to_delete.push(key);
- });
- for (var i = 0; i < to_delete.length; i += 1) {
- url_params.delete(to_delete[i]);
- }
- return url_params.toString();
- }
-
- function clean_up_parameters(params) {
- // `&a=&b=&c=1` => '&c=1'
- var param_names = Object.keys(params);
- for (var i = 0; i < param_names.length; i += 1) {
- var val = params[param_names[i]];
- if (typeof (val) === 'undefined' || val === '' || val === null) {
- delete params[param_names[i]];
- }
- }
- return params;
- }
-
- function update_html_title(title) {
- document.title = [title, 'OpenStreetMap Nominatim']
- .filter( (val) => val && val.length > 1 )
- .join(' | ');
- }
-
- /*!
- * escape-html
- * Copyright(c) 2012-2013 TJ Holowaychuk
- * Copyright(c) 2015 Andreas Lubbe
- * Copyright(c) 2015 Tiancheng "Timothy" Gu
- * MIT Licensed
- */
-
- /**
- * Module variables.
- * @private
- */
-
- var matchHtmlRegExp = /["'&<>]/;
-
- /**
- * Module exports.
- * @public
- */
-
- var escapeHtml_1 = escapeHtml;
-
- /**
- * Escape special characters in the given string of html.
- *
- * @param {string} string The string to escape for inserting into HTML
- * @return {string}
- * @public
- */
-
- function escapeHtml(string) {
- var str = '' + string;
- var match = matchHtmlRegExp.exec(str);
-
- if (!match) {
- return str;
- }
-
- var escape;
- var html = '';
- var index = 0;
- var lastIndex = 0;
-
- for (index = match.index; index < str.length; index++) {
- switch (str.charCodeAt(index)) {
- case 34: // "
- escape = '"';
- break;
- case 38: // &
- escape = '&';
- break;
- case 39: // '
- escape = ''';
- break;
- case 60: // <
- escape = '<';
- break;
- case 62: // >
- escape = '>';
- break;
- default:
- continue;
- }
-
- if (lastIndex !== index) {
- html += str.substring(lastIndex, index);
- }
-
- lastIndex = index + 1;
- html += escape;
- }
-
- return lastIndex !== index
- ? html + str.substring(lastIndex, index)
- : html;
- }
-
- var formatOSMType_1 = formatOSMType;
- var osmLink_1 = osmLink;
- var formatLabel_1 = formatLabel;
- var detailsURL_1 = detailsURL;
- var wikipediaLink_1 = wikipediaLink;
- var coverageType_1 = coverageType;
- var isAdminBoundary_1 = isAdminBoundary;
- var formatAddressRank_1 = formatAddressRank;
- var formatPlaceType_1 = formatPlaceType;
- var formatAdminLevel_1 = formatAdminLevel;
- var formatDistance_1 = formatDistance;
- var formatKeywordToken_1 = formatKeywordToken;
- var zoomLevels_1 = zoomLevels;
-
-
-
- function formatOSMType(sType, bExcludeExternal) {
- if (sType === 'N') return 'node';
- if (sType === 'W') return 'way';
- if (sType === 'R') return 'relation';
-
- if (!bExcludeExternal) return '';
-
- if (sType === 'T') return 'way';
- if (sType === 'I') return 'way';
-
- return '';
- }
-
- function formatShortOSMType(sType) {
- if (sType === 'node') return 'N';
- if (sType === 'way') return 'W';
- if (sType === 'relation') return 'R';
- return '';
- }
-
- function osmLink(aPlace) {
- if (!aPlace.osm_type) return '';
- var sOSMType = formatOSMType(aPlace.osm_type, false);
- if (!sOSMType) return '';
-
- return '<a href="https://www.openstreetmap.org/' + sOSMType + '/' + aPlace.osm_id + '">' + sOSMType + ' ' + aPlace.osm_id + '</a>'
- }
-
- function formatLabel(aPlace) {
- if (aPlace.label) return aPlace.label;
-
- function capitalize(s) {
- return s && s[0].toUpperCase() + s.slice(1);
- }
-
- if (aPlace.type && aPlace.type === 'yes' && aPlace.class) {
- return capitalize(aPlace.class.replace(/_/g, ' '));
- }
- if (aPlace.type) {
- return capitalize(aPlace.type.replace(/_/g, ' '));
- }
- return '';
- }
-
- // 'details.html?osmtype=R&osmid=2181874&class=boundary'
- function detailsURL(aFeature) {
- if (!aFeature) return '';
-
- var sOSMType = aFeature.osm_type;
- if (sOSMType && sOSMType.length !== 1) {
- sOSMType = formatShortOSMType(aFeature.osm_type); // node => N
- }
- if (!sOSMType) return '';
-
- var sURL = 'details.html?osmtype=' + sOSMType + '&osmid=' + aFeature.osm_id;
- if (aFeature.class) {
- sURL = sURL + '&class=' + encodeURIComponent(aFeature.class);
- } else if (aFeature.category) {
- sURL = sURL + '&class=' +encodeURIComponent(aFeature.category);
- }
- return sURL;
- }
-
- /* en:London_Borough_of_Redbridge => https://en.wikipedia.org/wiki/London_Borough_of_Redbridge */
- function wikipediaLink(aPlace) {
- if (!aPlace.calculated_wikipedia) return '';
-
- var parts = aPlace.calculated_wikipedia.split(':', 2);
-
- var sTitle = escapeHtml_1(aPlace.calculated_wikipedia);
- var sLanguage = escapeHtml_1(parts[0]);
- var sArticle = escapeHtml_1(parts[1]);
-
- return '<a href="https://' + sLanguage + '.wikipedia.org/wiki/' + sArticle + '" target="_blank">' + sTitle + '</a>';
- }
-
- function coverageType(aPlace) {
- return (aPlace.isarea ? 'Polygon' : 'Point');
- }
-
- function isAdminBoundary(aPlace) {
- return aPlace.category === 'boundary' && aPlace.type === 'administrative';
- }
-
- function formatAddressRank(iRank) {
- if (iRank < 4) return 'other';
- if (iRank < 6) return 'country';
- if (iRank < 8) return 'region';
- if (iRank < 10) return 'state';
- if (iRank < 12) return 'state district';
- if (iRank < 14) return 'county';
- if (iRank < 16) return 'municipality';
- if (iRank < 18) return 'city / town / village';
- if (iRank < 20) return 'city / village district';
- if (iRank < 22) return 'suburb / hamlet';
- if (iRank < 24) return 'neighbourhood';
- if (iRank < 26) return 'city block / square';
- if (iRank === 26) return 'major street';
- if (iRank === 27) return 'minory street / path';
- if (iRank <= 30) return 'house / building';
- return 'other';
- }
-
- function formatPlaceType(aPlace) {
- var sOut = aPlace.class + ':' + aPlace.type;
- if (aPlace.type && aPlace.type === 'administrative' && aPlace.place_type) {
- sOut = sOut + ' (' + aPlace.place_type + ')';
- }
- return escapeHtml_1(sOut);
- }
-
- // Any over 15 are invalid data in OSM anyway
- function formatAdminLevel(iLevel) {
- return (iLevel < 15 ? iLevel : '');
- }
-
- function formatDistance(fDistance, bInMeters) {
- if (bInMeters) {
- if (fDistance < 1) return '0';
- var sFormatted = (fDistance >= 1000)
- ? Math.round(fDistance / 1000, 1) + ' km'
- : Math.round(fDistance, 0) + ' m';
-
- return '<abbr class="distance" title="' + fDistance + ' meters">~' + sFormatted + '</abbr>';
- }
-
- // spheric distance, http://postgis.net/docs/ST_Distance_Spheroid.html
- if (fDistance === 0) return '0';
-
- return '<abbr class="distance" title="spheric distance ' + fDistance + '">~'
- + (Math.round(fDistance * 1000, 4) / 1000)
- + '</abbr>';
- }
-
- // mark partial tokens (those starting with a space) with a star for readability
- function formatKeywordToken(sToken) {
- return (sToken[0] === ' ' ? '*' : '') + escapeHtml_1(sToken);
- }
-
- function zoomLevels() {
- const aZoomLevels = [
- /* 0 */ 'Continent / Sea',
- /* 1 */ '',
- /* 2 */ '',
- /* 3 */ 'Country',
- /* 4 */ '',
- /* 5 */ 'State',
- /* 6 */ 'Region',
- /* 7 */ '',
- /* 8 */ 'County',
- /* 9 */ '',
- /* 10 */ 'City',
- /* 11 */ '',
- /* 12 */ 'Town / Village',
- /* 13 */ '',
- /* 14 */ 'Suburb',
- /* 15 */ '',
- /* 16 */ 'Street',
- /* 17 */ '',
- /* 18 */ 'Building',
- /* 19 */ '',
- /* 20 */ '',
- /* 21 */ ''
- ];
- return aZoomLevels;
-
- }
-
- /* src/components/SearchBar.svelte generated by Svelte v3.31.2 */
-
- const { console: console_1 } = globals;
- const file$3 = "src/components/SearchBar.svelte";
-
- function get_each_context(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[6] = list[i];
- child_ctx[8] = i;
- return child_ctx;
- }
-
- // (129:0) {:else}
- function create_else_block(ctx) {
- let div11;
- let ul;
- let li0;
- let a0;
- let t1;
- let li1;
- let a1;
- let t3;
- let div0;
- let a2;
- let t5;
- let a3;
- let t7;
- let div10;
- let div2;
- let form0;
- let input0;
- let input0_value_value;
- let t8;
- let div1;
- let button0;
- let t10;
- let input1;
- let input1_value_value;
- let t11;
- let input2;
- let input2_value_value;
- let t12;
- let input3;
- let input3_value_value;
- let t13;
- let input4;
- let input4_value_value;
- let t14;
- let input5;
- let input5_value_value;
- let t15;
- let input6;
- let input6_value_value;
- let t16;
- let input7;
- let input7_value_value;
- let t17;
- let div4;
- let form1;
- let input8;
- let input8_value_value;
- let t18;
- let input9;
- let input9_value_value;
- let t19;
- let input10;
- let input10_value_value;
- let t20;
- let input11;
- let input11_value_value;
- let t21;
- let input12;
- let input12_value_value;
- let t22;
- let input13;
- let input13_value_value;
- let t23;
- let div3;
- let button1;
- let t25;
- let input14;
- let input14_value_value;
- let t26;
- let input15;
- let input15_value_value;
- let t27;
- let input16;
- let input16_value_value;
- let t28;
- let input17;
- let input17_value_value;
- let t29;
- let input18;
- let input18_value_value;
- let t30;
- let input19;
- let input19_value_value;
- let t31;
- let input20;
- let input20_value_value;
- let t32;
- let a4;
- let t34;
- let div9;
- let div8;
- let div5;
- let span0;
- let input21;
- let input21_checked_value;
- let t35;
- let label0;
- let t37;
- let span1;
- let input22;
- let input22_checked_value;
- let t38;
- let label1;
- let t40;
- let span2;
- let input23;
- let input23_checked_value;
- let t41;
- let label2;
- let t43;
- let div6;
- let span3;
- let label3;
- let t45;
- let input24;
- let input24_value_value;
- let t46;
- let span4;
- let label4;
- let t48;
- let input25;
- let input25_value_value;
- let t49;
- let div7;
- let span5;
- let label5;
- let t51;
- let input26;
- let input26_value_value;
- let t52;
- let span6;
- let label6;
- let t54;
- let input27;
- let input27_value_value;
- let mounted;
- let dispose;
-
- const block = {
- c: function create() {
- div11 = element("div");
- ul = element("ul");
- li0 = element("li");
- a0 = element("a");
- a0.textContent = "simple";
- t1 = space();
- li1 = element("li");
- a1 = element("a");
- a1.textContent = "structured";
- t3 = space();
- div0 = element("div");
- a2 = element("a");
- a2.textContent = "search by id";
- t5 = space();
- a3 = element("a");
- a3.textContent = "reverse search";
- t7 = space();
- div10 = element("div");
- div2 = element("div");
- form0 = element("form");
- input0 = element("input");
- t8 = space();
- div1 = element("div");
- button0 = element("button");
- button0.textContent = "Search";
- t10 = space();
- input1 = element("input");
- t11 = space();
- input2 = element("input");
- t12 = space();
- input3 = element("input");
- t13 = space();
- input4 = element("input");
- t14 = space();
- input5 = element("input");
- t15 = space();
- input6 = element("input");
- t16 = space();
- input7 = element("input");
- t17 = space();
- div4 = element("div");
- form1 = element("form");
- input8 = element("input");
- t18 = space();
- input9 = element("input");
- t19 = space();
- input10 = element("input");
- t20 = space();
- input11 = element("input");
- t21 = space();
- input12 = element("input");
- t22 = space();
- input13 = element("input");
- t23 = space();
- div3 = element("div");
- button1 = element("button");
- button1.textContent = "Search";
- t25 = space();
- input14 = element("input");
- t26 = space();
- input15 = element("input");
- t27 = space();
- input16 = element("input");
- t28 = space();
- input17 = element("input");
- t29 = space();
- input18 = element("input");
- t30 = space();
- input19 = element("input");
- t31 = space();
- input20 = element("input");
- t32 = space();
- a4 = element("a");
- a4.textContent = "Advanced options";
- t34 = space();
- div9 = element("div");
- div8 = element("div");
- div5 = element("div");
- span0 = element("span");
- input21 = element("input");
- t35 = space();
- label0 = element("label");
- label0.textContent = "apply viewbox";
- t37 = space();
- span1 = element("span");
- input22 = element("input");
- t38 = space();
- label1 = element("label");
- label1.textContent = "bounded to viewbox";
- t40 = space();
- span2 = element("span");
- input23 = element("input");
- t41 = space();
- label2 = element("label");
- label2.textContent = "deduplicate results";
- t43 = space();
- div6 = element("div");
- span3 = element("span");
- label3 = element("label");
- label3.textContent = "Maximum number of results:";
- t45 = space();
- input24 = element("input");
- t46 = space();
- span4 = element("span");
- label4 = element("label");
- label4.textContent = "Polygon simplification:";
- t48 = space();
- input25 = element("input");
- t49 = space();
- div7 = element("div");
- span5 = element("span");
- label5 = element("label");
- label5.textContent = "Languages:";
- t51 = space();
- input26 = element("input");
- t52 = space();
- span6 = element("span");
- label6 = element("label");
- label6.textContent = "Countries:";
- t54 = space();
- input27 = element("input");
- attr_dev(a0, "class", "nav-link");
- attr_dev(a0, "data-toggle", "tab");
- attr_dev(a0, "href", "#simple");
- toggle_class(a0, "active", !/*bStructuredSearch*/ ctx[0]);
- add_location(a0, file$3, 133, 8, 4140);
- attr_dev(li0, "class", "nav-item");
- add_location(li0, file$3, 132, 6, 4110);
- attr_dev(a1, "class", "nav-link");
- attr_dev(a1, "data-toggle", "tab");
- attr_dev(a1, "href", "#structured");
- toggle_class(a1, "active", /*bStructuredSearch*/ ctx[0]);
- add_location(a1, file$3, 136, 8, 4286);
- attr_dev(li1, "class", "nav-item");
- add_location(li1, file$3, 135, 6, 4256);
- attr_dev(a2, "href", "details.html");
- attr_dev(a2, "class", "mr-2");
- add_location(a2, file$3, 139, 8, 4448);
- attr_dev(a3, "id", "switch-to-reverse");
- attr_dev(a3, "href", "reverse.html");
- add_location(a3, file$3, 140, 8, 4509);
- attr_dev(div0, "class", "search-type-link svelte-i44z6l");
- add_location(div0, file$3, 138, 6, 4409);
- attr_dev(ul, "class", "nav nav-tabs");
- add_location(ul, file$3, 131, 4, 4078);
- attr_dev(input0, "id", "q");
- attr_dev(input0, "name", "q");
- attr_dev(input0, "type", "text");
- attr_dev(input0, "class", "form-control form-control-sm svelte-i44z6l");
- attr_dev(input0, "placeholder", "Search");
- input0.value = input0_value_value = /*api_request_params*/ ctx[2].q || "";
- add_location(input0, file$3, 146, 10, 4814);
- attr_dev(button0, "type", "submit");
- attr_dev(button0, "class", "btn btn-primary btn-sm mx-1");
- add_location(button0, file$3, 154, 12, 5100);
- attr_dev(input1, "type", "hidden");
- attr_dev(input1, "name", "viewbox");
- input1.value = input1_value_value = /*sViewBox*/ ctx[3] || "";
- add_location(input1, file$3, 155, 12, 5186);
- attr_dev(input2, "type", "hidden");
- attr_dev(input2, "name", "dedupe");
- input2.value = input2_value_value = !/*api_request_params*/ ctx[2].dedupe ? "" : 1;
- add_location(input2, file$3, 156, 12, 5262);
- attr_dev(input3, "type", "hidden");
- attr_dev(input3, "name", "bounded");
- input3.value = input3_value_value = /*api_request_params*/ ctx[2].bounded ? 1 : "";
- add_location(input3, file$3, 157, 12, 5358);
- attr_dev(input4, "type", "hidden");
- attr_dev(input4, "name", "accept-language");
- input4.value = input4_value_value = /*api_request_params*/ ctx[2]["accept-language"] || "";
- add_location(input4, file$3, 158, 12, 5455);
- attr_dev(input5, "type", "hidden");
- attr_dev(input5, "name", "countrycodes");
- input5.value = input5_value_value = /*api_request_params*/ ctx[2].countrycodes || "";
- add_location(input5, file$3, 159, 12, 5568);
- attr_dev(input6, "type", "hidden");
- attr_dev(input6, "name", "limit");
- input6.value = input6_value_value = /*api_request_params*/ ctx[2].limit || "";
- add_location(input6, file$3, 160, 12, 5672);
- attr_dev(input7, "type", "hidden");
- attr_dev(input7, "name", "polygon_threshold");
- input7.value = input7_value_value = /*api_request_params*/ ctx[2].polygon_threshold || "";
- add_location(input7, file$3, 161, 12, 5762);
- attr_dev(div1, "class", "form-group search-button-group svelte-i44z6l");
- add_location(div1, file$3, 153, 10, 5043);
- attr_dev(form0, "class", "form-inline svelte-i44z6l");
- attr_dev(form0, "role", "search");
- attr_dev(form0, "accept-charset", "UTF-8");
- attr_dev(form0, "action", "");
- add_location(form0, file$3, 145, 8, 4730);
- attr_dev(div2, "class", "tab-pane");
- attr_dev(div2, "id", "simple");
- attr_dev(div2, "role", "tabpanel");
- toggle_class(div2, "active", !/*bStructuredSearch*/ ctx[0]);
- add_location(div2, file$3, 144, 6, 4637);
- attr_dev(input8, "name", "street");
- attr_dev(input8, "type", "text");
- attr_dev(input8, "class", "form-control form-control-sm mr-1");
- attr_dev(input8, "placeholder", "House number/Street");
- input8.value = input8_value_value = /*api_request_params*/ ctx[2].street || "";
- add_location(input8, file$3, 167, 10, 6096);
- attr_dev(input9, "name", "city");
- attr_dev(input9, "type", "text");
- attr_dev(input9, "class", "form-control form-control-sm mr-1");
- attr_dev(input9, "placeholder", "City");
- input9.value = input9_value_value = /*api_request_params*/ ctx[2].city || "";
- add_location(input9, file$3, 170, 10, 6294);
- attr_dev(input10, "id", "county");
- attr_dev(input10, "name", "county");
- attr_dev(input10, "type", "text");
- attr_dev(input10, "class", "form-control form-control-sm mr-1");
- attr_dev(input10, "placeholder", "County");
- input10.value = input10_value_value = /*api_request_params*/ ctx[2].county || "";
- add_location(input10, file$3, 173, 10, 6473);
- attr_dev(input11, "name", "state");
- attr_dev(input11, "type", "text");
- attr_dev(input11, "class", "form-control form-control-sm mr-1");
- attr_dev(input11, "placeholder", "State");
- input11.value = input11_value_value = /*api_request_params*/ ctx[2].state || "";
- add_location(input11, file$3, 176, 10, 6670);
- attr_dev(input12, "name", "country");
- attr_dev(input12, "type", "text");
- attr_dev(input12, "class", "form-control form-control-sm mr-1");
- attr_dev(input12, "placeholder", "Country");
- input12.value = input12_value_value = /*api_request_params*/ ctx[2].country || "";
- add_location(input12, file$3, 179, 10, 6852);
- attr_dev(input13, "name", "postalcode");
- attr_dev(input13, "type", "text");
- attr_dev(input13, "class", "form-control form-control-sm mr-1");
- attr_dev(input13, "placeholder", "Postal Code");
- input13.value = input13_value_value = /*api_request_params*/ ctx[2].postalcode || "";
- add_location(input13, file$3, 182, 10, 7040);
- attr_dev(button1, "type", "submit");
- attr_dev(button1, "class", "btn btn-primary btn-sm mx-1");
- add_location(button1, file$3, 187, 12, 7296);
- attr_dev(input14, "type", "hidden");
- attr_dev(input14, "name", "viewbox");
- input14.value = input14_value_value = /*sViewBox*/ ctx[3] || "";
- add_location(input14, file$3, 188, 12, 7382);
- attr_dev(input15, "type", "hidden");
- attr_dev(input15, "name", "dedupe");
- input15.value = input15_value_value = !/*api_request_params*/ ctx[2].dedupe ? "" : 1;
- add_location(input15, file$3, 189, 12, 7458);
- attr_dev(input16, "type", "hidden");
- attr_dev(input16, "name", "bounded");
- input16.value = input16_value_value = /*api_request_params*/ ctx[2].bounded ? 1 : "";
- add_location(input16, file$3, 190, 12, 7554);
- attr_dev(input17, "type", "hidden");
- attr_dev(input17, "name", "accept-language");
- input17.value = input17_value_value = /*api_request_params*/ ctx[2]["accept-language"] || "";
- add_location(input17, file$3, 191, 12, 7651);
- attr_dev(input18, "type", "hidden");
- attr_dev(input18, "name", "countrycodes");
- input18.value = input18_value_value = /*api_request_params*/ ctx[2].countrycodes || "";
- add_location(input18, file$3, 192, 12, 7764);
- attr_dev(input19, "type", "hidden");
- attr_dev(input19, "name", "limit");
- input19.value = input19_value_value = /*api_request_params*/ ctx[2].limit || "";
- add_location(input19, file$3, 193, 12, 7868);
- attr_dev(input20, "type", "hidden");
- attr_dev(input20, "name", "polygon_threshold");
- input20.value = input20_value_value = /*api_request_params*/ ctx[2].polygon_threshold || "";
- add_location(input20, file$3, 194, 12, 7958);
- attr_dev(div3, "class", "form-group search-button-group svelte-i44z6l");
- add_location(div3, file$3, 186, 10, 7239);
- attr_dev(form1, "class", "form-inline");
- attr_dev(form1, "role", "search");
- attr_dev(form1, "accept-charset", "UTF-8");
- attr_dev(form1, "action", "");
- add_location(form1, file$3, 166, 8, 6012);
- attr_dev(div4, "class", "tab-pane");
- attr_dev(div4, "id", "structured");
- attr_dev(div4, "role", "tabpanel");
- toggle_class(div4, "active", /*bStructuredSearch*/ ctx[0]);
- add_location(div4, file$3, 165, 6, 5916);
- attr_dev(a4, "href", "#advanced");
- attr_dev(a4, "class", "btn btn-outline-secondary btn-sm");
- attr_dev(a4, "data-toggle", "collapse");
- attr_dev(a4, "data-target", "#searchAdvancedOptions");
- attr_dev(a4, "role", "button");
- attr_dev(a4, "aria-expanded", "false");
- attr_dev(a4, "aria-controls", "collapseAdvancedOptions");
- add_location(a4, file$3, 199, 6, 8146);
- attr_dev(input21, "type", "checkbox");
- attr_dev(input21, "class", "form-check-input api-param-setting");
- attr_dev(input21, "id", "use_viewbox");
- input21.checked = input21_checked_value = /*api_request_params*/ ctx[2].viewbox;
- add_location(input21, file$3, 205, 20, 8559);
- attr_dev(label0, "class", "form-check-label svelte-i44z6l");
- attr_dev(label0, "for", "use_viewbox");
- add_location(label0, file$3, 207, 14, 8741);
- attr_dev(span0, "class", "svelte-i44z6l");
- add_location(span0, file$3, 205, 14, 8553);
- attr_dev(input22, "type", "checkbox");
- attr_dev(input22, "class", "form-check-input api-param-setting");
- attr_dev(input22, "id", "option_bounded");
- input22.checked = input22_checked_value = !!/*api_request_params*/ ctx[2].bounded;
- add_location(input22, file$3, 208, 20, 8840);
- attr_dev(label1, "class", "form-check-label svelte-i44z6l");
- attr_dev(label1, "for", "option_bounded");
- add_location(label1, file$3, 210, 14, 9025);
- attr_dev(span1, "class", "svelte-i44z6l");
- add_location(span1, file$3, 208, 14, 8834);
- attr_dev(input23, "type", "checkbox");
- attr_dev(input23, "class", "form-check-input api-param-setting");
- attr_dev(input23, "id", "option_dedupe");
- input23.checked = input23_checked_value = !!/*api_request_params*/ ctx[2].dedupe;
- add_location(input23, file$3, 211, 20, 9132);
- attr_dev(label2, "class", "form-check-label svelte-i44z6l");
- attr_dev(label2, "for", "option_dedupe");
- add_location(label2, file$3, 213, 14, 9314);
- attr_dev(span2, "class", "svelte-i44z6l");
- add_location(span2, file$3, 211, 14, 9126);
- attr_dev(div5, "class", "form-check form-check-inline");
- add_location(div5, file$3, 204, 12, 8496);
- attr_dev(label3, "class", "form-check-label svelte-i44z6l");
- attr_dev(label3, "for", "option_limit");
- add_location(label3, file$3, 216, 20, 9495);
- attr_dev(input24, "type", "number");
- attr_dev(input24, "class", "form-check-input api-param-setting");
- attr_dev(input24, "data-api-param", "limit");
- attr_dev(input24, "id", "option_limit");
- attr_dev(input24, "size", "5");
- attr_dev(input24, "min", "1");
- attr_dev(input24, "max", "50");
- input24.value = input24_value_value = /*api_request_params*/ ctx[2].limit || "";
- add_location(input24, file$3, 217, 14, 9596);
- attr_dev(span3, "class", "svelte-i44z6l");
- add_location(span3, file$3, 216, 14, 9489);
- attr_dev(label4, "class", "form-check-label svelte-i44z6l");
- attr_dev(label4, "for", "option_polygon_threashold");
- add_location(label4, file$3, 218, 20, 9822);
- attr_dev(input25, "type", "number");
- attr_dev(input25, "class", "form-check-input api-param-setting");
- attr_dev(input25, "data-api-param", "polygon_threshold");
- attr_dev(input25, "id", "option_polygon_threshold");
- attr_dev(input25, "size", "5");
- attr_dev(input25, "min", "0.0");
- attr_dev(input25, "step", "0.01");
- input25.value = input25_value_value = /*api_request_params*/ ctx[2].polygon_threshold || "";
- add_location(input25, file$3, 219, 14, 9933);
- attr_dev(span4, "class", "svelte-i44z6l");
- add_location(span4, file$3, 218, 14, 9816);
- attr_dev(div6, "class", "form-check form-check-inline");
- add_location(div6, file$3, 215, 12, 9432);
- attr_dev(label5, "class", "form-check-label svelte-i44z6l");
- attr_dev(label5, "for", "accept_lang");
- add_location(label5, file$3, 222, 20, 10274);
- attr_dev(input26, "type", "text");
- attr_dev(input26, "placeholder", "e.g. en,zh-Hant");
- attr_dev(input26, "class", "form-check-input api-param-setting");
- attr_dev(input26, "data-api-param", "accept-language");
- attr_dev(input26, "id", "accept_lang");
- attr_dev(input26, "size", "15");
- input26.value = input26_value_value = /*api_request_params*/ ctx[2]["accept-language"] || "";
- add_location(input26, file$3, 223, 14, 10358);
- attr_dev(span5, "class", "svelte-i44z6l");
- add_location(span5, file$3, 222, 14, 10268);
- attr_dev(label6, "class", "form-check-label svelte-i44z6l");
- attr_dev(label6, "for", "option_ccode");
- add_location(label6, file$3, 224, 20, 10618);
- attr_dev(input27, "type", "text");
- attr_dev(input27, "placeholder", "e.g. de,gb");
- attr_dev(input27, "class", "form-check-input api-param-setting");
- attr_dev(input27, "data-api-param", "countrycodes");
- attr_dev(input27, "id", "option_ccode");
- attr_dev(input27, "size", "15");
- input27.value = input27_value_value = /*api_request_params*/ ctx[2].countrycodes || "";
- add_location(input27, file$3, 225, 14, 10703);
- attr_dev(span6, "class", "svelte-i44z6l");
- add_location(span6, file$3, 224, 14, 10612);
- attr_dev(div7, "class", "form-check form-check-inline");
- add_location(div7, file$3, 221, 12, 10211);
- attr_dev(div8, "id", "searchAdvancedOptionsContent");
- attr_dev(div8, "class", "svelte-i44z6l");
- add_location(div8, file$3, 203, 8, 8444);
- attr_dev(div9, "class", "collapse");
- attr_dev(div9, "id", "searchAdvancedOptions");
- add_location(div9, file$3, 202, 6, 8386);
- attr_dev(div10, "class", "tab-content p-2 svelte-i44z6l");
- add_location(div10, file$3, 143, 4, 4601);
- attr_dev(div11, "class", "top-bar svelte-i44z6l");
- add_location(div11, file$3, 130, 2, 4052);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div11, anchor);
- append_dev(div11, ul);
- append_dev(ul, li0);
- append_dev(li0, a0);
- append_dev(ul, t1);
- append_dev(ul, li1);
- append_dev(li1, a1);
- append_dev(ul, t3);
- append_dev(ul, div0);
- append_dev(div0, a2);
- append_dev(div0, t5);
- append_dev(div0, a3);
- append_dev(div11, t7);
- append_dev(div11, div10);
- append_dev(div10, div2);
- append_dev(div2, form0);
- append_dev(form0, input0);
- append_dev(form0, t8);
- append_dev(form0, div1);
- append_dev(div1, button0);
- append_dev(div1, t10);
- append_dev(div1, input1);
- append_dev(div1, t11);
- append_dev(div1, input2);
- append_dev(div1, t12);
- append_dev(div1, input3);
- append_dev(div1, t13);
- append_dev(div1, input4);
- append_dev(div1, t14);
- append_dev(div1, input5);
- append_dev(div1, t15);
- append_dev(div1, input6);
- append_dev(div1, t16);
- append_dev(div1, input7);
- append_dev(div10, t17);
- append_dev(div10, div4);
- append_dev(div4, form1);
- append_dev(form1, input8);
- append_dev(form1, t18);
- append_dev(form1, input9);
- append_dev(form1, t19);
- append_dev(form1, input10);
- append_dev(form1, t20);
- append_dev(form1, input11);
- append_dev(form1, t21);
- append_dev(form1, input12);
- append_dev(form1, t22);
- append_dev(form1, input13);
- append_dev(form1, t23);
- append_dev(form1, div3);
- append_dev(div3, button1);
- append_dev(div3, t25);
- append_dev(div3, input14);
- append_dev(div3, t26);
- append_dev(div3, input15);
- append_dev(div3, t27);
- append_dev(div3, input16);
- append_dev(div3, t28);
- append_dev(div3, input17);
- append_dev(div3, t29);
- append_dev(div3, input18);
- append_dev(div3, t30);
- append_dev(div3, input19);
- append_dev(div3, t31);
- append_dev(div3, input20);
- append_dev(div10, t32);
- append_dev(div10, a4);
- append_dev(div10, t34);
- append_dev(div10, div9);
- append_dev(div9, div8);
- append_dev(div8, div5);
- append_dev(div5, span0);
- append_dev(span0, input21);
- append_dev(span0, t35);
- append_dev(span0, label0);
- append_dev(div5, t37);
- append_dev(div5, span1);
- append_dev(span1, input22);
- append_dev(span1, t38);
- append_dev(span1, label1);
- append_dev(div5, t40);
- append_dev(div5, span2);
- append_dev(span2, input23);
- append_dev(span2, t41);
- append_dev(span2, label2);
- append_dev(div8, t43);
- append_dev(div8, div6);
- append_dev(div6, span3);
- append_dev(span3, label3);
- append_dev(span3, t45);
- append_dev(span3, input24);
- append_dev(div6, t46);
- append_dev(div6, span4);
- append_dev(span4, label4);
- append_dev(span4, t48);
- append_dev(span4, input25);
- append_dev(div8, t49);
- append_dev(div8, div7);
- append_dev(div7, span5);
- append_dev(span5, label5);
- append_dev(span5, t51);
- append_dev(span5, input26);
- append_dev(div7, t52);
- append_dev(div7, span6);
- append_dev(span6, label6);
- append_dev(span6, t54);
- append_dev(span6, input27);
-
- if (!mounted) {
- dispose = [
- listen_dev(input21, "change", /*reset_viewbox*/ ctx[4], false, false, false),
- listen_dev(input22, "change", set_bounded, false, false, false),
- listen_dev(input23, "change", set_dedupe, false, false, false),
- listen_dev(input24, "change", set_api_param, false, false, false),
- listen_dev(input25, "change", set_api_param, false, false, false),
- listen_dev(input26, "change", set_api_param, false, false, false),
- listen_dev(input27, "change", set_api_param, false, false, false)
- ];
-
- mounted = true;
- }
- },
- p: function update(ctx, dirty) {
- if (dirty & /*bStructuredSearch*/ 1) {
- toggle_class(a0, "active", !/*bStructuredSearch*/ ctx[0]);
- }
-
- if (dirty & /*bStructuredSearch*/ 1) {
- toggle_class(a1, "active", /*bStructuredSearch*/ ctx[0]);
- }
-
- if (dirty & /*api_request_params*/ 4 && input0_value_value !== (input0_value_value = /*api_request_params*/ ctx[2].q || "") && input0.value !== input0_value_value) {
- prop_dev(input0, "value", input0_value_value);
- }
-
- if (dirty & /*sViewBox*/ 8 && input1_value_value !== (input1_value_value = /*sViewBox*/ ctx[3] || "")) {
- prop_dev(input1, "value", input1_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input2_value_value !== (input2_value_value = !/*api_request_params*/ ctx[2].dedupe ? "" : 1)) {
- prop_dev(input2, "value", input2_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input3_value_value !== (input3_value_value = /*api_request_params*/ ctx[2].bounded ? 1 : "")) {
- prop_dev(input3, "value", input3_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input4_value_value !== (input4_value_value = /*api_request_params*/ ctx[2]["accept-language"] || "")) {
- prop_dev(input4, "value", input4_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input5_value_value !== (input5_value_value = /*api_request_params*/ ctx[2].countrycodes || "")) {
- prop_dev(input5, "value", input5_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input6_value_value !== (input6_value_value = /*api_request_params*/ ctx[2].limit || "")) {
- prop_dev(input6, "value", input6_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input7_value_value !== (input7_value_value = /*api_request_params*/ ctx[2].polygon_threshold || "")) {
- prop_dev(input7, "value", input7_value_value);
- }
-
- if (dirty & /*bStructuredSearch*/ 1) {
- toggle_class(div2, "active", !/*bStructuredSearch*/ ctx[0]);
- }
-
- if (dirty & /*api_request_params*/ 4 && input8_value_value !== (input8_value_value = /*api_request_params*/ ctx[2].street || "") && input8.value !== input8_value_value) {
- prop_dev(input8, "value", input8_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input9_value_value !== (input9_value_value = /*api_request_params*/ ctx[2].city || "") && input9.value !== input9_value_value) {
- prop_dev(input9, "value", input9_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input10_value_value !== (input10_value_value = /*api_request_params*/ ctx[2].county || "") && input10.value !== input10_value_value) {
- prop_dev(input10, "value", input10_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input11_value_value !== (input11_value_value = /*api_request_params*/ ctx[2].state || "") && input11.value !== input11_value_value) {
- prop_dev(input11, "value", input11_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input12_value_value !== (input12_value_value = /*api_request_params*/ ctx[2].country || "") && input12.value !== input12_value_value) {
- prop_dev(input12, "value", input12_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input13_value_value !== (input13_value_value = /*api_request_params*/ ctx[2].postalcode || "") && input13.value !== input13_value_value) {
- prop_dev(input13, "value", input13_value_value);
- }
-
- if (dirty & /*sViewBox*/ 8 && input14_value_value !== (input14_value_value = /*sViewBox*/ ctx[3] || "")) {
- prop_dev(input14, "value", input14_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input15_value_value !== (input15_value_value = !/*api_request_params*/ ctx[2].dedupe ? "" : 1)) {
- prop_dev(input15, "value", input15_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input16_value_value !== (input16_value_value = /*api_request_params*/ ctx[2].bounded ? 1 : "")) {
- prop_dev(input16, "value", input16_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input17_value_value !== (input17_value_value = /*api_request_params*/ ctx[2]["accept-language"] || "")) {
- prop_dev(input17, "value", input17_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input18_value_value !== (input18_value_value = /*api_request_params*/ ctx[2].countrycodes || "")) {
- prop_dev(input18, "value", input18_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input19_value_value !== (input19_value_value = /*api_request_params*/ ctx[2].limit || "")) {
- prop_dev(input19, "value", input19_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input20_value_value !== (input20_value_value = /*api_request_params*/ ctx[2].polygon_threshold || "")) {
- prop_dev(input20, "value", input20_value_value);
- }
-
- if (dirty & /*bStructuredSearch*/ 1) {
- toggle_class(div4, "active", /*bStructuredSearch*/ ctx[0]);
- }
-
- if (dirty & /*api_request_params*/ 4 && input21_checked_value !== (input21_checked_value = /*api_request_params*/ ctx[2].viewbox)) {
- prop_dev(input21, "checked", input21_checked_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input22_checked_value !== (input22_checked_value = !!/*api_request_params*/ ctx[2].bounded)) {
- prop_dev(input22, "checked", input22_checked_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input23_checked_value !== (input23_checked_value = !!/*api_request_params*/ ctx[2].dedupe)) {
- prop_dev(input23, "checked", input23_checked_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input24_value_value !== (input24_value_value = /*api_request_params*/ ctx[2].limit || "")) {
- prop_dev(input24, "value", input24_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input25_value_value !== (input25_value_value = /*api_request_params*/ ctx[2].polygon_threshold || "")) {
- prop_dev(input25, "value", input25_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input26_value_value !== (input26_value_value = /*api_request_params*/ ctx[2]["accept-language"] || "") && input26.value !== input26_value_value) {
- prop_dev(input26, "value", input26_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input27_value_value !== (input27_value_value = /*api_request_params*/ ctx[2].countrycodes || "") && input27.value !== input27_value_value) {
- prop_dev(input27, "value", input27_value_value);
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div11);
- mounted = false;
- run_all(dispose);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_else_block.name,
- type: "else",
- source: "(129:0) {:else}",
- ctx
- });
-
- return block;
- }
-
- // (90:0) {#if reverse_search}
- function create_if_block$1(ctx) {
- let div2;
- let form;
- let div0;
- let input0;
- let t0;
- let label0;
- let t2;
- let input1;
- let input1_value_value;
- let t3;
- let a0;
- let t5;
- let label1;
- let t7;
- let input2;
- let input2_value_value;
- let t8;
- let label2;
- let t10;
- let select;
- let option;
- let t11;
- let option_selected_value;
- let select_value_value;
- let t12;
- let button;
- let t14;
- let div1;
- let a1;
- let t16;
- let a2;
- let mounted;
- let dispose;
- let each_value = zoomLevels_1();
- validate_each_argument(each_value);
- let each_blocks = [];
-
- for (let i = 0; i < each_value.length; i += 1) {
- each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
- }
-
- const block = {
- c: function create() {
- div2 = element("div");
- form = element("form");
- div0 = element("div");
- input0 = element("input");
- t0 = space();
- label0 = element("label");
- label0.textContent = "lat";
- t2 = space();
- input1 = element("input");
- t3 = space();
- a0 = element("a");
- a0.textContent = "<>";
- t5 = space();
- label1 = element("label");
- label1.textContent = "lon";
- t7 = space();
- input2 = element("input");
- t8 = space();
- label2 = element("label");
- label2.textContent = "max zoom";
- t10 = space();
- select = element("select");
- option = element("option");
- t11 = text("---");
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- t12 = space();
- button = element("button");
- button.textContent = "Search";
- t14 = space();
- div1 = element("div");
- a1 = element("a");
- a1.textContent = "search by id";
- t16 = space();
- a2 = element("a");
- a2.textContent = "forward search";
- attr_dev(input0, "name", "format");
- attr_dev(input0, "type", "hidden");
- input0.value = "html";
- add_location(input0, file$3, 93, 8, 2644);
- attr_dev(label0, "class", "svelte-i44z6l");
- add_location(label0, file$3, 94, 8, 2701);
- attr_dev(input1, "name", "lat");
- attr_dev(input1, "type", "text");
- attr_dev(input1, "class", "form-control form-control-sm");
- attr_dev(input1, "placeholder", "latitude");
- input1.value = input1_value_value = /*api_request_params*/ ctx[2].lat || "";
- add_location(input1, file$3, 95, 8, 2728);
- attr_dev(a0, "id", "switch-coords");
- attr_dev(a0, "class", "btn btn-outline-secondary btn-sm svelte-i44z6l");
- attr_dev(a0, "title", "switch lat and lon");
- add_location(a0, file$3, 100, 8, 2928);
- attr_dev(label1, "class", "svelte-i44z6l");
- add_location(label1, file$3, 104, 8, 3133);
- attr_dev(input2, "name", "lon");
- attr_dev(input2, "type", "text");
- attr_dev(input2, "class", "form-control form-control-sm");
- attr_dev(input2, "placeholder", "longitude");
- input2.value = input2_value_value = /*api_request_params*/ ctx[2].lon || "";
- add_location(input2, file$3, 105, 8, 3160);
- attr_dev(label2, "class", "svelte-i44z6l");
- add_location(label2, file$3, 110, 8, 3361);
- option.__value = "";
- option.value = option.__value;
- option.selected = option_selected_value = !/*api_request_params*/ ctx[2].zoom;
- add_location(option, file$3, 112, 10, 3495);
- attr_dev(select, "name", "zoom");
- attr_dev(select, "class", "form-control form-control-sm");
- add_location(select, file$3, 111, 8, 3393);
- attr_dev(button, "type", "submit");
- attr_dev(button, "class", "btn btn-primary btn-sm mx-1");
- add_location(button, file$3, 117, 8, 3752);
- attr_dev(div0, "class", "form-group");
- add_location(div0, file$3, 92, 6, 2611);
- attr_dev(a1, "href", "details.html");
- attr_dev(a1, "class", "mr-2");
- add_location(a1, file$3, 122, 8, 3904);
- attr_dev(a2, "href", "search.html");
- add_location(a2, file$3, 123, 8, 3965);
- attr_dev(div1, "class", "search-type-link svelte-i44z6l");
- add_location(div1, file$3, 121, 6, 3865);
- attr_dev(form, "class", "form-inline svelte-i44z6l");
- attr_dev(form, "role", "search");
- attr_dev(form, "accept-charset", "UTF-8");
- attr_dev(form, "action", "");
- add_location(form, file$3, 91, 4, 2531);
- attr_dev(div2, "class", "top-bar svelte-i44z6l");
- add_location(div2, file$3, 90, 2, 2505);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div2, anchor);
- append_dev(div2, form);
- append_dev(form, div0);
- append_dev(div0, input0);
- append_dev(div0, t0);
- append_dev(div0, label0);
- append_dev(div0, t2);
- append_dev(div0, input1);
- append_dev(div0, t3);
- append_dev(div0, a0);
- append_dev(div0, t5);
- append_dev(div0, label1);
- append_dev(div0, t7);
- append_dev(div0, input2);
- append_dev(div0, t8);
- append_dev(div0, label2);
- append_dev(div0, t10);
- append_dev(div0, select);
- append_dev(select, option);
- append_dev(option, t11);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(select, null);
- }
-
- select_option(select, /*api_request_params*/ ctx[2].zoom);
- append_dev(div0, t12);
- append_dev(div0, button);
- append_dev(form, t14);
- append_dev(form, div1);
- append_dev(div1, a1);
- append_dev(div1, t16);
- append_dev(div1, a2);
-
- if (!mounted) {
- dispose = listen_dev(a0, "click", stop_propagation(prevent_default(handleSwitchCoords)), false, true, true);
- mounted = true;
- }
- },
- p: function update(ctx, dirty) {
- if (dirty & /*api_request_params*/ 4 && input1_value_value !== (input1_value_value = /*api_request_params*/ ctx[2].lat || "") && input1.value !== input1_value_value) {
- prop_dev(input1, "value", input1_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && input2_value_value !== (input2_value_value = /*api_request_params*/ ctx[2].lon || "") && input2.value !== input2_value_value) {
- prop_dev(input2, "value", input2_value_value);
- }
-
- if (dirty & /*api_request_params*/ 4 && option_selected_value !== (option_selected_value = !/*api_request_params*/ ctx[2].zoom)) {
- prop_dev(option, "selected", option_selected_value);
- }
-
- if (dirty & /*api_request_params, zoomLevels*/ 4) {
- each_value = zoomLevels_1();
- validate_each_argument(each_value);
- let i;
-
- for (i = 0; i < each_value.length; i += 1) {
- const child_ctx = get_each_context(ctx, each_value, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- } else {
- each_blocks[i] = create_each_block(child_ctx);
- each_blocks[i].c();
- each_blocks[i].m(select, null);
- }
- }
-
- for (; i < each_blocks.length; i += 1) {
- each_blocks[i].d(1);
- }
-
- each_blocks.length = each_value.length;
- }
-
- if (dirty & /*api_request_params*/ 4 && select_value_value !== (select_value_value = /*api_request_params*/ ctx[2].zoom)) {
- select_option(select, /*api_request_params*/ ctx[2].zoom);
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div2);
- destroy_each(each_blocks, detaching);
- mounted = false;
- dispose();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block$1.name,
- type: "if",
- source: "(90:0) {#if reverse_search}",
- ctx
- });
-
- return block;
- }
-
- // (114:10) {#each zoomLevels() as zoomTitle, i}
- function create_each_block(ctx) {
- let option;
- let t0;
- let t1;
- let t2_value = /*zoomTitle*/ ctx[6] + "";
- let t2;
- let option_selected_value;
-
- const block = {
- c: function create() {
- option = element("option");
- t0 = text(/*i*/ ctx[8]);
- t1 = text(" - ");
- t2 = text(t2_value);
- option.__value = /*i*/ ctx[8];
- option.value = option.__value;
- option.selected = option_selected_value = /*i*/ ctx[8] === /*api_request_params*/ ctx[2].zoom;
- add_location(option, file$3, 114, 12, 3620);
- },
- m: function mount(target, anchor) {
- insert_dev(target, option, anchor);
- append_dev(option, t0);
- append_dev(option, t1);
- append_dev(option, t2);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*api_request_params*/ 4 && option_selected_value !== (option_selected_value = /*i*/ ctx[8] === /*api_request_params*/ ctx[2].zoom)) {
- prop_dev(option, "selected", option_selected_value);
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(option);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block.name,
- type: "each",
- source: "(114:10) {#each zoomLevels() as zoomTitle, i}",
- ctx
- });
-
- return block;
- }
-
- function create_fragment$3(ctx) {
- let if_block_anchor;
-
- function select_block_type(ctx, dirty) {
- if (/*reverse_search*/ ctx[1]) return create_if_block$1;
- return create_else_block;
- }
-
- let current_block_type = select_block_type(ctx);
- let if_block = current_block_type(ctx);
-
- const block = {
- c: function create() {
- if_block.c();
- if_block_anchor = empty();
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- if_block.m(target, anchor);
- insert_dev(target, if_block_anchor, anchor);
- },
- p: function update(ctx, [dirty]) {
- if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
- if_block.p(ctx, dirty);
- } else {
- if_block.d(1);
- if_block = current_block_type(ctx);
-
- if (if_block) {
- if_block.c();
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
- }
- }
- },
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if_block.d(detaching);
- if (detaching) detach_dev(if_block_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$3.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function map_viewbox_as_string(map) {
- var bounds = map.getBounds();
- var west = bounds.getWest();
- var east = bounds.getEast();
-
- if (east - west >= 360) {
- // covers more than whole planet
- west = map.getCenter().lng - 179.999;
-
- east = map.getCenter().lng + 179.999;
- }
-
- east = L.latLng(77, east).wrap().lng;
- west = L.latLng(77, west).wrap().lng;
-
- return [
- west.toFixed(5),
- bounds.getNorth().toFixed(5),
- east.toFixed(5),
- bounds.getSouth().toFixed(5)
- ].join(","); // left
- // top
- // right
- // bottom
- }
-
- function update_reverse_link(map) {
- let link = document.getElementById("switch-to-reverse");
-
- if (link) {
- let center_lat_lng = map.wrapLatLng(map.getCenter());
- link.href = "reverse.html?lat=" + center_lat_lng.lat.toFixed(5) + "&lon=" + center_lat_lng.lng.toFixed(5);
- }
- }
-
- function set_bounded(e) {
- console.log("setting", e.target);
- document.querySelector("input[name=bounded]").value = e.target.checked ? 1 : "";
- }
-
- function set_dedupe(e) {
- document.querySelector("input[name=dedupe]").value = e.target.checked ? 1 : "";
- }
-
- function set_api_param(e) {
- document.querySelector("input[name=" + e.target.dataset["apiParam"] + "]").value = e.target.value;
- }
-
- function handleSwitchCoords() {
- let lat = document.querySelector("input[name=lat]").value;
- let lon = document.querySelector("input[name=lon]").value;
- document.querySelector("input[name=lat]").value = lon;
- document.querySelector("input[name=lon]").value = lat;
- document.querySelector("form").submit();
- }
-
- function instance$3($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("SearchBar", slots, []);
- let { bStructuredSearch = false } = $$props;
- let { reverse_search = false } = $$props;
- let { api_request_params = {} } = $$props;
- let sViewBox;
-
- function set_viewbox(map) {
- let set_viewbox = document.getElementById("use_viewbox");
-
- if (set_viewbox && set_viewbox.checked) {
- $$invalidate(3, sViewBox = map_viewbox_as_string(map));
- } else {
- $$invalidate(3, sViewBox = "");
- }
- }
-
- map_store.subscribe(map => {
- if (!map) {
- return;
- }
-
- map.on("move", function () {
- set_viewbox(map);
- update_reverse_link(map);
- });
-
- map.on("load", function () {
- set_viewbox(map);
- update_reverse_link(map);
- });
- });
-
- function reset_viewbox() {
- let map = get_store_value(map_store);
-
- if (map) {
- set_viewbox(map);
- }
-
-
- }
-
- const writable_props = ["bStructuredSearch", "reverse_search", "api_request_params"];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console_1.warn(`<SearchBar> was created with unknown prop '${key}'`);
- });
-
- $$self.$$set = $$props => {
- if ("bStructuredSearch" in $$props) $$invalidate(0, bStructuredSearch = $$props.bStructuredSearch);
- if ("reverse_search" in $$props) $$invalidate(1, reverse_search = $$props.reverse_search);
- if ("api_request_params" in $$props) $$invalidate(2, api_request_params = $$props.api_request_params);
- };
-
- $$self.$capture_state = () => ({
- zoomLevels: zoomLevels_1,
- map_store,
- get: get_store_value,
- bStructuredSearch,
- reverse_search,
- api_request_params,
- sViewBox,
- map_viewbox_as_string,
- set_viewbox,
- update_reverse_link,
- reset_viewbox,
- set_bounded,
- set_dedupe,
- set_api_param,
- handleSwitchCoords
- });
-
- $$self.$inject_state = $$props => {
- if ("bStructuredSearch" in $$props) $$invalidate(0, bStructuredSearch = $$props.bStructuredSearch);
- if ("reverse_search" in $$props) $$invalidate(1, reverse_search = $$props.reverse_search);
- if ("api_request_params" in $$props) $$invalidate(2, api_request_params = $$props.api_request_params);
- if ("sViewBox" in $$props) $$invalidate(3, sViewBox = $$props.sViewBox);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [bStructuredSearch, reverse_search, api_request_params, sViewBox, reset_viewbox];
- }
-
- class SearchBar extends SvelteComponentDev {
- constructor(options) {
- super(options);
-
- init(this, options, instance$3, create_fragment$3, safe_not_equal, {
- bStructuredSearch: 0,
- reverse_search: 1,
- api_request_params: 2
- });
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "SearchBar",
- options,
- id: create_fragment$3.name
- });
- }
-
- get bStructuredSearch() {
- throw new Error("<SearchBar>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- set bStructuredSearch(value) {
- throw new Error("<SearchBar>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- get reverse_search() {
- throw new Error("<SearchBar>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- set reverse_search(value) {
- throw new Error("<SearchBar>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- get api_request_params() {
- throw new Error("<SearchBar>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- set api_request_params(value) {
- throw new Error("<SearchBar>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
- }
-
- /* src/components/Welcome.svelte generated by Svelte v3.31.2 */
-
- const file$4 = "src/components/Welcome.svelte";
-
- function create_fragment$4(ctx) {
- let div;
- let h2;
- let t1;
- let p;
- let t2;
- let a0;
- let t4;
- let t5;
- let a1;
- let t7;
-
- const block = {
- c: function create() {
- div = element("div");
- h2 = element("h2");
- h2.textContent = "Welcome to Nominatim";
- t1 = space();
- p = element("p");
- t2 = text("Nominatim is a search engine for\n ");
- a0 = element("a");
- a0.textContent = "OpenStreetMap";
- t4 = text(" data. This\n is the debugging interface. You may search for a name or address\n (forward search) or look up data by its geographic coordinate (reverse\n search). Each result comes with a link to a details page where you\n can inspect what data about the object is saved in the database and\n investigate how the address of the object has been computed.");
- t5 = text("\n\n For more information visit the\n ");
- a1 = element("a");
- a1.textContent = "Nominatim home page";
- t7 = text(".");
- add_location(h2, file$4, 1, 2, 21);
- attr_dev(a0, "href", "https://www.openstreetmap.org");
- add_location(a0, file$4, 5, 4, 99);
- add_location(p, file$4, 3, 2, 54);
- attr_dev(a1, "href", "https://nominatim.org");
- add_location(a1, file$4, 14, 2, 563);
- attr_dev(div, "id", "welcome");
- add_location(div, file$4, 0, 0, 0);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- insert_dev(target, div, anchor);
- append_dev(div, h2);
- append_dev(div, t1);
- append_dev(div, p);
- append_dev(p, t2);
- append_dev(p, a0);
- append_dev(p, t4);
- append_dev(div, t5);
- append_dev(div, a1);
- append_dev(div, t7);
- },
- p: noop,
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(div);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$4.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance$4($$self, $$props) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("Welcome", slots, []);
- const writable_props = [];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Welcome> was created with unknown prop '${key}'`);
- });
-
- return [];
- }
-
- class Welcome extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$4, create_fragment$4, safe_not_equal, {});
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "Welcome",
- options,
- id: create_fragment$4.name
- });
- }
- }
-
- /* src/components/MapIcon.svelte generated by Svelte v3.31.2 */
- const file$5 = "src/components/MapIcon.svelte";
-
- // (109:0) {#if sIcon}
- function create_if_block$2(ctx) {
- let img;
- let img_src_value;
-
- const block = {
- c: function create() {
- img = element("img");
- attr_dev(img, "class", "mapicon svelte-180cawe");
- if (img.src !== (img_src_value = /*url*/ ctx[2])) attr_dev(img, "src", img_src_value);
- attr_dev(img, "alt", /*title*/ ctx[1]);
- add_location(img, file$5, 109, 2, 4543);
- },
- m: function mount(target, anchor) {
- insert_dev(target, img, anchor);
- },
- p: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(img);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block$2.name,
- type: "if",
- source: "(109:0) {#if sIcon}",
- ctx
- });
-
- return block;
- }
-
- function create_fragment$5(ctx) {
- let if_block_anchor;
- let if_block = /*sIcon*/ ctx[0] && create_if_block$2(ctx);
-
- const block = {
- c: function create() {
- if (if_block) if_block.c();
- if_block_anchor = empty();
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- if (if_block) if_block.m(target, anchor);
- insert_dev(target, if_block_anchor, anchor);
- },
- p: function update(ctx, [dirty]) {
- if (/*sIcon*/ ctx[0]) if_block.p(ctx, dirty);
- },
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (if_block) if_block.d(detaching);
- if (detaching) detach_dev(if_block_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$5.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function getIcon(aPlace) {
- // equivalent to PHP Nominatim::ClassTypes::getIcon
- // covers 83 of 214 available icon filenames, e.g. transport_roundabout_anticlockwise
- // transport_rental_bicycle or place_of_worship_christian would need more data from
- // the place.
- var aIcons = {
- "boundary:administrative": "poi_boundary_administrative",
- "place:city": "poi_place_city",
- "place:town": "poi_place_town",
- "place:village": "poi_place_village",
- "place:hamlet": "poi_place_village",
- "place:suburb": "poi_place_village",
- "place:locality": "poi_place_village",
- "place:airport": "transport_airport2",
- "aeroway:aerodrome": "transport_airport2",
- "railway:station": "transport_train_station2",
- "amenity:place_of_worship": "place_of_worship_unknown3",
- "amenity:pub": "food_pub",
- "amenity:bar": "food_bar",
- "amenity:university": "education_university",
- "tourism:museum": "tourist_museum",
- "amenity:arts_centre": "tourist_art_gallery2",
- "tourism:zoo": "tourist_zoo",
- "tourism:theme_park": "poi_point_of_interest",
- "tourism:attraction": "poi_point_of_interest",
- "leisure:golf_course": "sport_golf",
- "historic:castle": "tourist_castle",
- "amenity:hospital": "health_hospital",
- "amenity:school": "education_school",
- "amenity:theatre": "tourist_theatre",
- "amenity:library": "amenity_library",
- "amenity:fire_station": "amenity_firestation3",
- "amenity:police": "amenity_police2",
- "amenity:bank": "money_bank2",
- "amenity:post_office": "amenity_post_office",
- "tourism:hotel": "accommodation_hotel2",
- "amenity:cinema": "tourist_cinema",
- "tourism:artwork": "tourist_art_gallery2",
- "historic:archaeological_site": "tourist_archaeological2",
- "amenity:doctors": "health_doctors",
- "leisure:sports_centre": "sport_leisure_centre",
- "leisure:swimming_pool": "sport_swimming_outdoor",
- "shop:supermarket": "shopping_supermarket",
- "shop:convenience": "shopping_convenience",
- "amenity:restaurant": "food_restaurant",
- "amenity:fast_food": "food_fastfood",
- "amenity:cafe": "food_cafe",
- "tourism:guest_house": "accommodation_bed_and_breakfast",
- "amenity:pharmacy": "health_pharmacy_dispensing",
- "amenity:fuel": "transport_fuel",
- "natural:peak": "poi_peak",
- "natural:wood": "landuse_coniferous_and_deciduous",
- "shop:bicycle": "shopping_bicycle",
- "shop:clothes": "shopping_clothes",
- "shop:hairdresser": "shopping_hairdresser",
- "shop:doityourself": "shopping_diy",
- "shop:estate_agent": "shopping_estateagent2",
- "shop:car": "shopping_car",
- "shop:garden_centre": "shopping_garden_centre",
- "shop:car_repair": "shopping_car_repair",
- "shop:bakery": "shopping_bakery",
- "shop:butcher": "shopping_butcher",
- "shop:apparel": "shopping_clothes",
- "shop:laundry": "shopping_laundrette",
- "shop:beverages": "shopping_alcohol",
- "shop:alcohol": "shopping_alcohol",
- "shop:optician": "health_opticians",
- "shop:chemist": "health_pharmacy",
- "shop:gallery": "tourist_art_gallery2",
- "shop:jewelry": "shopping_jewelry",
- "tourism:information": "amenity_information",
- "historic:ruins": "tourist_ruin",
- "amenity:college": "education_school",
- "historic:monument": "tourist_monument",
- "historic:memorial": "tourist_monument",
- "historic:mine": "poi_mine",
- "tourism:caravan_site": "accommodation_caravan_park",
- "amenity:bus_station": "transport_bus_station",
- "amenity:atm": "money_atm2",
- "tourism:viewpoint": "tourist_view_point",
- "tourism:guesthouse": "accommodation_bed_and_breakfast",
- "railway:tram": "transport_tram_stop",
- "amenity:courthouse": "amenity_court",
- "amenity:recycling": "amenity_recycling",
- "amenity:dentist": "health_dentist",
- "natural:beach": "tourist_beach",
- "railway:tram_stop": "transport_tram_stop",
- "amenity:prison": "amenity_prison",
- "highway:bus_stop": "transport_bus_stop2"
- };
-
- var sCategoryPlace = aPlace.category + ":" + aPlace.type;
- return aIcons[sCategoryPlace];
- }
-
- function instance$5($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("MapIcon", slots, []);
- let { aPlace } = $$props;
- let sIcon = getIcon(aPlace);
- let title = "icon for " + aPlace.category + " " + aPlace.type;
- let url = get_config_value_1("Images_Base_Url") + sIcon + ".p.20.png";
- const writable_props = ["aPlace"];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<MapIcon> was created with unknown prop '${key}'`);
- });
-
- $$self.$$set = $$props => {
- if ("aPlace" in $$props) $$invalidate(3, aPlace = $$props.aPlace);
- };
-
- $$self.$capture_state = () => ({
- aPlace,
- get_config_value: get_config_value_1,
- sIcon,
- title,
- url,
- getIcon
- });
-
- $$self.$inject_state = $$props => {
- if ("aPlace" in $$props) $$invalidate(3, aPlace = $$props.aPlace);
- if ("sIcon" in $$props) $$invalidate(0, sIcon = $$props.sIcon);
- if ("title" in $$props) $$invalidate(1, title = $$props.title);
- if ("url" in $$props) $$invalidate(2, url = $$props.url);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [sIcon, title, url, aPlace];
- }
-
- class MapIcon extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$5, create_fragment$5, safe_not_equal, { aPlace: 3 });
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "MapIcon",
- options,
- id: create_fragment$5.name
- });
-
- const { ctx } = this.$$;
- const props = options.props || {};
-
- if (/*aPlace*/ ctx[3] === undefined && !("aPlace" in props)) {
- console.warn("<MapIcon> was created without expected prop 'aPlace'");
- }
- }
-
- get aPlace() {
- throw new Error("<MapIcon>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- set aPlace(value) {
- throw new Error("<MapIcon>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
- }
-
- /* src/components/ResultsList.svelte generated by Svelte v3.31.2 */
- const file$6 = "src/components/ResultsList.svelte";
-
- function get_each_context$1(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[5] = list[i];
- child_ctx[7] = i;
- return child_ctx;
- }
-
- // (83:0) {:else}
- function create_else_block_1(ctx) {
- let welcome;
- let current;
- welcome = new Welcome({ $$inline: true });
-
- const block = {
- c: function create() {
- create_component(welcome.$$.fragment);
- },
- m: function mount(target, anchor) {
- mount_component(welcome, target, anchor);
- current = true;
- },
- p: noop,
- i: function intro(local) {
- if (current) return;
- transition_in(welcome.$$.fragment, local);
- current = true;
- },
- o: function outro(local) {
- transition_out(welcome.$$.fragment, local);
- current = false;
- },
- d: function destroy(detaching) {
- destroy_component(welcome, detaching);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_else_block_1.name,
- type: "else",
- source: "(83:0) {:else}",
- ctx
- });
-
- return block;
- }
-
- // (77:25)
- function create_if_block_2(ctx) {
- let if_block_anchor;
-
- function select_block_type_1(ctx, dirty) {
- if (/*reverse_search*/ ctx[0]) return create_if_block_3;
- return create_else_block$1;
- }
-
- let current_block_type = select_block_type_1(ctx);
- let if_block = current_block_type(ctx);
-
- const block = {
- c: function create() {
- if_block.c();
- if_block_anchor = empty();
- },
- m: function mount(target, anchor) {
- if_block.m(target, anchor);
- insert_dev(target, if_block_anchor, anchor);
- },
- p: function update(ctx, dirty) {
- if (current_block_type !== (current_block_type = select_block_type_1(ctx))) {
- if_block.d(1);
- if_block = current_block_type(ctx);
-
- if (if_block) {
- if_block.c();
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
- }
- }
- },
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if_block.d(detaching);
- if (detaching) detach_dev(if_block_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_2.name,
- type: "if",
- source: "(77:25) ",
- ctx
- });
-
- return block;
- }
-
- // (53:0) {#if aSearchResults && aSearchResults.length > 0}
- function create_if_block$3(ctx) {
- let div;
- let t;
- let current;
- let each_value = /*aSearchResults*/ ctx[1];
- validate_each_argument(each_value);
- let each_blocks = [];
-
- for (let i = 0; i < each_value.length; i += 1) {
- each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i));
- }
-
- const out = i => transition_out(each_blocks[i], 1, 1, () => {
- each_blocks[i] = null;
- });
-
- let if_block = /*sMoreURL*/ ctx[3] && !/*reverse_search*/ ctx[0] && create_if_block_1(ctx);
-
- const block = {
- c: function create() {
- div = element("div");
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- t = space();
- if (if_block) if_block.c();
- attr_dev(div, "id", "searchresults");
- add_location(div, file$6, 53, 2, 1681);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div, anchor);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(div, null);
- }
-
- append_dev(div, t);
- if (if_block) if_block.m(div, null);
- current = true;
- },
- p: function update(ctx, dirty) {
- if (dirty & /*iHighlightNum, handleClick, detailsURL, aSearchResults, formatLabel*/ 22) {
- each_value = /*aSearchResults*/ ctx[1];
- validate_each_argument(each_value);
- let i;
-
- for (i = 0; i < each_value.length; i += 1) {
- const child_ctx = get_each_context$1(ctx, each_value, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- transition_in(each_blocks[i], 1);
- } else {
- each_blocks[i] = create_each_block$1(child_ctx);
- each_blocks[i].c();
- transition_in(each_blocks[i], 1);
- each_blocks[i].m(div, t);
- }
- }
-
- group_outros();
-
- for (i = each_value.length; i < each_blocks.length; i += 1) {
- out(i);
- }
-
- check_outros();
- }
-
- if (/*sMoreURL*/ ctx[3] && !/*reverse_search*/ ctx[0]) {
- if (if_block) {
- if_block.p(ctx, dirty);
- } else {
- if_block = create_if_block_1(ctx);
- if_block.c();
- if_block.m(div, null);
- }
- } else if (if_block) {
- if_block.d(1);
- if_block = null;
- }
- },
- i: function intro(local) {
- if (current) return;
-
- for (let i = 0; i < each_value.length; i += 1) {
- transition_in(each_blocks[i]);
- }
-
- current = true;
- },
- o: function outro(local) {
- each_blocks = each_blocks.filter(Boolean);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- transition_out(each_blocks[i]);
- }
-
- current = false;
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div);
- destroy_each(each_blocks, detaching);
- if (if_block) if_block.d();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block$3.name,
- type: "if",
- source: "(53:0) {#if aSearchResults && aSearchResults.length > 0}",
- ctx
- });
-
- return block;
- }
-
- // (80:2) {:else}
- function create_else_block$1(ctx) {
- let div;
-
- const block = {
- c: function create() {
- div = element("div");
- div.textContent = "No search results found";
- attr_dev(div, "class", "noresults svelte-d36c6n");
- add_location(div, file$6, 80, 4, 2634);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div, anchor);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_else_block$1.name,
- type: "else",
- source: "(80:2) {:else}",
- ctx
- });
-
- return block;
- }
-
- // (78:2) {#if reverse_search}
- function create_if_block_3(ctx) {
- let div;
-
- const block = {
- c: function create() {
- div = element("div");
- div.textContent = "Search for coordinates or click anywhere on the map.";
- attr_dev(div, "id", "intro");
- attr_dev(div, "class", "sidebar");
- add_location(div, file$6, 78, 4, 2529);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div, anchor);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_3.name,
- type: "if",
- source: "(78:2) {#if reverse_search}",
- ctx
- });
-
- return block;
- }
-
- // (56:4) {#each aSearchResults as aResult, iResNum}
- function create_each_block$1(ctx) {
- let div1;
- let div0;
- let mapicon;
- let t0;
- let span0;
- let t1_value = /*aResult*/ ctx[5].display_name + "";
- let t1;
- let t2;
- let span1;
- let t3_value = formatLabel_1(/*aResult*/ ctx[5]) + "";
- let t3;
- let t4;
- let p;
- let t5_value = /*aResult*/ ctx[5].lat + "";
- let t5;
- let t6;
- let t7_value = /*aResult*/ ctx[5].lon + "";
- let t7;
- let t8;
- let a;
- let t9;
- let a_href_value;
- let current;
- let mounted;
- let dispose;
-
- mapicon = new MapIcon({
- props: { aPlace: /*aResult*/ ctx[5] },
- $$inline: true
- });
-
- const block = {
- c: function create() {
- div1 = element("div");
- div0 = element("div");
- create_component(mapicon.$$.fragment);
- t0 = space();
- span0 = element("span");
- t1 = text(t1_value);
- t2 = space();
- span1 = element("span");
- t3 = text(t3_value);
- t4 = space();
- p = element("p");
- t5 = text(t5_value);
- t6 = text(",");
- t7 = text(t7_value);
- t8 = space();
- a = element("a");
- t9 = text("details");
- set_style(div0, "float", "right");
- add_location(div0, file$6, 57, 8, 1898);
- attr_dev(span0, "class", "name");
- add_location(span0, file$6, 60, 8, 1986);
- attr_dev(span1, "class", "type svelte-d36c6n");
- add_location(span1, file$6, 61, 8, 2043);
- attr_dev(p, "class", "coords svelte-d36c6n");
- add_location(p, file$6, 62, 8, 2100);
- attr_dev(a, "class", "details btn btn-outline-secondary btn-sm svelte-d36c6n");
- attr_dev(a, "href", a_href_value = detailsURL_1(/*aResult*/ ctx[5]));
- add_location(a, file$6, 64, 8, 2161);
- attr_dev(div1, "class", "result svelte-d36c6n");
- attr_dev(div1, "data-position", /*iResNum*/ ctx[7]);
- toggle_class(div1, "highlight", /*iResNum*/ ctx[7] === /*iHighlightNum*/ ctx[2]);
- add_location(div1, file$6, 56, 6, 1760);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div1, anchor);
- append_dev(div1, div0);
- mount_component(mapicon, div0, null);
- append_dev(div1, t0);
- append_dev(div1, span0);
- append_dev(span0, t1);
- append_dev(div1, t2);
- append_dev(div1, span1);
- append_dev(span1, t3);
- append_dev(div1, t4);
- append_dev(div1, p);
- append_dev(p, t5);
- append_dev(p, t6);
- append_dev(p, t7);
- append_dev(div1, t8);
- append_dev(div1, a);
- append_dev(a, t9);
- current = true;
-
- if (!mounted) {
- dispose = listen_dev(div1, "click", stop_propagation(/*handleClick*/ ctx[4]), false, false, true);
- mounted = true;
- }
- },
- p: function update(ctx, dirty) {
- const mapicon_changes = {};
- if (dirty & /*aSearchResults*/ 2) mapicon_changes.aPlace = /*aResult*/ ctx[5];
- mapicon.$set(mapicon_changes);
- if ((!current || dirty & /*aSearchResults*/ 2) && t1_value !== (t1_value = /*aResult*/ ctx[5].display_name + "")) set_data_dev(t1, t1_value);
- if ((!current || dirty & /*aSearchResults*/ 2) && t3_value !== (t3_value = formatLabel_1(/*aResult*/ ctx[5]) + "")) set_data_dev(t3, t3_value);
- if ((!current || dirty & /*aSearchResults*/ 2) && t5_value !== (t5_value = /*aResult*/ ctx[5].lat + "")) set_data_dev(t5, t5_value);
- if ((!current || dirty & /*aSearchResults*/ 2) && t7_value !== (t7_value = /*aResult*/ ctx[5].lon + "")) set_data_dev(t7, t7_value);
-
- if (!current || dirty & /*aSearchResults*/ 2 && a_href_value !== (a_href_value = detailsURL_1(/*aResult*/ ctx[5]))) {
- attr_dev(a, "href", a_href_value);
- }
-
- if (dirty & /*iHighlightNum*/ 4) {
- toggle_class(div1, "highlight", /*iResNum*/ ctx[7] === /*iHighlightNum*/ ctx[2]);
- }
- },
- i: function intro(local) {
- if (current) return;
- transition_in(mapicon.$$.fragment, local);
- current = true;
- },
- o: function outro(local) {
- transition_out(mapicon.$$.fragment, local);
- current = false;
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div1);
- destroy_component(mapicon);
- mounted = false;
- dispose();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block$1.name,
- type: "each",
- source: "(56:4) {#each aSearchResults as aResult, iResNum}",
- ctx
- });
-
- return block;
- }
-
- // (69:4) {#if sMoreURL && !reverse_search}
- function create_if_block_1(ctx) {
- let div;
- let a;
- let t;
-
- const block = {
- c: function create() {
- div = element("div");
- a = element("a");
- t = text("Search for more results");
- attr_dev(a, "class", "btn btn-primary");
- attr_dev(a, "href", /*sMoreURL*/ ctx[3]);
- add_location(a, file$6, 70, 8, 2351);
- attr_dev(div, "class", "more svelte-d36c6n");
- add_location(div, file$6, 69, 6, 2324);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div, anchor);
- append_dev(div, a);
- append_dev(a, t);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*sMoreURL*/ 8) {
- attr_dev(a, "href", /*sMoreURL*/ ctx[3]);
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_1.name,
- type: "if",
- source: "(69:4) {#if sMoreURL && !reverse_search}",
- ctx
- });
-
- return block;
- }
-
- function create_fragment$6(ctx) {
- let current_block_type_index;
- let if_block;
- let if_block_anchor;
- let current;
- const if_block_creators = [create_if_block$3, create_if_block_2, create_else_block_1];
- const if_blocks = [];
-
- function select_block_type(ctx, dirty) {
- if (/*aSearchResults*/ ctx[1] && /*aSearchResults*/ ctx[1].length > 0) return 0;
- if (/*aSearchResults*/ ctx[1]) return 1;
- return 2;
- }
-
- current_block_type_index = select_block_type(ctx);
- if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
-
- const block = {
- c: function create() {
- if_block.c();
- if_block_anchor = empty();
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- if_blocks[current_block_type_index].m(target, anchor);
- insert_dev(target, if_block_anchor, anchor);
- current = true;
- },
- p: function update(ctx, [dirty]) {
- let previous_block_index = current_block_type_index;
- current_block_type_index = select_block_type(ctx);
-
- if (current_block_type_index === previous_block_index) {
- if_blocks[current_block_type_index].p(ctx, dirty);
- } else {
- group_outros();
-
- transition_out(if_blocks[previous_block_index], 1, 1, () => {
- if_blocks[previous_block_index] = null;
- });
-
- check_outros();
- if_block = if_blocks[current_block_type_index];
-
- if (!if_block) {
- if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
- if_block.c();
- } else {
- if_block.p(ctx, dirty);
- }
-
- transition_in(if_block, 1);
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
- }
- },
- i: function intro(local) {
- if (current) return;
- transition_in(if_block);
- current = true;
- },
- o: function outro(local) {
- transition_out(if_block);
- current = false;
- },
- d: function destroy(detaching) {
- if_blocks[current_block_type_index].d(detaching);
- if (detaching) detach_dev(if_block_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$6.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance$6($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("ResultsList", slots, []);
- let { reverse_search = false } = $$props;
- let aSearchResults;
- let iHighlightNum;
- let sMoreURL;
-
- results_store.subscribe(data => {
- if (!data) {
- return;
- }
-
- $$invalidate(1, aSearchResults = data);
- $$invalidate(2, iHighlightNum = 0);
- current_result_store.set(aSearchResults[0]);
- let search_params = new URLSearchParams(window.location.search);
- let aResults = data;
-
- // lonvia wrote: https://github.com/osm-search/nominatim-ui/issues/24
- // I would suggest to remove the guessing and always show the link. Nominatim only returns
- // one or two results when it believes the result to be a good enough match.
- // if (aResults.length >= 10) {
- var aExcludePlaceIds = [];
-
- if (search_params.has("exclude_place_ids")) {
- aExcludePlaceIds = search_params.get("exclude_place_ids").split(",");
- }
-
- for (var i = 0; i < aResults.length; i += 1) {
- aExcludePlaceIds.push(aResults[i].place_id);
- }
-
- var parsed_url = new URLSearchParams(window.location.search);
- parsed_url.set("exclude_place_ids", aExcludePlaceIds.join(","));
- $$invalidate(3, sMoreURL = "?" + parsed_url.toString());
- });
-
- function handleClick(e) {
- let result_el = e.target;
-
- if (!result_el.className.match("result")) {
- result_el = result_el.parentElement;
- }
-
- let pos = Number(result_el.dataset.position);
- current_result_store.set(aSearchResults[pos]);
- $$invalidate(2, iHighlightNum = pos);
- }
-
- const writable_props = ["reverse_search"];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<ResultsList> was created with unknown prop '${key}'`);
- });
-
- $$self.$$set = $$props => {
- if ("reverse_search" in $$props) $$invalidate(0, reverse_search = $$props.reverse_search);
- };
-
- $$self.$capture_state = () => ({
- results_store,
- current_result_store,
- formatLabel: formatLabel_1,
- detailsURL: detailsURL_1,
- Welcome,
- MapIcon,
- reverse_search,
- aSearchResults,
- iHighlightNum,
- sMoreURL,
- handleClick
- });
-
- $$self.$inject_state = $$props => {
- if ("reverse_search" in $$props) $$invalidate(0, reverse_search = $$props.reverse_search);
- if ("aSearchResults" in $$props) $$invalidate(1, aSearchResults = $$props.aSearchResults);
- if ("iHighlightNum" in $$props) $$invalidate(2, iHighlightNum = $$props.iHighlightNum);
- if ("sMoreURL" in $$props) $$invalidate(3, sMoreURL = $$props.sMoreURL);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [reverse_search, aSearchResults, iHighlightNum, sMoreURL, handleClick];
- }
-
- class ResultsList extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$6, create_fragment$6, safe_not_equal, { reverse_search: 0 });
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "ResultsList",
- options,
- id: create_fragment$6.name
- });
- }
-
- get reverse_search() {
- throw new Error("<ResultsList>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- set reverse_search(value) {
- throw new Error("<ResultsList>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
- }
-
- /* @preserve
- * Leaflet 1.7.1, a JS library for interactive maps. http://leafletjs.com
- * (c) 2010-2019 Vladimir Agafonkin, (c) 2010-2011 CloudMade
- */
-
- var leafletSrc = createCommonjsModule(function (module, exports) {
- (function (global, factory) {
- factory(exports) ;
- }(commonjsGlobal, (function (exports) {
- var version = "1.7.1";
-
- /*\r
- * @namespace Util\r
- *\r
- * Various utility functions, used by Leaflet internally.\r
- */\r
-\r
- // @function extend(dest: Object, src?: Object): Object\r
- // Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut.\r
- function extend(dest) {\r
- var i, j, len, src;\r
-\r
- for (j = 1, len = arguments.length; j < len; j++) {\r
- src = arguments[j];\r
- for (i in src) {\r
- dest[i] = src[i];\r
- }\r
- }\r
- return dest;\r
- }\r
-\r
- // @function create(proto: Object, properties?: Object): Object\r
- // Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create)\r
- var create = Object.create || (function () {\r
- function F() {}\r
- return function (proto) {\r
- F.prototype = proto;\r
- return new F();\r
- };\r
- })();\r
-\r
- // @function bind(fn: Function, …): Function\r
- // Returns a new function bound to the arguments passed, like [Function.prototype.bind](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).\r
- // Has a `L.bind()` shortcut.\r
- function bind(fn, obj) {\r
- var slice = Array.prototype.slice;\r
-\r
- if (fn.bind) {\r
- return fn.bind.apply(fn, slice.call(arguments, 1));\r
- }\r
-\r
- var args = slice.call(arguments, 2);\r
-\r
- return function () {\r
- return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);\r
- };\r
- }\r
-\r
- // @property lastId: Number\r
- // Last unique ID used by [`stamp()`](#util-stamp)\r
- var lastId = 0;\r
-\r
- // @function stamp(obj: Object): Number\r
- // Returns the unique ID of an object, assigning it one if it doesn't have it.\r
- function stamp(obj) {\r
- /*eslint-disable */\r
- obj._leaflet_id = obj._leaflet_id || ++lastId;\r
- return obj._leaflet_id;\r
- /* eslint-enable */\r
- }\r
-\r
- // @function throttle(fn: Function, time: Number, context: Object): Function\r
- // Returns a function which executes function `fn` with the given scope `context`\r
- // (so that the `this` keyword refers to `context` inside `fn`'s code). The function\r
- // `fn` will be called no more than one time per given amount of `time`. The arguments\r
- // received by the bound function will be any arguments passed when binding the\r
- // function, followed by any arguments passed when invoking the bound function.\r
- // Has an `L.throttle` shortcut.\r
- function throttle(fn, time, context) {\r
- var lock, args, wrapperFn, later;\r
-\r
- later = function () {\r
- // reset lock and call if queued\r
- lock = false;\r
- if (args) {\r
- wrapperFn.apply(context, args);\r
- args = false;\r
- }\r
- };\r
-\r
- wrapperFn = function () {\r
- if (lock) {\r
- // called too soon, queue to call later\r
- args = arguments;\r
-\r
- } else {\r
- // call and lock until later\r
- fn.apply(context, arguments);\r
- setTimeout(later, time);\r
- lock = true;\r
- }\r
- };\r
-\r
- return wrapperFn;\r
- }\r
-\r
- // @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number\r
- // Returns the number `num` modulo `range` in such a way so it lies within\r
- // `range[0]` and `range[1]`. The returned value will be always smaller than\r
- // `range[1]` unless `includeMax` is set to `true`.\r
- function wrapNum(x, range, includeMax) {\r
- var max = range[1],\r
- min = range[0],\r
- d = max - min;\r
- return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\r
- }\r
-\r
- // @function falseFn(): Function\r
- // Returns a function which always returns `false`.\r
- function falseFn() { return false; }\r
-\r
- // @function formatNum(num: Number, digits?: Number): Number\r
- // Returns the number `num` rounded to `digits` decimals, or to 6 decimals by default.\r
- function formatNum(num, digits) {\r
- var pow = Math.pow(10, (digits === undefined ? 6 : digits));\r
- return Math.round(num * pow) / pow;\r
- }\r
-\r
- // @function trim(str: String): String\r
- // Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)\r
- function trim(str) {\r
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');\r
- }\r
-\r
- // @function splitWords(str: String): String[]\r
- // Trims and splits the string on whitespace and returns the array of parts.\r
- function splitWords(str) {\r
- return trim(str).split(/\s+/);\r
- }\r
-\r
- // @function setOptions(obj: Object, options: Object): Object\r
- // Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut.\r
- function setOptions(obj, options) {\r
- if (!Object.prototype.hasOwnProperty.call(obj, 'options')) {\r
- obj.options = obj.options ? create(obj.options) : {};\r
- }\r
- for (var i in options) {\r
- obj.options[i] = options[i];\r
- }\r
- return obj.options;\r
- }\r
-\r
- // @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String\r
- // Converts an object into a parameter URL string, e.g. `{a: "foo", b: "bar"}`\r
- // translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will\r
- // be appended at the end. If `uppercase` is `true`, the parameter names will\r
- // be uppercased (e.g. `'?A=foo&B=bar'`)\r
- function getParamString(obj, existingUrl, uppercase) {\r
- var params = [];\r
- for (var i in obj) {\r
- params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));\r
- }\r
- return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&');\r
- }\r
-\r
- var templateRe = /\{ *([\w_-]+) *\}/g;\r
-\r
- // @function template(str: String, data: Object): String\r
- // Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'`\r
- // and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string\r
- // `('Hello foo, bar')`. You can also specify functions instead of strings for\r
- // data values — they will be evaluated passing `data` as an argument.\r
- function template(str, data) {\r
- return str.replace(templateRe, function (str, key) {\r
- var value = data[key];\r
-\r
- if (value === undefined) {\r
- throw new Error('No value provided for variable ' + str);\r
-\r
- } else if (typeof value === 'function') {\r
- value = value(data);\r
- }\r
- return value;\r
- });\r
- }\r
-\r
- // @function isArray(obj): Boolean\r
- // Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)\r
- var isArray = Array.isArray || function (obj) {\r
- return (Object.prototype.toString.call(obj) === '[object Array]');\r
- };\r
-\r
- // @function indexOf(array: Array, el: Object): Number\r
- // Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)\r
- function indexOf(array, el) {\r
- for (var i = 0; i < array.length; i++) {\r
- if (array[i] === el) { return i; }\r
- }\r
- return -1;\r
- }\r
-\r
- // @property emptyImageUrl: String\r
- // Data URI string containing a base64-encoded empty GIF image.\r
- // Used as a hack to free memory from unused images on WebKit-powered\r
- // mobile devices (by setting image `src` to this string).\r
- var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';\r
-\r
- // inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/\r
-\r
- function getPrefixed(name) {\r
- return window['webkit' + name] || window['moz' + name] || window['ms' + name];\r
- }\r
-\r
- var lastTime = 0;\r
-\r
- // fallback for IE 7-8\r
- function timeoutDefer(fn) {\r
- var time = +new Date(),\r
- timeToCall = Math.max(0, 16 - (time - lastTime));\r
-\r
- lastTime = time + timeToCall;\r
- return window.setTimeout(fn, timeToCall);\r
- }\r
-\r
- var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer;\r
- var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') ||\r
- getPrefixed('CancelRequestAnimationFrame') || function (id) { window.clearTimeout(id); };\r
-\r
- // @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number\r
- // Schedules `fn` to be executed when the browser repaints. `fn` is bound to\r
- // `context` if given. When `immediate` is set, `fn` is called immediately if\r
- // the browser doesn't have native support for\r
- // [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame),\r
- // otherwise it's delayed. Returns a request ID that can be used to cancel the request.\r
- function requestAnimFrame(fn, context, immediate) {\r
- if (immediate && requestFn === timeoutDefer) {\r
- fn.call(context);\r
- } else {\r
- return requestFn.call(window, bind(fn, context));\r
- }\r
- }\r
-\r
- // @function cancelAnimFrame(id: Number): undefined\r
- // Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame).\r
- function cancelAnimFrame(id) {\r
- if (id) {\r
- cancelFn.call(window, id);\r
- }\r
- }
-
- var Util = ({
- extend: extend,
- create: create,
- bind: bind,
- lastId: lastId,
- stamp: stamp,
- throttle: throttle,
- wrapNum: wrapNum,
- falseFn: falseFn,
- formatNum: formatNum,
- trim: trim,
- splitWords: splitWords,
- setOptions: setOptions,
- getParamString: getParamString,
- template: template,
- isArray: isArray,
- indexOf: indexOf,
- emptyImageUrl: emptyImageUrl,
- requestFn: requestFn,
- cancelFn: cancelFn,
- requestAnimFrame: requestAnimFrame,
- cancelAnimFrame: cancelAnimFrame
- });
-
- // @class Class\r
- // @aka L.Class\r
-\r
- // @section\r
- // @uninheritable\r
-\r
- // Thanks to John Resig and Dean Edwards for inspiration!\r
-\r
- function Class() {}\r
-\r
- Class.extend = function (props) {\r
-\r
- // @function extend(props: Object): Function\r
- // [Extends the current class](#class-inheritance) given the properties to be included.\r
- // Returns a Javascript function that is a class constructor (to be called with `new`).\r
- var NewClass = function () {\r
-\r
- // call the constructor\r
- if (this.initialize) {\r
- this.initialize.apply(this, arguments);\r
- }\r
-\r
- // call all constructor hooks\r
- this.callInitHooks();\r
- };\r
-\r
- var parentProto = NewClass.__super__ = this.prototype;\r
-\r
- var proto = create(parentProto);\r
- proto.constructor = NewClass;\r
-\r
- NewClass.prototype = proto;\r
-\r
- // inherit parent's statics\r
- for (var i in this) {\r
- if (Object.prototype.hasOwnProperty.call(this, i) && i !== 'prototype' && i !== '__super__') {\r
- NewClass[i] = this[i];\r
- }\r
- }\r
-\r
- // mix static properties into the class\r
- if (props.statics) {\r
- extend(NewClass, props.statics);\r
- delete props.statics;\r
- }\r
-\r
- // mix includes into the prototype\r
- if (props.includes) {\r
- checkDeprecatedMixinEvents(props.includes);\r
- extend.apply(null, [proto].concat(props.includes));\r
- delete props.includes;\r
- }\r
-\r
- // merge options\r
- if (proto.options) {\r
- props.options = extend(create(proto.options), props.options);\r
- }\r
-\r
- // mix given properties into the prototype\r
- extend(proto, props);\r
-\r
- proto._initHooks = [];\r
-\r
- // add method for calling all hooks\r
- proto.callInitHooks = function () {\r
-\r
- if (this._initHooksCalled) { return; }\r
-\r
- if (parentProto.callInitHooks) {\r
- parentProto.callInitHooks.call(this);\r
- }\r
-\r
- this._initHooksCalled = true;\r
-\r
- for (var i = 0, len = proto._initHooks.length; i < len; i++) {\r
- proto._initHooks[i].call(this);\r
- }\r
- };\r
-\r
- return NewClass;\r
- };\r
-\r
-\r
- // @function include(properties: Object): this\r
- // [Includes a mixin](#class-includes) into the current class.\r
- Class.include = function (props) {\r
- extend(this.prototype, props);\r
- return this;\r
- };\r
-\r
- // @function mergeOptions(options: Object): this\r
- // [Merges `options`](#class-options) into the defaults of the class.\r
- Class.mergeOptions = function (options) {\r
- extend(this.prototype.options, options);\r
- return this;\r
- };\r
-\r
- // @function addInitHook(fn: Function): this\r
- // Adds a [constructor hook](#class-constructor-hooks) to the class.\r
- Class.addInitHook = function (fn) { // (Function) || (String, args...)\r
- var args = Array.prototype.slice.call(arguments, 1);\r
-\r
- var init = typeof fn === 'function' ? fn : function () {\r
- this[fn].apply(this, args);\r
- };\r
-\r
- this.prototype._initHooks = this.prototype._initHooks || [];\r
- this.prototype._initHooks.push(init);\r
- return this;\r
- };\r
-\r
- function checkDeprecatedMixinEvents(includes) {\r
- if (typeof L === 'undefined' || !L || !L.Mixin) { return; }\r
-\r
- includes = isArray(includes) ? includes : [includes];\r
-\r
- for (var i = 0; i < includes.length; i++) {\r
- if (includes[i] === L.Mixin.Events) {\r
- console.warn('Deprecated include of L.Mixin.Events: ' +\r
- 'this property will be removed in future releases, ' +\r
- 'please inherit from L.Evented instead.', new Error().stack);\r
- }\r
- }\r
- }
-
- /*\r
- * @class Evented\r
- * @aka L.Evented\r
- * @inherits Class\r
- *\r
- * A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event).\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * map.on('click', function(e) {\r
- * alert(e.latlng);\r
- * } );\r
- * ```\r
- *\r
- * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:\r
- *\r
- * ```js\r
- * function onClick(e) { ... }\r
- *\r
- * map.on('click', onClick);\r
- * map.off('click', onClick);\r
- * ```\r
- */\r
-\r
- var Events = {\r
- /* @method on(type: String, fn: Function, context?: Object): this\r
- * Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`).\r
- *\r
- * @alternative\r
- * @method on(eventMap: Object): this\r
- * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\r
- */\r
- on: function (types, fn, context) {\r
-\r
- // types can be a map of types/handlers\r
- if (typeof types === 'object') {\r
- for (var type in types) {\r
- // we don't process space-separated events here for performance;\r
- // it's a hot path since Layer uses the on(obj) syntax\r
- this._on(type, types[type], fn);\r
- }\r
-\r
- } else {\r
- // types can be a string of space-separated words\r
- types = splitWords(types);\r
-\r
- for (var i = 0, len = types.length; i < len; i++) {\r
- this._on(types[i], fn, context);\r
- }\r
- }\r
-\r
- return this;\r
- },\r
-\r
- /* @method off(type: String, fn?: Function, context?: Object): this\r
- * Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener.\r
- *\r
- * @alternative\r
- * @method off(eventMap: Object): this\r
- * Removes a set of type/listener pairs.\r
- *\r
- * @alternative\r
- * @method off: this\r
- * Removes all listeners to all events on the object. This includes implicitly attached events.\r
- */\r
- off: function (types, fn, context) {\r
-\r
- if (!types) {\r
- // clear all listeners if called without arguments\r
- delete this._events;\r
-\r
- } else if (typeof types === 'object') {\r
- for (var type in types) {\r
- this._off(type, types[type], fn);\r
- }\r
-\r
- } else {\r
- types = splitWords(types);\r
-\r
- for (var i = 0, len = types.length; i < len; i++) {\r
- this._off(types[i], fn, context);\r
- }\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // attach listener (without syntactic sugar now)\r
- _on: function (type, fn, context) {\r
- this._events = this._events || {};\r
-\r
- /* get/init listeners for type */\r
- var typeListeners = this._events[type];\r
- if (!typeListeners) {\r
- typeListeners = [];\r
- this._events[type] = typeListeners;\r
- }\r
-\r
- if (context === this) {\r
- // Less memory footprint.\r
- context = undefined;\r
- }\r
- var newListener = {fn: fn, ctx: context},\r
- listeners = typeListeners;\r
-\r
- // check if fn already there\r
- for (var i = 0, len = listeners.length; i < len; i++) {\r
- if (listeners[i].fn === fn && listeners[i].ctx === context) {\r
- return;\r
- }\r
- }\r
-\r
- listeners.push(newListener);\r
- },\r
-\r
- _off: function (type, fn, context) {\r
- var listeners,\r
- i,\r
- len;\r
-\r
- if (!this._events) { return; }\r
-\r
- listeners = this._events[type];\r
-\r
- if (!listeners) {\r
- return;\r
- }\r
-\r
- if (!fn) {\r
- // Set all removed listeners to noop so they are not called if remove happens in fire\r
- for (i = 0, len = listeners.length; i < len; i++) {\r
- listeners[i].fn = falseFn;\r
- }\r
- // clear all listeners for a type if function isn't specified\r
- delete this._events[type];\r
- return;\r
- }\r
-\r
- if (context === this) {\r
- context = undefined;\r
- }\r
-\r
- if (listeners) {\r
-\r
- // find fn and remove it\r
- for (i = 0, len = listeners.length; i < len; i++) {\r
- var l = listeners[i];\r
- if (l.ctx !== context) { continue; }\r
- if (l.fn === fn) {\r
-\r
- // set the removed listener to noop so that's not called if remove happens in fire\r
- l.fn = falseFn;\r
-\r
- if (this._firingCount) {\r
- /* copy array in case events are being fired */\r
- this._events[type] = listeners = listeners.slice();\r
- }\r
- listeners.splice(i, 1);\r
-\r
- return;\r
- }\r
- }\r
- }\r
- },\r
-\r
- // @method fire(type: String, data?: Object, propagate?: Boolean): this\r
- // Fires an event of the specified type. You can optionally provide an data\r
- // object — the first argument of the listener function will contain its\r
- // properties. The event can optionally be propagated to event parents.\r
- fire: function (type, data, propagate) {\r
- if (!this.listens(type, propagate)) { return this; }\r
-\r
- var event = extend({}, data, {\r
- type: type,\r
- target: this,\r
- sourceTarget: data && data.sourceTarget || this\r
- });\r
-\r
- if (this._events) {\r
- var listeners = this._events[type];\r
-\r
- if (listeners) {\r
- this._firingCount = (this._firingCount + 1) || 1;\r
- for (var i = 0, len = listeners.length; i < len; i++) {\r
- var l = listeners[i];\r
- l.fn.call(l.ctx || this, event);\r
- }\r
-\r
- this._firingCount--;\r
- }\r
- }\r
-\r
- if (propagate) {\r
- // propagate the event to parents (set with addEventParent)\r
- this._propagateEvent(event);\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method listens(type: String): Boolean\r
- // Returns `true` if a particular event type has any listeners attached to it.\r
- listens: function (type, propagate) {\r
- var listeners = this._events && this._events[type];\r
- if (listeners && listeners.length) { return true; }\r
-\r
- if (propagate) {\r
- // also check parents for listeners if event propagates\r
- for (var id in this._eventParents) {\r
- if (this._eventParents[id].listens(type, propagate)) { return true; }\r
- }\r
- }\r
- return false;\r
- },\r
-\r
- // @method once(…): this\r
- // Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.\r
- once: function (types, fn, context) {\r
-\r
- if (typeof types === 'object') {\r
- for (var type in types) {\r
- this.once(type, types[type], fn);\r
- }\r
- return this;\r
- }\r
-\r
- var handler = bind(function () {\r
- this\r
- .off(types, fn, context)\r
- .off(types, handler, context);\r
- }, this);\r
-\r
- // add a listener that's executed once and removed after that\r
- return this\r
- .on(types, fn, context)\r
- .on(types, handler, context);\r
- },\r
-\r
- // @method addEventParent(obj: Evented): this\r
- // Adds an event parent - an `Evented` that will receive propagated events\r
- addEventParent: function (obj) {\r
- this._eventParents = this._eventParents || {};\r
- this._eventParents[stamp(obj)] = obj;\r
- return this;\r
- },\r
-\r
- // @method removeEventParent(obj: Evented): this\r
- // Removes an event parent, so it will stop receiving propagated events\r
- removeEventParent: function (obj) {\r
- if (this._eventParents) {\r
- delete this._eventParents[stamp(obj)];\r
- }\r
- return this;\r
- },\r
-\r
- _propagateEvent: function (e) {\r
- for (var id in this._eventParents) {\r
- this._eventParents[id].fire(e.type, extend({\r
- layer: e.target,\r
- propagatedFrom: e.target\r
- }, e), true);\r
- }\r
- }\r
- };\r
-\r
- // aliases; we should ditch those eventually\r
-\r
- // @method addEventListener(…): this\r
- // Alias to [`on(…)`](#evented-on)\r
- Events.addEventListener = Events.on;\r
-\r
- // @method removeEventListener(…): this\r
- // Alias to [`off(…)`](#evented-off)\r
-\r
- // @method clearAllEventListeners(…): this\r
- // Alias to [`off()`](#evented-off)\r
- Events.removeEventListener = Events.clearAllEventListeners = Events.off;\r
-\r
- // @method addOneTimeEventListener(…): this\r
- // Alias to [`once(…)`](#evented-once)\r
- Events.addOneTimeEventListener = Events.once;\r
-\r
- // @method fireEvent(…): this\r
- // Alias to [`fire(…)`](#evented-fire)\r
- Events.fireEvent = Events.fire;\r
-\r
- // @method hasEventListeners(…): Boolean\r
- // Alias to [`listens(…)`](#evented-listens)\r
- Events.hasEventListeners = Events.listens;\r
-\r
- var Evented = Class.extend(Events);
-
- /*\r
- * @class Point\r
- * @aka L.Point\r
- *\r
- * Represents a point with `x` and `y` coordinates in pixels.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * var point = L.point(200, 300);\r
- * ```\r
- *\r
- * All Leaflet methods and options that accept `Point` objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:\r
- *\r
- * ```js\r
- * map.panBy([200, 300]);\r
- * map.panBy(L.point(200, 300));\r
- * ```\r
- *\r
- * Note that `Point` does not inherit from Leaflet's `Class` object,\r
- * which means new classes can't inherit from it, and new methods\r
- * can't be added to it with the `include` function.\r
- */\r
-\r
- function Point(x, y, round) {\r
- // @property x: Number; The `x` coordinate of the point\r
- this.x = (round ? Math.round(x) : x);\r
- // @property y: Number; The `y` coordinate of the point\r
- this.y = (round ? Math.round(y) : y);\r
- }\r
-\r
- var trunc = Math.trunc || function (v) {\r
- return v > 0 ? Math.floor(v) : Math.ceil(v);\r
- };\r
-\r
- Point.prototype = {\r
-\r
- // @method clone(): Point\r
- // Returns a copy of the current point.\r
- clone: function () {\r
- return new Point(this.x, this.y);\r
- },\r
-\r
- // @method add(otherPoint: Point): Point\r
- // Returns the result of addition of the current and the given points.\r
- add: function (point) {\r
- // non-destructive, returns a new point\r
- return this.clone()._add(toPoint(point));\r
- },\r
-\r
- _add: function (point) {\r
- // destructive, used directly for performance in situations where it's safe to modify existing point\r
- this.x += point.x;\r
- this.y += point.y;\r
- return this;\r
- },\r
-\r
- // @method subtract(otherPoint: Point): Point\r
- // Returns the result of subtraction of the given point from the current.\r
- subtract: function (point) {\r
- return this.clone()._subtract(toPoint(point));\r
- },\r
-\r
- _subtract: function (point) {\r
- this.x -= point.x;\r
- this.y -= point.y;\r
- return this;\r
- },\r
-\r
- // @method divideBy(num: Number): Point\r
- // Returns the result of division of the current point by the given number.\r
- divideBy: function (num) {\r
- return this.clone()._divideBy(num);\r
- },\r
-\r
- _divideBy: function (num) {\r
- this.x /= num;\r
- this.y /= num;\r
- return this;\r
- },\r
-\r
- // @method multiplyBy(num: Number): Point\r
- // Returns the result of multiplication of the current point by the given number.\r
- multiplyBy: function (num) {\r
- return this.clone()._multiplyBy(num);\r
- },\r
-\r
- _multiplyBy: function (num) {\r
- this.x *= num;\r
- this.y *= num;\r
- return this;\r
- },\r
-\r
- // @method scaleBy(scale: Point): Point\r
- // Multiply each coordinate of the current point by each coordinate of\r
- // `scale`. In linear algebra terms, multiply the point by the\r
- // [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation)\r
- // defined by `scale`.\r
- scaleBy: function (point) {\r
- return new Point(this.x * point.x, this.y * point.y);\r
- },\r
-\r
- // @method unscaleBy(scale: Point): Point\r
- // Inverse of `scaleBy`. Divide each coordinate of the current point by\r
- // each coordinate of `scale`.\r
- unscaleBy: function (point) {\r
- return new Point(this.x / point.x, this.y / point.y);\r
- },\r
-\r
- // @method round(): Point\r
- // Returns a copy of the current point with rounded coordinates.\r
- round: function () {\r
- return this.clone()._round();\r
- },\r
-\r
- _round: function () {\r
- this.x = Math.round(this.x);\r
- this.y = Math.round(this.y);\r
- return this;\r
- },\r
-\r
- // @method floor(): Point\r
- // Returns a copy of the current point with floored coordinates (rounded down).\r
- floor: function () {\r
- return this.clone()._floor();\r
- },\r
-\r
- _floor: function () {\r
- this.x = Math.floor(this.x);\r
- this.y = Math.floor(this.y);\r
- return this;\r
- },\r
-\r
- // @method ceil(): Point\r
- // Returns a copy of the current point with ceiled coordinates (rounded up).\r
- ceil: function () {\r
- return this.clone()._ceil();\r
- },\r
-\r
- _ceil: function () {\r
- this.x = Math.ceil(this.x);\r
- this.y = Math.ceil(this.y);\r
- return this;\r
- },\r
-\r
- // @method trunc(): Point\r
- // Returns a copy of the current point with truncated coordinates (rounded towards zero).\r
- trunc: function () {\r
- return this.clone()._trunc();\r
- },\r
-\r
- _trunc: function () {\r
- this.x = trunc(this.x);\r
- this.y = trunc(this.y);\r
- return this;\r
- },\r
-\r
- // @method distanceTo(otherPoint: Point): Number\r
- // Returns the cartesian distance between the current and the given points.\r
- distanceTo: function (point) {\r
- point = toPoint(point);\r
-\r
- var x = point.x - this.x,\r
- y = point.y - this.y;\r
-\r
- return Math.sqrt(x * x + y * y);\r
- },\r
-\r
- // @method equals(otherPoint: Point): Boolean\r
- // Returns `true` if the given point has the same coordinates.\r
- equals: function (point) {\r
- point = toPoint(point);\r
-\r
- return point.x === this.x &&\r
- point.y === this.y;\r
- },\r
-\r
- // @method contains(otherPoint: Point): Boolean\r
- // Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).\r
- contains: function (point) {\r
- point = toPoint(point);\r
-\r
- return Math.abs(point.x) <= Math.abs(this.x) &&\r
- Math.abs(point.y) <= Math.abs(this.y);\r
- },\r
-\r
- // @method toString(): String\r
- // Returns a string representation of the point for debugging purposes.\r
- toString: function () {\r
- return 'Point(' +\r
- formatNum(this.x) + ', ' +\r
- formatNum(this.y) + ')';\r
- }\r
- };\r
-\r
- // @factory L.point(x: Number, y: Number, round?: Boolean)\r
- // Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values.\r
-\r
- // @alternative\r
- // @factory L.point(coords: Number[])\r
- // Expects an array of the form `[x, y]` instead.\r
-\r
- // @alternative\r
- // @factory L.point(coords: Object)\r
- // Expects a plain object of the form `{x: Number, y: Number}` instead.\r
- function toPoint(x, y, round) {\r
- if (x instanceof Point) {\r
- return x;\r
- }\r
- if (isArray(x)) {\r
- return new Point(x[0], x[1]);\r
- }\r
- if (x === undefined || x === null) {\r
- return x;\r
- }\r
- if (typeof x === 'object' && 'x' in x && 'y' in x) {\r
- return new Point(x.x, x.y);\r
- }\r
- return new Point(x, y, round);\r
- }
-
- /*\r
- * @class Bounds\r
- * @aka L.Bounds\r
- *\r
- * Represents a rectangular area in pixel coordinates.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * var p1 = L.point(10, 10),\r
- * p2 = L.point(40, 60),\r
- * bounds = L.bounds(p1, p2);\r
- * ```\r
- *\r
- * All Leaflet methods that accept `Bounds` objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:\r
- *\r
- * ```js\r
- * otherBounds.intersects([[10, 10], [40, 60]]);\r
- * ```\r
- *\r
- * Note that `Bounds` does not inherit from Leaflet's `Class` object,\r
- * which means new classes can't inherit from it, and new methods\r
- * can't be added to it with the `include` function.\r
- */\r
-\r
- function Bounds(a, b) {\r
- if (!a) { return; }\r
-\r
- var points = b ? [a, b] : a;\r
-\r
- for (var i = 0, len = points.length; i < len; i++) {\r
- this.extend(points[i]);\r
- }\r
- }\r
-\r
- Bounds.prototype = {\r
- // @method extend(point: Point): this\r
- // Extends the bounds to contain the given point.\r
- extend: function (point) { // (Point)\r
- point = toPoint(point);\r
-\r
- // @property min: Point\r
- // The top left corner of the rectangle.\r
- // @property max: Point\r
- // The bottom right corner of the rectangle.\r
- if (!this.min && !this.max) {\r
- this.min = point.clone();\r
- this.max = point.clone();\r
- } else {\r
- this.min.x = Math.min(point.x, this.min.x);\r
- this.max.x = Math.max(point.x, this.max.x);\r
- this.min.y = Math.min(point.y, this.min.y);\r
- this.max.y = Math.max(point.y, this.max.y);\r
- }\r
- return this;\r
- },\r
-\r
- // @method getCenter(round?: Boolean): Point\r
- // Returns the center point of the bounds.\r
- getCenter: function (round) {\r
- return new Point(\r
- (this.min.x + this.max.x) / 2,\r
- (this.min.y + this.max.y) / 2, round);\r
- },\r
-\r
- // @method getBottomLeft(): Point\r
- // Returns the bottom-left point of the bounds.\r
- getBottomLeft: function () {\r
- return new Point(this.min.x, this.max.y);\r
- },\r
-\r
- // @method getTopRight(): Point\r
- // Returns the top-right point of the bounds.\r
- getTopRight: function () { // -> Point\r
- return new Point(this.max.x, this.min.y);\r
- },\r
-\r
- // @method getTopLeft(): Point\r
- // Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)).\r
- getTopLeft: function () {\r
- return this.min; // left, top\r
- },\r
-\r
- // @method getBottomRight(): Point\r
- // Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)).\r
- getBottomRight: function () {\r
- return this.max; // right, bottom\r
- },\r
-\r
- // @method getSize(): Point\r
- // Returns the size of the given bounds\r
- getSize: function () {\r
- return this.max.subtract(this.min);\r
- },\r
-\r
- // @method contains(otherBounds: Bounds): Boolean\r
- // Returns `true` if the rectangle contains the given one.\r
- // @alternative\r
- // @method contains(point: Point): Boolean\r
- // Returns `true` if the rectangle contains the given point.\r
- contains: function (obj) {\r
- var min, max;\r
-\r
- if (typeof obj[0] === 'number' || obj instanceof Point) {\r
- obj = toPoint(obj);\r
- } else {\r
- obj = toBounds(obj);\r
- }\r
-\r
- if (obj instanceof Bounds) {\r
- min = obj.min;\r
- max = obj.max;\r
- } else {\r
- min = max = obj;\r
- }\r
-\r
- return (min.x >= this.min.x) &&\r
- (max.x <= this.max.x) &&\r
- (min.y >= this.min.y) &&\r
- (max.y <= this.max.y);\r
- },\r
-\r
- // @method intersects(otherBounds: Bounds): Boolean\r
- // Returns `true` if the rectangle intersects the given bounds. Two bounds\r
- // intersect if they have at least one point in common.\r
- intersects: function (bounds) { // (Bounds) -> Boolean\r
- bounds = toBounds(bounds);\r
-\r
- var min = this.min,\r
- max = this.max,\r
- min2 = bounds.min,\r
- max2 = bounds.max,\r
- xIntersects = (max2.x >= min.x) && (min2.x <= max.x),\r
- yIntersects = (max2.y >= min.y) && (min2.y <= max.y);\r
-\r
- return xIntersects && yIntersects;\r
- },\r
-\r
- // @method overlaps(otherBounds: Bounds): Boolean\r
- // Returns `true` if the rectangle overlaps the given bounds. Two bounds\r
- // overlap if their intersection is an area.\r
- overlaps: function (bounds) { // (Bounds) -> Boolean\r
- bounds = toBounds(bounds);\r
-\r
- var min = this.min,\r
- max = this.max,\r
- min2 = bounds.min,\r
- max2 = bounds.max,\r
- xOverlaps = (max2.x > min.x) && (min2.x < max.x),\r
- yOverlaps = (max2.y > min.y) && (min2.y < max.y);\r
-\r
- return xOverlaps && yOverlaps;\r
- },\r
-\r
- isValid: function () {\r
- return !!(this.min && this.max);\r
- }\r
- };\r
-\r
-\r
- // @factory L.bounds(corner1: Point, corner2: Point)\r
- // Creates a Bounds object from two corners coordinate pairs.\r
- // @alternative\r
- // @factory L.bounds(points: Point[])\r
- // Creates a Bounds object from the given array of points.\r
- function toBounds(a, b) {\r
- if (!a || a instanceof Bounds) {\r
- return a;\r
- }\r
- return new Bounds(a, b);\r
- }
-
- /*\r
- * @class LatLngBounds\r
- * @aka L.LatLngBounds\r
- *\r
- * Represents a rectangular geographical area on a map.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * var corner1 = L.latLng(40.712, -74.227),\r
- * corner2 = L.latLng(40.774, -74.125),\r
- * bounds = L.latLngBounds(corner1, corner2);\r
- * ```\r
- *\r
- * All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:\r
- *\r
- * ```js\r
- * map.fitBounds([\r
- * [40.712, -74.227],\r
- * [40.774, -74.125]\r
- * ]);\r
- * ```\r
- *\r
- * Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range.\r
- *\r
- * Note that `LatLngBounds` does not inherit from Leaflet's `Class` object,\r
- * which means new classes can't inherit from it, and new methods\r
- * can't be added to it with the `include` function.\r
- */\r
-\r
- function LatLngBounds(corner1, corner2) { // (LatLng, LatLng) or (LatLng[])\r
- if (!corner1) { return; }\r
-\r
- var latlngs = corner2 ? [corner1, corner2] : corner1;\r
-\r
- for (var i = 0, len = latlngs.length; i < len; i++) {\r
- this.extend(latlngs[i]);\r
- }\r
- }\r
-\r
- LatLngBounds.prototype = {\r
-\r
- // @method extend(latlng: LatLng): this\r
- // Extend the bounds to contain the given point\r
-\r
- // @alternative\r
- // @method extend(otherBounds: LatLngBounds): this\r
- // Extend the bounds to contain the given bounds\r
- extend: function (obj) {\r
- var sw = this._southWest,\r
- ne = this._northEast,\r
- sw2, ne2;\r
-\r
- if (obj instanceof LatLng) {\r
- sw2 = obj;\r
- ne2 = obj;\r
-\r
- } else if (obj instanceof LatLngBounds) {\r
- sw2 = obj._southWest;\r
- ne2 = obj._northEast;\r
-\r
- if (!sw2 || !ne2) { return this; }\r
-\r
- } else {\r
- return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this;\r
- }\r
-\r
- if (!sw && !ne) {\r
- this._southWest = new LatLng(sw2.lat, sw2.lng);\r
- this._northEast = new LatLng(ne2.lat, ne2.lng);\r
- } else {\r
- sw.lat = Math.min(sw2.lat, sw.lat);\r
- sw.lng = Math.min(sw2.lng, sw.lng);\r
- ne.lat = Math.max(ne2.lat, ne.lat);\r
- ne.lng = Math.max(ne2.lng, ne.lng);\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method pad(bufferRatio: Number): LatLngBounds\r
- // Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.\r
- // For example, a ratio of 0.5 extends the bounds by 50% in each direction.\r
- // Negative values will retract the bounds.\r
- pad: function (bufferRatio) {\r
- var sw = this._southWest,\r
- ne = this._northEast,\r
- heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio,\r
- widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio;\r
-\r
- return new LatLngBounds(\r
- new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer),\r
- new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer));\r
- },\r
-\r
- // @method getCenter(): LatLng\r
- // Returns the center point of the bounds.\r
- getCenter: function () {\r
- return new LatLng(\r
- (this._southWest.lat + this._northEast.lat) / 2,\r
- (this._southWest.lng + this._northEast.lng) / 2);\r
- },\r
-\r
- // @method getSouthWest(): LatLng\r
- // Returns the south-west point of the bounds.\r
- getSouthWest: function () {\r
- return this._southWest;\r
- },\r
-\r
- // @method getNorthEast(): LatLng\r
- // Returns the north-east point of the bounds.\r
- getNorthEast: function () {\r
- return this._northEast;\r
- },\r
-\r
- // @method getNorthWest(): LatLng\r
- // Returns the north-west point of the bounds.\r
- getNorthWest: function () {\r
- return new LatLng(this.getNorth(), this.getWest());\r
- },\r
-\r
- // @method getSouthEast(): LatLng\r
- // Returns the south-east point of the bounds.\r
- getSouthEast: function () {\r
- return new LatLng(this.getSouth(), this.getEast());\r
- },\r
-\r
- // @method getWest(): Number\r
- // Returns the west longitude of the bounds\r
- getWest: function () {\r
- return this._southWest.lng;\r
- },\r
-\r
- // @method getSouth(): Number\r
- // Returns the south latitude of the bounds\r
- getSouth: function () {\r
- return this._southWest.lat;\r
- },\r
-\r
- // @method getEast(): Number\r
- // Returns the east longitude of the bounds\r
- getEast: function () {\r
- return this._northEast.lng;\r
- },\r
-\r
- // @method getNorth(): Number\r
- // Returns the north latitude of the bounds\r
- getNorth: function () {\r
- return this._northEast.lat;\r
- },\r
-\r
- // @method contains(otherBounds: LatLngBounds): Boolean\r
- // Returns `true` if the rectangle contains the given one.\r
-\r
- // @alternative\r
- // @method contains (latlng: LatLng): Boolean\r
- // Returns `true` if the rectangle contains the given point.\r
- contains: function (obj) { // (LatLngBounds) or (LatLng) -> Boolean\r
- if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) {\r
- obj = toLatLng(obj);\r
- } else {\r
- obj = toLatLngBounds(obj);\r
- }\r
-\r
- var sw = this._southWest,\r
- ne = this._northEast,\r
- sw2, ne2;\r
-\r
- if (obj instanceof LatLngBounds) {\r
- sw2 = obj.getSouthWest();\r
- ne2 = obj.getNorthEast();\r
- } else {\r
- sw2 = ne2 = obj;\r
- }\r
-\r
- return (sw2.lat >= sw.lat) && (ne2.lat <= ne.lat) &&\r
- (sw2.lng >= sw.lng) && (ne2.lng <= ne.lng);\r
- },\r
-\r
- // @method intersects(otherBounds: LatLngBounds): Boolean\r
- // Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.\r
- intersects: function (bounds) {\r
- bounds = toLatLngBounds(bounds);\r
-\r
- var sw = this._southWest,\r
- ne = this._northEast,\r
- sw2 = bounds.getSouthWest(),\r
- ne2 = bounds.getNorthEast(),\r
-\r
- latIntersects = (ne2.lat >= sw.lat) && (sw2.lat <= ne.lat),\r
- lngIntersects = (ne2.lng >= sw.lng) && (sw2.lng <= ne.lng);\r
-\r
- return latIntersects && lngIntersects;\r
- },\r
-\r
- // @method overlaps(otherBounds: LatLngBounds): Boolean\r
- // Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.\r
- overlaps: function (bounds) {\r
- bounds = toLatLngBounds(bounds);\r
-\r
- var sw = this._southWest,\r
- ne = this._northEast,\r
- sw2 = bounds.getSouthWest(),\r
- ne2 = bounds.getNorthEast(),\r
-\r
- latOverlaps = (ne2.lat > sw.lat) && (sw2.lat < ne.lat),\r
- lngOverlaps = (ne2.lng > sw.lng) && (sw2.lng < ne.lng);\r
-\r
- return latOverlaps && lngOverlaps;\r
- },\r
-\r
- // @method toBBoxString(): String\r
- // Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.\r
- toBBoxString: function () {\r
- return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(',');\r
- },\r
-\r
- // @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean\r
- // Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number.\r
- equals: function (bounds, maxMargin) {\r
- if (!bounds) { return false; }\r
-\r
- bounds = toLatLngBounds(bounds);\r
-\r
- return this._southWest.equals(bounds.getSouthWest(), maxMargin) &&\r
- this._northEast.equals(bounds.getNorthEast(), maxMargin);\r
- },\r
-\r
- // @method isValid(): Boolean\r
- // Returns `true` if the bounds are properly initialized.\r
- isValid: function () {\r
- return !!(this._southWest && this._northEast);\r
- }\r
- };\r
-\r
- // TODO International date line?\r
-\r
- // @factory L.latLngBounds(corner1: LatLng, corner2: LatLng)\r
- // Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle.\r
-\r
- // @alternative\r
- // @factory L.latLngBounds(latlngs: LatLng[])\r
- // Creates a `LatLngBounds` object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with [`fitBounds`](#map-fitbounds).\r
- function toLatLngBounds(a, b) {\r
- if (a instanceof LatLngBounds) {\r
- return a;\r
- }\r
- return new LatLngBounds(a, b);\r
- }
-
- /* @class LatLng\r
- * @aka L.LatLng\r
- *\r
- * Represents a geographical point with a certain latitude and longitude.\r
- *\r
- * @example\r
- *\r
- * ```\r
- * var latlng = L.latLng(50.5, 30.5);\r
- * ```\r
- *\r
- * All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:\r
- *\r
- * ```\r
- * map.panTo([50, 30]);\r
- * map.panTo({lon: 30, lat: 50});\r
- * map.panTo({lat: 50, lng: 30});\r
- * map.panTo(L.latLng(50, 30));\r
- * ```\r
- *\r
- * Note that `LatLng` does not inherit from Leaflet's `Class` object,\r
- * which means new classes can't inherit from it, and new methods\r
- * can't be added to it with the `include` function.\r
- */\r
-\r
- function LatLng(lat, lng, alt) {\r
- if (isNaN(lat) || isNaN(lng)) {\r
- throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');\r
- }\r
-\r
- // @property lat: Number\r
- // Latitude in degrees\r
- this.lat = +lat;\r
-\r
- // @property lng: Number\r
- // Longitude in degrees\r
- this.lng = +lng;\r
-\r
- // @property alt: Number\r
- // Altitude in meters (optional)\r
- if (alt !== undefined) {\r
- this.alt = +alt;\r
- }\r
- }\r
-\r
- LatLng.prototype = {\r
- // @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean\r
- // Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number.\r
- equals: function (obj, maxMargin) {\r
- if (!obj) { return false; }\r
-\r
- obj = toLatLng(obj);\r
-\r
- var margin = Math.max(\r
- Math.abs(this.lat - obj.lat),\r
- Math.abs(this.lng - obj.lng));\r
-\r
- return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin);\r
- },\r
-\r
- // @method toString(): String\r
- // Returns a string representation of the point (for debugging purposes).\r
- toString: function (precision) {\r
- return 'LatLng(' +\r
- formatNum(this.lat, precision) + ', ' +\r
- formatNum(this.lng, precision) + ')';\r
- },\r
-\r
- // @method distanceTo(otherLatLng: LatLng): Number\r
- // Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines).\r
- distanceTo: function (other) {\r
- return Earth.distance(this, toLatLng(other));\r
- },\r
-\r
- // @method wrap(): LatLng\r
- // Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees.\r
- wrap: function () {\r
- return Earth.wrapLatLng(this);\r
- },\r
-\r
- // @method toBounds(sizeInMeters: Number): LatLngBounds\r
- // Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`.\r
- toBounds: function (sizeInMeters) {\r
- var latAccuracy = 180 * sizeInMeters / 40075017,\r
- lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);\r
-\r
- return toLatLngBounds(\r
- [this.lat - latAccuracy, this.lng - lngAccuracy],\r
- [this.lat + latAccuracy, this.lng + lngAccuracy]);\r
- },\r
-\r
- clone: function () {\r
- return new LatLng(this.lat, this.lng, this.alt);\r
- }\r
- };\r
-\r
-\r
-\r
- // @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng\r
- // Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).\r
-\r
- // @alternative\r
- // @factory L.latLng(coords: Array): LatLng\r
- // Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead.\r
-\r
- // @alternative\r
- // @factory L.latLng(coords: Object): LatLng\r
- // Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead.\r
-\r
- function toLatLng(a, b, c) {\r
- if (a instanceof LatLng) {\r
- return a;\r
- }\r
- if (isArray(a) && typeof a[0] !== 'object') {\r
- if (a.length === 3) {\r
- return new LatLng(a[0], a[1], a[2]);\r
- }\r
- if (a.length === 2) {\r
- return new LatLng(a[0], a[1]);\r
- }\r
- return null;\r
- }\r
- if (a === undefined || a === null) {\r
- return a;\r
- }\r
- if (typeof a === 'object' && 'lat' in a) {\r
- return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\r
- }\r
- if (b === undefined) {\r
- return null;\r
- }\r
- return new LatLng(a, b, c);\r
- }
-
- /*\r
- * @namespace CRS\r
- * @crs L.CRS.Base\r
- * Object that defines coordinate reference systems for projecting\r
- * geographical points into pixel (screen) coordinates and back (and to\r
- * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See\r
- * [spatial reference system](http://en.wikipedia.org/wiki/Coordinate_reference_system).\r
- *\r
- * Leaflet defines the most usual CRSs by default. If you want to use a\r
- * CRS not defined by default, take a look at the\r
- * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin.\r
- *\r
- * Note that the CRS instances do not inherit from Leaflet's `Class` object,\r
- * and can't be instantiated. Also, new classes can't inherit from them,\r
- * and methods can't be added to them with the `include` function.\r
- */\r
-\r
- var CRS = {\r
- // @method latLngToPoint(latlng: LatLng, zoom: Number): Point\r
- // Projects geographical coordinates into pixel coordinates for a given zoom.\r
- latLngToPoint: function (latlng, zoom) {\r
- var projectedPoint = this.projection.project(latlng),\r
- scale = this.scale(zoom);\r
-\r
- return this.transformation._transform(projectedPoint, scale);\r
- },\r
-\r
- // @method pointToLatLng(point: Point, zoom: Number): LatLng\r
- // The inverse of `latLngToPoint`. Projects pixel coordinates on a given\r
- // zoom into geographical coordinates.\r
- pointToLatLng: function (point, zoom) {\r
- var scale = this.scale(zoom),\r
- untransformedPoint = this.transformation.untransform(point, scale);\r
-\r
- return this.projection.unproject(untransformedPoint);\r
- },\r
-\r
- // @method project(latlng: LatLng): Point\r
- // Projects geographical coordinates into coordinates in units accepted for\r
- // this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).\r
- project: function (latlng) {\r
- return this.projection.project(latlng);\r
- },\r
-\r
- // @method unproject(point: Point): LatLng\r
- // Given a projected coordinate returns the corresponding LatLng.\r
- // The inverse of `project`.\r
- unproject: function (point) {\r
- return this.projection.unproject(point);\r
- },\r
-\r
- // @method scale(zoom: Number): Number\r
- // Returns the scale used when transforming projected coordinates into\r
- // pixel coordinates for a particular zoom. For example, it returns\r
- // `256 * 2^zoom` for Mercator-based CRS.\r
- scale: function (zoom) {\r
- return 256 * Math.pow(2, zoom);\r
- },\r
-\r
- // @method zoom(scale: Number): Number\r
- // Inverse of `scale()`, returns the zoom level corresponding to a scale\r
- // factor of `scale`.\r
- zoom: function (scale) {\r
- return Math.log(scale / 256) / Math.LN2;\r
- },\r
-\r
- // @method getProjectedBounds(zoom: Number): Bounds\r
- // Returns the projection's bounds scaled and transformed for the provided `zoom`.\r
- getProjectedBounds: function (zoom) {\r
- if (this.infinite) { return null; }\r
-\r
- var b = this.projection.bounds,\r
- s = this.scale(zoom),\r
- min = this.transformation.transform(b.min, s),\r
- max = this.transformation.transform(b.max, s);\r
-\r
- return new Bounds(min, max);\r
- },\r
-\r
- // @method distance(latlng1: LatLng, latlng2: LatLng): Number\r
- // Returns the distance between two geographical coordinates.\r
-\r
- // @property code: String\r
- // Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`)\r
- //\r
- // @property wrapLng: Number[]\r
- // An array of two numbers defining whether the longitude (horizontal) coordinate\r
- // axis wraps around a given range and how. Defaults to `[-180, 180]` in most\r
- // geographical CRSs. If `undefined`, the longitude axis does not wrap around.\r
- //\r
- // @property wrapLat: Number[]\r
- // Like `wrapLng`, but for the latitude (vertical) axis.\r
-\r
- // wrapLng: [min, max],\r
- // wrapLat: [min, max],\r
-\r
- // @property infinite: Boolean\r
- // If true, the coordinate space will be unbounded (infinite in both axes)\r
- infinite: false,\r
-\r
- // @method wrapLatLng(latlng: LatLng): LatLng\r
- // Returns a `LatLng` where lat and lng has been wrapped according to the\r
- // CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds.\r
- wrapLatLng: function (latlng) {\r
- var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng,\r
- lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat,\r
- alt = latlng.alt;\r
-\r
- return new LatLng(lat, lng, alt);\r
- },\r
-\r
- // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds\r
- // Returns a `LatLngBounds` with the same size as the given one, ensuring\r
- // that its center is within the CRS's bounds.\r
- // Only accepts actual `L.LatLngBounds` instances, not arrays.\r
- wrapLatLngBounds: function (bounds) {\r
- var center = bounds.getCenter(),\r
- newCenter = this.wrapLatLng(center),\r
- latShift = center.lat - newCenter.lat,\r
- lngShift = center.lng - newCenter.lng;\r
-\r
- if (latShift === 0 && lngShift === 0) {\r
- return bounds;\r
- }\r
-\r
- var sw = bounds.getSouthWest(),\r
- ne = bounds.getNorthEast(),\r
- newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift),\r
- newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift);\r
-\r
- return new LatLngBounds(newSw, newNe);\r
- }\r
- };
-
- /*
- * @namespace CRS
- * @crs L.CRS.Earth
- *
- * Serves as the base for CRS that are global such that they cover the earth.
- * Can only be used as the base for other CRS and cannot be used directly,
- * since it does not have a `code`, `projection` or `transformation`. `distance()` returns
- * meters.
- */
-
- var Earth = extend({}, CRS, {
- wrapLng: [-180, 180],
-
- // Mean Earth Radius, as recommended for use by
- // the International Union of Geodesy and Geophysics,
- // see http://rosettacode.org/wiki/Haversine_formula
- R: 6371000,
-
- // distance between two geographical points using spherical law of cosines approximation
- distance: function (latlng1, latlng2) {
- var rad = Math.PI / 180,
- lat1 = latlng1.lat * rad,
- lat2 = latlng2.lat * rad,
- sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2),
- sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2),
- a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon,
- c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
- return this.R * c;
- }
- });
-
- /*\r
- * @namespace Projection\r
- * @projection L.Projection.SphericalMercator\r
- *\r
- * Spherical Mercator projection — the most common projection for online maps,\r
- * used by almost all free and commercial tile providers. Assumes that Earth is\r
- * a sphere. Used by the `EPSG:3857` CRS.\r
- */\r
-\r
- var earthRadius = 6378137;\r
-\r
- var SphericalMercator = {\r
-\r
- R: earthRadius,\r
- MAX_LATITUDE: 85.0511287798,\r
-\r
- project: function (latlng) {\r
- var d = Math.PI / 180,\r
- max = this.MAX_LATITUDE,\r
- lat = Math.max(Math.min(max, latlng.lat), -max),\r
- sin = Math.sin(lat * d);\r
-\r
- return new Point(\r
- this.R * latlng.lng * d,\r
- this.R * Math.log((1 + sin) / (1 - sin)) / 2);\r
- },\r
-\r
- unproject: function (point) {\r
- var d = 180 / Math.PI;\r
-\r
- return new LatLng(\r
- (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,\r
- point.x * d / this.R);\r
- },\r
-\r
- bounds: (function () {\r
- var d = earthRadius * Math.PI;\r
- return new Bounds([-d, -d], [d, d]);\r
- })()\r
- };
-
- /*\r
- * @class Transformation\r
- * @aka L.Transformation\r
- *\r
- * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d`\r
- * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing\r
- * the reverse. Used by Leaflet in its projections code.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * var transformation = L.transformation(2, 5, -1, 10),\r
- * p = L.point(1, 2),\r
- * p2 = transformation.transform(p), // L.point(7, 8)\r
- * p3 = transformation.untransform(p2); // L.point(1, 2)\r
- * ```\r
- */\r
-\r
-\r
- // factory new L.Transformation(a: Number, b: Number, c: Number, d: Number)\r
- // Creates a `Transformation` object with the given coefficients.\r
- function Transformation(a, b, c, d) {\r
- if (isArray(a)) {\r
- // use array properties\r
- this._a = a[0];\r
- this._b = a[1];\r
- this._c = a[2];\r
- this._d = a[3];\r
- return;\r
- }\r
- this._a = a;\r
- this._b = b;\r
- this._c = c;\r
- this._d = d;\r
- }\r
-\r
- Transformation.prototype = {\r
- // @method transform(point: Point, scale?: Number): Point\r
- // Returns a transformed point, optionally multiplied by the given scale.\r
- // Only accepts actual `L.Point` instances, not arrays.\r
- transform: function (point, scale) { // (Point, Number) -> Point\r
- return this._transform(point.clone(), scale);\r
- },\r
-\r
- // destructive transform (faster)\r
- _transform: function (point, scale) {\r
- scale = scale || 1;\r
- point.x = scale * (this._a * point.x + this._b);\r
- point.y = scale * (this._c * point.y + this._d);\r
- return point;\r
- },\r
-\r
- // @method untransform(point: Point, scale?: Number): Point\r
- // Returns the reverse transformation of the given point, optionally divided\r
- // by the given scale. Only accepts actual `L.Point` instances, not arrays.\r
- untransform: function (point, scale) {\r
- scale = scale || 1;\r
- return new Point(\r
- (point.x / scale - this._b) / this._a,\r
- (point.y / scale - this._d) / this._c);\r
- }\r
- };\r
-\r
- // factory L.transformation(a: Number, b: Number, c: Number, d: Number)\r
-\r
- // @factory L.transformation(a: Number, b: Number, c: Number, d: Number)\r
- // Instantiates a Transformation object with the given coefficients.\r
-\r
- // @alternative\r
- // @factory L.transformation(coefficients: Array): Transformation\r
- // Expects an coefficients array of the form\r
- // `[a: Number, b: Number, c: Number, d: Number]`.\r
-\r
- function toTransformation(a, b, c, d) {\r
- return new Transformation(a, b, c, d);\r
- }
-
- /*\r
- * @namespace CRS\r
- * @crs L.CRS.EPSG3857\r
- *\r
- * The most common CRS for online maps, used by almost all free and commercial\r
- * tile providers. Uses Spherical Mercator projection. Set in by default in\r
- * Map's `crs` option.\r
- */\r
-\r
- var EPSG3857 = extend({}, Earth, {\r
- code: 'EPSG:3857',\r
- projection: SphericalMercator,\r
-\r
- transformation: (function () {\r
- var scale = 0.5 / (Math.PI * SphericalMercator.R);\r
- return toTransformation(scale, 0.5, -scale, 0.5);\r
- }())\r
- });\r
-\r
- var EPSG900913 = extend({}, EPSG3857, {\r
- code: 'EPSG:900913'\r
- });
-
- // @namespace SVG; @section
- // There are several static functions which can be called without instantiating L.SVG:
-
- // @function create(name: String): SVGElement
- // Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement),
- // corresponding to the class name passed. For example, using 'line' will return
- // an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement).
- function svgCreate(name) {
- return document.createElementNS('http://www.w3.org/2000/svg', name);
- }
-
- // @function pointsToPath(rings: Point[], closed: Boolean): String
- // Generates a SVG path string for multiple rings, with each ring turning
- // into "M..L..L.." instructions
- function pointsToPath(rings, closed) {
- var str = '',
- i, j, len, len2, points, p;
-
- for (i = 0, len = rings.length; i < len; i++) {
- points = rings[i];
-
- for (j = 0, len2 = points.length; j < len2; j++) {
- p = points[j];
- str += (j ? 'L' : 'M') + p.x + ' ' + p.y;
- }
-
- // closes the ring for polygons; "x" is VML syntax
- str += closed ? (svg ? 'z' : 'x') : '';
- }
-
- // SVG complains about empty path strings
- return str || 'M0 0';
- }
-
- /*\r
- * @namespace Browser\r
- * @aka L.Browser\r
- *\r
- * A namespace with static properties for browser/feature detection used by Leaflet internally.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * if (L.Browser.ielt9) {\r
- * alert('Upgrade your browser, dude!');\r
- * }\r
- * ```\r
- */\r
-\r
- var style$1 = document.documentElement.style;\r
-\r
- // @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).\r
- var ie = 'ActiveXObject' in window;\r
-\r
- // @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.\r
- var ielt9 = ie && !document.addEventListener;\r
-\r
- // @property edge: Boolean; `true` for the Edge web browser.\r
- var edge = 'msLaunchUri' in navigator && !('documentMode' in document);\r
-\r
- // @property webkit: Boolean;\r
- // `true` for webkit-based browsers like Chrome and Safari (including mobile versions).\r
- var webkit = userAgentContains('webkit');\r
-\r
- // @property android: Boolean\r
- // `true` for any browser running on an Android platform.\r
- var android = userAgentContains('android');\r
-\r
- // @property android23: Boolean; `true` for browsers running on Android 2 or Android 3.\r
- var android23 = userAgentContains('android 2') || userAgentContains('android 3');\r
-\r
- /* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */\r
- var webkitVer = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit\r
- // @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome)\r
- var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window);\r
-\r
- // @property opera: Boolean; `true` for the Opera browser\r
- var opera = !!window.opera;\r
-\r
- // @property chrome: Boolean; `true` for the Chrome browser.\r
- var chrome = !edge && userAgentContains('chrome');\r
-\r
- // @property gecko: Boolean; `true` for gecko-based browsers like Firefox.\r
- var gecko = userAgentContains('gecko') && !webkit && !opera && !ie;\r
-\r
- // @property safari: Boolean; `true` for the Safari browser.\r
- var safari = !chrome && userAgentContains('safari');\r
-\r
- var phantom = userAgentContains('phantom');\r
-\r
- // @property opera12: Boolean\r
- // `true` for the Opera browser supporting CSS transforms (version 12 or later).\r
- var opera12 = 'OTransition' in style$1;\r
-\r
- // @property win: Boolean; `true` when the browser is running in a Windows platform\r
- var win = navigator.platform.indexOf('Win') === 0;\r
-\r
- // @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.\r
- var ie3d = ie && ('transition' in style$1);\r
-\r
- // @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.\r
- var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23;\r
-\r
- // @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.\r
- var gecko3d = 'MozPerspective' in style$1;\r
-\r
- // @property any3d: Boolean\r
- // `true` for all browsers supporting CSS transforms.\r
- var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom;\r
-\r
- // @property mobile: Boolean; `true` for all browsers running in a mobile device.\r
- var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile');\r
-\r
- // @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.\r
- var mobileWebkit = mobile && webkit;\r
-\r
- // @property mobileWebkit3d: Boolean\r
- // `true` for all webkit-based browsers in a mobile device supporting CSS transforms.\r
- var mobileWebkit3d = mobile && webkit3d;\r
-\r
- // @property msPointer: Boolean\r
- // `true` for browsers implementing the Microsoft touch events model (notably IE10).\r
- var msPointer = !window.PointerEvent && window.MSPointerEvent;\r
-\r
- // @property pointer: Boolean\r
- // `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).\r
- var pointer = !!(window.PointerEvent || msPointer);\r
-\r
- // @property touch: Boolean\r
- // `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).\r
- // This does not necessarily mean that the browser is running in a computer with\r
- // a touchscreen, it only means that the browser is capable of understanding\r
- // touch events.\r
- var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window ||\r
- (window.DocumentTouch && document instanceof window.DocumentTouch));\r
-\r
- // @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.\r
- var mobileOpera = mobile && opera;\r
-\r
- // @property mobileGecko: Boolean\r
- // `true` for gecko-based browsers running in a mobile device.\r
- var mobileGecko = mobile && gecko;\r
-\r
- // @property retina: Boolean\r
- // `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.\r
- var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;\r
-\r
- // @property passiveEvents: Boolean\r
- // `true` for browsers that support passive events.\r
- var passiveEvents = (function () {\r
- var supportsPassiveOption = false;\r
- try {\r
- var opts = Object.defineProperty({}, 'passive', {\r
- get: function () { // eslint-disable-line getter-return\r
- supportsPassiveOption = true;\r
- }\r
- });\r
- window.addEventListener('testPassiveEventSupport', falseFn, opts);\r
- window.removeEventListener('testPassiveEventSupport', falseFn, opts);\r
- } catch (e) {\r
- // Errors can safely be ignored since this is only a browser support test.\r
- }\r
- return supportsPassiveOption;\r
- }());\r
-\r
- // @property canvas: Boolean\r
- // `true` when the browser supports [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).\r
- var canvas = (function () {\r
- return !!document.createElement('canvas').getContext;\r
- }());\r
-\r
- // @property svg: Boolean\r
- // `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG).\r
- var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect);\r
-\r
- // @property vml: Boolean\r
- // `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language).\r
- var vml = !svg && (function () {\r
- try {\r
- var div = document.createElement('div');\r
- div.innerHTML = '<v:shape adj="1"/>';\r
-\r
- var shape = div.firstChild;\r
- shape.style.behavior = 'url(#default#VML)';\r
-\r
- return shape && (typeof shape.adj === 'object');\r
-\r
- } catch (e) {\r
- return false;\r
- }\r
- }());\r
-\r
-\r
- function userAgentContains(str) {\r
- return navigator.userAgent.toLowerCase().indexOf(str) >= 0;\r
- }
-
- var Browser = ({
- ie: ie,
- ielt9: ielt9,
- edge: edge,
- webkit: webkit,
- android: android,
- android23: android23,
- androidStock: androidStock,
- opera: opera,
- chrome: chrome,
- gecko: gecko,
- safari: safari,
- phantom: phantom,
- opera12: opera12,
- win: win,
- ie3d: ie3d,
- webkit3d: webkit3d,
- gecko3d: gecko3d,
- any3d: any3d,
- mobile: mobile,
- mobileWebkit: mobileWebkit,
- mobileWebkit3d: mobileWebkit3d,
- msPointer: msPointer,
- pointer: pointer,
- touch: touch,
- mobileOpera: mobileOpera,
- mobileGecko: mobileGecko,
- retina: retina,
- passiveEvents: passiveEvents,
- canvas: canvas,
- svg: svg,
- vml: vml
- });
-
- /*
- * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.
- */
-
-
- var POINTER_DOWN = msPointer ? 'MSPointerDown' : 'pointerdown';
- var POINTER_MOVE = msPointer ? 'MSPointerMove' : 'pointermove';
- var POINTER_UP = msPointer ? 'MSPointerUp' : 'pointerup';
- var POINTER_CANCEL = msPointer ? 'MSPointerCancel' : 'pointercancel';
-
- var _pointers = {};
- var _pointerDocListener = false;
-
- // Provides a touch events wrapper for (ms)pointer events.
- // ref http://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890
-
- function addPointerListener(obj, type, handler, id) {
- if (type === 'touchstart') {
- _addPointerStart(obj, handler, id);
-
- } else if (type === 'touchmove') {
- _addPointerMove(obj, handler, id);
-
- } else if (type === 'touchend') {
- _addPointerEnd(obj, handler, id);
- }
-
- return this;
- }
-
- function removePointerListener(obj, type, id) {
- var handler = obj['_leaflet_' + type + id];
-
- if (type === 'touchstart') {
- obj.removeEventListener(POINTER_DOWN, handler, false);
-
- } else if (type === 'touchmove') {
- obj.removeEventListener(POINTER_MOVE, handler, false);
-
- } else if (type === 'touchend') {
- obj.removeEventListener(POINTER_UP, handler, false);
- obj.removeEventListener(POINTER_CANCEL, handler, false);
- }
-
- return this;
- }
-
- function _addPointerStart(obj, handler, id) {
- var onDown = bind(function (e) {
- // IE10 specific: MsTouch needs preventDefault. See #2000
- if (e.MSPOINTER_TYPE_TOUCH && e.pointerType === e.MSPOINTER_TYPE_TOUCH) {
- preventDefault(e);
- }
-
- _handlePointer(e, handler);
- });
-
- obj['_leaflet_touchstart' + id] = onDown;
- obj.addEventListener(POINTER_DOWN, onDown, false);
-
- // need to keep track of what pointers and how many are active to provide e.touches emulation
- if (!_pointerDocListener) {
- // we listen document as any drags that end by moving the touch off the screen get fired there
- document.addEventListener(POINTER_DOWN, _globalPointerDown, true);
- document.addEventListener(POINTER_MOVE, _globalPointerMove, true);
- document.addEventListener(POINTER_UP, _globalPointerUp, true);
- document.addEventListener(POINTER_CANCEL, _globalPointerUp, true);
-
- _pointerDocListener = true;
- }
- }
-
- function _globalPointerDown(e) {
- _pointers[e.pointerId] = e;
- }
-
- function _globalPointerMove(e) {
- if (_pointers[e.pointerId]) {
- _pointers[e.pointerId] = e;
- }
- }
-
- function _globalPointerUp(e) {
- delete _pointers[e.pointerId];
- }
-
- function _handlePointer(e, handler) {
- e.touches = [];
- for (var i in _pointers) {
- e.touches.push(_pointers[i]);
- }
- e.changedTouches = [e];
-
- handler(e);
- }
-
- function _addPointerMove(obj, handler, id) {
- var onMove = function (e) {
- // don't fire touch moves when mouse isn't down
- if ((e.pointerType === (e.MSPOINTER_TYPE_MOUSE || 'mouse')) && e.buttons === 0) {
- return;
- }
-
- _handlePointer(e, handler);
- };
-
- obj['_leaflet_touchmove' + id] = onMove;
- obj.addEventListener(POINTER_MOVE, onMove, false);
- }
-
- function _addPointerEnd(obj, handler, id) {
- var onUp = function (e) {
- _handlePointer(e, handler);
- };
-
- obj['_leaflet_touchend' + id] = onUp;
- obj.addEventListener(POINTER_UP, onUp, false);
- obj.addEventListener(POINTER_CANCEL, onUp, false);
- }
-
- /*\r
- * Extends the event handling code with double tap support for mobile browsers.\r
- */\r
-\r
- var _touchstart = msPointer ? 'MSPointerDown' : pointer ? 'pointerdown' : 'touchstart';\r
- var _touchend = msPointer ? 'MSPointerUp' : pointer ? 'pointerup' : 'touchend';\r
- var _pre = '_leaflet_';\r
-\r
- // inspired by Zepto touch code by Thomas Fuchs\r
- function addDoubleTapListener(obj, handler, id) {\r
- var last, touch$$1,\r
- doubleTap = false,\r
- delay = 250;\r
-\r
- function onTouchStart(e) {\r
-\r
- if (pointer) {\r
- if (!e.isPrimary) { return; }\r
- if (e.pointerType === 'mouse') { return; } // mouse fires native dblclick\r
- } else if (e.touches.length > 1) {\r
- return;\r
- }\r
-\r
- var now = Date.now(),\r
- delta = now - (last || now);\r
-\r
- touch$$1 = e.touches ? e.touches[0] : e;\r
- doubleTap = (delta > 0 && delta <= delay);\r
- last = now;\r
- }\r
-\r
- function onTouchEnd(e) {\r
- if (doubleTap && !touch$$1.cancelBubble) {\r
- if (pointer) {\r
- if (e.pointerType === 'mouse') { return; }\r
- // work around .type being readonly with MSPointer* events\r
- var newTouch = {},\r
- prop, i;\r
-\r
- for (i in touch$$1) {\r
- prop = touch$$1[i];\r
- newTouch[i] = prop && prop.bind ? prop.bind(touch$$1) : prop;\r
- }\r
- touch$$1 = newTouch;\r
- }\r
- touch$$1.type = 'dblclick';\r
- touch$$1.button = 0;\r
- handler(touch$$1);\r
- last = null;\r
- }\r
- }\r
-\r
- obj[_pre + _touchstart + id] = onTouchStart;\r
- obj[_pre + _touchend + id] = onTouchEnd;\r
- obj[_pre + 'dblclick' + id] = handler;\r
-\r
- obj.addEventListener(_touchstart, onTouchStart, passiveEvents ? {passive: false} : false);\r
- obj.addEventListener(_touchend, onTouchEnd, passiveEvents ? {passive: false} : false);\r
-\r
- // On some platforms (notably, chrome<55 on win10 + touchscreen + mouse),\r
- // the browser doesn't fire touchend/pointerup events but does fire\r
- // native dblclicks. See #4127.\r
- // Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180.\r
- obj.addEventListener('dblclick', handler, false);\r
-\r
- return this;\r
- }\r
-\r
- function removeDoubleTapListener(obj, id) {\r
- var touchstart = obj[_pre + _touchstart + id],\r
- touchend = obj[_pre + _touchend + id],\r
- dblclick = obj[_pre + 'dblclick' + id];\r
-\r
- obj.removeEventListener(_touchstart, touchstart, passiveEvents ? {passive: false} : false);\r
- obj.removeEventListener(_touchend, touchend, passiveEvents ? {passive: false} : false);\r
- obj.removeEventListener('dblclick', dblclick, false);\r
-\r
- return this;\r
- }
-
- /*\r
- * @namespace DomUtil\r
- *\r
- * Utility functions to work with the [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model)\r
- * tree, used by Leaflet internally.\r
- *\r
- * Most functions expecting or returning a `HTMLElement` also work for\r
- * SVG elements. The only difference is that classes refer to CSS classes\r
- * in HTML and SVG classes in SVG.\r
- */\r
-\r
-\r
- // @property TRANSFORM: String\r
- // Vendor-prefixed transform style name (e.g. `'webkitTransform'` for WebKit).\r
- var TRANSFORM = testProp(\r
- ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']);\r
-\r
- // webkitTransition comes first because some browser versions that drop vendor prefix don't do\r
- // the same for the transitionend event, in particular the Android 4.1 stock browser\r
-\r
- // @property TRANSITION: String\r
- // Vendor-prefixed transition style name.\r
- var TRANSITION = testProp(\r
- ['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']);\r
-\r
- // @property TRANSITION_END: String\r
- // Vendor-prefixed transitionend event name.\r
- var TRANSITION_END =\r
- TRANSITION === 'webkitTransition' || TRANSITION === 'OTransition' ? TRANSITION + 'End' : 'transitionend';\r
-\r
-\r
- // @function get(id: String|HTMLElement): HTMLElement\r
- // Returns an element given its DOM id, or returns the element itself\r
- // if it was passed directly.\r
- function get(id) {\r
- return typeof id === 'string' ? document.getElementById(id) : id;\r
- }\r
-\r
- // @function getStyle(el: HTMLElement, styleAttrib: String): String\r
- // Returns the value for a certain style attribute on an element,\r
- // including computed values or values set through CSS.\r
- function getStyle(el, style) {\r
- var value = el.style[style] || (el.currentStyle && el.currentStyle[style]);\r
-\r
- if ((!value || value === 'auto') && document.defaultView) {\r
- var css = document.defaultView.getComputedStyle(el, null);\r
- value = css ? css[style] : null;\r
- }\r
- return value === 'auto' ? null : value;\r
- }\r
-\r
- // @function create(tagName: String, className?: String, container?: HTMLElement): HTMLElement\r
- // Creates an HTML element with `tagName`, sets its class to `className`, and optionally appends it to `container` element.\r
- function create$1(tagName, className, container) {\r
- var el = document.createElement(tagName);\r
- el.className = className || '';\r
-\r
- if (container) {\r
- container.appendChild(el);\r
- }\r
- return el;\r
- }\r
-\r
- // @function remove(el: HTMLElement)\r
- // Removes `el` from its parent element\r
- function remove(el) {\r
- var parent = el.parentNode;\r
- if (parent) {\r
- parent.removeChild(el);\r
- }\r
- }\r
-\r
- // @function empty(el: HTMLElement)\r
- // Removes all of `el`'s children elements from `el`\r
- function empty(el) {\r
- while (el.firstChild) {\r
- el.removeChild(el.firstChild);\r
- }\r
- }\r
-\r
- // @function toFront(el: HTMLElement)\r
- // Makes `el` the last child of its parent, so it renders in front of the other children.\r
- function toFront(el) {\r
- var parent = el.parentNode;\r
- if (parent && parent.lastChild !== el) {\r
- parent.appendChild(el);\r
- }\r
- }\r
-\r
- // @function toBack(el: HTMLElement)\r
- // Makes `el` the first child of its parent, so it renders behind the other children.\r
- function toBack(el) {\r
- var parent = el.parentNode;\r
- if (parent && parent.firstChild !== el) {\r
- parent.insertBefore(el, parent.firstChild);\r
- }\r
- }\r
-\r
- // @function hasClass(el: HTMLElement, name: String): Boolean\r
- // Returns `true` if the element's class attribute contains `name`.\r
- function hasClass(el, name) {\r
- if (el.classList !== undefined) {\r
- return el.classList.contains(name);\r
- }\r
- var className = getClass(el);\r
- return className.length > 0 && new RegExp('(^|\\s)' + name + '(\\s|$)').test(className);\r
- }\r
-\r
- // @function addClass(el: HTMLElement, name: String)\r
- // Adds `name` to the element's class attribute.\r
- function addClass(el, name) {\r
- if (el.classList !== undefined) {\r
- var classes = splitWords(name);\r
- for (var i = 0, len = classes.length; i < len; i++) {\r
- el.classList.add(classes[i]);\r
- }\r
- } else if (!hasClass(el, name)) {\r
- var className = getClass(el);\r
- setClass(el, (className ? className + ' ' : '') + name);\r
- }\r
- }\r
-\r
- // @function removeClass(el: HTMLElement, name: String)\r
- // Removes `name` from the element's class attribute.\r
- function removeClass(el, name) {\r
- if (el.classList !== undefined) {\r
- el.classList.remove(name);\r
- } else {\r
- setClass(el, trim((' ' + getClass(el) + ' ').replace(' ' + name + ' ', ' ')));\r
- }\r
- }\r
-\r
- // @function setClass(el: HTMLElement, name: String)\r
- // Sets the element's class.\r
- function setClass(el, name) {\r
- if (el.className.baseVal === undefined) {\r
- el.className = name;\r
- } else {\r
- // in case of SVG element\r
- el.className.baseVal = name;\r
- }\r
- }\r
-\r
- // @function getClass(el: HTMLElement): String\r
- // Returns the element's class.\r
- function getClass(el) {\r
- // Check if the element is an SVGElementInstance and use the correspondingElement instead\r
- // (Required for linked SVG elements in IE11.)\r
- if (el.correspondingElement) {\r
- el = el.correspondingElement;\r
- }\r
- return el.className.baseVal === undefined ? el.className : el.className.baseVal;\r
- }\r
-\r
- // @function setOpacity(el: HTMLElement, opacity: Number)\r
- // Set the opacity of an element (including old IE support).\r
- // `opacity` must be a number from `0` to `1`.\r
- function setOpacity(el, value) {\r
- if ('opacity' in el.style) {\r
- el.style.opacity = value;\r
- } else if ('filter' in el.style) {\r
- _setOpacityIE(el, value);\r
- }\r
- }\r
-\r
- function _setOpacityIE(el, value) {\r
- var filter = false,\r
- filterName = 'DXImageTransform.Microsoft.Alpha';\r
-\r
- // filters collection throws an error if we try to retrieve a filter that doesn't exist\r
- try {\r
- filter = el.filters.item(filterName);\r
- } catch (e) {\r
- // don't set opacity to 1 if we haven't already set an opacity,\r
- // it isn't needed and breaks transparent pngs.\r
- if (value === 1) { return; }\r
- }\r
-\r
- value = Math.round(value * 100);\r
-\r
- if (filter) {\r
- filter.Enabled = (value !== 100);\r
- filter.Opacity = value;\r
- } else {\r
- el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';\r
- }\r
- }\r
-\r
- // @function testProp(props: String[]): String|false\r
- // Goes through the array of style names and returns the first name\r
- // that is a valid style name for an element. If no such name is found,\r
- // it returns false. Useful for vendor-prefixed styles like `transform`.\r
- function testProp(props) {\r
- var style = document.documentElement.style;\r
-\r
- for (var i = 0; i < props.length; i++) {\r
- if (props[i] in style) {\r
- return props[i];\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- // @function setTransform(el: HTMLElement, offset: Point, scale?: Number)\r
- // Resets the 3D CSS transform of `el` so it is translated by `offset` pixels\r
- // and optionally scaled by `scale`. Does not have an effect if the\r
- // browser doesn't support 3D CSS transforms.\r
- function setTransform(el, offset, scale) {\r
- var pos = offset || new Point(0, 0);\r
-\r
- el.style[TRANSFORM] =\r
- (ie3d ?\r
- 'translate(' + pos.x + 'px,' + pos.y + 'px)' :\r
- 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +\r
- (scale ? ' scale(' + scale + ')' : '');\r
- }\r
-\r
- // @function setPosition(el: HTMLElement, position: Point)\r
- // Sets the position of `el` to coordinates specified by `position`,\r
- // using CSS translate or top/left positioning depending on the browser\r
- // (used by Leaflet internally to position its layers).\r
- function setPosition(el, point) {\r
-\r
- /*eslint-disable */\r
- el._leaflet_pos = point;\r
- /* eslint-enable */\r
-\r
- if (any3d) {\r
- setTransform(el, point);\r
- } else {\r
- el.style.left = point.x + 'px';\r
- el.style.top = point.y + 'px';\r
- }\r
- }\r
-\r
- // @function getPosition(el: HTMLElement): Point\r
- // Returns the coordinates of an element previously positioned with setPosition.\r
- function getPosition(el) {\r
- // this method is only used for elements previously positioned using setPosition,\r
- // so it's safe to cache the position for performance\r
-\r
- return el._leaflet_pos || new Point(0, 0);\r
- }\r
-\r
- // @function disableTextSelection()\r
- // Prevents the user from generating `selectstart` DOM events, usually generated\r
- // when the user drags the mouse through a page with text. Used internally\r
- // by Leaflet to override the behaviour of any click-and-drag interaction on\r
- // the map. Affects drag interactions on the whole document.\r
-\r
- // @function enableTextSelection()\r
- // Cancels the effects of a previous [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection).\r
- var disableTextSelection;\r
- var enableTextSelection;\r
- var _userSelect;\r
- if ('onselectstart' in document) {\r
- disableTextSelection = function () {\r
- on(window, 'selectstart', preventDefault);\r
- };\r
- enableTextSelection = function () {\r
- off(window, 'selectstart', preventDefault);\r
- };\r
- } else {\r
- var userSelectProperty = testProp(\r
- ['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']);\r
-\r
- disableTextSelection = function () {\r
- if (userSelectProperty) {\r
- var style = document.documentElement.style;\r
- _userSelect = style[userSelectProperty];\r
- style[userSelectProperty] = 'none';\r
- }\r
- };\r
- enableTextSelection = function () {\r
- if (userSelectProperty) {\r
- document.documentElement.style[userSelectProperty] = _userSelect;\r
- _userSelect = undefined;\r
- }\r
- };\r
- }\r
-\r
- // @function disableImageDrag()\r
- // As [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection), but\r
- // for `dragstart` DOM events, usually generated when the user drags an image.\r
- function disableImageDrag() {\r
- on(window, 'dragstart', preventDefault);\r
- }\r
-\r
- // @function enableImageDrag()\r
- // Cancels the effects of a previous [`L.DomUtil.disableImageDrag`](#domutil-disabletextselection).\r
- function enableImageDrag() {\r
- off(window, 'dragstart', preventDefault);\r
- }\r
-\r
- var _outlineElement, _outlineStyle;\r
- // @function preventOutline(el: HTMLElement)\r
- // Makes the [outline](https://developer.mozilla.org/docs/Web/CSS/outline)\r
- // of the element `el` invisible. Used internally by Leaflet to prevent\r
- // focusable elements from displaying an outline when the user performs a\r
- // drag interaction on them.\r
- function preventOutline(element) {\r
- while (element.tabIndex === -1) {\r
- element = element.parentNode;\r
- }\r
- if (!element.style) { return; }\r
- restoreOutline();\r
- _outlineElement = element;\r
- _outlineStyle = element.style.outline;\r
- element.style.outline = 'none';\r
- on(window, 'keydown', restoreOutline);\r
- }\r
-\r
- // @function restoreOutline()\r
- // Cancels the effects of a previous [`L.DomUtil.preventOutline`]().\r
- function restoreOutline() {\r
- if (!_outlineElement) { return; }\r
- _outlineElement.style.outline = _outlineStyle;\r
- _outlineElement = undefined;\r
- _outlineStyle = undefined;\r
- off(window, 'keydown', restoreOutline);\r
- }\r
-\r
- // @function getSizedParentNode(el: HTMLElement): HTMLElement\r
- // Finds the closest parent node which size (width and height) is not null.\r
- function getSizedParentNode(element) {\r
- do {\r
- element = element.parentNode;\r
- } while ((!element.offsetWidth || !element.offsetHeight) && element !== document.body);\r
- return element;\r
- }\r
-\r
- // @function getScale(el: HTMLElement): Object\r
- // Computes the CSS scale currently applied on the element.\r
- // Returns an object with `x` and `y` members as horizontal and vertical scales respectively,\r
- // and `boundingClientRect` as the result of [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).\r
- function getScale(element) {\r
- var rect = element.getBoundingClientRect(); // Read-only in old browsers.\r
-\r
- return {\r
- x: rect.width / element.offsetWidth || 1,\r
- y: rect.height / element.offsetHeight || 1,\r
- boundingClientRect: rect\r
- };\r
- }
-
- var DomUtil = ({
- TRANSFORM: TRANSFORM,
- TRANSITION: TRANSITION,
- TRANSITION_END: TRANSITION_END,
- get: get,
- getStyle: getStyle,
- create: create$1,
- remove: remove,
- empty: empty,
- toFront: toFront,
- toBack: toBack,
- hasClass: hasClass,
- addClass: addClass,
- removeClass: removeClass,
- setClass: setClass,
- getClass: getClass,
- setOpacity: setOpacity,
- testProp: testProp,
- setTransform: setTransform,
- setPosition: setPosition,
- getPosition: getPosition,
- disableTextSelection: disableTextSelection,
- enableTextSelection: enableTextSelection,
- disableImageDrag: disableImageDrag,
- enableImageDrag: enableImageDrag,
- preventOutline: preventOutline,
- restoreOutline: restoreOutline,
- getSizedParentNode: getSizedParentNode,
- getScale: getScale
- });
-
- /*\r
- * @namespace DomEvent\r
- * Utility functions to work with the [DOM events](https://developer.mozilla.org/docs/Web/API/Event), used by Leaflet internally.\r
- */\r
-\r
- // Inspired by John Resig, Dean Edwards and YUI addEvent implementations.\r
-\r
- // @function on(el: HTMLElement, types: String, fn: Function, context?: Object): this\r
- // Adds a listener function (`fn`) to a particular DOM event type of the\r
- // element `el`. You can optionally specify the context of the listener\r
- // (object the `this` keyword will point to). You can also pass several\r
- // space-separated types (e.g. `'click dblclick'`).\r
-\r
- // @alternative\r
- // @function on(el: HTMLElement, eventMap: Object, context?: Object): this\r
- // Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\r
- function on(obj, types, fn, context) {\r
-\r
- if (typeof types === 'object') {\r
- for (var type in types) {\r
- addOne(obj, type, types[type], fn);\r
- }\r
- } else {\r
- types = splitWords(types);\r
-\r
- for (var i = 0, len = types.length; i < len; i++) {\r
- addOne(obj, types[i], fn, context);\r
- }\r
- }\r
-\r
- return this;\r
- }\r
-\r
- var eventsKey = '_leaflet_events';\r
-\r
- // @function off(el: HTMLElement, types: String, fn: Function, context?: Object): this\r
- // Removes a previously added listener function.\r
- // Note that if you passed a custom context to on, you must pass the same\r
- // context to `off` in order to remove the listener.\r
-\r
- // @alternative\r
- // @function off(el: HTMLElement, eventMap: Object, context?: Object): this\r
- // Removes a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\r
- function off(obj, types, fn, context) {\r
-\r
- if (typeof types === 'object') {\r
- for (var type in types) {\r
- removeOne(obj, type, types[type], fn);\r
- }\r
- } else if (types) {\r
- types = splitWords(types);\r
-\r
- for (var i = 0, len = types.length; i < len; i++) {\r
- removeOne(obj, types[i], fn, context);\r
- }\r
- } else {\r
- for (var j in obj[eventsKey]) {\r
- removeOne(obj, j, obj[eventsKey][j]);\r
- }\r
- delete obj[eventsKey];\r
- }\r
-\r
- return this;\r
- }\r
-\r
- function browserFiresNativeDblClick() {\r
- // See https://github.com/w3c/pointerevents/issues/171\r
- if (pointer) {\r
- return !(edge || safari);\r
- }\r
- }\r
-\r
- var mouseSubst = {\r
- mouseenter: 'mouseover',\r
- mouseleave: 'mouseout',\r
- wheel: !('onwheel' in window) && 'mousewheel'\r
- };\r
-\r
- function addOne(obj, type, fn, context) {\r
- var id = type + stamp(fn) + (context ? '_' + stamp(context) : '');\r
-\r
- if (obj[eventsKey] && obj[eventsKey][id]) { return this; }\r
-\r
- var handler = function (e) {\r
- return fn.call(context || obj, e || window.event);\r
- };\r
-\r
- var originalHandler = handler;\r
-\r
- if (pointer && type.indexOf('touch') === 0) {\r
- // Needs DomEvent.Pointer.js\r
- addPointerListener(obj, type, handler, id);\r
-\r
- } else if (touch && (type === 'dblclick') && !browserFiresNativeDblClick()) {\r
- addDoubleTapListener(obj, handler, id);\r
-\r
- } else if ('addEventListener' in obj) {\r
-\r
- if (type === 'touchstart' || type === 'touchmove' || type === 'wheel' || type === 'mousewheel') {\r
- obj.addEventListener(mouseSubst[type] || type, handler, passiveEvents ? {passive: false} : false);\r
-\r
- } else if (type === 'mouseenter' || type === 'mouseleave') {\r
- handler = function (e) {\r
- e = e || window.event;\r
- if (isExternalTarget(obj, e)) {\r
- originalHandler(e);\r
- }\r
- };\r
- obj.addEventListener(mouseSubst[type], handler, false);\r
-\r
- } else {\r
- obj.addEventListener(type, originalHandler, false);\r
- }\r
-\r
- } else if ('attachEvent' in obj) {\r
- obj.attachEvent('on' + type, handler);\r
- }\r
-\r
- obj[eventsKey] = obj[eventsKey] || {};\r
- obj[eventsKey][id] = handler;\r
- }\r
-\r
- function removeOne(obj, type, fn, context) {\r
-\r
- var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''),\r
- handler = obj[eventsKey] && obj[eventsKey][id];\r
-\r
- if (!handler) { return this; }\r
-\r
- if (pointer && type.indexOf('touch') === 0) {\r
- removePointerListener(obj, type, id);\r
-\r
- } else if (touch && (type === 'dblclick') && !browserFiresNativeDblClick()) {\r
- removeDoubleTapListener(obj, id);\r
-\r
- } else if ('removeEventListener' in obj) {\r
-\r
- obj.removeEventListener(mouseSubst[type] || type, handler, false);\r
-\r
- } else if ('detachEvent' in obj) {\r
- obj.detachEvent('on' + type, handler);\r
- }\r
-\r
- obj[eventsKey][id] = null;\r
- }\r
-\r
- // @function stopPropagation(ev: DOMEvent): this\r
- // Stop the given event from propagation to parent elements. Used inside the listener functions:\r
- // ```js\r
- // L.DomEvent.on(div, 'click', function (ev) {\r
- // L.DomEvent.stopPropagation(ev);\r
- // });\r
- // ```\r
- function stopPropagation(e) {\r
-\r
- if (e.stopPropagation) {\r
- e.stopPropagation();\r
- } else if (e.originalEvent) { // In case of Leaflet event.\r
- e.originalEvent._stopped = true;\r
- } else {\r
- e.cancelBubble = true;\r
- }\r
- skipped(e);\r
-\r
- return this;\r
- }\r
-\r
- // @function disableScrollPropagation(el: HTMLElement): this\r
- // Adds `stopPropagation` to the element's `'wheel'` events (plus browser variants).\r
- function disableScrollPropagation(el) {\r
- addOne(el, 'wheel', stopPropagation);\r
- return this;\r
- }\r
-\r
- // @function disableClickPropagation(el: HTMLElement): this\r
- // Adds `stopPropagation` to the element's `'click'`, `'doubleclick'`,\r
- // `'mousedown'` and `'touchstart'` events (plus browser variants).\r
- function disableClickPropagation(el) {\r
- on(el, 'mousedown touchstart dblclick', stopPropagation);\r
- addOne(el, 'click', fakeStop);\r
- return this;\r
- }\r
-\r
- // @function preventDefault(ev: DOMEvent): this\r
- // Prevents the default action of the DOM Event `ev` from happening (such as\r
- // following a link in the href of the a element, or doing a POST request\r
- // with page reload when a `<form>` is submitted).\r
- // Use it inside listener functions.\r
- function preventDefault(e) {\r
- if (e.preventDefault) {\r
- e.preventDefault();\r
- } else {\r
- e.returnValue = false;\r
- }\r
- return this;\r
- }\r
-\r
- // @function stop(ev: DOMEvent): this\r
- // Does `stopPropagation` and `preventDefault` at the same time.\r
- function stop(e) {\r
- preventDefault(e);\r
- stopPropagation(e);\r
- return this;\r
- }\r
-\r
- // @function getMousePosition(ev: DOMEvent, container?: HTMLElement): Point\r
- // Gets normalized mouse position from a DOM event relative to the\r
- // `container` (border excluded) or to the whole page if not specified.\r
- function getMousePosition(e, container) {\r
- if (!container) {\r
- return new Point(e.clientX, e.clientY);\r
- }\r
-\r
- var scale = getScale(container),\r
- offset = scale.boundingClientRect; // left and top values are in page scale (like the event clientX/Y)\r
-\r
- return new Point(\r
- // offset.left/top values are in page scale (like clientX/Y),\r
- // whereas clientLeft/Top (border width) values are the original values (before CSS scale applies).\r
- (e.clientX - offset.left) / scale.x - container.clientLeft,\r
- (e.clientY - offset.top) / scale.y - container.clientTop\r
- );\r
- }\r
-\r
- // Chrome on Win scrolls double the pixels as in other platforms (see #4538),\r
- // and Firefox scrolls device pixels, not CSS pixels\r
- var wheelPxFactor =\r
- (win && chrome) ? 2 * window.devicePixelRatio :\r
- gecko ? window.devicePixelRatio : 1;\r
-\r
- // @function getWheelDelta(ev: DOMEvent): Number\r
- // Gets normalized wheel delta from a wheel DOM event, in vertical\r
- // pixels scrolled (negative if scrolling down).\r
- // Events from pointing devices without precise scrolling are mapped to\r
- // a best guess of 60 pixels.\r
- function getWheelDelta(e) {\r
- return (edge) ? e.wheelDeltaY / 2 : // Don't trust window-geometry-based delta\r
- (e.deltaY && e.deltaMode === 0) ? -e.deltaY / wheelPxFactor : // Pixels\r
- (e.deltaY && e.deltaMode === 1) ? -e.deltaY * 20 : // Lines\r
- (e.deltaY && e.deltaMode === 2) ? -e.deltaY * 60 : // Pages\r
- (e.deltaX || e.deltaZ) ? 0 : // Skip horizontal/depth wheel events\r
- e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels\r
- (e.detail && Math.abs(e.detail) < 32765) ? -e.detail * 20 : // Legacy Moz lines\r
- e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages\r
- 0;\r
- }\r
-\r
- var skipEvents = {};\r
-\r
- function fakeStop(e) {\r
- // fakes stopPropagation by setting a special event flag, checked/reset with skipped(e)\r
- skipEvents[e.type] = true;\r
- }\r
-\r
- function skipped(e) {\r
- var events = skipEvents[e.type];\r
- // reset when checking, as it's only used in map container and propagates outside of the map\r
- skipEvents[e.type] = false;\r
- return events;\r
- }\r
-\r
- // check if element really left/entered the event target (for mouseenter/mouseleave)\r
- function isExternalTarget(el, e) {\r
-\r
- var related = e.relatedTarget;\r
-\r
- if (!related) { return true; }\r
-\r
- try {\r
- while (related && (related !== el)) {\r
- related = related.parentNode;\r
- }\r
- } catch (err) {\r
- return false;\r
- }\r
- return (related !== el);\r
- }
-
- var DomEvent = ({
- on: on,
- off: off,
- stopPropagation: stopPropagation,
- disableScrollPropagation: disableScrollPropagation,
- disableClickPropagation: disableClickPropagation,
- preventDefault: preventDefault,
- stop: stop,
- getMousePosition: getMousePosition,
- getWheelDelta: getWheelDelta,
- fakeStop: fakeStop,
- skipped: skipped,
- isExternalTarget: isExternalTarget,
- addListener: on,
- removeListener: off
- });
-
- /*
- * @class PosAnimation
- * @aka L.PosAnimation
- * @inherits Evented
- * Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9.
- *
- * @example
- * ```js
- * var fx = new L.PosAnimation();
- * fx.run(el, [300, 500], 0.5);
- * ```
- *
- * @constructor L.PosAnimation()
- * Creates a `PosAnimation` object.
- *
- */
-
- var PosAnimation = Evented.extend({
-
- // @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number)
- // Run an animation of a given element to a new position, optionally setting
- // duration in seconds (`0.25` by default) and easing linearity factor (3rd
- // argument of the [cubic bezier curve](http://cubic-bezier.com/#0,0,.5,1),
- // `0.5` by default).
- run: function (el, newPos, duration, easeLinearity) {
- this.stop();
-
- this._el = el;
- this._inProgress = true;
- this._duration = duration || 0.25;
- this._easeOutPower = 1 / Math.max(easeLinearity || 0.5, 0.2);
-
- this._startPos = getPosition(el);
- this._offset = newPos.subtract(this._startPos);
- this._startTime = +new Date();
-
- // @event start: Event
- // Fired when the animation starts
- this.fire('start');
-
- this._animate();
- },
-
- // @method stop()
- // Stops the animation (if currently running).
- stop: function () {
- if (!this._inProgress) { return; }
-
- this._step(true);
- this._complete();
- },
-
- _animate: function () {
- // animation loop
- this._animId = requestAnimFrame(this._animate, this);
- this._step();
- },
-
- _step: function (round) {
- var elapsed = (+new Date()) - this._startTime,
- duration = this._duration * 1000;
-
- if (elapsed < duration) {
- this._runFrame(this._easeOut(elapsed / duration), round);
- } else {
- this._runFrame(1);
- this._complete();
- }
- },
-
- _runFrame: function (progress, round) {
- var pos = this._startPos.add(this._offset.multiplyBy(progress));
- if (round) {
- pos._round();
- }
- setPosition(this._el, pos);
-
- // @event step: Event
- // Fired continuously during the animation.
- this.fire('step');
- },
-
- _complete: function () {
- cancelAnimFrame(this._animId);
-
- this._inProgress = false;
- // @event end: Event
- // Fired when the animation ends.
- this.fire('end');
- },
-
- _easeOut: function (t) {
- return 1 - Math.pow(1 - t, this._easeOutPower);
- }
- });
-
- /*\r
- * @class Map\r
- * @aka L.Map\r
- * @inherits Evented\r
- *\r
- * The central class of the API — it is used to create a map on a page and manipulate it.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * // initialize the map on the "map" div with a given center and zoom\r
- * var map = L.map('map', {\r
- * center: [51.505, -0.09],\r
- * zoom: 13\r
- * });\r
- * ```\r
- *\r
- */\r
-\r
- var Map = Evented.extend({\r
-\r
- options: {\r
- // @section Map State Options\r
- // @option crs: CRS = L.CRS.EPSG3857\r
- // The [Coordinate Reference System](#crs) to use. Don't change this if you're not\r
- // sure what it means.\r
- crs: EPSG3857,\r
-\r
- // @option center: LatLng = undefined\r
- // Initial geographic center of the map\r
- center: undefined,\r
-\r
- // @option zoom: Number = undefined\r
- // Initial map zoom level\r
- zoom: undefined,\r
-\r
- // @option minZoom: Number = *\r
- // Minimum zoom level of the map.\r
- // If not specified and at least one `GridLayer` or `TileLayer` is in the map,\r
- // the lowest of their `minZoom` options will be used instead.\r
- minZoom: undefined,\r
-\r
- // @option maxZoom: Number = *\r
- // Maximum zoom level of the map.\r
- // If not specified and at least one `GridLayer` or `TileLayer` is in the map,\r
- // the highest of their `maxZoom` options will be used instead.\r
- maxZoom: undefined,\r
-\r
- // @option layers: Layer[] = []\r
- // Array of layers that will be added to the map initially\r
- layers: [],\r
-\r
- // @option maxBounds: LatLngBounds = null\r
- // When this option is set, the map restricts the view to the given\r
- // geographical bounds, bouncing the user back if the user tries to pan\r
- // outside the view. To set the restriction dynamically, use\r
- // [`setMaxBounds`](#map-setmaxbounds) method.\r
- maxBounds: undefined,\r
-\r
- // @option renderer: Renderer = *\r
- // The default method for drawing vector layers on the map. `L.SVG`\r
- // or `L.Canvas` by default depending on browser support.\r
- renderer: undefined,\r
-\r
-\r
- // @section Animation Options\r
- // @option zoomAnimation: Boolean = true\r
- // Whether the map zoom animation is enabled. By default it's enabled\r
- // in all browsers that support CSS3 Transitions except Android.\r
- zoomAnimation: true,\r
-\r
- // @option zoomAnimationThreshold: Number = 4\r
- // Won't animate zoom if the zoom difference exceeds this value.\r
- zoomAnimationThreshold: 4,\r
-\r
- // @option fadeAnimation: Boolean = true\r
- // Whether the tile fade animation is enabled. By default it's enabled\r
- // in all browsers that support CSS3 Transitions except Android.\r
- fadeAnimation: true,\r
-\r
- // @option markerZoomAnimation: Boolean = true\r
- // Whether markers animate their zoom with the zoom animation, if disabled\r
- // they will disappear for the length of the animation. By default it's\r
- // enabled in all browsers that support CSS3 Transitions except Android.\r
- markerZoomAnimation: true,\r
-\r
- // @option transform3DLimit: Number = 2^23\r
- // Defines the maximum size of a CSS translation transform. The default\r
- // value should not be changed unless a web browser positions layers in\r
- // the wrong place after doing a large `panBy`.\r
- transform3DLimit: 8388608, // Precision limit of a 32-bit float\r
-\r
- // @section Interaction Options\r
- // @option zoomSnap: Number = 1\r
- // Forces the map's zoom level to always be a multiple of this, particularly\r
- // right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom.\r
- // By default, the zoom level snaps to the nearest integer; lower values\r
- // (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0`\r
- // means the zoom level will not be snapped after `fitBounds` or a pinch-zoom.\r
- zoomSnap: 1,\r
-\r
- // @option zoomDelta: Number = 1\r
- // Controls how much the map's zoom level will change after a\r
- // [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+`\r
- // or `-` on the keyboard, or using the [zoom controls](#control-zoom).\r
- // Values smaller than `1` (e.g. `0.5`) allow for greater granularity.\r
- zoomDelta: 1,\r
-\r
- // @option trackResize: Boolean = true\r
- // Whether the map automatically handles browser window resize to update itself.\r
- trackResize: true\r
- },\r
-\r
- initialize: function (id, options) { // (HTMLElement or String, Object)\r
- options = setOptions(this, options);\r
-\r
- // Make sure to assign internal flags at the beginning,\r
- // to avoid inconsistent state in some edge cases.\r
- this._handlers = [];\r
- this._layers = {};\r
- this._zoomBoundLayers = {};\r
- this._sizeChanged = true;\r
-\r
- this._initContainer(id);\r
- this._initLayout();\r
-\r
- // hack for https://github.com/Leaflet/Leaflet/issues/1980\r
- this._onResize = bind(this._onResize, this);\r
-\r
- this._initEvents();\r
-\r
- if (options.maxBounds) {\r
- this.setMaxBounds(options.maxBounds);\r
- }\r
-\r
- if (options.zoom !== undefined) {\r
- this._zoom = this._limitZoom(options.zoom);\r
- }\r
-\r
- if (options.center && options.zoom !== undefined) {\r
- this.setView(toLatLng(options.center), options.zoom, {reset: true});\r
- }\r
-\r
- this.callInitHooks();\r
-\r
- // don't animate on browsers without hardware-accelerated transitions or old Android/Opera\r
- this._zoomAnimated = TRANSITION && any3d && !mobileOpera &&\r
- this.options.zoomAnimation;\r
-\r
- // zoom transitions run with the same duration for all layers, so if one of transitionend events\r
- // happens after starting zoom animation (propagating to the map pane), we know that it ended globally\r
- if (this._zoomAnimated) {\r
- this._createAnimProxy();\r
- on(this._proxy, TRANSITION_END, this._catchTransitionEnd, this);\r
- }\r
-\r
- this._addLayers(this.options.layers);\r
- },\r
-\r
-\r
- // @section Methods for modifying map state\r
-\r
- // @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this\r
- // Sets the view of the map (geographical center and zoom) with the given\r
- // animation options.\r
- setView: function (center, zoom, options) {\r
-\r
- zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);\r
- center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds);\r
- options = options || {};\r
-\r
- this._stop();\r
-\r
- if (this._loaded && !options.reset && options !== true) {\r
-\r
- if (options.animate !== undefined) {\r
- options.zoom = extend({animate: options.animate}, options.zoom);\r
- options.pan = extend({animate: options.animate, duration: options.duration}, options.pan);\r
- }\r
-\r
- // try animating pan or zoom\r
- var moved = (this._zoom !== zoom) ?\r
- this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) :\r
- this._tryAnimatedPan(center, options.pan);\r
-\r
- if (moved) {\r
- // prevent resize handler call, the view will refresh after animation anyway\r
- clearTimeout(this._sizeTimer);\r
- return this;\r
- }\r
- }\r
-\r
- // animation didn't start, just reset the map view\r
- this._resetView(center, zoom);\r
-\r
- return this;\r
- },\r
-\r
- // @method setZoom(zoom: Number, options?: Zoom/pan options): this\r
- // Sets the zoom of the map.\r
- setZoom: function (zoom, options) {\r
- if (!this._loaded) {\r
- this._zoom = zoom;\r
- return this;\r
- }\r
- return this.setView(this.getCenter(), zoom, {zoom: options});\r
- },\r
-\r
- // @method zoomIn(delta?: Number, options?: Zoom options): this\r
- // Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).\r
- zoomIn: function (delta, options) {\r
- delta = delta || (any3d ? this.options.zoomDelta : 1);\r
- return this.setZoom(this._zoom + delta, options);\r
- },\r
-\r
- // @method zoomOut(delta?: Number, options?: Zoom options): this\r
- // Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).\r
- zoomOut: function (delta, options) {\r
- delta = delta || (any3d ? this.options.zoomDelta : 1);\r
- return this.setZoom(this._zoom - delta, options);\r
- },\r
-\r
- // @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this\r
- // Zooms the map while keeping a specified geographical point on the map\r
- // stationary (e.g. used internally for scroll zoom and double-click zoom).\r
- // @alternative\r
- // @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this\r
- // Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.\r
- setZoomAround: function (latlng, zoom, options) {\r
- var scale = this.getZoomScale(zoom),\r
- viewHalf = this.getSize().divideBy(2),\r
- containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng),\r
-\r
- centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),\r
- newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));\r
-\r
- return this.setView(newCenter, zoom, {zoom: options});\r
- },\r
-\r
- _getBoundsCenterZoom: function (bounds, options) {\r
-\r
- options = options || {};\r
- bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds);\r
-\r
- var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),\r
- paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),\r
-\r
- zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));\r
-\r
- zoom = (typeof options.maxZoom === 'number') ? Math.min(options.maxZoom, zoom) : zoom;\r
-\r
- if (zoom === Infinity) {\r
- return {\r
- center: bounds.getCenter(),\r
- zoom: zoom\r
- };\r
- }\r
-\r
- var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),\r
-\r
- swPoint = this.project(bounds.getSouthWest(), zoom),\r
- nePoint = this.project(bounds.getNorthEast(), zoom),\r
- center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);\r
-\r
- return {\r
- center: center,\r
- zoom: zoom\r
- };\r
- },\r
-\r
- // @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this\r
- // Sets a map view that contains the given geographical bounds with the\r
- // maximum zoom level possible.\r
- fitBounds: function (bounds, options) {\r
-\r
- bounds = toLatLngBounds(bounds);\r
-\r
- if (!bounds.isValid()) {\r
- throw new Error('Bounds are not valid.');\r
- }\r
-\r
- var target = this._getBoundsCenterZoom(bounds, options);\r
- return this.setView(target.center, target.zoom, options);\r
- },\r
-\r
- // @method fitWorld(options?: fitBounds options): this\r
- // Sets a map view that mostly contains the whole world with the maximum\r
- // zoom level possible.\r
- fitWorld: function (options) {\r
- return this.fitBounds([[-90, -180], [90, 180]], options);\r
- },\r
-\r
- // @method panTo(latlng: LatLng, options?: Pan options): this\r
- // Pans the map to a given center.\r
- panTo: function (center, options) { // (LatLng)\r
- return this.setView(center, this._zoom, {pan: options});\r
- },\r
-\r
- // @method panBy(offset: Point, options?: Pan options): this\r
- // Pans the map by a given number of pixels (animated).\r
- panBy: function (offset, options) {\r
- offset = toPoint(offset).round();\r
- options = options || {};\r
-\r
- if (!offset.x && !offset.y) {\r
- return this.fire('moveend');\r
- }\r
- // If we pan too far, Chrome gets issues with tiles\r
- // and makes them disappear or appear in the wrong place (slightly offset) #2602\r
- if (options.animate !== true && !this.getSize().contains(offset)) {\r
- this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom());\r
- return this;\r
- }\r
-\r
- if (!this._panAnim) {\r
- this._panAnim = new PosAnimation();\r
-\r
- this._panAnim.on({\r
- 'step': this._onPanTransitionStep,\r
- 'end': this._onPanTransitionEnd\r
- }, this);\r
- }\r
-\r
- // don't fire movestart if animating inertia\r
- if (!options.noMoveStart) {\r
- this.fire('movestart');\r
- }\r
-\r
- // animate pan unless animate: false specified\r
- if (options.animate !== false) {\r
- addClass(this._mapPane, 'leaflet-pan-anim');\r
-\r
- var newPos = this._getMapPanePos().subtract(offset).round();\r
- this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity);\r
- } else {\r
- this._rawPanBy(offset);\r
- this.fire('move').fire('moveend');\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this\r
- // Sets the view of the map (geographical center and zoom) performing a smooth\r
- // pan-zoom animation.\r
- flyTo: function (targetCenter, targetZoom, options) {\r
-\r
- options = options || {};\r
- if (options.animate === false || !any3d) {\r
- return this.setView(targetCenter, targetZoom, options);\r
- }\r
-\r
- this._stop();\r
-\r
- var from = this.project(this.getCenter()),\r
- to = this.project(targetCenter),\r
- size = this.getSize(),\r
- startZoom = this._zoom;\r
-\r
- targetCenter = toLatLng(targetCenter);\r
- targetZoom = targetZoom === undefined ? startZoom : targetZoom;\r
-\r
- var w0 = Math.max(size.x, size.y),\r
- w1 = w0 * this.getZoomScale(startZoom, targetZoom),\r
- u1 = (to.distanceTo(from)) || 1,\r
- rho = 1.42,\r
- rho2 = rho * rho;\r
-\r
- function r(i) {\r
- var s1 = i ? -1 : 1,\r
- s2 = i ? w1 : w0,\r
- t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1,\r
- b1 = 2 * s2 * rho2 * u1,\r
- b = t1 / b1,\r
- sq = Math.sqrt(b * b + 1) - b;\r
-\r
- // workaround for floating point precision bug when sq = 0, log = -Infinite,\r
- // thus triggering an infinite loop in flyTo\r
- var log = sq < 0.000000001 ? -18 : Math.log(sq);\r
-\r
- return log;\r
- }\r
-\r
- function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }\r
- function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }\r
- function tanh(n) { return sinh(n) / cosh(n); }\r
-\r
- var r0 = r(0);\r
-\r
- function w(s) { return w0 * (cosh(r0) / cosh(r0 + rho * s)); }\r
- function u(s) { return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2; }\r
-\r
- function easeOut(t) { return 1 - Math.pow(1 - t, 1.5); }\r
-\r
- var start = Date.now(),\r
- S = (r(1) - r0) / rho,\r
- duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8;\r
-\r
- function frame() {\r
- var t = (Date.now() - start) / duration,\r
- s = easeOut(t) * S;\r
-\r
- if (t <= 1) {\r
- this._flyToFrame = requestAnimFrame(frame, this);\r
-\r
- this._move(\r
- this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom),\r
- this.getScaleZoom(w0 / w(s), startZoom),\r
- {flyTo: true});\r
-\r
- } else {\r
- this\r
- ._move(targetCenter, targetZoom)\r
- ._moveEnd(true);\r
- }\r
- }\r
-\r
- this._moveStart(true, options.noMoveStart);\r
-\r
- frame.call(this);\r
- return this;\r
- },\r
-\r
- // @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this\r
- // Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto),\r
- // but takes a bounds parameter like [`fitBounds`](#map-fitbounds).\r
- flyToBounds: function (bounds, options) {\r
- var target = this._getBoundsCenterZoom(bounds, options);\r
- return this.flyTo(target.center, target.zoom, options);\r
- },\r
-\r
- // @method setMaxBounds(bounds: LatLngBounds): this\r
- // Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option).\r
- setMaxBounds: function (bounds) {\r
- bounds = toLatLngBounds(bounds);\r
-\r
- if (!bounds.isValid()) {\r
- this.options.maxBounds = null;\r
- return this.off('moveend', this._panInsideMaxBounds);\r
- } else if (this.options.maxBounds) {\r
- this.off('moveend', this._panInsideMaxBounds);\r
- }\r
-\r
- this.options.maxBounds = bounds;\r
-\r
- if (this._loaded) {\r
- this._panInsideMaxBounds();\r
- }\r
-\r
- return this.on('moveend', this._panInsideMaxBounds);\r
- },\r
-\r
- // @method setMinZoom(zoom: Number): this\r
- // Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option).\r
- setMinZoom: function (zoom) {\r
- var oldZoom = this.options.minZoom;\r
- this.options.minZoom = zoom;\r
-\r
- if (this._loaded && oldZoom !== zoom) {\r
- this.fire('zoomlevelschange');\r
-\r
- if (this.getZoom() < this.options.minZoom) {\r
- return this.setZoom(zoom);\r
- }\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method setMaxZoom(zoom: Number): this\r
- // Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option).\r
- setMaxZoom: function (zoom) {\r
- var oldZoom = this.options.maxZoom;\r
- this.options.maxZoom = zoom;\r
-\r
- if (this._loaded && oldZoom !== zoom) {\r
- this.fire('zoomlevelschange');\r
-\r
- if (this.getZoom() > this.options.maxZoom) {\r
- return this.setZoom(zoom);\r
- }\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this\r
- // Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.\r
- panInsideBounds: function (bounds, options) {\r
- this._enforcingBounds = true;\r
- var center = this.getCenter(),\r
- newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds));\r
-\r
- if (!center.equals(newCenter)) {\r
- this.panTo(newCenter, options);\r
- }\r
-\r
- this._enforcingBounds = false;\r
- return this;\r
- },\r
-\r
- // @method panInside(latlng: LatLng, options?: options): this\r
- // Pans the map the minimum amount to make the `latlng` visible. Use\r
- // `padding`, `paddingTopLeft` and `paddingTopRight` options to fit\r
- // the display to more restricted bounds, like [`fitBounds`](#map-fitbounds).\r
- // If `latlng` is already within the (optionally padded) display bounds,\r
- // the map will not be panned.\r
- panInside: function (latlng, options) {\r
- options = options || {};\r
-\r
- var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),\r
- paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),\r
- center = this.getCenter(),\r
- pixelCenter = this.project(center),\r
- pixelPoint = this.project(latlng),\r
- pixelBounds = this.getPixelBounds(),\r
- halfPixelBounds = pixelBounds.getSize().divideBy(2),\r
- paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]);\r
-\r
- if (!paddedBounds.contains(pixelPoint)) {\r
- this._enforcingBounds = true;\r
- var diff = pixelCenter.subtract(pixelPoint),\r
- newCenter = toPoint(pixelPoint.x + diff.x, pixelPoint.y + diff.y);\r
-\r
- if (pixelPoint.x < paddedBounds.min.x || pixelPoint.x > paddedBounds.max.x) {\r
- newCenter.x = pixelCenter.x - diff.x;\r
- if (diff.x > 0) {\r
- newCenter.x += halfPixelBounds.x - paddingTL.x;\r
- } else {\r
- newCenter.x -= halfPixelBounds.x - paddingBR.x;\r
- }\r
- }\r
- if (pixelPoint.y < paddedBounds.min.y || pixelPoint.y > paddedBounds.max.y) {\r
- newCenter.y = pixelCenter.y - diff.y;\r
- if (diff.y > 0) {\r
- newCenter.y += halfPixelBounds.y - paddingTL.y;\r
- } else {\r
- newCenter.y -= halfPixelBounds.y - paddingBR.y;\r
- }\r
- }\r
- this.panTo(this.unproject(newCenter), options);\r
- this._enforcingBounds = false;\r
- }\r
- return this;\r
- },\r
-\r
- // @method invalidateSize(options: Zoom/pan options): this\r
- // Checks if the map container size changed and updates the map if so —\r
- // call it after you've changed the map size dynamically, also animating\r
- // pan by default. If `options.pan` is `false`, panning will not occur.\r
- // If `options.debounceMoveend` is `true`, it will delay `moveend` event so\r
- // that it doesn't happen often even if the method is called many\r
- // times in a row.\r
-\r
- // @alternative\r
- // @method invalidateSize(animate: Boolean): this\r
- // Checks if the map container size changed and updates the map if so —\r
- // call it after you've changed the map size dynamically, also animating\r
- // pan by default.\r
- invalidateSize: function (options) {\r
- if (!this._loaded) { return this; }\r
-\r
- options = extend({\r
- animate: false,\r
- pan: true\r
- }, options === true ? {animate: true} : options);\r
-\r
- var oldSize = this.getSize();\r
- this._sizeChanged = true;\r
- this._lastCenter = null;\r
-\r
- var newSize = this.getSize(),\r
- oldCenter = oldSize.divideBy(2).round(),\r
- newCenter = newSize.divideBy(2).round(),\r
- offset = oldCenter.subtract(newCenter);\r
-\r
- if (!offset.x && !offset.y) { return this; }\r
-\r
- if (options.animate && options.pan) {\r
- this.panBy(offset);\r
-\r
- } else {\r
- if (options.pan) {\r
- this._rawPanBy(offset);\r
- }\r
-\r
- this.fire('move');\r
-\r
- if (options.debounceMoveend) {\r
- clearTimeout(this._sizeTimer);\r
- this._sizeTimer = setTimeout(bind(this.fire, this, 'moveend'), 200);\r
- } else {\r
- this.fire('moveend');\r
- }\r
- }\r
-\r
- // @section Map state change events\r
- // @event resize: ResizeEvent\r
- // Fired when the map is resized.\r
- return this.fire('resize', {\r
- oldSize: oldSize,\r
- newSize: newSize\r
- });\r
- },\r
-\r
- // @section Methods for modifying map state\r
- // @method stop(): this\r
- // Stops the currently running `panTo` or `flyTo` animation, if any.\r
- stop: function () {\r
- this.setZoom(this._limitZoom(this._zoom));\r
- if (!this.options.zoomSnap) {\r
- this.fire('viewreset');\r
- }\r
- return this._stop();\r
- },\r
-\r
- // @section Geolocation methods\r
- // @method locate(options?: Locate options): this\r
- // Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound)\r
- // event with location data on success or a [`locationerror`](#map-locationerror) event on failure,\r
- // and optionally sets the map view to the user's location with respect to\r
- // detection accuracy (or to the world view if geolocation failed).\r
- // Note that, if your page doesn't use HTTPS, this method will fail in\r
- // modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins))\r
- // See `Locate options` for more details.\r
- locate: function (options) {\r
-\r
- options = this._locateOptions = extend({\r
- timeout: 10000,\r
- watch: false\r
- // setView: false\r
- // maxZoom: <Number>\r
- // maximumAge: 0\r
- // enableHighAccuracy: false\r
- }, options);\r
-\r
- if (!('geolocation' in navigator)) {\r
- this._handleGeolocationError({\r
- code: 0,\r
- message: 'Geolocation not supported.'\r
- });\r
- return this;\r
- }\r
-\r
- var onResponse = bind(this._handleGeolocationResponse, this),\r
- onError = bind(this._handleGeolocationError, this);\r
-\r
- if (options.watch) {\r
- this._locationWatchId =\r
- navigator.geolocation.watchPosition(onResponse, onError, options);\r
- } else {\r
- navigator.geolocation.getCurrentPosition(onResponse, onError, options);\r
- }\r
- return this;\r
- },\r
-\r
- // @method stopLocate(): this\r
- // Stops watching location previously initiated by `map.locate({watch: true})`\r
- // and aborts resetting the map view if map.locate was called with\r
- // `{setView: true}`.\r
- stopLocate: function () {\r
- if (navigator.geolocation && navigator.geolocation.clearWatch) {\r
- navigator.geolocation.clearWatch(this._locationWatchId);\r
- }\r
- if (this._locateOptions) {\r
- this._locateOptions.setView = false;\r
- }\r
- return this;\r
- },\r
-\r
- _handleGeolocationError: function (error) {\r
- var c = error.code,\r
- message = error.message ||\r
- (c === 1 ? 'permission denied' :\r
- (c === 2 ? 'position unavailable' : 'timeout'));\r
-\r
- if (this._locateOptions.setView && !this._loaded) {\r
- this.fitWorld();\r
- }\r
-\r
- // @section Location events\r
- // @event locationerror: ErrorEvent\r
- // Fired when geolocation (using the [`locate`](#map-locate) method) failed.\r
- this.fire('locationerror', {\r
- code: c,\r
- message: 'Geolocation error: ' + message + '.'\r
- });\r
- },\r
-\r
- _handleGeolocationResponse: function (pos) {\r
- var lat = pos.coords.latitude,\r
- lng = pos.coords.longitude,\r
- latlng = new LatLng(lat, lng),\r
- bounds = latlng.toBounds(pos.coords.accuracy * 2),\r
- options = this._locateOptions;\r
-\r
- if (options.setView) {\r
- var zoom = this.getBoundsZoom(bounds);\r
- this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom);\r
- }\r
-\r
- var data = {\r
- latlng: latlng,\r
- bounds: bounds,\r
- timestamp: pos.timestamp\r
- };\r
-\r
- for (var i in pos.coords) {\r
- if (typeof pos.coords[i] === 'number') {\r
- data[i] = pos.coords[i];\r
- }\r
- }\r
-\r
- // @event locationfound: LocationEvent\r
- // Fired when geolocation (using the [`locate`](#map-locate) method)\r
- // went successfully.\r
- this.fire('locationfound', data);\r
- },\r
-\r
- // TODO Appropriate docs section?\r
- // @section Other Methods\r
- // @method addHandler(name: String, HandlerClass: Function): this\r
- // Adds a new `Handler` to the map, given its name and constructor function.\r
- addHandler: function (name, HandlerClass) {\r
- if (!HandlerClass) { return this; }\r
-\r
- var handler = this[name] = new HandlerClass(this);\r
-\r
- this._handlers.push(handler);\r
-\r
- if (this.options[name]) {\r
- handler.enable();\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method remove(): this\r
- // Destroys the map and clears all related event listeners.\r
- remove: function () {\r
-\r
- this._initEvents(true);\r
- this.off('moveend', this._panInsideMaxBounds);\r
-\r
- if (this._containerId !== this._container._leaflet_id) {\r
- throw new Error('Map container is being reused by another instance');\r
- }\r
-\r
- try {\r
- // throws error in IE6-8\r
- delete this._container._leaflet_id;\r
- delete this._containerId;\r
- } catch (e) {\r
- /*eslint-disable */\r
- this._container._leaflet_id = undefined;\r
- /* eslint-enable */\r
- this._containerId = undefined;\r
- }\r
-\r
- if (this._locationWatchId !== undefined) {\r
- this.stopLocate();\r
- }\r
-\r
- this._stop();\r
-\r
- remove(this._mapPane);\r
-\r
- if (this._clearControlPos) {\r
- this._clearControlPos();\r
- }\r
- if (this._resizeRequest) {\r
- cancelAnimFrame(this._resizeRequest);\r
- this._resizeRequest = null;\r
- }\r
-\r
- this._clearHandlers();\r
-\r
- if (this._loaded) {\r
- // @section Map state change events\r
- // @event unload: Event\r
- // Fired when the map is destroyed with [remove](#map-remove) method.\r
- this.fire('unload');\r
- }\r
-\r
- var i;\r
- for (i in this._layers) {\r
- this._layers[i].remove();\r
- }\r
- for (i in this._panes) {\r
- remove(this._panes[i]);\r
- }\r
-\r
- this._layers = [];\r
- this._panes = [];\r
- delete this._mapPane;\r
- delete this._renderer;\r
-\r
- return this;\r
- },\r
-\r
- // @section Other Methods\r
- // @method createPane(name: String, container?: HTMLElement): HTMLElement\r
- // Creates a new [map pane](#map-pane) with the given name if it doesn't exist already,\r
- // then returns it. The pane is created as a child of `container`, or\r
- // as a child of the main map pane if not set.\r
- createPane: function (name, container) {\r
- var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''),\r
- pane = create$1('div', className, container || this._mapPane);\r
-\r
- if (name) {\r
- this._panes[name] = pane;\r
- }\r
- return pane;\r
- },\r
-\r
- // @section Methods for Getting Map State\r
-\r
- // @method getCenter(): LatLng\r
- // Returns the geographical center of the map view\r
- getCenter: function () {\r
- this._checkIfLoaded();\r
-\r
- if (this._lastCenter && !this._moved()) {\r
- return this._lastCenter;\r
- }\r
- return this.layerPointToLatLng(this._getCenterLayerPoint());\r
- },\r
-\r
- // @method getZoom(): Number\r
- // Returns the current zoom level of the map view\r
- getZoom: function () {\r
- return this._zoom;\r
- },\r
-\r
- // @method getBounds(): LatLngBounds\r
- // Returns the geographical bounds visible in the current map view\r
- getBounds: function () {\r
- var bounds = this.getPixelBounds(),\r
- sw = this.unproject(bounds.getBottomLeft()),\r
- ne = this.unproject(bounds.getTopRight());\r
-\r
- return new LatLngBounds(sw, ne);\r
- },\r
-\r
- // @method getMinZoom(): Number\r
- // Returns the minimum zoom level of the map (if set in the `minZoom` option of the map or of any layers), or `0` by default.\r
- getMinZoom: function () {\r
- return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom;\r
- },\r
-\r
- // @method getMaxZoom(): Number\r
- // Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers).\r
- getMaxZoom: function () {\r
- return this.options.maxZoom === undefined ?\r
- (this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom) :\r
- this.options.maxZoom;\r
- },\r
-\r
- // @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number\r
- // Returns the maximum zoom level on which the given bounds fit to the map\r
- // view in its entirety. If `inside` (optional) is set to `true`, the method\r
- // instead returns the minimum zoom level on which the map view fits into\r
- // the given bounds in its entirety.\r
- getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number\r
- bounds = toLatLngBounds(bounds);\r
- padding = toPoint(padding || [0, 0]);\r
-\r
- var zoom = this.getZoom() || 0,\r
- min = this.getMinZoom(),\r
- max = this.getMaxZoom(),\r
- nw = bounds.getNorthWest(),\r
- se = bounds.getSouthEast(),\r
- size = this.getSize().subtract(padding),\r
- boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(),\r
- snap = any3d ? this.options.zoomSnap : 1,\r
- scalex = size.x / boundsSize.x,\r
- scaley = size.y / boundsSize.y,\r
- scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);\r
-\r
- zoom = this.getScaleZoom(scale, zoom);\r
-\r
- if (snap) {\r
- zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level\r
- zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap;\r
- }\r
-\r
- return Math.max(min, Math.min(max, zoom));\r
- },\r
-\r
- // @method getSize(): Point\r
- // Returns the current size of the map container (in pixels).\r
- getSize: function () {\r
- if (!this._size || this._sizeChanged) {\r
- this._size = new Point(\r
- this._container.clientWidth || 0,\r
- this._container.clientHeight || 0);\r
-\r
- this._sizeChanged = false;\r
- }\r
- return this._size.clone();\r
- },\r
-\r
- // @method getPixelBounds(): Bounds\r
- // Returns the bounds of the current map view in projected pixel\r
- // coordinates (sometimes useful in layer and overlay implementations).\r
- getPixelBounds: function (center, zoom) {\r
- var topLeftPoint = this._getTopLeftPoint(center, zoom);\r
- return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));\r
- },\r
-\r
- // TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to\r
- // the map pane? "left point of the map layer" can be confusing, specially\r
- // since there can be negative offsets.\r
- // @method getPixelOrigin(): Point\r
- // Returns the projected pixel coordinates of the top left point of\r
- // the map layer (useful in custom layer and overlay implementations).\r
- getPixelOrigin: function () {\r
- this._checkIfLoaded();\r
- return this._pixelOrigin;\r
- },\r
-\r
- // @method getPixelWorldBounds(zoom?: Number): Bounds\r
- // Returns the world's bounds in pixel coordinates for zoom level `zoom`.\r
- // If `zoom` is omitted, the map's current zoom level is used.\r
- getPixelWorldBounds: function (zoom) {\r
- return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom);\r
- },\r
-\r
- // @section Other Methods\r
-\r
- // @method getPane(pane: String|HTMLElement): HTMLElement\r
- // Returns a [map pane](#map-pane), given its name or its HTML element (its identity).\r
- getPane: function (pane) {\r
- return typeof pane === 'string' ? this._panes[pane] : pane;\r
- },\r
-\r
- // @method getPanes(): Object\r
- // Returns a plain object containing the names of all [panes](#map-pane) as keys and\r
- // the panes as values.\r
- getPanes: function () {\r
- return this._panes;\r
- },\r
-\r
- // @method getContainer: HTMLElement\r
- // Returns the HTML element that contains the map.\r
- getContainer: function () {\r
- return this._container;\r
- },\r
-\r
-\r
- // @section Conversion Methods\r
-\r
- // @method getZoomScale(toZoom: Number, fromZoom: Number): Number\r
- // Returns the scale factor to be applied to a map transition from zoom level\r
- // `fromZoom` to `toZoom`. Used internally to help with zoom animations.\r
- getZoomScale: function (toZoom, fromZoom) {\r
- // TODO replace with universal implementation after refactoring projections\r
- var crs = this.options.crs;\r
- fromZoom = fromZoom === undefined ? this._zoom : fromZoom;\r
- return crs.scale(toZoom) / crs.scale(fromZoom);\r
- },\r
-\r
- // @method getScaleZoom(scale: Number, fromZoom: Number): Number\r
- // Returns the zoom level that the map would end up at, if it is at `fromZoom`\r
- // level and everything is scaled by a factor of `scale`. Inverse of\r
- // [`getZoomScale`](#map-getZoomScale).\r
- getScaleZoom: function (scale, fromZoom) {\r
- var crs = this.options.crs;\r
- fromZoom = fromZoom === undefined ? this._zoom : fromZoom;\r
- var zoom = crs.zoom(scale * crs.scale(fromZoom));\r
- return isNaN(zoom) ? Infinity : zoom;\r
- },\r
-\r
- // @method project(latlng: LatLng, zoom: Number): Point\r
- // Projects a geographical coordinate `LatLng` according to the projection\r
- // of the map's CRS, then scales it according to `zoom` and the CRS's\r
- // `Transformation`. The result is pixel coordinate relative to\r
- // the CRS origin.\r
- project: function (latlng, zoom) {\r
- zoom = zoom === undefined ? this._zoom : zoom;\r
- return this.options.crs.latLngToPoint(toLatLng(latlng), zoom);\r
- },\r
-\r
- // @method unproject(point: Point, zoom: Number): LatLng\r
- // Inverse of [`project`](#map-project).\r
- unproject: function (point, zoom) {\r
- zoom = zoom === undefined ? this._zoom : zoom;\r
- return this.options.crs.pointToLatLng(toPoint(point), zoom);\r
- },\r
-\r
- // @method layerPointToLatLng(point: Point): LatLng\r
- // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),\r
- // returns the corresponding geographical coordinate (for the current zoom level).\r
- layerPointToLatLng: function (point) {\r
- var projectedPoint = toPoint(point).add(this.getPixelOrigin());\r
- return this.unproject(projectedPoint);\r
- },\r
-\r
- // @method latLngToLayerPoint(latlng: LatLng): Point\r
- // Given a geographical coordinate, returns the corresponding pixel coordinate\r
- // relative to the [origin pixel](#map-getpixelorigin).\r
- latLngToLayerPoint: function (latlng) {\r
- var projectedPoint = this.project(toLatLng(latlng))._round();\r
- return projectedPoint._subtract(this.getPixelOrigin());\r
- },\r
-\r
- // @method wrapLatLng(latlng: LatLng): LatLng\r
- // Returns a `LatLng` where `lat` and `lng` has been wrapped according to the\r
- // map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the\r
- // CRS's bounds.\r
- // By default this means longitude is wrapped around the dateline so its\r
- // value is between -180 and +180 degrees.\r
- wrapLatLng: function (latlng) {\r
- return this.options.crs.wrapLatLng(toLatLng(latlng));\r
- },\r
-\r
- // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds\r
- // Returns a `LatLngBounds` with the same size as the given one, ensuring that\r
- // its center is within the CRS's bounds.\r
- // By default this means the center longitude is wrapped around the dateline so its\r
- // value is between -180 and +180 degrees, and the majority of the bounds\r
- // overlaps the CRS's bounds.\r
- wrapLatLngBounds: function (latlng) {\r
- return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng));\r
- },\r
-\r
- // @method distance(latlng1: LatLng, latlng2: LatLng): Number\r
- // Returns the distance between two geographical coordinates according to\r
- // the map's CRS. By default this measures distance in meters.\r
- distance: function (latlng1, latlng2) {\r
- return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2));\r
- },\r
-\r
- // @method containerPointToLayerPoint(point: Point): Point\r
- // Given a pixel coordinate relative to the map container, returns the corresponding\r
- // pixel coordinate relative to the [origin pixel](#map-getpixelorigin).\r
- containerPointToLayerPoint: function (point) { // (Point)\r
- return toPoint(point).subtract(this._getMapPanePos());\r
- },\r
-\r
- // @method layerPointToContainerPoint(point: Point): Point\r
- // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),\r
- // returns the corresponding pixel coordinate relative to the map container.\r
- layerPointToContainerPoint: function (point) { // (Point)\r
- return toPoint(point).add(this._getMapPanePos());\r
- },\r
-\r
- // @method containerPointToLatLng(point: Point): LatLng\r
- // Given a pixel coordinate relative to the map container, returns\r
- // the corresponding geographical coordinate (for the current zoom level).\r
- containerPointToLatLng: function (point) {\r
- var layerPoint = this.containerPointToLayerPoint(toPoint(point));\r
- return this.layerPointToLatLng(layerPoint);\r
- },\r
-\r
- // @method latLngToContainerPoint(latlng: LatLng): Point\r
- // Given a geographical coordinate, returns the corresponding pixel coordinate\r
- // relative to the map container.\r
- latLngToContainerPoint: function (latlng) {\r
- return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng)));\r
- },\r
-\r
- // @method mouseEventToContainerPoint(ev: MouseEvent): Point\r
- // Given a MouseEvent object, returns the pixel coordinate relative to the\r
- // map container where the event took place.\r
- mouseEventToContainerPoint: function (e) {\r
- return getMousePosition(e, this._container);\r
- },\r
-\r
- // @method mouseEventToLayerPoint(ev: MouseEvent): Point\r
- // Given a MouseEvent object, returns the pixel coordinate relative to\r
- // the [origin pixel](#map-getpixelorigin) where the event took place.\r
- mouseEventToLayerPoint: function (e) {\r
- return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e));\r
- },\r
-\r
- // @method mouseEventToLatLng(ev: MouseEvent): LatLng\r
- // Given a MouseEvent object, returns geographical coordinate where the\r
- // event took place.\r
- mouseEventToLatLng: function (e) { // (MouseEvent)\r
- return this.layerPointToLatLng(this.mouseEventToLayerPoint(e));\r
- },\r
-\r
-\r
- // map initialization methods\r
-\r
- _initContainer: function (id) {\r
- var container = this._container = get(id);\r
-\r
- if (!container) {\r
- throw new Error('Map container not found.');\r
- } else if (container._leaflet_id) {\r
- throw new Error('Map container is already initialized.');\r
- }\r
-\r
- on(container, 'scroll', this._onScroll, this);\r
- this._containerId = stamp(container);\r
- },\r
-\r
- _initLayout: function () {\r
- var container = this._container;\r
-\r
- this._fadeAnimated = this.options.fadeAnimation && any3d;\r
-\r
- addClass(container, 'leaflet-container' +\r
- (touch ? ' leaflet-touch' : '') +\r
- (retina ? ' leaflet-retina' : '') +\r
- (ielt9 ? ' leaflet-oldie' : '') +\r
- (safari ? ' leaflet-safari' : '') +\r
- (this._fadeAnimated ? ' leaflet-fade-anim' : ''));\r
-\r
- var position = getStyle(container, 'position');\r
-\r
- if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') {\r
- container.style.position = 'relative';\r
- }\r
-\r
- this._initPanes();\r
-\r
- if (this._initControlPos) {\r
- this._initControlPos();\r
- }\r
- },\r
-\r
- _initPanes: function () {\r
- var panes = this._panes = {};\r
- this._paneRenderers = {};\r
-\r
- // @section\r
- //\r
- // Panes are DOM elements used to control the ordering of layers on the map. You\r
- // can access panes with [`map.getPane`](#map-getpane) or\r
- // [`map.getPanes`](#map-getpanes) methods. New panes can be created with the\r
- // [`map.createPane`](#map-createpane) method.\r
- //\r
- // Every map has the following default panes that differ only in zIndex.\r
- //\r
- // @pane mapPane: HTMLElement = 'auto'\r
- // Pane that contains all other map panes\r
-\r
- this._mapPane = this.createPane('mapPane', this._container);\r
- setPosition(this._mapPane, new Point(0, 0));\r
-\r
- // @pane tilePane: HTMLElement = 200\r
- // Pane for `GridLayer`s and `TileLayer`s\r
- this.createPane('tilePane');\r
- // @pane overlayPane: HTMLElement = 400\r
- // Pane for overlay shadows (e.g. `Marker` shadows)\r
- this.createPane('shadowPane');\r
- // @pane shadowPane: HTMLElement = 500\r
- // Pane for vectors (`Path`s, like `Polyline`s and `Polygon`s), `ImageOverlay`s and `VideoOverlay`s\r
- this.createPane('overlayPane');\r
- // @pane markerPane: HTMLElement = 600\r
- // Pane for `Icon`s of `Marker`s\r
- this.createPane('markerPane');\r
- // @pane tooltipPane: HTMLElement = 650\r
- // Pane for `Tooltip`s.\r
- this.createPane('tooltipPane');\r
- // @pane popupPane: HTMLElement = 700\r
- // Pane for `Popup`s.\r
- this.createPane('popupPane');\r
-\r
- if (!this.options.markerZoomAnimation) {\r
- addClass(panes.markerPane, 'leaflet-zoom-hide');\r
- addClass(panes.shadowPane, 'leaflet-zoom-hide');\r
- }\r
- },\r
-\r
-\r
- // private methods that modify map state\r
-\r
- // @section Map state change events\r
- _resetView: function (center, zoom) {\r
- setPosition(this._mapPane, new Point(0, 0));\r
-\r
- var loading = !this._loaded;\r
- this._loaded = true;\r
- zoom = this._limitZoom(zoom);\r
-\r
- this.fire('viewprereset');\r
-\r
- var zoomChanged = this._zoom !== zoom;\r
- this\r
- ._moveStart(zoomChanged, false)\r
- ._move(center, zoom)\r
- ._moveEnd(zoomChanged);\r
-\r
- // @event viewreset: Event\r
- // Fired when the map needs to redraw its content (this usually happens\r
- // on map zoom or load). Very useful for creating custom overlays.\r
- this.fire('viewreset');\r
-\r
- // @event load: Event\r
- // Fired when the map is initialized (when its center and zoom are set\r
- // for the first time).\r
- if (loading) {\r
- this.fire('load');\r
- }\r
- },\r
-\r
- _moveStart: function (zoomChanged, noMoveStart) {\r
- // @event zoomstart: Event\r
- // Fired when the map zoom is about to change (e.g. before zoom animation).\r
- // @event movestart: Event\r
- // Fired when the view of the map starts changing (e.g. user starts dragging the map).\r
- if (zoomChanged) {\r
- this.fire('zoomstart');\r
- }\r
- if (!noMoveStart) {\r
- this.fire('movestart');\r
- }\r
- return this;\r
- },\r
-\r
- _move: function (center, zoom, data) {\r
- if (zoom === undefined) {\r
- zoom = this._zoom;\r
- }\r
- var zoomChanged = this._zoom !== zoom;\r
-\r
- this._zoom = zoom;\r
- this._lastCenter = center;\r
- this._pixelOrigin = this._getNewPixelOrigin(center);\r
-\r
- // @event zoom: Event\r
- // Fired repeatedly during any change in zoom level, including zoom\r
- // and fly animations.\r
- if (zoomChanged || (data && data.pinch)) { // Always fire 'zoom' if pinching because #3530\r
- this.fire('zoom', data);\r
- }\r
-\r
- // @event move: Event\r
- // Fired repeatedly during any movement of the map, including pan and\r
- // fly animations.\r
- return this.fire('move', data);\r
- },\r
-\r
- _moveEnd: function (zoomChanged) {\r
- // @event zoomend: Event\r
- // Fired when the map has changed, after any animations.\r
- if (zoomChanged) {\r
- this.fire('zoomend');\r
- }\r
-\r
- // @event moveend: Event\r
- // Fired when the center of the map stops changing (e.g. user stopped\r
- // dragging the map).\r
- return this.fire('moveend');\r
- },\r
-\r
- _stop: function () {\r
- cancelAnimFrame(this._flyToFrame);\r
- if (this._panAnim) {\r
- this._panAnim.stop();\r
- }\r
- return this;\r
- },\r
-\r
- _rawPanBy: function (offset) {\r
- setPosition(this._mapPane, this._getMapPanePos().subtract(offset));\r
- },\r
-\r
- _getZoomSpan: function () {\r
- return this.getMaxZoom() - this.getMinZoom();\r
- },\r
-\r
- _panInsideMaxBounds: function () {\r
- if (!this._enforcingBounds) {\r
- this.panInsideBounds(this.options.maxBounds);\r
- }\r
- },\r
-\r
- _checkIfLoaded: function () {\r
- if (!this._loaded) {\r
- throw new Error('Set map center and zoom first.');\r
- }\r
- },\r
-\r
- // DOM event handling\r
-\r
- // @section Interaction events\r
- _initEvents: function (remove$$1) {\r
- this._targets = {};\r
- this._targets[stamp(this._container)] = this;\r
-\r
- var onOff = remove$$1 ? off : on;\r
-\r
- // @event click: MouseEvent\r
- // Fired when the user clicks (or taps) the map.\r
- // @event dblclick: MouseEvent\r
- // Fired when the user double-clicks (or double-taps) the map.\r
- // @event mousedown: MouseEvent\r
- // Fired when the user pushes the mouse button on the map.\r
- // @event mouseup: MouseEvent\r
- // Fired when the user releases the mouse button on the map.\r
- // @event mouseover: MouseEvent\r
- // Fired when the mouse enters the map.\r
- // @event mouseout: MouseEvent\r
- // Fired when the mouse leaves the map.\r
- // @event mousemove: MouseEvent\r
- // Fired while the mouse moves over the map.\r
- // @event contextmenu: MouseEvent\r
- // Fired when the user pushes the right mouse button on the map, prevents\r
- // default browser context menu from showing if there are listeners on\r
- // this event. Also fired on mobile when the user holds a single touch\r
- // for a second (also called long press).\r
- // @event keypress: KeyboardEvent\r
- // Fired when the user presses a key from the keyboard that produces a character value while the map is focused.\r
- // @event keydown: KeyboardEvent\r
- // Fired when the user presses a key from the keyboard while the map is focused. Unlike the `keypress` event,\r
- // the `keydown` event is fired for keys that produce a character value and for keys\r
- // that do not produce a character value.\r
- // @event keyup: KeyboardEvent\r
- // Fired when the user releases a key from the keyboard while the map is focused.\r
- onOff(this._container, 'click dblclick mousedown mouseup ' +\r
- 'mouseover mouseout mousemove contextmenu keypress keydown keyup', this._handleDOMEvent, this);\r
-\r
- if (this.options.trackResize) {\r
- onOff(window, 'resize', this._onResize, this);\r
- }\r
-\r
- if (any3d && this.options.transform3DLimit) {\r
- (remove$$1 ? this.off : this.on).call(this, 'moveend', this._onMoveEnd);\r
- }\r
- },\r
-\r
- _onResize: function () {\r
- cancelAnimFrame(this._resizeRequest);\r
- this._resizeRequest = requestAnimFrame(\r
- function () { this.invalidateSize({debounceMoveend: true}); }, this);\r
- },\r
-\r
- _onScroll: function () {\r
- this._container.scrollTop = 0;\r
- this._container.scrollLeft = 0;\r
- },\r
-\r
- _onMoveEnd: function () {\r
- var pos = this._getMapPanePos();\r
- if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) {\r
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have\r
- // a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/\r
- this._resetView(this.getCenter(), this.getZoom());\r
- }\r
- },\r
-\r
- _findEventTargets: function (e, type) {\r
- var targets = [],\r
- target,\r
- isHover = type === 'mouseout' || type === 'mouseover',\r
- src = e.target || e.srcElement,\r
- dragging = false;\r
-\r
- while (src) {\r
- target = this._targets[stamp(src)];\r
- if (target && (type === 'click' || type === 'preclick') && !e._simulated && this._draggableMoved(target)) {\r
- // Prevent firing click after you just dragged an object.\r
- dragging = true;\r
- break;\r
- }\r
- if (target && target.listens(type, true)) {\r
- if (isHover && !isExternalTarget(src, e)) { break; }\r
- targets.push(target);\r
- if (isHover) { break; }\r
- }\r
- if (src === this._container) { break; }\r
- src = src.parentNode;\r
- }\r
- if (!targets.length && !dragging && !isHover && isExternalTarget(src, e)) {\r
- targets = [this];\r
- }\r
- return targets;\r
- },\r
-\r
- _handleDOMEvent: function (e) {\r
- if (!this._loaded || skipped(e)) { return; }\r
-\r
- var type = e.type;\r
-\r
- if (type === 'mousedown' || type === 'keypress' || type === 'keyup' || type === 'keydown') {\r
- // prevents outline when clicking on keyboard-focusable element\r
- preventOutline(e.target || e.srcElement);\r
- }\r
-\r
- this._fireDOMEvent(e, type);\r
- },\r
-\r
- _mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'],\r
-\r
- _fireDOMEvent: function (e, type, targets) {\r
-\r
- if (e.type === 'click') {\r
- // Fire a synthetic 'preclick' event which propagates up (mainly for closing popups).\r
- // @event preclick: MouseEvent\r
- // Fired before mouse click on the map (sometimes useful when you\r
- // want something to happen on click before any existing click\r
- // handlers start running).\r
- var synth = extend({}, e);\r
- synth.type = 'preclick';\r
- this._fireDOMEvent(synth, synth.type, targets);\r
- }\r
-\r
- if (e._stopped) { return; }\r
-\r
- // Find the layer the event is propagating from and its parents.\r
- targets = (targets || []).concat(this._findEventTargets(e, type));\r
-\r
- if (!targets.length) { return; }\r
-\r
- var target = targets[0];\r
- if (type === 'contextmenu' && target.listens(type, true)) {\r
- preventDefault(e);\r
- }\r
-\r
- var data = {\r
- originalEvent: e\r
- };\r
-\r
- if (e.type !== 'keypress' && e.type !== 'keydown' && e.type !== 'keyup') {\r
- var isMarker = target.getLatLng && (!target._radius || target._radius <= 10);\r
- data.containerPoint = isMarker ?\r
- this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e);\r
- data.layerPoint = this.containerPointToLayerPoint(data.containerPoint);\r
- data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint);\r
- }\r
-\r
- for (var i = 0; i < targets.length; i++) {\r
- targets[i].fire(type, data, true);\r
- if (data.originalEvent._stopped ||\r
- (targets[i].options.bubblingMouseEvents === false && indexOf(this._mouseEvents, type) !== -1)) { return; }\r
- }\r
- },\r
-\r
- _draggableMoved: function (obj) {\r
- obj = obj.dragging && obj.dragging.enabled() ? obj : this;\r
- return (obj.dragging && obj.dragging.moved()) || (this.boxZoom && this.boxZoom.moved());\r
- },\r
-\r
- _clearHandlers: function () {\r
- for (var i = 0, len = this._handlers.length; i < len; i++) {\r
- this._handlers[i].disable();\r
- }\r
- },\r
-\r
- // @section Other Methods\r
-\r
- // @method whenReady(fn: Function, context?: Object): this\r
- // Runs the given function `fn` when the map gets initialized with\r
- // a view (center and zoom) and at least one layer, or immediately\r
- // if it's already initialized, optionally passing a function context.\r
- whenReady: function (callback, context) {\r
- if (this._loaded) {\r
- callback.call(context || this, {target: this});\r
- } else {\r
- this.on('load', callback, context);\r
- }\r
- return this;\r
- },\r
-\r
-\r
- // private methods for getting map state\r
-\r
- _getMapPanePos: function () {\r
- return getPosition(this._mapPane) || new Point(0, 0);\r
- },\r
-\r
- _moved: function () {\r
- var pos = this._getMapPanePos();\r
- return pos && !pos.equals([0, 0]);\r
- },\r
-\r
- _getTopLeftPoint: function (center, zoom) {\r
- var pixelOrigin = center && zoom !== undefined ?\r
- this._getNewPixelOrigin(center, zoom) :\r
- this.getPixelOrigin();\r
- return pixelOrigin.subtract(this._getMapPanePos());\r
- },\r
-\r
- _getNewPixelOrigin: function (center, zoom) {\r
- var viewHalf = this.getSize()._divideBy(2);\r
- return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round();\r
- },\r
-\r
- _latLngToNewLayerPoint: function (latlng, zoom, center) {\r
- var topLeft = this._getNewPixelOrigin(center, zoom);\r
- return this.project(latlng, zoom)._subtract(topLeft);\r
- },\r
-\r
- _latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) {\r
- var topLeft = this._getNewPixelOrigin(center, zoom);\r
- return toBounds([\r
- this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft),\r
- this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft),\r
- this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft),\r
- this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft)\r
- ]);\r
- },\r
-\r
- // layer point of the current center\r
- _getCenterLayerPoint: function () {\r
- return this.containerPointToLayerPoint(this.getSize()._divideBy(2));\r
- },\r
-\r
- // offset of the specified place to the current center in pixels\r
- _getCenterOffset: function (latlng) {\r
- return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint());\r
- },\r
-\r
- // adjust center for view to get inside bounds\r
- _limitCenter: function (center, zoom, bounds) {\r
-\r
- if (!bounds) { return center; }\r
-\r
- var centerPoint = this.project(center, zoom),\r
- viewHalf = this.getSize().divideBy(2),\r
- viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),\r
- offset = this._getBoundsOffset(viewBounds, bounds, zoom);\r
-\r
- // If offset is less than a pixel, ignore.\r
- // This prevents unstable projections from getting into\r
- // an infinite loop of tiny offsets.\r
- if (offset.round().equals([0, 0])) {\r
- return center;\r
- }\r
-\r
- return this.unproject(centerPoint.add(offset), zoom);\r
- },\r
-\r
- // adjust offset for view to get inside bounds\r
- _limitOffset: function (offset, bounds) {\r
- if (!bounds) { return offset; }\r
-\r
- var viewBounds = this.getPixelBounds(),\r
- newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));\r
-\r
- return offset.add(this._getBoundsOffset(newBounds, bounds));\r
- },\r
-\r
- // returns offset needed for pxBounds to get inside maxBounds at a specified zoom\r
- _getBoundsOffset: function (pxBounds, maxBounds, zoom) {\r
- var projectedMaxBounds = toBounds(\r
- this.project(maxBounds.getNorthEast(), zoom),\r
- this.project(maxBounds.getSouthWest(), zoom)\r
- ),\r
- minOffset = projectedMaxBounds.min.subtract(pxBounds.min),\r
- maxOffset = projectedMaxBounds.max.subtract(pxBounds.max),\r
-\r
- dx = this._rebound(minOffset.x, -maxOffset.x),\r
- dy = this._rebound(minOffset.y, -maxOffset.y);\r
-\r
- return new Point(dx, dy);\r
- },\r
-\r
- _rebound: function (left, right) {\r
- return left + right > 0 ?\r
- Math.round(left - right) / 2 :\r
- Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right));\r
- },\r
-\r
- _limitZoom: function (zoom) {\r
- var min = this.getMinZoom(),\r
- max = this.getMaxZoom(),\r
- snap = any3d ? this.options.zoomSnap : 1;\r
- if (snap) {\r
- zoom = Math.round(zoom / snap) * snap;\r
- }\r
- return Math.max(min, Math.min(max, zoom));\r
- },\r
-\r
- _onPanTransitionStep: function () {\r
- this.fire('move');\r
- },\r
-\r
- _onPanTransitionEnd: function () {\r
- removeClass(this._mapPane, 'leaflet-pan-anim');\r
- this.fire('moveend');\r
- },\r
-\r
- _tryAnimatedPan: function (center, options) {\r
- // difference between the new and current centers in pixels\r
- var offset = this._getCenterOffset(center)._trunc();\r
-\r
- // don't animate too far unless animate: true specified in options\r
- if ((options && options.animate) !== true && !this.getSize().contains(offset)) { return false; }\r
-\r
- this.panBy(offset, options);\r
-\r
- return true;\r
- },\r
-\r
- _createAnimProxy: function () {\r
-\r
- var proxy = this._proxy = create$1('div', 'leaflet-proxy leaflet-zoom-animated');\r
- this._panes.mapPane.appendChild(proxy);\r
-\r
- this.on('zoomanim', function (e) {\r
- var prop = TRANSFORM,\r
- transform = this._proxy.style[prop];\r
-\r
- setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1));\r
-\r
- // workaround for case when transform is the same and so transitionend event is not fired\r
- if (transform === this._proxy.style[prop] && this._animatingZoom) {\r
- this._onZoomTransitionEnd();\r
- }\r
- }, this);\r
-\r
- this.on('load moveend', this._animMoveEnd, this);\r
-\r
- this._on('unload', this._destroyAnimProxy, this);\r
- },\r
-\r
- _destroyAnimProxy: function () {\r
- remove(this._proxy);\r
- this.off('load moveend', this._animMoveEnd, this);\r
- delete this._proxy;\r
- },\r
-\r
- _animMoveEnd: function () {\r
- var c = this.getCenter(),\r
- z = this.getZoom();\r
- setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1));\r
- },\r
-\r
- _catchTransitionEnd: function (e) {\r
- if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) {\r
- this._onZoomTransitionEnd();\r
- }\r
- },\r
-\r
- _nothingToAnimate: function () {\r
- return !this._container.getElementsByClassName('leaflet-zoom-animated').length;\r
- },\r
-\r
- _tryAnimatedZoom: function (center, zoom, options) {\r
-\r
- if (this._animatingZoom) { return true; }\r
-\r
- options = options || {};\r
-\r
- // don't animate if disabled, not supported or zoom difference is too large\r
- if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() ||\r
- Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) { return false; }\r
-\r
- // offset is the pixel coords of the zoom origin relative to the current center\r
- var scale = this.getZoomScale(zoom),\r
- offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale);\r
-\r
- // don't animate if the zoom origin isn't within one screen from the current center, unless forced\r
- if (options.animate !== true && !this.getSize().contains(offset)) { return false; }\r
-\r
- requestAnimFrame(function () {\r
- this\r
- ._moveStart(true, false)\r
- ._animateZoom(center, zoom, true);\r
- }, this);\r
-\r
- return true;\r
- },\r
-\r
- _animateZoom: function (center, zoom, startAnim, noUpdate) {\r
- if (!this._mapPane) { return; }\r
-\r
- if (startAnim) {\r
- this._animatingZoom = true;\r
-\r
- // remember what center/zoom to set after animation\r
- this._animateToCenter = center;\r
- this._animateToZoom = zoom;\r
-\r
- addClass(this._mapPane, 'leaflet-zoom-anim');\r
- }\r
-\r
- // @section Other Events\r
- // @event zoomanim: ZoomAnimEvent\r
- // Fired at least once per zoom animation. For continuous zoom, like pinch zooming, fired once per frame during zoom.\r
- this.fire('zoomanim', {\r
- center: center,\r
- zoom: zoom,\r
- noUpdate: noUpdate\r
- });\r
-\r
- // Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693\r
- setTimeout(bind(this._onZoomTransitionEnd, this), 250);\r
- },\r
-\r
- _onZoomTransitionEnd: function () {\r
- if (!this._animatingZoom) { return; }\r
-\r
- if (this._mapPane) {\r
- removeClass(this._mapPane, 'leaflet-zoom-anim');\r
- }\r
-\r
- this._animatingZoom = false;\r
-\r
- this._move(this._animateToCenter, this._animateToZoom);\r
-\r
- // This anim frame should prevent an obscure iOS webkit tile loading race condition.\r
- requestAnimFrame(function () {\r
- this._moveEnd(true);\r
- }, this);\r
- }\r
- });\r
-\r
- // @section\r
-\r
- // @factory L.map(id: String, options?: Map options)\r
- // Instantiates a map object given the DOM ID of a `<div>` element\r
- // and optionally an object literal with `Map options`.\r
- //\r
- // @alternative\r
- // @factory L.map(el: HTMLElement, options?: Map options)\r
- // Instantiates a map object given an instance of a `<div>` HTML element\r
- // and optionally an object literal with `Map options`.\r
- function createMap(id, options) {\r
- return new Map(id, options);\r
- }
-
- /*\r
- * @class Control\r
- * @aka L.Control\r
- * @inherits Class\r
- *\r
- * L.Control is a base class for implementing map controls. Handles positioning.\r
- * All other controls extend from this class.\r
- */\r
-\r
- var Control = Class.extend({\r
- // @section\r
- // @aka Control options\r
- options: {\r
- // @option position: String = 'topright'\r
- // The position of the control (one of the map corners). Possible values are `'topleft'`,\r
- // `'topright'`, `'bottomleft'` or `'bottomright'`\r
- position: 'topright'\r
- },\r
-\r
- initialize: function (options) {\r
- setOptions(this, options);\r
- },\r
-\r
- /* @section\r
- * Classes extending L.Control will inherit the following methods:\r
- *\r
- * @method getPosition: string\r
- * Returns the position of the control.\r
- */\r
- getPosition: function () {\r
- return this.options.position;\r
- },\r
-\r
- // @method setPosition(position: string): this\r
- // Sets the position of the control.\r
- setPosition: function (position) {\r
- var map = this._map;\r
-\r
- if (map) {\r
- map.removeControl(this);\r
- }\r
-\r
- this.options.position = position;\r
-\r
- if (map) {\r
- map.addControl(this);\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method getContainer: HTMLElement\r
- // Returns the HTMLElement that contains the control.\r
- getContainer: function () {\r
- return this._container;\r
- },\r
-\r
- // @method addTo(map: Map): this\r
- // Adds the control to the given map.\r
- addTo: function (map) {\r
- this.remove();\r
- this._map = map;\r
-\r
- var container = this._container = this.onAdd(map),\r
- pos = this.getPosition(),\r
- corner = map._controlCorners[pos];\r
-\r
- addClass(container, 'leaflet-control');\r
-\r
- if (pos.indexOf('bottom') !== -1) {\r
- corner.insertBefore(container, corner.firstChild);\r
- } else {\r
- corner.appendChild(container);\r
- }\r
-\r
- this._map.on('unload', this.remove, this);\r
-\r
- return this;\r
- },\r
-\r
- // @method remove: this\r
- // Removes the control from the map it is currently active on.\r
- remove: function () {\r
- if (!this._map) {\r
- return this;\r
- }\r
-\r
- remove(this._container);\r
-\r
- if (this.onRemove) {\r
- this.onRemove(this._map);\r
- }\r
-\r
- this._map.off('unload', this.remove, this);\r
- this._map = null;\r
-\r
- return this;\r
- },\r
-\r
- _refocusOnMap: function (e) {\r
- // if map exists and event is not a keyboard event\r
- if (this._map && e && e.screenX > 0 && e.screenY > 0) {\r
- this._map.getContainer().focus();\r
- }\r
- }\r
- });\r
-\r
- var control = function (options) {\r
- return new Control(options);\r
- };\r
-\r
- /* @section Extension methods\r
- * @uninheritable\r
- *\r
- * Every control should extend from `L.Control` and (re-)implement the following methods.\r
- *\r
- * @method onAdd(map: Map): HTMLElement\r
- * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo).\r
- *\r
- * @method onRemove(map: Map)\r
- * Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove).\r
- */\r
-\r
- /* @namespace Map\r
- * @section Methods for Layers and Controls\r
- */\r
- Map.include({\r
- // @method addControl(control: Control): this\r
- // Adds the given control to the map\r
- addControl: function (control) {\r
- control.addTo(this);\r
- return this;\r
- },\r
-\r
- // @method removeControl(control: Control): this\r
- // Removes the given control from the map\r
- removeControl: function (control) {\r
- control.remove();\r
- return this;\r
- },\r
-\r
- _initControlPos: function () {\r
- var corners = this._controlCorners = {},\r
- l = 'leaflet-',\r
- container = this._controlContainer =\r
- create$1('div', l + 'control-container', this._container);\r
-\r
- function createCorner(vSide, hSide) {\r
- var className = l + vSide + ' ' + l + hSide;\r
-\r
- corners[vSide + hSide] = create$1('div', className, container);\r
- }\r
-\r
- createCorner('top', 'left');\r
- createCorner('top', 'right');\r
- createCorner('bottom', 'left');\r
- createCorner('bottom', 'right');\r
- },\r
-\r
- _clearControlPos: function () {\r
- for (var i in this._controlCorners) {\r
- remove(this._controlCorners[i]);\r
- }\r
- remove(this._controlContainer);\r
- delete this._controlCorners;\r
- delete this._controlContainer;\r
- }\r
- });
-
- /*\r
- * @class Control.Layers\r
- * @aka L.Control.Layers\r
- * @inherits Control\r
- *\r
- * The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the [detailed example](http://leafletjs.com/examples/layers-control/)). Extends `Control`.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * var baseLayers = {\r
- * "Mapbox": mapbox,\r
- * "OpenStreetMap": osm\r
- * };\r
- *\r
- * var overlays = {\r
- * "Marker": marker,\r
- * "Roads": roadsLayer\r
- * };\r
- *\r
- * L.control.layers(baseLayers, overlays).addTo(map);\r
- * ```\r
- *\r
- * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values:\r
- *\r
- * ```js\r
- * {\r
- * "<someName1>": layer1,\r
- * "<someName2>": layer2\r
- * }\r
- * ```\r
- *\r
- * The layer names can contain HTML, which allows you to add additional styling to the items:\r
- *\r
- * ```js\r
- * {"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer}\r
- * ```\r
- */\r
-\r
- var Layers = Control.extend({\r
- // @section\r
- // @aka Control.Layers options\r
- options: {\r
- // @option collapsed: Boolean = true\r
- // If `true`, the control will be collapsed into an icon and expanded on mouse hover or touch.\r
- collapsed: true,\r
- position: 'topright',\r
-\r
- // @option autoZIndex: Boolean = true\r
- // If `true`, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.\r
- autoZIndex: true,\r
-\r
- // @option hideSingleBase: Boolean = false\r
- // If `true`, the base layers in the control will be hidden when there is only one.\r
- hideSingleBase: false,\r
-\r
- // @option sortLayers: Boolean = false\r
- // Whether to sort the layers. When `false`, layers will keep the order\r
- // in which they were added to the control.\r
- sortLayers: false,\r
-\r
- // @option sortFunction: Function = *\r
- // A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)\r
- // that will be used for sorting the layers, when `sortLayers` is `true`.\r
- // The function receives both the `L.Layer` instances and their names, as in\r
- // `sortFunction(layerA, layerB, nameA, nameB)`.\r
- // By default, it sorts layers alphabetically by their name.\r
- sortFunction: function (layerA, layerB, nameA, nameB) {\r
- return nameA < nameB ? -1 : (nameB < nameA ? 1 : 0);\r
- }\r
- },\r
-\r
- initialize: function (baseLayers, overlays, options) {\r
- setOptions(this, options);\r
-\r
- this._layerControlInputs = [];\r
- this._layers = [];\r
- this._lastZIndex = 0;\r
- this._handlingClick = false;\r
-\r
- for (var i in baseLayers) {\r
- this._addLayer(baseLayers[i], i);\r
- }\r
-\r
- for (i in overlays) {\r
- this._addLayer(overlays[i], i, true);\r
- }\r
- },\r
-\r
- onAdd: function (map) {\r
- this._initLayout();\r
- this._update();\r
-\r
- this._map = map;\r
- map.on('zoomend', this._checkDisabledLayers, this);\r
-\r
- for (var i = 0; i < this._layers.length; i++) {\r
- this._layers[i].layer.on('add remove', this._onLayerChange, this);\r
- }\r
-\r
- return this._container;\r
- },\r
-\r
- addTo: function (map) {\r
- Control.prototype.addTo.call(this, map);\r
- // Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height.\r
- return this._expandIfNotCollapsed();\r
- },\r
-\r
- onRemove: function () {\r
- this._map.off('zoomend', this._checkDisabledLayers, this);\r
-\r
- for (var i = 0; i < this._layers.length; i++) {\r
- this._layers[i].layer.off('add remove', this._onLayerChange, this);\r
- }\r
- },\r
-\r
- // @method addBaseLayer(layer: Layer, name: String): this\r
- // Adds a base layer (radio button entry) with the given name to the control.\r
- addBaseLayer: function (layer, name) {\r
- this._addLayer(layer, name);\r
- return (this._map) ? this._update() : this;\r
- },\r
-\r
- // @method addOverlay(layer: Layer, name: String): this\r
- // Adds an overlay (checkbox entry) with the given name to the control.\r
- addOverlay: function (layer, name) {\r
- this._addLayer(layer, name, true);\r
- return (this._map) ? this._update() : this;\r
- },\r
-\r
- // @method removeLayer(layer: Layer): this\r
- // Remove the given layer from the control.\r
- removeLayer: function (layer) {\r
- layer.off('add remove', this._onLayerChange, this);\r
-\r
- var obj = this._getLayer(stamp(layer));\r
- if (obj) {\r
- this._layers.splice(this._layers.indexOf(obj), 1);\r
- }\r
- return (this._map) ? this._update() : this;\r
- },\r
-\r
- // @method expand(): this\r
- // Expand the control container if collapsed.\r
- expand: function () {\r
- addClass(this._container, 'leaflet-control-layers-expanded');\r
- this._section.style.height = null;\r
- var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);\r
- if (acceptableHeight < this._section.clientHeight) {\r
- addClass(this._section, 'leaflet-control-layers-scrollbar');\r
- this._section.style.height = acceptableHeight + 'px';\r
- } else {\r
- removeClass(this._section, 'leaflet-control-layers-scrollbar');\r
- }\r
- this._checkDisabledLayers();\r
- return this;\r
- },\r
-\r
- // @method collapse(): this\r
- // Collapse the control container if expanded.\r
- collapse: function () {\r
- removeClass(this._container, 'leaflet-control-layers-expanded');\r
- return this;\r
- },\r
-\r
- _initLayout: function () {\r
- var className = 'leaflet-control-layers',\r
- container = this._container = create$1('div', className),\r
- collapsed = this.options.collapsed;\r
-\r
- // makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released\r
- container.setAttribute('aria-haspopup', true);\r
-\r
- disableClickPropagation(container);\r
- disableScrollPropagation(container);\r
-\r
- var section = this._section = create$1('section', className + '-list');\r
-\r
- if (collapsed) {\r
- this._map.on('click', this.collapse, this);\r
-\r
- if (!android) {\r
- on(container, {\r
- mouseenter: this.expand,\r
- mouseleave: this.collapse\r
- }, this);\r
- }\r
- }\r
-\r
- var link = this._layersLink = create$1('a', className + '-toggle', container);\r
- link.href = '#';\r
- link.title = 'Layers';\r
-\r
- if (touch) {\r
- on(link, 'click', stop);\r
- on(link, 'click', this.expand, this);\r
- } else {\r
- on(link, 'focus', this.expand, this);\r
- }\r
-\r
- if (!collapsed) {\r
- this.expand();\r
- }\r
-\r
- this._baseLayersList = create$1('div', className + '-base', section);\r
- this._separator = create$1('div', className + '-separator', section);\r
- this._overlaysList = create$1('div', className + '-overlays', section);\r
-\r
- container.appendChild(section);\r
- },\r
-\r
- _getLayer: function (id) {\r
- for (var i = 0; i < this._layers.length; i++) {\r
-\r
- if (this._layers[i] && stamp(this._layers[i].layer) === id) {\r
- return this._layers[i];\r
- }\r
- }\r
- },\r
-\r
- _addLayer: function (layer, name, overlay) {\r
- if (this._map) {\r
- layer.on('add remove', this._onLayerChange, this);\r
- }\r
-\r
- this._layers.push({\r
- layer: layer,\r
- name: name,\r
- overlay: overlay\r
- });\r
-\r
- if (this.options.sortLayers) {\r
- this._layers.sort(bind(function (a, b) {\r
- return this.options.sortFunction(a.layer, b.layer, a.name, b.name);\r
- }, this));\r
- }\r
-\r
- if (this.options.autoZIndex && layer.setZIndex) {\r
- this._lastZIndex++;\r
- layer.setZIndex(this._lastZIndex);\r
- }\r
-\r
- this._expandIfNotCollapsed();\r
- },\r
-\r
- _update: function () {\r
- if (!this._container) { return this; }\r
-\r
- empty(this._baseLayersList);\r
- empty(this._overlaysList);\r
-\r
- this._layerControlInputs = [];\r
- var baseLayersPresent, overlaysPresent, i, obj, baseLayersCount = 0;\r
-\r
- for (i = 0; i < this._layers.length; i++) {\r
- obj = this._layers[i];\r
- this._addItem(obj);\r
- overlaysPresent = overlaysPresent || obj.overlay;\r
- baseLayersPresent = baseLayersPresent || !obj.overlay;\r
- baseLayersCount += !obj.overlay ? 1 : 0;\r
- }\r
-\r
- // Hide base layers section if there's only one layer.\r
- if (this.options.hideSingleBase) {\r
- baseLayersPresent = baseLayersPresent && baseLayersCount > 1;\r
- this._baseLayersList.style.display = baseLayersPresent ? '' : 'none';\r
- }\r
-\r
- this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';\r
-\r
- return this;\r
- },\r
-\r
- _onLayerChange: function (e) {\r
- if (!this._handlingClick) {\r
- this._update();\r
- }\r
-\r
- var obj = this._getLayer(stamp(e.target));\r
-\r
- // @namespace Map\r
- // @section Layer events\r
- // @event baselayerchange: LayersControlEvent\r
- // Fired when the base layer is changed through the [layers control](#control-layers).\r
- // @event overlayadd: LayersControlEvent\r
- // Fired when an overlay is selected through the [layers control](#control-layers).\r
- // @event overlayremove: LayersControlEvent\r
- // Fired when an overlay is deselected through the [layers control](#control-layers).\r
- // @namespace Control.Layers\r
- var type = obj.overlay ?\r
- (e.type === 'add' ? 'overlayadd' : 'overlayremove') :\r
- (e.type === 'add' ? 'baselayerchange' : null);\r
-\r
- if (type) {\r
- this._map.fire(type, obj);\r
- }\r
- },\r
-\r
- // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)\r
- _createRadioElement: function (name, checked) {\r
-\r
- var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' +\r
- name + '"' + (checked ? ' checked="checked"' : '') + '/>';\r
-\r
- var radioFragment = document.createElement('div');\r
- radioFragment.innerHTML = radioHtml;\r
-\r
- return radioFragment.firstChild;\r
- },\r
-\r
- _addItem: function (obj) {\r
- var label = document.createElement('label'),\r
- checked = this._map.hasLayer(obj.layer),\r
- input;\r
-\r
- if (obj.overlay) {\r
- input = document.createElement('input');\r
- input.type = 'checkbox';\r
- input.className = 'leaflet-control-layers-selector';\r
- input.defaultChecked = checked;\r
- } else {\r
- input = this._createRadioElement('leaflet-base-layers_' + stamp(this), checked);\r
- }\r
-\r
- this._layerControlInputs.push(input);\r
- input.layerId = stamp(obj.layer);\r
-\r
- on(input, 'click', this._onInputClick, this);\r
-\r
- var name = document.createElement('span');\r
- name.innerHTML = ' ' + obj.name;\r
-\r
- // Helps from preventing layer control flicker when checkboxes are disabled\r
- // https://github.com/Leaflet/Leaflet/issues/2771\r
- var holder = document.createElement('div');\r
-\r
- label.appendChild(holder);\r
- holder.appendChild(input);\r
- holder.appendChild(name);\r
-\r
- var container = obj.overlay ? this._overlaysList : this._baseLayersList;\r
- container.appendChild(label);\r
-\r
- this._checkDisabledLayers();\r
- return label;\r
- },\r
-\r
- _onInputClick: function () {\r
- var inputs = this._layerControlInputs,\r
- input, layer;\r
- var addedLayers = [],\r
- removedLayers = [];\r
-\r
- this._handlingClick = true;\r
-\r
- for (var i = inputs.length - 1; i >= 0; i--) {\r
- input = inputs[i];\r
- layer = this._getLayer(input.layerId).layer;\r
-\r
- if (input.checked) {\r
- addedLayers.push(layer);\r
- } else if (!input.checked) {\r
- removedLayers.push(layer);\r
- }\r
- }\r
-\r
- // Bugfix issue 2318: Should remove all old layers before readding new ones\r
- for (i = 0; i < removedLayers.length; i++) {\r
- if (this._map.hasLayer(removedLayers[i])) {\r
- this._map.removeLayer(removedLayers[i]);\r
- }\r
- }\r
- for (i = 0; i < addedLayers.length; i++) {\r
- if (!this._map.hasLayer(addedLayers[i])) {\r
- this._map.addLayer(addedLayers[i]);\r
- }\r
- }\r
-\r
- this._handlingClick = false;\r
-\r
- this._refocusOnMap();\r
- },\r
-\r
- _checkDisabledLayers: function () {\r
- var inputs = this._layerControlInputs,\r
- input,\r
- layer,\r
- zoom = this._map.getZoom();\r
-\r
- for (var i = inputs.length - 1; i >= 0; i--) {\r
- input = inputs[i];\r
- layer = this._getLayer(input.layerId).layer;\r
- input.disabled = (layer.options.minZoom !== undefined && zoom < layer.options.minZoom) ||\r
- (layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom);\r
-\r
- }\r
- },\r
-\r
- _expandIfNotCollapsed: function () {\r
- if (this._map && !this.options.collapsed) {\r
- this.expand();\r
- }\r
- return this;\r
- },\r
-\r
- _expand: function () {\r
- // Backward compatibility, remove me in 1.1.\r
- return this.expand();\r
- },\r
-\r
- _collapse: function () {\r
- // Backward compatibility, remove me in 1.1.\r
- return this.collapse();\r
- }\r
-\r
- });\r
-\r
-\r
- // @factory L.control.layers(baselayers?: Object, overlays?: Object, options?: Control.Layers options)\r
- // Creates a layers control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.\r
- var layers = function (baseLayers, overlays, options) {\r
- return new Layers(baseLayers, overlays, options);\r
- };
-
- /*\r
- * @class Control.Zoom\r
- * @aka L.Control.Zoom\r
- * @inherits Control\r
- *\r
- * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`.\r
- */\r
-\r
- var Zoom = Control.extend({\r
- // @section\r
- // @aka Control.Zoom options\r
- options: {\r
- position: 'topleft',\r
-\r
- // @option zoomInText: String = '+'\r
- // The text set on the 'zoom in' button.\r
- zoomInText: '+',\r
-\r
- // @option zoomInTitle: String = 'Zoom in'\r
- // The title set on the 'zoom in' button.\r
- zoomInTitle: 'Zoom in',\r
-\r
- // @option zoomOutText: String = '−'\r
- // The text set on the 'zoom out' button.\r
- zoomOutText: '−',\r
-\r
- // @option zoomOutTitle: String = 'Zoom out'\r
- // The title set on the 'zoom out' button.\r
- zoomOutTitle: 'Zoom out'\r
- },\r
-\r
- onAdd: function (map) {\r
- var zoomName = 'leaflet-control-zoom',\r
- container = create$1('div', zoomName + ' leaflet-bar'),\r
- options = this.options;\r
-\r
- this._zoomInButton = this._createButton(options.zoomInText, options.zoomInTitle,\r
- zoomName + '-in', container, this._zoomIn);\r
- this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle,\r
- zoomName + '-out', container, this._zoomOut);\r
-\r
- this._updateDisabled();\r
- map.on('zoomend zoomlevelschange', this._updateDisabled, this);\r
-\r
- return container;\r
- },\r
-\r
- onRemove: function (map) {\r
- map.off('zoomend zoomlevelschange', this._updateDisabled, this);\r
- },\r
-\r
- disable: function () {\r
- this._disabled = true;\r
- this._updateDisabled();\r
- return this;\r
- },\r
-\r
- enable: function () {\r
- this._disabled = false;\r
- this._updateDisabled();\r
- return this;\r
- },\r
-\r
- _zoomIn: function (e) {\r
- if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {\r
- this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\r
- }\r
- },\r
-\r
- _zoomOut: function (e) {\r
- if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {\r
- this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\r
- }\r
- },\r
-\r
- _createButton: function (html, title, className, container, fn) {\r
- var link = create$1('a', className, container);\r
- link.innerHTML = html;\r
- link.href = '#';\r
- link.title = title;\r
-\r
- /*\r
- * Will force screen readers like VoiceOver to read this as "Zoom in - button"\r
- */\r
- link.setAttribute('role', 'button');\r
- link.setAttribute('aria-label', title);\r
-\r
- disableClickPropagation(link);\r
- on(link, 'click', stop);\r
- on(link, 'click', fn, this);\r
- on(link, 'click', this._refocusOnMap, this);\r
-\r
- return link;\r
- },\r
-\r
- _updateDisabled: function () {\r
- var map = this._map,\r
- className = 'leaflet-disabled';\r
-\r
- removeClass(this._zoomInButton, className);\r
- removeClass(this._zoomOutButton, className);\r
-\r
- if (this._disabled || map._zoom === map.getMinZoom()) {\r
- addClass(this._zoomOutButton, className);\r
- }\r
- if (this._disabled || map._zoom === map.getMaxZoom()) {\r
- addClass(this._zoomInButton, className);\r
- }\r
- }\r
- });\r
-\r
- // @namespace Map\r
- // @section Control options\r
- // @option zoomControl: Boolean = true\r
- // Whether a [zoom control](#control-zoom) is added to the map by default.\r
- Map.mergeOptions({\r
- zoomControl: true\r
- });\r
-\r
- Map.addInitHook(function () {\r
- if (this.options.zoomControl) {\r
- // @section Controls\r
- // @property zoomControl: Control.Zoom\r
- // The default zoom control (only available if the\r
- // [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map).\r
- this.zoomControl = new Zoom();\r
- this.addControl(this.zoomControl);\r
- }\r
- });\r
-\r
- // @namespace Control.Zoom\r
- // @factory L.control.zoom(options: Control.Zoom options)\r
- // Creates a zoom control\r
- var zoom = function (options) {\r
- return new Zoom(options);\r
- };
-
- /*
- * @class Control.Scale
- * @aka L.Control.Scale
- * @inherits Control
- *
- * A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends `Control`.
- *
- * @example
- *
- * ```js
- * L.control.scale().addTo(map);
- * ```
- */
-
- var Scale = Control.extend({
- // @section
- // @aka Control.Scale options
- options: {
- position: 'bottomleft',
-
- // @option maxWidth: Number = 100
- // Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
- maxWidth: 100,
-
- // @option metric: Boolean = True
- // Whether to show the metric scale line (m/km).
- metric: true,
-
- // @option imperial: Boolean = True
- // Whether to show the imperial scale line (mi/ft).
- imperial: true
-
- // @option updateWhenIdle: Boolean = false
- // If `true`, the control is updated on [`moveend`](#map-moveend), otherwise it's always up-to-date (updated on [`move`](#map-move)).
- },
-
- onAdd: function (map) {
- var className = 'leaflet-control-scale',
- container = create$1('div', className),
- options = this.options;
-
- this._addScales(options, className + '-line', container);
-
- map.on(options.updateWhenIdle ? 'moveend' : 'move', this._update, this);
- map.whenReady(this._update, this);
-
- return container;
- },
-
- onRemove: function (map) {
- map.off(this.options.updateWhenIdle ? 'moveend' : 'move', this._update, this);
- },
-
- _addScales: function (options, className, container) {
- if (options.metric) {
- this._mScale = create$1('div', className, container);
- }
- if (options.imperial) {
- this._iScale = create$1('div', className, container);
- }
- },
-
- _update: function () {
- var map = this._map,
- y = map.getSize().y / 2;
-
- var maxMeters = map.distance(
- map.containerPointToLatLng([0, y]),
- map.containerPointToLatLng([this.options.maxWidth, y]));
-
- this._updateScales(maxMeters);
- },
-
- _updateScales: function (maxMeters) {
- if (this.options.metric && maxMeters) {
- this._updateMetric(maxMeters);
- }
- if (this.options.imperial && maxMeters) {
- this._updateImperial(maxMeters);
- }
- },
-
- _updateMetric: function (maxMeters) {
- var meters = this._getRoundNum(maxMeters),
- label = meters < 1000 ? meters + ' m' : (meters / 1000) + ' km';
-
- this._updateScale(this._mScale, label, meters / maxMeters);
- },
-
- _updateImperial: function (maxMeters) {
- var maxFeet = maxMeters * 3.2808399,
- maxMiles, miles, feet;
-
- if (maxFeet > 5280) {
- maxMiles = maxFeet / 5280;
- miles = this._getRoundNum(maxMiles);
- this._updateScale(this._iScale, miles + ' mi', miles / maxMiles);
-
- } else {
- feet = this._getRoundNum(maxFeet);
- this._updateScale(this._iScale, feet + ' ft', feet / maxFeet);
- }
- },
-
- _updateScale: function (scale, text, ratio) {
- scale.style.width = Math.round(this.options.maxWidth * ratio) + 'px';
- scale.innerHTML = text;
- },
-
- _getRoundNum: function (num) {
- var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1),
- d = num / pow10;
-
- d = d >= 10 ? 10 :
- d >= 5 ? 5 :
- d >= 3 ? 3 :
- d >= 2 ? 2 : 1;
-
- return pow10 * d;
- }
- });
-
-
- // @factory L.control.scale(options?: Control.Scale options)
- // Creates an scale control with the given options.
- var scale = function (options) {
- return new Scale(options);
- };
-
- /*\r
- * @class Control.Attribution\r
- * @aka L.Control.Attribution\r
- * @inherits Control\r
- *\r
- * The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches attribution texts from layers with the [`getAttribution` method](#layer-getattribution) automatically. Extends Control.\r
- */\r
-\r
- var Attribution = Control.extend({\r
- // @section\r
- // @aka Control.Attribution options\r
- options: {\r
- position: 'bottomright',\r
-\r
- // @option prefix: String = 'Leaflet'\r
- // The HTML text shown before the attributions. Pass `false` to disable.\r
- prefix: '<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'\r
- },\r
-\r
- initialize: function (options) {\r
- setOptions(this, options);\r
-\r
- this._attributions = {};\r
- },\r
-\r
- onAdd: function (map) {\r
- map.attributionControl = this;\r
- this._container = create$1('div', 'leaflet-control-attribution');\r
- disableClickPropagation(this._container);\r
-\r
- // TODO ugly, refactor\r
- for (var i in map._layers) {\r
- if (map._layers[i].getAttribution) {\r
- this.addAttribution(map._layers[i].getAttribution());\r
- }\r
- }\r
-\r
- this._update();\r
-\r
- return this._container;\r
- },\r
-\r
- // @method setPrefix(prefix: String): this\r
- // Sets the text before the attributions.\r
- setPrefix: function (prefix) {\r
- this.options.prefix = prefix;\r
- this._update();\r
- return this;\r
- },\r
-\r
- // @method addAttribution(text: String): this\r
- // Adds an attribution text (e.g. `'Vector data © Mapbox'`).\r
- addAttribution: function (text) {\r
- if (!text) { return this; }\r
-\r
- if (!this._attributions[text]) {\r
- this._attributions[text] = 0;\r
- }\r
- this._attributions[text]++;\r
-\r
- this._update();\r
-\r
- return this;\r
- },\r
-\r
- // @method removeAttribution(text: String): this\r
- // Removes an attribution text.\r
- removeAttribution: function (text) {\r
- if (!text) { return this; }\r
-\r
- if (this._attributions[text]) {\r
- this._attributions[text]--;\r
- this._update();\r
- }\r
-\r
- return this;\r
- },\r
-\r
- _update: function () {\r
- if (!this._map) { return; }\r
-\r
- var attribs = [];\r
-\r
- for (var i in this._attributions) {\r
- if (this._attributions[i]) {\r
- attribs.push(i);\r
- }\r
- }\r
-\r
- var prefixAndAttribs = [];\r
-\r
- if (this.options.prefix) {\r
- prefixAndAttribs.push(this.options.prefix);\r
- }\r
- if (attribs.length) {\r
- prefixAndAttribs.push(attribs.join(', '));\r
- }\r
-\r
- this._container.innerHTML = prefixAndAttribs.join(' | ');\r
- }\r
- });\r
-\r
- // @namespace Map\r
- // @section Control options\r
- // @option attributionControl: Boolean = true\r
- // Whether a [attribution control](#control-attribution) is added to the map by default.\r
- Map.mergeOptions({\r
- attributionControl: true\r
- });\r
-\r
- Map.addInitHook(function () {\r
- if (this.options.attributionControl) {\r
- new Attribution().addTo(this);\r
- }\r
- });\r
-\r
- // @namespace Control.Attribution\r
- // @factory L.control.attribution(options: Control.Attribution options)\r
- // Creates an attribution control.\r
- var attribution = function (options) {\r
- return new Attribution(options);\r
- };
-
- Control.Layers = Layers;
- Control.Zoom = Zoom;
- Control.Scale = Scale;
- Control.Attribution = Attribution;
-
- control.layers = layers;
- control.zoom = zoom;
- control.scale = scale;
- control.attribution = attribution;
-
- /*
- L.Handler is a base class for handler classes that are used internally to inject
- interaction features like dragging to classes like Map and Marker.
- */
-
- // @class Handler
- // @aka L.Handler
- // Abstract class for map interaction handlers
-
- var Handler = Class.extend({
- initialize: function (map) {
- this._map = map;
- },
-
- // @method enable(): this
- // Enables the handler
- enable: function () {
- if (this._enabled) { return this; }
-
- this._enabled = true;
- this.addHooks();
- return this;
- },
-
- // @method disable(): this
- // Disables the handler
- disable: function () {
- if (!this._enabled) { return this; }
-
- this._enabled = false;
- this.removeHooks();
- return this;
- },
-
- // @method enabled(): Boolean
- // Returns `true` if the handler is enabled
- enabled: function () {
- return !!this._enabled;
- }
-
- // @section Extension methods
- // Classes inheriting from `Handler` must implement the two following methods:
- // @method addHooks()
- // Called when the handler is enabled, should add event hooks.
- // @method removeHooks()
- // Called when the handler is disabled, should remove the event hooks added previously.
- });
-
- // @section There is static function which can be called without instantiating L.Handler:
- // @function addTo(map: Map, name: String): this
- // Adds a new Handler to the given map with the given name.
- Handler.addTo = function (map, name) {
- map.addHandler(name, this);
- return this;
- };
-
- var Mixin = {Events: Events};
-
- /*\r
- * @class Draggable\r
- * @aka L.Draggable\r
- * @inherits Evented\r
- *\r
- * A class for making DOM elements draggable (including touch support).\r
- * Used internally for map and marker dragging. Only works for elements\r
- * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition).\r
- *\r
- * @example\r
- * ```js\r
- * var draggable = new L.Draggable(elementToDrag);\r
- * draggable.enable();\r
- * ```\r
- */\r
-\r
- var START = touch ? 'touchstart mousedown' : 'mousedown';\r
- var END = {\r
- mousedown: 'mouseup',\r
- touchstart: 'touchend',\r
- pointerdown: 'touchend',\r
- MSPointerDown: 'touchend'\r
- };\r
- var MOVE = {\r
- mousedown: 'mousemove',\r
- touchstart: 'touchmove',\r
- pointerdown: 'touchmove',\r
- MSPointerDown: 'touchmove'\r
- };\r
-\r
-\r
- var Draggable = Evented.extend({\r
-\r
- options: {\r
- // @section\r
- // @aka Draggable options\r
- // @option clickTolerance: Number = 3\r
- // The max number of pixels a user can shift the mouse pointer during a click\r
- // for it to be considered a valid click (as opposed to a mouse drag).\r
- clickTolerance: 3\r
- },\r
-\r
- // @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options)\r
- // Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default).\r
- initialize: function (element, dragStartTarget, preventOutline$$1, options) {\r
- setOptions(this, options);\r
-\r
- this._element = element;\r
- this._dragStartTarget = dragStartTarget || element;\r
- this._preventOutline = preventOutline$$1;\r
- },\r
-\r
- // @method enable()\r
- // Enables the dragging ability\r
- enable: function () {\r
- if (this._enabled) { return; }\r
-\r
- on(this._dragStartTarget, START, this._onDown, this);\r
-\r
- this._enabled = true;\r
- },\r
-\r
- // @method disable()\r
- // Disables the dragging ability\r
- disable: function () {\r
- if (!this._enabled) { return; }\r
-\r
- // If we're currently dragging this draggable,\r
- // disabling it counts as first ending the drag.\r
- if (Draggable._dragging === this) {\r
- this.finishDrag();\r
- }\r
-\r
- off(this._dragStartTarget, START, this._onDown, this);\r
-\r
- this._enabled = false;\r
- this._moved = false;\r
- },\r
-\r
- _onDown: function (e) {\r
- // Ignore simulated events, since we handle both touch and\r
- // mouse explicitly; otherwise we risk getting duplicates of\r
- // touch events, see #4315.\r
- // Also ignore the event if disabled; this happens in IE11\r
- // under some circumstances, see #3666.\r
- if (e._simulated || !this._enabled) { return; }\r
-\r
- this._moved = false;\r
-\r
- if (hasClass(this._element, 'leaflet-zoom-anim')) { return; }\r
-\r
- if (Draggable._dragging || e.shiftKey || ((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; }\r
- Draggable._dragging = this; // Prevent dragging multiple objects at once.\r
-\r
- if (this._preventOutline) {\r
- preventOutline(this._element);\r
- }\r
-\r
- disableImageDrag();\r
- disableTextSelection();\r
-\r
- if (this._moving) { return; }\r
-\r
- // @event down: Event\r
- // Fired when a drag is about to start.\r
- this.fire('down');\r
-\r
- var first = e.touches ? e.touches[0] : e,\r
- sizedParent = getSizedParentNode(this._element);\r
-\r
- this._startPoint = new Point(first.clientX, first.clientY);\r
-\r
- // Cache the scale, so that we can continuously compensate for it during drag (_onMove).\r
- this._parentScale = getScale(sizedParent);\r
-\r
- on(document, MOVE[e.type], this._onMove, this);\r
- on(document, END[e.type], this._onUp, this);\r
- },\r
-\r
- _onMove: function (e) {\r
- // Ignore simulated events, since we handle both touch and\r
- // mouse explicitly; otherwise we risk getting duplicates of\r
- // touch events, see #4315.\r
- // Also ignore the event if disabled; this happens in IE11\r
- // under some circumstances, see #3666.\r
- if (e._simulated || !this._enabled) { return; }\r
-\r
- if (e.touches && e.touches.length > 1) {\r
- this._moved = true;\r
- return;\r
- }\r
-\r
- var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e),\r
- offset = new Point(first.clientX, first.clientY)._subtract(this._startPoint);\r
-\r
- if (!offset.x && !offset.y) { return; }\r
- if (Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) { return; }\r
-\r
- // We assume that the parent container's position, border and scale do not change for the duration of the drag.\r
- // Therefore there is no need to account for the position and border (they are eliminated by the subtraction)\r
- // and we can use the cached value for the scale.\r
- offset.x /= this._parentScale.x;\r
- offset.y /= this._parentScale.y;\r
-\r
- preventDefault(e);\r
-\r
- if (!this._moved) {\r
- // @event dragstart: Event\r
- // Fired when a drag starts\r
- this.fire('dragstart');\r
-\r
- this._moved = true;\r
- this._startPos = getPosition(this._element).subtract(offset);\r
-\r
- addClass(document.body, 'leaflet-dragging');\r
-\r
- this._lastTarget = e.target || e.srcElement;\r
- // IE and Edge do not give the <use> element, so fetch it\r
- // if necessary\r
- if (window.SVGElementInstance && this._lastTarget instanceof window.SVGElementInstance) {\r
- this._lastTarget = this._lastTarget.correspondingUseElement;\r
- }\r
- addClass(this._lastTarget, 'leaflet-drag-target');\r
- }\r
-\r
- this._newPos = this._startPos.add(offset);\r
- this._moving = true;\r
-\r
- cancelAnimFrame(this._animRequest);\r
- this._lastEvent = e;\r
- this._animRequest = requestAnimFrame(this._updatePosition, this, true);\r
- },\r
-\r
- _updatePosition: function () {\r
- var e = {originalEvent: this._lastEvent};\r
-\r
- // @event predrag: Event\r
- // Fired continuously during dragging *before* each corresponding\r
- // update of the element's position.\r
- this.fire('predrag', e);\r
- setPosition(this._element, this._newPos);\r
-\r
- // @event drag: Event\r
- // Fired continuously during dragging.\r
- this.fire('drag', e);\r
- },\r
-\r
- _onUp: function (e) {\r
- // Ignore simulated events, since we handle both touch and\r
- // mouse explicitly; otherwise we risk getting duplicates of\r
- // touch events, see #4315.\r
- // Also ignore the event if disabled; this happens in IE11\r
- // under some circumstances, see #3666.\r
- if (e._simulated || !this._enabled) { return; }\r
- this.finishDrag();\r
- },\r
-\r
- finishDrag: function () {\r
- removeClass(document.body, 'leaflet-dragging');\r
-\r
- if (this._lastTarget) {\r
- removeClass(this._lastTarget, 'leaflet-drag-target');\r
- this._lastTarget = null;\r
- }\r
-\r
- for (var i in MOVE) {\r
- off(document, MOVE[i], this._onMove, this);\r
- off(document, END[i], this._onUp, this);\r
- }\r
-\r
- enableImageDrag();\r
- enableTextSelection();\r
-\r
- if (this._moved && this._moving) {\r
- // ensure drag is not fired after dragend\r
- cancelAnimFrame(this._animRequest);\r
-\r
- // @event dragend: DragEndEvent\r
- // Fired when the drag ends.\r
- this.fire('dragend', {\r
- distance: this._newPos.distanceTo(this._startPos)\r
- });\r
- }\r
-\r
- this._moving = false;\r
- Draggable._dragging = false;\r
- }\r
-\r
- });
-
- /*\r
- * @namespace LineUtil\r
- *\r
- * Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.\r
- */\r
-\r
- // Simplify polyline with vertex reduction and Douglas-Peucker simplification.\r
- // Improves rendering performance dramatically by lessening the number of points to draw.\r
-\r
- // @function simplify(points: Point[], tolerance: Number): Point[]\r
- // Dramatically reduces the number of points in a polyline while retaining\r
- // its shape and returns a new array of simplified points, using the\r
- // [Douglas-Peucker algorithm](http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm).\r
- // Used for a huge performance boost when processing/displaying Leaflet polylines for\r
- // each zoom level and also reducing visual noise. tolerance affects the amount of\r
- // simplification (lesser value means higher quality but slower and with more points).\r
- // Also released as a separated micro-library [Simplify.js](http://mourner.github.com/simplify-js/).\r
- function simplify(points, tolerance) {\r
- if (!tolerance || !points.length) {\r
- return points.slice();\r
- }\r
-\r
- var sqTolerance = tolerance * tolerance;\r
-\r
- // stage 1: vertex reduction\r
- points = _reducePoints(points, sqTolerance);\r
-\r
- // stage 2: Douglas-Peucker simplification\r
- points = _simplifyDP(points, sqTolerance);\r
-\r
- return points;\r
- }\r
-\r
- // @function pointToSegmentDistance(p: Point, p1: Point, p2: Point): Number\r
- // Returns the distance between point `p` and segment `p1` to `p2`.\r
- function pointToSegmentDistance(p, p1, p2) {\r
- return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true));\r
- }\r
-\r
- // @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number\r
- // Returns the closest point from a point `p` on a segment `p1` to `p2`.\r
- function closestPointOnSegment(p, p1, p2) {\r
- return _sqClosestPointOnSegment(p, p1, p2);\r
- }\r
-\r
- // Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm\r
- function _simplifyDP(points, sqTolerance) {\r
-\r
- var len = points.length,\r
- ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array,\r
- markers = new ArrayConstructor(len);\r
-\r
- markers[0] = markers[len - 1] = 1;\r
-\r
- _simplifyDPStep(points, markers, sqTolerance, 0, len - 1);\r
-\r
- var i,\r
- newPoints = [];\r
-\r
- for (i = 0; i < len; i++) {\r
- if (markers[i]) {\r
- newPoints.push(points[i]);\r
- }\r
- }\r
-\r
- return newPoints;\r
- }\r
-\r
- function _simplifyDPStep(points, markers, sqTolerance, first, last) {\r
-\r
- var maxSqDist = 0,\r
- index, i, sqDist;\r
-\r
- for (i = first + 1; i <= last - 1; i++) {\r
- sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true);\r
-\r
- if (sqDist > maxSqDist) {\r
- index = i;\r
- maxSqDist = sqDist;\r
- }\r
- }\r
-\r
- if (maxSqDist > sqTolerance) {\r
- markers[index] = 1;\r
-\r
- _simplifyDPStep(points, markers, sqTolerance, first, index);\r
- _simplifyDPStep(points, markers, sqTolerance, index, last);\r
- }\r
- }\r
-\r
- // reduce points that are too close to each other to a single point\r
- function _reducePoints(points, sqTolerance) {\r
- var reducedPoints = [points[0]];\r
-\r
- for (var i = 1, prev = 0, len = points.length; i < len; i++) {\r
- if (_sqDist(points[i], points[prev]) > sqTolerance) {\r
- reducedPoints.push(points[i]);\r
- prev = i;\r
- }\r
- }\r
- if (prev < len - 1) {\r
- reducedPoints.push(points[len - 1]);\r
- }\r
- return reducedPoints;\r
- }\r
-\r
- var _lastCode;\r
-\r
- // @function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: Boolean, round?: Boolean): Point[]|Boolean\r
- // Clips the segment a to b by rectangular bounds with the\r
- // [Cohen-Sutherland algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm)\r
- // (modifying the segment points directly!). Used by Leaflet to only show polyline\r
- // points that are on the screen or near, increasing performance.\r
- function clipSegment(a, b, bounds, useLastCode, round) {\r
- var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds),\r
- codeB = _getBitCode(b, bounds),\r
-\r
- codeOut, p, newCode;\r
-\r
- // save 2nd code to avoid calculating it on the next segment\r
- _lastCode = codeB;\r
-\r
- while (true) {\r
- // if a,b is inside the clip window (trivial accept)\r
- if (!(codeA | codeB)) {\r
- return [a, b];\r
- }\r
-\r
- // if a,b is outside the clip window (trivial reject)\r
- if (codeA & codeB) {\r
- return false;\r
- }\r
-\r
- // other cases\r
- codeOut = codeA || codeB;\r
- p = _getEdgeIntersection(a, b, codeOut, bounds, round);\r
- newCode = _getBitCode(p, bounds);\r
-\r
- if (codeOut === codeA) {\r
- a = p;\r
- codeA = newCode;\r
- } else {\r
- b = p;\r
- codeB = newCode;\r
- }\r
- }\r
- }\r
-\r
- function _getEdgeIntersection(a, b, code, bounds, round) {\r
- var dx = b.x - a.x,\r
- dy = b.y - a.y,\r
- min = bounds.min,\r
- max = bounds.max,\r
- x, y;\r
-\r
- if (code & 8) { // top\r
- x = a.x + dx * (max.y - a.y) / dy;\r
- y = max.y;\r
-\r
- } else if (code & 4) { // bottom\r
- x = a.x + dx * (min.y - a.y) / dy;\r
- y = min.y;\r
-\r
- } else if (code & 2) { // right\r
- x = max.x;\r
- y = a.y + dy * (max.x - a.x) / dx;\r
-\r
- } else if (code & 1) { // left\r
- x = min.x;\r
- y = a.y + dy * (min.x - a.x) / dx;\r
- }\r
-\r
- return new Point(x, y, round);\r
- }\r
-\r
- function _getBitCode(p, bounds) {\r
- var code = 0;\r
-\r
- if (p.x < bounds.min.x) { // left\r
- code |= 1;\r
- } else if (p.x > bounds.max.x) { // right\r
- code |= 2;\r
- }\r
-\r
- if (p.y < bounds.min.y) { // bottom\r
- code |= 4;\r
- } else if (p.y > bounds.max.y) { // top\r
- code |= 8;\r
- }\r
-\r
- return code;\r
- }\r
-\r
- // square distance (to avoid unnecessary Math.sqrt calls)\r
- function _sqDist(p1, p2) {\r
- var dx = p2.x - p1.x,\r
- dy = p2.y - p1.y;\r
- return dx * dx + dy * dy;\r
- }\r
-\r
- // return closest point on segment or distance to that point\r
- function _sqClosestPointOnSegment(p, p1, p2, sqDist) {\r
- var x = p1.x,\r
- y = p1.y,\r
- dx = p2.x - x,\r
- dy = p2.y - y,\r
- dot = dx * dx + dy * dy,\r
- t;\r
-\r
- if (dot > 0) {\r
- t = ((p.x - x) * dx + (p.y - y) * dy) / dot;\r
-\r
- if (t > 1) {\r
- x = p2.x;\r
- y = p2.y;\r
- } else if (t > 0) {\r
- x += dx * t;\r
- y += dy * t;\r
- }\r
- }\r
-\r
- dx = p.x - x;\r
- dy = p.y - y;\r
-\r
- return sqDist ? dx * dx + dy * dy : new Point(x, y);\r
- }\r
-\r
-\r
- // @function isFlat(latlngs: LatLng[]): Boolean\r
- // Returns true if `latlngs` is a flat array, false is nested.\r
- function isFlat(latlngs) {\r
- return !isArray(latlngs[0]) || (typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined');\r
- }\r
-\r
- function _flat(latlngs) {\r
- console.warn('Deprecated use of _flat, please use L.LineUtil.isFlat instead.');\r
- return isFlat(latlngs);\r
- }
-
- var LineUtil = ({
- simplify: simplify,
- pointToSegmentDistance: pointToSegmentDistance,
- closestPointOnSegment: closestPointOnSegment,
- clipSegment: clipSegment,
- _getEdgeIntersection: _getEdgeIntersection,
- _getBitCode: _getBitCode,
- _sqClosestPointOnSegment: _sqClosestPointOnSegment,
- isFlat: isFlat,
- _flat: _flat
- });
-
- /*\r
- * @namespace PolyUtil\r
- * Various utility functions for polygon geometries.\r
- */\r
-\r
- /* @function clipPolygon(points: Point[], bounds: Bounds, round?: Boolean): Point[]\r
- * Clips the polygon geometry defined by the given `points` by the given bounds (using the [Sutherland-Hodgman algorithm](https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm)).\r
- * Used by Leaflet to only show polygon points that are on the screen or near, increasing\r
- * performance. Note that polygon points needs different algorithm for clipping\r
- * than polyline, so there's a separate method for it.\r
- */\r
- function clipPolygon(points, bounds, round) {\r
- var clippedPoints,\r
- edges = [1, 4, 2, 8],\r
- i, j, k,\r
- a, b,\r
- len, edge, p;\r
-\r
- for (i = 0, len = points.length; i < len; i++) {\r
- points[i]._code = _getBitCode(points[i], bounds);\r
- }\r
-\r
- // for each edge (left, bottom, right, top)\r
- for (k = 0; k < 4; k++) {\r
- edge = edges[k];\r
- clippedPoints = [];\r
-\r
- for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {\r
- a = points[i];\r
- b = points[j];\r
-\r
- // if a is inside the clip window\r
- if (!(a._code & edge)) {\r
- // if b is outside the clip window (a->b goes out of screen)\r
- if (b._code & edge) {\r
- p = _getEdgeIntersection(b, a, edge, bounds, round);\r
- p._code = _getBitCode(p, bounds);\r
- clippedPoints.push(p);\r
- }\r
- clippedPoints.push(a);\r
-\r
- // else if b is inside the clip window (a->b enters the screen)\r
- } else if (!(b._code & edge)) {\r
- p = _getEdgeIntersection(b, a, edge, bounds, round);\r
- p._code = _getBitCode(p, bounds);\r
- clippedPoints.push(p);\r
- }\r
- }\r
- points = clippedPoints;\r
- }\r
-\r
- return points;\r
- }
-
- var PolyUtil = ({
- clipPolygon: clipPolygon
- });
-
- /*\r
- * @namespace Projection\r
- * @section\r
- * Leaflet comes with a set of already defined Projections out of the box:\r
- *\r
- * @projection L.Projection.LonLat\r
- *\r
- * Equirectangular, or Plate Carree projection — the most simple projection,\r
- * mostly used by GIS enthusiasts. Directly maps `x` as longitude, and `y` as\r
- * latitude. Also suitable for flat worlds, e.g. game maps. Used by the\r
- * `EPSG:4326` and `Simple` CRS.\r
- */\r
-\r
- var LonLat = {\r
- project: function (latlng) {\r
- return new Point(latlng.lng, latlng.lat);\r
- },\r
-\r
- unproject: function (point) {\r
- return new LatLng(point.y, point.x);\r
- },\r
-\r
- bounds: new Bounds([-180, -90], [180, 90])\r
- };
-
- /*\r
- * @namespace Projection\r
- * @projection L.Projection.Mercator\r
- *\r
- * Elliptical Mercator projection — more complex than Spherical Mercator. Assumes that Earth is an ellipsoid. Used by the EPSG:3395 CRS.\r
- */\r
-\r
- var Mercator = {\r
- R: 6378137,\r
- R_MINOR: 6356752.314245179,\r
-\r
- bounds: new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]),\r
-\r
- project: function (latlng) {\r
- var d = Math.PI / 180,\r
- r = this.R,\r
- y = latlng.lat * d,\r
- tmp = this.R_MINOR / r,\r
- e = Math.sqrt(1 - tmp * tmp),\r
- con = e * Math.sin(y);\r
-\r
- var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\r
- y = -r * Math.log(Math.max(ts, 1E-10));\r
-\r
- return new Point(latlng.lng * d * r, y);\r
- },\r
-\r
- unproject: function (point) {\r
- var d = 180 / Math.PI,\r
- r = this.R,\r
- tmp = this.R_MINOR / r,\r
- e = Math.sqrt(1 - tmp * tmp),\r
- ts = Math.exp(-point.y / r),\r
- phi = Math.PI / 2 - 2 * Math.atan(ts);\r
-\r
- for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\r
- con = e * Math.sin(phi);\r
- con = Math.pow((1 - con) / (1 + con), e / 2);\r
- dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\r
- phi += dphi;\r
- }\r
-\r
- return new LatLng(phi * d, point.x * d / r);\r
- }\r
- };
-
- /*
- * @class Projection
-
- * An object with methods for projecting geographical coordinates of the world onto
- * a flat surface (and back). See [Map projection](http://en.wikipedia.org/wiki/Map_projection).
-
- * @property bounds: Bounds
- * The bounds (specified in CRS units) where the projection is valid
-
- * @method project(latlng: LatLng): Point
- * Projects geographical coordinates into a 2D point.
- * Only accepts actual `L.LatLng` instances, not arrays.
-
- * @method unproject(point: Point): LatLng
- * The inverse of `project`. Projects a 2D point into a geographical location.
- * Only accepts actual `L.Point` instances, not arrays.
-
- * Note that the projection instances do not inherit from Leaflet's `Class` object,
- * and can't be instantiated. Also, new classes can't inherit from them,
- * and methods can't be added to them with the `include` function.
-
- */
-
- var index = ({
- LonLat: LonLat,
- Mercator: Mercator,
- SphericalMercator: SphericalMercator
- });
-
- /*\r
- * @namespace CRS\r
- * @crs L.CRS.EPSG3395\r
- *\r
- * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.\r
- */\r
- var EPSG3395 = extend({}, Earth, {\r
- code: 'EPSG:3395',\r
- projection: Mercator,\r
-\r
- transformation: (function () {\r
- var scale = 0.5 / (Math.PI * Mercator.R);\r
- return toTransformation(scale, 0.5, -scale, 0.5);\r
- }())\r
- });
-
- /*\r
- * @namespace CRS\r
- * @crs L.CRS.EPSG4326\r
- *\r
- * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.\r
- *\r
- * Leaflet 1.0.x complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic),\r
- * which is a breaking change from 0.7.x behaviour. If you are using a `TileLayer`\r
- * with this CRS, ensure that there are two 256x256 pixel tiles covering the\r
- * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),\r
- * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set.\r
- */\r
-\r
- var EPSG4326 = extend({}, Earth, {\r
- code: 'EPSG:4326',\r
- projection: LonLat,\r
- transformation: toTransformation(1 / 180, 1, -1 / 180, 0.5)\r
- });
-
- /*
- * @namespace CRS
- * @crs L.CRS.Simple
- *
- * A simple CRS that maps longitude and latitude into `x` and `y` directly.
- * May be used for maps of flat surfaces (e.g. game maps). Note that the `y`
- * axis should still be inverted (going from bottom to top). `distance()` returns
- * simple euclidean distance.
- */
-
- var Simple = extend({}, CRS, {
- projection: LonLat,
- transformation: toTransformation(1, 0, -1, 0),
-
- scale: function (zoom) {
- return Math.pow(2, zoom);
- },
-
- zoom: function (scale) {
- return Math.log(scale) / Math.LN2;
- },
-
- distance: function (latlng1, latlng2) {
- var dx = latlng2.lng - latlng1.lng,
- dy = latlng2.lat - latlng1.lat;
-
- return Math.sqrt(dx * dx + dy * dy);
- },
-
- infinite: true
- });
-
- CRS.Earth = Earth;
- CRS.EPSG3395 = EPSG3395;
- CRS.EPSG3857 = EPSG3857;
- CRS.EPSG900913 = EPSG900913;
- CRS.EPSG4326 = EPSG4326;
- CRS.Simple = Simple;
-
- /*
- * @class Layer
- * @inherits Evented
- * @aka L.Layer
- * @aka ILayer
- *
- * A set of methods from the Layer base class that all Leaflet layers use.
- * Inherits all methods, options and events from `L.Evented`.
- *
- * @example
- *
- * ```js
- * var layer = L.marker(latlng).addTo(map);
- * layer.addTo(map);
- * layer.remove();
- * ```
- *
- * @event add: Event
- * Fired after the layer is added to a map
- *
- * @event remove: Event
- * Fired after the layer is removed from a map
- */
-
-
- var Layer = Evented.extend({
-
- // Classes extending `L.Layer` will inherit the following options:
- options: {
- // @option pane: String = 'overlayPane'
- // By default the layer will be added to the map's [overlay pane](#map-overlaypane). Overriding this option will cause the layer to be placed on another pane by default.
- pane: 'overlayPane',
-
- // @option attribution: String = null
- // String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
- attribution: null,
-
- bubblingMouseEvents: true
- },
-
- /* @section
- * Classes extending `L.Layer` will inherit the following methods:
- *
- * @method addTo(map: Map|LayerGroup): this
- * Adds the layer to the given map or layer group.
- */
- addTo: function (map) {
- map.addLayer(this);
- return this;
- },
-
- // @method remove: this
- // Removes the layer from the map it is currently active on.
- remove: function () {
- return this.removeFrom(this._map || this._mapToAdd);
- },
-
- // @method removeFrom(map: Map): this
- // Removes the layer from the given map
- //
- // @alternative
- // @method removeFrom(group: LayerGroup): this
- // Removes the layer from the given `LayerGroup`
- removeFrom: function (obj) {
- if (obj) {
- obj.removeLayer(this);
- }
- return this;
- },
-
- // @method getPane(name? : String): HTMLElement
- // Returns the `HTMLElement` representing the named pane on the map. If `name` is omitted, returns the pane for this layer.
- getPane: function (name) {
- return this._map.getPane(name ? (this.options[name] || name) : this.options.pane);
- },
-
- addInteractiveTarget: function (targetEl) {
- this._map._targets[stamp(targetEl)] = this;
- return this;
- },
-
- removeInteractiveTarget: function (targetEl) {
- delete this._map._targets[stamp(targetEl)];
- return this;
- },
-
- // @method getAttribution: String
- // Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution).
- getAttribution: function () {
- return this.options.attribution;
- },
-
- _layerAdd: function (e) {
- var map = e.target;
-
- // check in case layer gets added and then removed before the map is ready
- if (!map.hasLayer(this)) { return; }
-
- this._map = map;
- this._zoomAnimated = map._zoomAnimated;
-
- if (this.getEvents) {
- var events = this.getEvents();
- map.on(events, this);
- this.once('remove', function () {
- map.off(events, this);
- }, this);
- }
-
- this.onAdd(map);
-
- if (this.getAttribution && map.attributionControl) {
- map.attributionControl.addAttribution(this.getAttribution());
- }
-
- this.fire('add');
- map.fire('layeradd', {layer: this});
- }
- });
-
- /* @section Extension methods
- * @uninheritable
- *
- * Every layer should extend from `L.Layer` and (re-)implement the following methods.
- *
- * @method onAdd(map: Map): this
- * Should contain code that creates DOM elements for the layer, adds them to `map panes` where they should belong and puts listeners on relevant map events. Called on [`map.addLayer(layer)`](#map-addlayer).
- *
- * @method onRemove(map: Map): this
- * Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in [`onAdd`](#layer-onadd). Called on [`map.removeLayer(layer)`](#map-removelayer).
- *
- * @method getEvents(): Object
- * This optional method should return an object like `{ viewreset: this._reset }` for [`addEventListener`](#evented-addeventlistener). The event handlers in this object will be automatically added and removed from the map with your layer.
- *
- * @method getAttribution(): String
- * This optional method should return a string containing HTML to be shown on the `Attribution control` whenever the layer is visible.
- *
- * @method beforeAdd(map: Map): this
- * Optional method. Called on [`map.addLayer(layer)`](#map-addlayer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only.
- */
-
-
- /* @namespace Map
- * @section Layer events
- *
- * @event layeradd: LayerEvent
- * Fired when a new layer is added to the map.
- *
- * @event layerremove: LayerEvent
- * Fired when some layer is removed from the map
- *
- * @section Methods for Layers and Controls
- */
- Map.include({
- // @method addLayer(layer: Layer): this
- // Adds the given layer to the map
- addLayer: function (layer) {
- if (!layer._layerAdd) {
- throw new Error('The provided object is not a Layer.');
- }
-
- var id = stamp(layer);
- if (this._layers[id]) { return this; }
- this._layers[id] = layer;
-
- layer._mapToAdd = this;
-
- if (layer.beforeAdd) {
- layer.beforeAdd(this);
- }
-
- this.whenReady(layer._layerAdd, layer);
-
- return this;
- },
-
- // @method removeLayer(layer: Layer): this
- // Removes the given layer from the map.
- removeLayer: function (layer) {
- var id = stamp(layer);
-
- if (!this._layers[id]) { return this; }
-
- if (this._loaded) {
- layer.onRemove(this);
- }
-
- if (layer.getAttribution && this.attributionControl) {
- this.attributionControl.removeAttribution(layer.getAttribution());
- }
-
- delete this._layers[id];
-
- if (this._loaded) {
- this.fire('layerremove', {layer: layer});
- layer.fire('remove');
- }
-
- layer._map = layer._mapToAdd = null;
-
- return this;
- },
-
- // @method hasLayer(layer: Layer): Boolean
- // Returns `true` if the given layer is currently added to the map
- hasLayer: function (layer) {
- return !!layer && (stamp(layer) in this._layers);
- },
-
- /* @method eachLayer(fn: Function, context?: Object): this
- * Iterates over the layers of the map, optionally specifying context of the iterator function.
- * ```
- * map.eachLayer(function(layer){
- * layer.bindPopup('Hello');
- * });
- * ```
- */
- eachLayer: function (method, context) {
- for (var i in this._layers) {
- method.call(context, this._layers[i]);
- }
- return this;
- },
-
- _addLayers: function (layers) {
- layers = layers ? (isArray(layers) ? layers : [layers]) : [];
-
- for (var i = 0, len = layers.length; i < len; i++) {
- this.addLayer(layers[i]);
- }
- },
-
- _addZoomLimit: function (layer) {
- if (isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom)) {
- this._zoomBoundLayers[stamp(layer)] = layer;
- this._updateZoomLevels();
- }
- },
-
- _removeZoomLimit: function (layer) {
- var id = stamp(layer);
-
- if (this._zoomBoundLayers[id]) {
- delete this._zoomBoundLayers[id];
- this._updateZoomLevels();
- }
- },
-
- _updateZoomLevels: function () {
- var minZoom = Infinity,
- maxZoom = -Infinity,
- oldZoomSpan = this._getZoomSpan();
-
- for (var i in this._zoomBoundLayers) {
- var options = this._zoomBoundLayers[i].options;
-
- minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom);
- maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom);
- }
-
- this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom;
- this._layersMinZoom = minZoom === Infinity ? undefined : minZoom;
-
- // @section Map state change events
- // @event zoomlevelschange: Event
- // Fired when the number of zoomlevels on the map is changed due
- // to adding or removing a layer.
- if (oldZoomSpan !== this._getZoomSpan()) {
- this.fire('zoomlevelschange');
- }
-
- if (this.options.maxZoom === undefined && this._layersMaxZoom && this.getZoom() > this._layersMaxZoom) {
- this.setZoom(this._layersMaxZoom);
- }
- if (this.options.minZoom === undefined && this._layersMinZoom && this.getZoom() < this._layersMinZoom) {
- this.setZoom(this._layersMinZoom);
- }
- }
- });
-
- /*\r
- * @class LayerGroup\r
- * @aka L.LayerGroup\r
- * @inherits Layer\r
- *\r
- * Used to group several layers and handle them as one. If you add it to the map,\r
- * any layers added or removed from the group will be added/removed on the map as\r
- * well. Extends `Layer`.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * L.layerGroup([marker1, marker2])\r
- * .addLayer(polyline)\r
- * .addTo(map);\r
- * ```\r
- */\r
-\r
- var LayerGroup = Layer.extend({\r
-\r
- initialize: function (layers, options) {\r
- setOptions(this, options);\r
-\r
- this._layers = {};\r
-\r
- var i, len;\r
-\r
- if (layers) {\r
- for (i = 0, len = layers.length; i < len; i++) {\r
- this.addLayer(layers[i]);\r
- }\r
- }\r
- },\r
-\r
- // @method addLayer(layer: Layer): this\r
- // Adds the given layer to the group.\r
- addLayer: function (layer) {\r
- var id = this.getLayerId(layer);\r
-\r
- this._layers[id] = layer;\r
-\r
- if (this._map) {\r
- this._map.addLayer(layer);\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method removeLayer(layer: Layer): this\r
- // Removes the given layer from the group.\r
- // @alternative\r
- // @method removeLayer(id: Number): this\r
- // Removes the layer with the given internal ID from the group.\r
- removeLayer: function (layer) {\r
- var id = layer in this._layers ? layer : this.getLayerId(layer);\r
-\r
- if (this._map && this._layers[id]) {\r
- this._map.removeLayer(this._layers[id]);\r
- }\r
-\r
- delete this._layers[id];\r
-\r
- return this;\r
- },\r
-\r
- // @method hasLayer(layer: Layer): Boolean\r
- // Returns `true` if the given layer is currently added to the group.\r
- // @alternative\r
- // @method hasLayer(id: Number): Boolean\r
- // Returns `true` if the given internal ID is currently added to the group.\r
- hasLayer: function (layer) {\r
- if (!layer) { return false; }\r
- var layerId = typeof layer === 'number' ? layer : this.getLayerId(layer);\r
- return layerId in this._layers;\r
- },\r
-\r
- // @method clearLayers(): this\r
- // Removes all the layers from the group.\r
- clearLayers: function () {\r
- return this.eachLayer(this.removeLayer, this);\r
- },\r
-\r
- // @method invoke(methodName: String, …): this\r
- // Calls `methodName` on every layer contained in this group, passing any\r
- // additional parameters. Has no effect if the layers contained do not\r
- // implement `methodName`.\r
- invoke: function (methodName) {\r
- var args = Array.prototype.slice.call(arguments, 1),\r
- i, layer;\r
-\r
- for (i in this._layers) {\r
- layer = this._layers[i];\r
-\r
- if (layer[methodName]) {\r
- layer[methodName].apply(layer, args);\r
- }\r
- }\r
-\r
- return this;\r
- },\r
-\r
- onAdd: function (map) {\r
- this.eachLayer(map.addLayer, map);\r
- },\r
-\r
- onRemove: function (map) {\r
- this.eachLayer(map.removeLayer, map);\r
- },\r
-\r
- // @method eachLayer(fn: Function, context?: Object): this\r
- // Iterates over the layers of the group, optionally specifying context of the iterator function.\r
- // ```js\r
- // group.eachLayer(function (layer) {\r
- // layer.bindPopup('Hello');\r
- // });\r
- // ```\r
- eachLayer: function (method, context) {\r
- for (var i in this._layers) {\r
- method.call(context, this._layers[i]);\r
- }\r
- return this;\r
- },\r
-\r
- // @method getLayer(id: Number): Layer\r
- // Returns the layer with the given internal ID.\r
- getLayer: function (id) {\r
- return this._layers[id];\r
- },\r
-\r
- // @method getLayers(): Layer[]\r
- // Returns an array of all the layers added to the group.\r
- getLayers: function () {\r
- var layers = [];\r
- this.eachLayer(layers.push, layers);\r
- return layers;\r
- },\r
-\r
- // @method setZIndex(zIndex: Number): this\r
- // Calls `setZIndex` on every layer contained in this group, passing the z-index.\r
- setZIndex: function (zIndex) {\r
- return this.invoke('setZIndex', zIndex);\r
- },\r
-\r
- // @method getLayerId(layer: Layer): Number\r
- // Returns the internal ID for a layer\r
- getLayerId: function (layer) {\r
- return stamp(layer);\r
- }\r
- });\r
-\r
-\r
- // @factory L.layerGroup(layers?: Layer[], options?: Object)\r
- // Create a layer group, optionally given an initial set of layers and an `options` object.\r
- var layerGroup = function (layers, options) {\r
- return new LayerGroup(layers, options);\r
- };
-
- /*\r
- * @class FeatureGroup\r
- * @aka L.FeatureGroup\r
- * @inherits LayerGroup\r
- *\r
- * Extended `LayerGroup` that makes it easier to do the same thing to all its member layers:\r
- * * [`bindPopup`](#layer-bindpopup) binds a popup to all of the layers at once (likewise with [`bindTooltip`](#layer-bindtooltip))\r
- * * Events are propagated to the `FeatureGroup`, so if the group has an event\r
- * handler, it will handle events from any of the layers. This includes mouse events\r
- * and custom events.\r
- * * Has `layeradd` and `layerremove` events\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * L.featureGroup([marker1, marker2, polyline])\r
- * .bindPopup('Hello world!')\r
- * .on('click', function() { alert('Clicked on a member of the group!'); })\r
- * .addTo(map);\r
- * ```\r
- */\r
-\r
- var FeatureGroup = LayerGroup.extend({\r
-\r
- addLayer: function (layer) {\r
- if (this.hasLayer(layer)) {\r
- return this;\r
- }\r
-\r
- layer.addEventParent(this);\r
-\r
- LayerGroup.prototype.addLayer.call(this, layer);\r
-\r
- // @event layeradd: LayerEvent\r
- // Fired when a layer is added to this `FeatureGroup`\r
- return this.fire('layeradd', {layer: layer});\r
- },\r
-\r
- removeLayer: function (layer) {\r
- if (!this.hasLayer(layer)) {\r
- return this;\r
- }\r
- if (layer in this._layers) {\r
- layer = this._layers[layer];\r
- }\r
-\r
- layer.removeEventParent(this);\r
-\r
- LayerGroup.prototype.removeLayer.call(this, layer);\r
-\r
- // @event layerremove: LayerEvent\r
- // Fired when a layer is removed from this `FeatureGroup`\r
- return this.fire('layerremove', {layer: layer});\r
- },\r
-\r
- // @method setStyle(style: Path options): this\r
- // Sets the given path options to each layer of the group that has a `setStyle` method.\r
- setStyle: function (style) {\r
- return this.invoke('setStyle', style);\r
- },\r
-\r
- // @method bringToFront(): this\r
- // Brings the layer group to the top of all other layers\r
- bringToFront: function () {\r
- return this.invoke('bringToFront');\r
- },\r
-\r
- // @method bringToBack(): this\r
- // Brings the layer group to the back of all other layers\r
- bringToBack: function () {\r
- return this.invoke('bringToBack');\r
- },\r
-\r
- // @method getBounds(): LatLngBounds\r
- // Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).\r
- getBounds: function () {\r
- var bounds = new LatLngBounds();\r
-\r
- for (var id in this._layers) {\r
- var layer = this._layers[id];\r
- bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng());\r
- }\r
- return bounds;\r
- }\r
- });\r
-\r
- // @factory L.featureGroup(layers?: Layer[], options?: Object)\r
- // Create a feature group, optionally given an initial set of layers and an `options` object.\r
- var featureGroup = function (layers, options) {\r
- return new FeatureGroup(layers, options);\r
- };
-
- /*\r
- * @class Icon\r
- * @aka L.Icon\r
- *\r
- * Represents an icon to provide when creating a marker.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * var myIcon = L.icon({\r
- * iconUrl: 'my-icon.png',\r
- * iconRetinaUrl: 'my-icon@2x.png',\r
- * iconSize: [38, 95],\r
- * iconAnchor: [22, 94],\r
- * popupAnchor: [-3, -76],\r
- * shadowUrl: 'my-icon-shadow.png',\r
- * shadowRetinaUrl: 'my-icon-shadow@2x.png',\r
- * shadowSize: [68, 95],\r
- * shadowAnchor: [22, 94]\r
- * });\r
- *\r
- * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);\r
- * ```\r
- *\r
- * `L.Icon.Default` extends `L.Icon` and is the blue icon Leaflet uses for markers by default.\r
- *\r
- */\r
-\r
- var Icon = Class.extend({\r
-\r
- /* @section\r
- * @aka Icon options\r
- *\r
- * @option iconUrl: String = null\r
- * **(required)** The URL to the icon image (absolute or relative to your script path).\r
- *\r
- * @option iconRetinaUrl: String = null\r
- * The URL to a retina sized version of the icon image (absolute or relative to your\r
- * script path). Used for Retina screen devices.\r
- *\r
- * @option iconSize: Point = null\r
- * Size of the icon image in pixels.\r
- *\r
- * @option iconAnchor: Point = null\r
- * The coordinates of the "tip" of the icon (relative to its top left corner). The icon\r
- * will be aligned so that this point is at the marker's geographical location. Centered\r
- * by default if size is specified, also can be set in CSS with negative margins.\r
- *\r
- * @option popupAnchor: Point = [0, 0]\r
- * The coordinates of the point from which popups will "open", relative to the icon anchor.\r
- *\r
- * @option tooltipAnchor: Point = [0, 0]\r
- * The coordinates of the point from which tooltips will "open", relative to the icon anchor.\r
- *\r
- * @option shadowUrl: String = null\r
- * The URL to the icon shadow image. If not specified, no shadow image will be created.\r
- *\r
- * @option shadowRetinaUrl: String = null\r
- *\r
- * @option shadowSize: Point = null\r
- * Size of the shadow image in pixels.\r
- *\r
- * @option shadowAnchor: Point = null\r
- * The coordinates of the "tip" of the shadow (relative to its top left corner) (the same\r
- * as iconAnchor if not specified).\r
- *\r
- * @option className: String = ''\r
- * A custom class name to assign to both icon and shadow images. Empty by default.\r
- */\r
-\r
- options: {\r
- popupAnchor: [0, 0],\r
- tooltipAnchor: [0, 0]\r
- },\r
-\r
- initialize: function (options) {\r
- setOptions(this, options);\r
- },\r
-\r
- // @method createIcon(oldIcon?: HTMLElement): HTMLElement\r
- // Called internally when the icon has to be shown, returns a `<img>` HTML element\r
- // styled according to the options.\r
- createIcon: function (oldIcon) {\r
- return this._createIcon('icon', oldIcon);\r
- },\r
-\r
- // @method createShadow(oldIcon?: HTMLElement): HTMLElement\r
- // As `createIcon`, but for the shadow beneath it.\r
- createShadow: function (oldIcon) {\r
- return this._createIcon('shadow', oldIcon);\r
- },\r
-\r
- _createIcon: function (name, oldIcon) {\r
- var src = this._getIconUrl(name);\r
-\r
- if (!src) {\r
- if (name === 'icon') {\r
- throw new Error('iconUrl not set in Icon options (see the docs).');\r
- }\r
- return null;\r
- }\r
-\r
- var img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null);\r
- this._setIconStyles(img, name);\r
-\r
- return img;\r
- },\r
-\r
- _setIconStyles: function (img, name) {\r
- var options = this.options;\r
- var sizeOption = options[name + 'Size'];\r
-\r
- if (typeof sizeOption === 'number') {\r
- sizeOption = [sizeOption, sizeOption];\r
- }\r
-\r
- var size = toPoint(sizeOption),\r
- anchor = toPoint(name === 'shadow' && options.shadowAnchor || options.iconAnchor ||\r
- size && size.divideBy(2, true));\r
-\r
- img.className = 'leaflet-marker-' + name + ' ' + (options.className || '');\r
-\r
- if (anchor) {\r
- img.style.marginLeft = (-anchor.x) + 'px';\r
- img.style.marginTop = (-anchor.y) + 'px';\r
- }\r
-\r
- if (size) {\r
- img.style.width = size.x + 'px';\r
- img.style.height = size.y + 'px';\r
- }\r
- },\r
-\r
- _createImg: function (src, el) {\r
- el = el || document.createElement('img');\r
- el.src = src;\r
- return el;\r
- },\r
-\r
- _getIconUrl: function (name) {\r
- return retina && this.options[name + 'RetinaUrl'] || this.options[name + 'Url'];\r
- }\r
- });\r
-\r
-\r
- // @factory L.icon(options: Icon options)\r
- // Creates an icon instance with the given options.\r
- function icon(options) {\r
- return new Icon(options);\r
- }
-
- /*
- * @miniclass Icon.Default (Icon)
- * @aka L.Icon.Default
- * @section
- *
- * A trivial subclass of `Icon`, represents the icon to use in `Marker`s when
- * no icon is specified. Points to the blue marker image distributed with Leaflet
- * releases.
- *
- * In order to customize the default icon, just change the properties of `L.Icon.Default.prototype.options`
- * (which is a set of `Icon options`).
- *
- * If you want to _completely_ replace the default icon, override the
- * `L.Marker.prototype.options.icon` with your own icon instead.
- */
-
- var IconDefault = Icon.extend({
-
- options: {
- iconUrl: 'marker-icon.png',
- iconRetinaUrl: 'marker-icon-2x.png',
- shadowUrl: 'marker-shadow.png',
- iconSize: [25, 41],
- iconAnchor: [12, 41],
- popupAnchor: [1, -34],
- tooltipAnchor: [16, -28],
- shadowSize: [41, 41]
- },
-
- _getIconUrl: function (name) {
- if (!IconDefault.imagePath) { // Deprecated, backwards-compatibility only
- IconDefault.imagePath = this._detectIconPath();
- }
-
- // @option imagePath: String
- // `Icon.Default` will try to auto-detect the location of the
- // blue icon images. If you are placing these images in a non-standard
- // way, set this option to point to the right path.
- return (this.options.imagePath || IconDefault.imagePath) + Icon.prototype._getIconUrl.call(this, name);
- },
-
- _detectIconPath: function () {
- var el = create$1('div', 'leaflet-default-icon-path', document.body);
- var path = getStyle(el, 'background-image') ||
- getStyle(el, 'backgroundImage'); // IE8
-
- document.body.removeChild(el);
-
- if (path === null || path.indexOf('url') !== 0) {
- path = '';
- } else {
- path = path.replace(/^url\(["']?/, '').replace(/marker-icon\.png["']?\)$/, '');
- }
-
- return path;
- }
- });
-
- /*
- * L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable.
- */
-
-
- /* @namespace Marker
- * @section Interaction handlers
- *
- * Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see `Handler` methods). Example:
- *
- * ```js
- * marker.dragging.disable();
- * ```
- *
- * @property dragging: Handler
- * Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set [`marker.options.draggable`](#marker-draggable)).
- */
-
- var MarkerDrag = Handler.extend({
- initialize: function (marker) {
- this._marker = marker;
- },
-
- addHooks: function () {
- var icon = this._marker._icon;
-
- if (!this._draggable) {
- this._draggable = new Draggable(icon, icon, true);
- }
-
- this._draggable.on({
- dragstart: this._onDragStart,
- predrag: this._onPreDrag,
- drag: this._onDrag,
- dragend: this._onDragEnd
- }, this).enable();
-
- addClass(icon, 'leaflet-marker-draggable');
- },
-
- removeHooks: function () {
- this._draggable.off({
- dragstart: this._onDragStart,
- predrag: this._onPreDrag,
- drag: this._onDrag,
- dragend: this._onDragEnd
- }, this).disable();
-
- if (this._marker._icon) {
- removeClass(this._marker._icon, 'leaflet-marker-draggable');
- }
- },
-
- moved: function () {
- return this._draggable && this._draggable._moved;
- },
-
- _adjustPan: function (e) {
- var marker = this._marker,
- map = marker._map,
- speed = this._marker.options.autoPanSpeed,
- padding = this._marker.options.autoPanPadding,
- iconPos = getPosition(marker._icon),
- bounds = map.getPixelBounds(),
- origin = map.getPixelOrigin();
-
- var panBounds = toBounds(
- bounds.min._subtract(origin).add(padding),
- bounds.max._subtract(origin).subtract(padding)
- );
-
- if (!panBounds.contains(iconPos)) {
- // Compute incremental movement
- var movement = toPoint(
- (Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) -
- (Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x),
-
- (Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) -
- (Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y)
- ).multiplyBy(speed);
-
- map.panBy(movement, {animate: false});
-
- this._draggable._newPos._add(movement);
- this._draggable._startPos._add(movement);
-
- setPosition(marker._icon, this._draggable._newPos);
- this._onDrag(e);
-
- this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));
- }
- },
-
- _onDragStart: function () {
- // @section Dragging events
- // @event dragstart: Event
- // Fired when the user starts dragging the marker.
-
- // @event movestart: Event
- // Fired when the marker starts moving (because of dragging).
-
- this._oldLatLng = this._marker.getLatLng();
-
- // When using ES6 imports it could not be set when `Popup` was not imported as well
- this._marker.closePopup && this._marker.closePopup();
-
- this._marker
- .fire('movestart')
- .fire('dragstart');
- },
-
- _onPreDrag: function (e) {
- if (this._marker.options.autoPan) {
- cancelAnimFrame(this._panRequest);
- this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));
- }
- },
-
- _onDrag: function (e) {
- var marker = this._marker,
- shadow = marker._shadow,
- iconPos = getPosition(marker._icon),
- latlng = marker._map.layerPointToLatLng(iconPos);
-
- // update shadow position
- if (shadow) {
- setPosition(shadow, iconPos);
- }
-
- marker._latlng = latlng;
- e.latlng = latlng;
- e.oldLatLng = this._oldLatLng;
-
- // @event drag: Event
- // Fired repeatedly while the user drags the marker.
- marker
- .fire('move', e)
- .fire('drag', e);
- },
-
- _onDragEnd: function (e) {
- // @event dragend: DragEndEvent
- // Fired when the user stops dragging the marker.
-
- cancelAnimFrame(this._panRequest);
-
- // @event moveend: Event
- // Fired when the marker stops moving (because of dragging).
- delete this._oldLatLng;
- this._marker
- .fire('moveend')
- .fire('dragend', e);
- }
- });
-
- /*\r
- * @class Marker\r
- * @inherits Interactive layer\r
- * @aka L.Marker\r
- * L.Marker is used to display clickable/draggable icons on the map. Extends `Layer`.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * L.marker([50.5, 30.5]).addTo(map);\r
- * ```\r
- */\r
-\r
- var Marker = Layer.extend({\r
-\r
- // @section\r
- // @aka Marker options\r
- options: {\r
- // @option icon: Icon = *\r
- // Icon instance to use for rendering the marker.\r
- // See [Icon documentation](#L.Icon) for details on how to customize the marker icon.\r
- // If not specified, a common instance of `L.Icon.Default` is used.\r
- icon: new IconDefault(),\r
-\r
- // Option inherited from "Interactive layer" abstract class\r
- interactive: true,\r
-\r
- // @option keyboard: Boolean = true\r
- // Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.\r
- keyboard: true,\r
-\r
- // @option title: String = ''\r
- // Text for the browser tooltip that appear on marker hover (no tooltip by default).\r
- title: '',\r
-\r
- // @option alt: String = ''\r
- // Text for the `alt` attribute of the icon image (useful for accessibility).\r
- alt: '',\r
-\r
- // @option zIndexOffset: Number = 0\r
- // By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like `1000` (or high negative value, respectively).\r
- zIndexOffset: 0,\r
-\r
- // @option opacity: Number = 1.0\r
- // The opacity of the marker.\r
- opacity: 1,\r
-\r
- // @option riseOnHover: Boolean = false\r
- // If `true`, the marker will get on top of others when you hover the mouse over it.\r
- riseOnHover: false,\r
-\r
- // @option riseOffset: Number = 250\r
- // The z-index offset used for the `riseOnHover` feature.\r
- riseOffset: 250,\r
-\r
- // @option pane: String = 'markerPane'\r
- // `Map pane` where the markers icon will be added.\r
- pane: 'markerPane',\r
-\r
- // @option shadowPane: String = 'shadowPane'\r
- // `Map pane` where the markers shadow will be added.\r
- shadowPane: 'shadowPane',\r
-\r
- // @option bubblingMouseEvents: Boolean = false\r
- // When `true`, a mouse event on this marker will trigger the same event on the map\r
- // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).\r
- bubblingMouseEvents: false,\r
-\r
- // @section Draggable marker options\r
- // @option draggable: Boolean = false\r
- // Whether the marker is draggable with mouse/touch or not.\r
- draggable: false,\r
-\r
- // @option autoPan: Boolean = false\r
- // Whether to pan the map when dragging this marker near its edge or not.\r
- autoPan: false,\r
-\r
- // @option autoPanPadding: Point = Point(50, 50)\r
- // Distance (in pixels to the left/right and to the top/bottom) of the\r
- // map edge to start panning the map.\r
- autoPanPadding: [50, 50],\r
-\r
- // @option autoPanSpeed: Number = 10\r
- // Number of pixels the map should pan by.\r
- autoPanSpeed: 10\r
- },\r
-\r
- /* @section\r
- *\r
- * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods:\r
- */\r
-\r
- initialize: function (latlng, options) {\r
- setOptions(this, options);\r
- this._latlng = toLatLng(latlng);\r
- },\r
-\r
- onAdd: function (map) {\r
- this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation;\r
-\r
- if (this._zoomAnimated) {\r
- map.on('zoomanim', this._animateZoom, this);\r
- }\r
-\r
- this._initIcon();\r
- this.update();\r
- },\r
-\r
- onRemove: function (map) {\r
- if (this.dragging && this.dragging.enabled()) {\r
- this.options.draggable = true;\r
- this.dragging.removeHooks();\r
- }\r
- delete this.dragging;\r
-\r
- if (this._zoomAnimated) {\r
- map.off('zoomanim', this._animateZoom, this);\r
- }\r
-\r
- this._removeIcon();\r
- this._removeShadow();\r
- },\r
-\r
- getEvents: function () {\r
- return {\r
- zoom: this.update,\r
- viewreset: this.update\r
- };\r
- },\r
-\r
- // @method getLatLng: LatLng\r
- // Returns the current geographical position of the marker.\r
- getLatLng: function () {\r
- return this._latlng;\r
- },\r
-\r
- // @method setLatLng(latlng: LatLng): this\r
- // Changes the marker position to the given point.\r
- setLatLng: function (latlng) {\r
- var oldLatLng = this._latlng;\r
- this._latlng = toLatLng(latlng);\r
- this.update();\r
-\r
- // @event move: Event\r
- // Fired when the marker is moved via [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`.\r
- return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng});\r
- },\r
-\r
- // @method setZIndexOffset(offset: Number): this\r
- // Changes the [zIndex offset](#marker-zindexoffset) of the marker.\r
- setZIndexOffset: function (offset) {\r
- this.options.zIndexOffset = offset;\r
- return this.update();\r
- },\r
-\r
- // @method getIcon: Icon\r
- // Returns the current icon used by the marker\r
- getIcon: function () {\r
- return this.options.icon;\r
- },\r
-\r
- // @method setIcon(icon: Icon): this\r
- // Changes the marker icon.\r
- setIcon: function (icon) {\r
-\r
- this.options.icon = icon;\r
-\r
- if (this._map) {\r
- this._initIcon();\r
- this.update();\r
- }\r
-\r
- if (this._popup) {\r
- this.bindPopup(this._popup, this._popup.options);\r
- }\r
-\r
- return this;\r
- },\r
-\r
- getElement: function () {\r
- return this._icon;\r
- },\r
-\r
- update: function () {\r
-\r
- if (this._icon && this._map) {\r
- var pos = this._map.latLngToLayerPoint(this._latlng).round();\r
- this._setPos(pos);\r
- }\r
-\r
- return this;\r
- },\r
-\r
- _initIcon: function () {\r
- var options = this.options,\r
- classToAdd = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');\r
-\r
- var icon = options.icon.createIcon(this._icon),\r
- addIcon = false;\r
-\r
- // if we're not reusing the icon, remove the old one and init new one\r
- if (icon !== this._icon) {\r
- if (this._icon) {\r
- this._removeIcon();\r
- }\r
- addIcon = true;\r
-\r
- if (options.title) {\r
- icon.title = options.title;\r
- }\r
-\r
- if (icon.tagName === 'IMG') {\r
- icon.alt = options.alt || '';\r
- }\r
- }\r
-\r
- addClass(icon, classToAdd);\r
-\r
- if (options.keyboard) {\r
- icon.tabIndex = '0';\r
- }\r
-\r
- this._icon = icon;\r
-\r
- if (options.riseOnHover) {\r
- this.on({\r
- mouseover: this._bringToFront,\r
- mouseout: this._resetZIndex\r
- });\r
- }\r
-\r
- var newShadow = options.icon.createShadow(this._shadow),\r
- addShadow = false;\r
-\r
- if (newShadow !== this._shadow) {\r
- this._removeShadow();\r
- addShadow = true;\r
- }\r
-\r
- if (newShadow) {\r
- addClass(newShadow, classToAdd);\r
- newShadow.alt = '';\r
- }\r
- this._shadow = newShadow;\r
-\r
-\r
- if (options.opacity < 1) {\r
- this._updateOpacity();\r
- }\r
-\r
-\r
- if (addIcon) {\r
- this.getPane().appendChild(this._icon);\r
- }\r
- this._initInteraction();\r
- if (newShadow && addShadow) {\r
- this.getPane(options.shadowPane).appendChild(this._shadow);\r
- }\r
- },\r
-\r
- _removeIcon: function () {\r
- if (this.options.riseOnHover) {\r
- this.off({\r
- mouseover: this._bringToFront,\r
- mouseout: this._resetZIndex\r
- });\r
- }\r
-\r
- remove(this._icon);\r
- this.removeInteractiveTarget(this._icon);\r
-\r
- this._icon = null;\r
- },\r
-\r
- _removeShadow: function () {\r
- if (this._shadow) {\r
- remove(this._shadow);\r
- }\r
- this._shadow = null;\r
- },\r
-\r
- _setPos: function (pos) {\r
-\r
- if (this._icon) {\r
- setPosition(this._icon, pos);\r
- }\r
-\r
- if (this._shadow) {\r
- setPosition(this._shadow, pos);\r
- }\r
-\r
- this._zIndex = pos.y + this.options.zIndexOffset;\r
-\r
- this._resetZIndex();\r
- },\r
-\r
- _updateZIndex: function (offset) {\r
- if (this._icon) {\r
- this._icon.style.zIndex = this._zIndex + offset;\r
- }\r
- },\r
-\r
- _animateZoom: function (opt) {\r
- var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();\r
-\r
- this._setPos(pos);\r
- },\r
-\r
- _initInteraction: function () {\r
-\r
- if (!this.options.interactive) { return; }\r
-\r
- addClass(this._icon, 'leaflet-interactive');\r
-\r
- this.addInteractiveTarget(this._icon);\r
-\r
- if (MarkerDrag) {\r
- var draggable = this.options.draggable;\r
- if (this.dragging) {\r
- draggable = this.dragging.enabled();\r
- this.dragging.disable();\r
- }\r
-\r
- this.dragging = new MarkerDrag(this);\r
-\r
- if (draggable) {\r
- this.dragging.enable();\r
- }\r
- }\r
- },\r
-\r
- // @method setOpacity(opacity: Number): this\r
- // Changes the opacity of the marker.\r
- setOpacity: function (opacity) {\r
- this.options.opacity = opacity;\r
- if (this._map) {\r
- this._updateOpacity();\r
- }\r
-\r
- return this;\r
- },\r
-\r
- _updateOpacity: function () {\r
- var opacity = this.options.opacity;\r
-\r
- if (this._icon) {\r
- setOpacity(this._icon, opacity);\r
- }\r
-\r
- if (this._shadow) {\r
- setOpacity(this._shadow, opacity);\r
- }\r
- },\r
-\r
- _bringToFront: function () {\r
- this._updateZIndex(this.options.riseOffset);\r
- },\r
-\r
- _resetZIndex: function () {\r
- this._updateZIndex(0);\r
- },\r
-\r
- _getPopupAnchor: function () {\r
- return this.options.icon.options.popupAnchor;\r
- },\r
-\r
- _getTooltipAnchor: function () {\r
- return this.options.icon.options.tooltipAnchor;\r
- }\r
- });\r
-\r
-\r
- // factory L.marker(latlng: LatLng, options? : Marker options)\r
-\r
- // @factory L.marker(latlng: LatLng, options? : Marker options)\r
- // Instantiates a Marker object given a geographical point and optionally an options object.\r
- function marker(latlng, options) {\r
- return new Marker(latlng, options);\r
- }
-
- /*
- * @class Path
- * @aka L.Path
- * @inherits Interactive layer
- *
- * An abstract class that contains options and constants shared between vector
- * overlays (Polygon, Polyline, Circle). Do not use it directly. Extends `Layer`.
- */
-
- var Path = Layer.extend({
-
- // @section
- // @aka Path options
- options: {
- // @option stroke: Boolean = true
- // Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles.
- stroke: true,
-
- // @option color: String = '#3388ff'
- // Stroke color
- color: '#3388ff',
-
- // @option weight: Number = 3
- // Stroke width in pixels
- weight: 3,
-
- // @option opacity: Number = 1.0
- // Stroke opacity
- opacity: 1,
-
- // @option lineCap: String= 'round'
- // A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke.
- lineCap: 'round',
-
- // @option lineJoin: String = 'round'
- // A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke.
- lineJoin: 'round',
-
- // @option dashArray: String = null
- // A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).
- dashArray: null,
-
- // @option dashOffset: String = null
- // A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).
- dashOffset: null,
-
- // @option fill: Boolean = depends
- // Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles.
- fill: false,
-
- // @option fillColor: String = *
- // Fill color. Defaults to the value of the [`color`](#path-color) option
- fillColor: null,
-
- // @option fillOpacity: Number = 0.2
- // Fill opacity.
- fillOpacity: 0.2,
-
- // @option fillRule: String = 'evenodd'
- // A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined.
- fillRule: 'evenodd',
-
- // className: '',
-
- // Option inherited from "Interactive layer" abstract class
- interactive: true,
-
- // @option bubblingMouseEvents: Boolean = true
- // When `true`, a mouse event on this path will trigger the same event on the map
- // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).
- bubblingMouseEvents: true
- },
-
- beforeAdd: function (map) {
- // Renderer is set here because we need to call renderer.getEvents
- // before this.getEvents.
- this._renderer = map.getRenderer(this);
- },
-
- onAdd: function () {
- this._renderer._initPath(this);
- this._reset();
- this._renderer._addPath(this);
- },
-
- onRemove: function () {
- this._renderer._removePath(this);
- },
-
- // @method redraw(): this
- // Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
- redraw: function () {
- if (this._map) {
- this._renderer._updatePath(this);
- }
- return this;
- },
-
- // @method setStyle(style: Path options): this
- // Changes the appearance of a Path based on the options in the `Path options` object.
- setStyle: function (style) {
- setOptions(this, style);
- if (this._renderer) {
- this._renderer._updateStyle(this);
- if (this.options.stroke && style && Object.prototype.hasOwnProperty.call(style, 'weight')) {
- this._updateBounds();
- }
- }
- return this;
- },
-
- // @method bringToFront(): this
- // Brings the layer to the top of all path layers.
- bringToFront: function () {
- if (this._renderer) {
- this._renderer._bringToFront(this);
- }
- return this;
- },
-
- // @method bringToBack(): this
- // Brings the layer to the bottom of all path layers.
- bringToBack: function () {
- if (this._renderer) {
- this._renderer._bringToBack(this);
- }
- return this;
- },
-
- getElement: function () {
- return this._path;
- },
-
- _reset: function () {
- // defined in child classes
- this._project();
- this._update();
- },
-
- _clickTolerance: function () {
- // used when doing hit detection for Canvas layers
- return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance;
- }
- });
-
- /*
- * @class CircleMarker
- * @aka L.CircleMarker
- * @inherits Path
- *
- * A circle of a fixed size with radius specified in pixels. Extends `Path`.
- */
-
- var CircleMarker = Path.extend({
-
- // @section
- // @aka CircleMarker options
- options: {
- fill: true,
-
- // @option radius: Number = 10
- // Radius of the circle marker, in pixels
- radius: 10
- },
-
- initialize: function (latlng, options) {
- setOptions(this, options);
- this._latlng = toLatLng(latlng);
- this._radius = this.options.radius;
- },
-
- // @method setLatLng(latLng: LatLng): this
- // Sets the position of a circle marker to a new location.
- setLatLng: function (latlng) {
- var oldLatLng = this._latlng;
- this._latlng = toLatLng(latlng);
- this.redraw();
-
- // @event move: Event
- // Fired when the marker is moved via [`setLatLng`](#circlemarker-setlatlng). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`.
- return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng});
- },
-
- // @method getLatLng(): LatLng
- // Returns the current geographical position of the circle marker
- getLatLng: function () {
- return this._latlng;
- },
-
- // @method setRadius(radius: Number): this
- // Sets the radius of a circle marker. Units are in pixels.
- setRadius: function (radius) {
- this.options.radius = this._radius = radius;
- return this.redraw();
- },
-
- // @method getRadius(): Number
- // Returns the current radius of the circle
- getRadius: function () {
- return this._radius;
- },
-
- setStyle : function (options) {
- var radius = options && options.radius || this._radius;
- Path.prototype.setStyle.call(this, options);
- this.setRadius(radius);
- return this;
- },
-
- _project: function () {
- this._point = this._map.latLngToLayerPoint(this._latlng);
- this._updateBounds();
- },
-
- _updateBounds: function () {
- var r = this._radius,
- r2 = this._radiusY || r,
- w = this._clickTolerance(),
- p = [r + w, r2 + w];
- this._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p));
- },
-
- _update: function () {
- if (this._map) {
- this._updatePath();
- }
- },
-
- _updatePath: function () {
- this._renderer._updateCircle(this);
- },
-
- _empty: function () {
- return this._radius && !this._renderer._bounds.intersects(this._pxBounds);
- },
-
- // Needed by the `Canvas` renderer for interactivity
- _containsPoint: function (p) {
- return p.distanceTo(this._point) <= this._radius + this._clickTolerance();
- }
- });
-
-
- // @factory L.circleMarker(latlng: LatLng, options?: CircleMarker options)
- // Instantiates a circle marker object given a geographical point, and an optional options object.
- function circleMarker(latlng, options) {
- return new CircleMarker(latlng, options);
- }
-
- /*
- * @class Circle
- * @aka L.Circle
- * @inherits CircleMarker
- *
- * A class for drawing circle overlays on a map. Extends `CircleMarker`.
- *
- * It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).
- *
- * @example
- *
- * ```js
- * L.circle([50.5, 30.5], {radius: 200}).addTo(map);
- * ```
- */
-
- var Circle = CircleMarker.extend({
-
- initialize: function (latlng, options, legacyOptions) {
- if (typeof options === 'number') {
- // Backwards compatibility with 0.7.x factory (latlng, radius, options?)
- options = extend({}, legacyOptions, {radius: options});
- }
- setOptions(this, options);
- this._latlng = toLatLng(latlng);
-
- if (isNaN(this.options.radius)) { throw new Error('Circle radius cannot be NaN'); }
-
- // @section
- // @aka Circle options
- // @option radius: Number; Radius of the circle, in meters.
- this._mRadius = this.options.radius;
- },
-
- // @method setRadius(radius: Number): this
- // Sets the radius of a circle. Units are in meters.
- setRadius: function (radius) {
- this._mRadius = radius;
- return this.redraw();
- },
-
- // @method getRadius(): Number
- // Returns the current radius of a circle. Units are in meters.
- getRadius: function () {
- return this._mRadius;
- },
-
- // @method getBounds(): LatLngBounds
- // Returns the `LatLngBounds` of the path.
- getBounds: function () {
- var half = [this._radius, this._radiusY || this._radius];
-
- return new LatLngBounds(
- this._map.layerPointToLatLng(this._point.subtract(half)),
- this._map.layerPointToLatLng(this._point.add(half)));
- },
-
- setStyle: Path.prototype.setStyle,
-
- _project: function () {
-
- var lng = this._latlng.lng,
- lat = this._latlng.lat,
- map = this._map,
- crs = map.options.crs;
-
- if (crs.distance === Earth.distance) {
- var d = Math.PI / 180,
- latR = (this._mRadius / Earth.R) / d,
- top = map.project([lat + latR, lng]),
- bottom = map.project([lat - latR, lng]),
- p = top.add(bottom).divideBy(2),
- lat2 = map.unproject(p).lat,
- lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) /
- (Math.cos(lat * d) * Math.cos(lat2 * d))) / d;
-
- if (isNaN(lngR) || lngR === 0) {
- lngR = latR / Math.cos(Math.PI / 180 * lat); // Fallback for edge case, #2425
- }
-
- this._point = p.subtract(map.getPixelOrigin());
- this._radius = isNaN(lngR) ? 0 : p.x - map.project([lat2, lng - lngR]).x;
- this._radiusY = p.y - top.y;
-
- } else {
- var latlng2 = crs.unproject(crs.project(this._latlng).subtract([this._mRadius, 0]));
-
- this._point = map.latLngToLayerPoint(this._latlng);
- this._radius = this._point.x - map.latLngToLayerPoint(latlng2).x;
- }
-
- this._updateBounds();
- }
- });
-
- // @factory L.circle(latlng: LatLng, options?: Circle options)
- // Instantiates a circle object given a geographical point, and an options object
- // which contains the circle radius.
- // @alternative
- // @factory L.circle(latlng: LatLng, radius: Number, options?: Circle options)
- // Obsolete way of instantiating a circle, for compatibility with 0.7.x code.
- // Do not use in new applications or plugins.
- function circle(latlng, options, legacyOptions) {
- return new Circle(latlng, options, legacyOptions);
- }
-
- /*
- * @class Polyline
- * @aka L.Polyline
- * @inherits Path
- *
- * A class for drawing polyline overlays on a map. Extends `Path`.
- *
- * @example
- *
- * ```js
- * // create a red polyline from an array of LatLng points
- * var latlngs = [
- * [45.51, -122.68],
- * [37.77, -122.43],
- * [34.04, -118.2]
- * ];
- *
- * var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
- *
- * // zoom the map to the polyline
- * map.fitBounds(polyline.getBounds());
- * ```
- *
- * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape:
- *
- * ```js
- * // create a red polyline from an array of arrays of LatLng points
- * var latlngs = [
- * [[45.51, -122.68],
- * [37.77, -122.43],
- * [34.04, -118.2]],
- * [[40.78, -73.91],
- * [41.83, -87.62],
- * [32.76, -96.72]]
- * ];
- * ```
- */
-
-
- var Polyline = Path.extend({
-
- // @section
- // @aka Polyline options
- options: {
- // @option smoothFactor: Number = 1.0
- // How much to simplify the polyline on each zoom level. More means
- // better performance and smoother look, and less means more accurate representation.
- smoothFactor: 1.0,
-
- // @option noClip: Boolean = false
- // Disable polyline clipping.
- noClip: false
- },
-
- initialize: function (latlngs, options) {
- setOptions(this, options);
- this._setLatLngs(latlngs);
- },
-
- // @method getLatLngs(): LatLng[]
- // Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
- getLatLngs: function () {
- return this._latlngs;
- },
-
- // @method setLatLngs(latlngs: LatLng[]): this
- // Replaces all the points in the polyline with the given array of geographical points.
- setLatLngs: function (latlngs) {
- this._setLatLngs(latlngs);
- return this.redraw();
- },
-
- // @method isEmpty(): Boolean
- // Returns `true` if the Polyline has no LatLngs.
- isEmpty: function () {
- return !this._latlngs.length;
- },
-
- // @method closestLayerPoint(p: Point): Point
- // Returns the point closest to `p` on the Polyline.
- closestLayerPoint: function (p) {
- var minDistance = Infinity,
- minPoint = null,
- closest = _sqClosestPointOnSegment,
- p1, p2;
-
- for (var j = 0, jLen = this._parts.length; j < jLen; j++) {
- var points = this._parts[j];
-
- for (var i = 1, len = points.length; i < len; i++) {
- p1 = points[i - 1];
- p2 = points[i];
-
- var sqDist = closest(p, p1, p2, true);
-
- if (sqDist < minDistance) {
- minDistance = sqDist;
- minPoint = closest(p, p1, p2);
- }
- }
- }
- if (minPoint) {
- minPoint.distance = Math.sqrt(minDistance);
- }
- return minPoint;
- },
-
- // @method getCenter(): LatLng
- // Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the polyline.
- getCenter: function () {
- // throws error when not yet added to map as this center calculation requires projected coordinates
- if (!this._map) {
- throw new Error('Must add layer to map before using getCenter()');
- }
-
- var i, halfDist, segDist, dist, p1, p2, ratio,
- points = this._rings[0],
- len = points.length;
-
- if (!len) { return null; }
-
- // polyline centroid algorithm; only uses the first ring if there are multiple
-
- for (i = 0, halfDist = 0; i < len - 1; i++) {
- halfDist += points[i].distanceTo(points[i + 1]) / 2;
- }
-
- // The line is so small in the current view that all points are on the same pixel.
- if (halfDist === 0) {
- return this._map.layerPointToLatLng(points[0]);
- }
-
- for (i = 0, dist = 0; i < len - 1; i++) {
- p1 = points[i];
- p2 = points[i + 1];
- segDist = p1.distanceTo(p2);
- dist += segDist;
-
- if (dist > halfDist) {
- ratio = (dist - halfDist) / segDist;
- return this._map.layerPointToLatLng([
- p2.x - ratio * (p2.x - p1.x),
- p2.y - ratio * (p2.y - p1.y)
- ]);
- }
- }
- },
-
- // @method getBounds(): LatLngBounds
- // Returns the `LatLngBounds` of the path.
- getBounds: function () {
- return this._bounds;
- },
-
- // @method addLatLng(latlng: LatLng, latlngs?: LatLng[]): this
- // Adds a given point to the polyline. By default, adds to the first ring of
- // the polyline in case of a multi-polyline, but can be overridden by passing
- // a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)).
- addLatLng: function (latlng, latlngs) {
- latlngs = latlngs || this._defaultShape();
- latlng = toLatLng(latlng);
- latlngs.push(latlng);
- this._bounds.extend(latlng);
- return this.redraw();
- },
-
- _setLatLngs: function (latlngs) {
- this._bounds = new LatLngBounds();
- this._latlngs = this._convertLatLngs(latlngs);
- },
-
- _defaultShape: function () {
- return isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];
- },
-
- // recursively convert latlngs input into actual LatLng instances; calculate bounds along the way
- _convertLatLngs: function (latlngs) {
- var result = [],
- flat = isFlat(latlngs);
-
- for (var i = 0, len = latlngs.length; i < len; i++) {
- if (flat) {
- result[i] = toLatLng(latlngs[i]);
- this._bounds.extend(result[i]);
- } else {
- result[i] = this._convertLatLngs(latlngs[i]);
- }
- }
-
- return result;
- },
-
- _project: function () {
- var pxBounds = new Bounds();
- this._rings = [];
- this._projectLatlngs(this._latlngs, this._rings, pxBounds);
-
- if (this._bounds.isValid() && pxBounds.isValid()) {
- this._rawPxBounds = pxBounds;
- this._updateBounds();
- }
- },
-
- _updateBounds: function () {
- var w = this._clickTolerance(),
- p = new Point(w, w);
- this._pxBounds = new Bounds([
- this._rawPxBounds.min.subtract(p),
- this._rawPxBounds.max.add(p)
- ]);
- },
-
- // recursively turns latlngs into a set of rings with projected coordinates
- _projectLatlngs: function (latlngs, result, projectedBounds) {
- var flat = latlngs[0] instanceof LatLng,
- len = latlngs.length,
- i, ring;
-
- if (flat) {
- ring = [];
- for (i = 0; i < len; i++) {
- ring[i] = this._map.latLngToLayerPoint(latlngs[i]);
- projectedBounds.extend(ring[i]);
- }
- result.push(ring);
- } else {
- for (i = 0; i < len; i++) {
- this._projectLatlngs(latlngs[i], result, projectedBounds);
- }
- }
- },
-
- // clip polyline by renderer bounds so that we have less to render for performance
- _clipPoints: function () {
- var bounds = this._renderer._bounds;
-
- this._parts = [];
- if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
- return;
- }
-
- if (this.options.noClip) {
- this._parts = this._rings;
- return;
- }
-
- var parts = this._parts,
- i, j, k, len, len2, segment, points;
-
- for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
- points = this._rings[i];
-
- for (j = 0, len2 = points.length; j < len2 - 1; j++) {
- segment = clipSegment(points[j], points[j + 1], bounds, j, true);
-
- if (!segment) { continue; }
-
- parts[k] = parts[k] || [];
- parts[k].push(segment[0]);
-
- // if segment goes out of screen, or it's the last one, it's the end of the line part
- if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {
- parts[k].push(segment[1]);
- k++;
- }
- }
- }
- },
-
- // simplify each clipped part of the polyline for performance
- _simplifyPoints: function () {
- var parts = this._parts,
- tolerance = this.options.smoothFactor;
-
- for (var i = 0, len = parts.length; i < len; i++) {
- parts[i] = simplify(parts[i], tolerance);
- }
- },
-
- _update: function () {
- if (!this._map) { return; }
-
- this._clipPoints();
- this._simplifyPoints();
- this._updatePath();
- },
-
- _updatePath: function () {
- this._renderer._updatePoly(this);
- },
-
- // Needed by the `Canvas` renderer for interactivity
- _containsPoint: function (p, closed) {
- var i, j, k, len, len2, part,
- w = this._clickTolerance();
-
- if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }
-
- // hit detection for polylines
- for (i = 0, len = this._parts.length; i < len; i++) {
- part = this._parts[i];
-
- for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
- if (!closed && (j === 0)) { continue; }
-
- if (pointToSegmentDistance(p, part[k], part[j]) <= w) {
- return true;
- }
- }
- }
- return false;
- }
- });
-
- // @factory L.polyline(latlngs: LatLng[], options?: Polyline options)
- // Instantiates a polyline object given an array of geographical points and
- // optionally an options object. You can create a `Polyline` object with
- // multiple separate lines (`MultiPolyline`) by passing an array of arrays
- // of geographic points.
- function polyline(latlngs, options) {
- return new Polyline(latlngs, options);
- }
-
- // Retrocompat. Allow plugins to support Leaflet versions before and after 1.1.
- Polyline._flat = _flat;
-
- /*
- * @class Polygon
- * @aka L.Polygon
- * @inherits Polyline
- *
- * A class for drawing polygon overlays on a map. Extends `Polyline`.
- *
- * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.
- *
- *
- * @example
- *
- * ```js
- * // create a red polygon from an array of LatLng points
- * var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
- *
- * var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
- *
- * // zoom the map to the polygon
- * map.fitBounds(polygon.getBounds());
- * ```
- *
- * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:
- *
- * ```js
- * var latlngs = [
- * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
- * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
- * ];
- * ```
- *
- * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.
- *
- * ```js
- * var latlngs = [
- * [ // first polygon
- * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
- * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
- * ],
- * [ // second polygon
- * [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
- * ]
- * ];
- * ```
- */
-
- var Polygon = Polyline.extend({
-
- options: {
- fill: true
- },
-
- isEmpty: function () {
- return !this._latlngs.length || !this._latlngs[0].length;
- },
-
- getCenter: function () {
- // throws error when not yet added to map as this center calculation requires projected coordinates
- if (!this._map) {
- throw new Error('Must add layer to map before using getCenter()');
- }
-
- var i, j, p1, p2, f, area, x, y, center,
- points = this._rings[0],
- len = points.length;
-
- if (!len) { return null; }
-
- // polygon centroid algorithm; only uses the first ring if there are multiple
-
- area = x = y = 0;
-
- for (i = 0, j = len - 1; i < len; j = i++) {
- p1 = points[i];
- p2 = points[j];
-
- f = p1.y * p2.x - p2.y * p1.x;
- x += (p1.x + p2.x) * f;
- y += (p1.y + p2.y) * f;
- area += f * 3;
- }
-
- if (area === 0) {
- // Polygon is so small that all points are on same pixel.
- center = points[0];
- } else {
- center = [x / area, y / area];
- }
- return this._map.layerPointToLatLng(center);
- },
-
- _convertLatLngs: function (latlngs) {
- var result = Polyline.prototype._convertLatLngs.call(this, latlngs),
- len = result.length;
-
- // remove last point if it equals first one
- if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) {
- result.pop();
- }
- return result;
- },
-
- _setLatLngs: function (latlngs) {
- Polyline.prototype._setLatLngs.call(this, latlngs);
- if (isFlat(this._latlngs)) {
- this._latlngs = [this._latlngs];
- }
- },
-
- _defaultShape: function () {
- return isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];
- },
-
- _clipPoints: function () {
- // polygons need a different clipping algorithm so we redefine that
-
- var bounds = this._renderer._bounds,
- w = this.options.weight,
- p = new Point(w, w);
-
- // increase clip padding by stroke width to avoid stroke on clip edges
- bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p));
-
- this._parts = [];
- if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
- return;
- }
-
- if (this.options.noClip) {
- this._parts = this._rings;
- return;
- }
-
- for (var i = 0, len = this._rings.length, clipped; i < len; i++) {
- clipped = clipPolygon(this._rings[i], bounds, true);
- if (clipped.length) {
- this._parts.push(clipped);
- }
- }
- },
-
- _updatePath: function () {
- this._renderer._updatePoly(this, true);
- },
-
- // Needed by the `Canvas` renderer for interactivity
- _containsPoint: function (p) {
- var inside = false,
- part, p1, p2, i, j, k, len, len2;
-
- if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }
-
- // ray casting algorithm for detecting if point is in polygon
- for (i = 0, len = this._parts.length; i < len; i++) {
- part = this._parts[i];
-
- for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
- p1 = part[j];
- p2 = part[k];
-
- if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {
- inside = !inside;
- }
- }
- }
-
- // also check if it's on polygon stroke
- return inside || Polyline.prototype._containsPoint.call(this, p, true);
- }
-
- });
-
-
- // @factory L.polygon(latlngs: LatLng[], options?: Polyline options)
- function polygon(latlngs, options) {
- return new Polygon(latlngs, options);
- }
-
- /*\r
- * @class GeoJSON\r
- * @aka L.GeoJSON\r
- * @inherits FeatureGroup\r
- *\r
- * Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse\r
- * GeoJSON data and display it on the map. Extends `FeatureGroup`.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * L.geoJSON(data, {\r
- * style: function (feature) {\r
- * return {color: feature.properties.color};\r
- * }\r
- * }).bindPopup(function (layer) {\r
- * return layer.feature.properties.description;\r
- * }).addTo(map);\r
- * ```\r
- */\r
-\r
- var GeoJSON = FeatureGroup.extend({\r
-\r
- /* @section\r
- * @aka GeoJSON options\r
- *\r
- * @option pointToLayer: Function = *\r
- * A `Function` defining how GeoJSON points spawn Leaflet layers. It is internally\r
- * called when data is added, passing the GeoJSON point feature and its `LatLng`.\r
- * The default is to spawn a default `Marker`:\r
- * ```js\r
- * function(geoJsonPoint, latlng) {\r
- * return L.marker(latlng);\r
- * }\r
- * ```\r
- *\r
- * @option style: Function = *\r
- * A `Function` defining the `Path options` for styling GeoJSON lines and polygons,\r
- * called internally when data is added.\r
- * The default value is to not override any defaults:\r
- * ```js\r
- * function (geoJsonFeature) {\r
- * return {}\r
- * }\r
- * ```\r
- *\r
- * @option onEachFeature: Function = *\r
- * A `Function` that will be called once for each created `Feature`, after it has\r
- * been created and styled. Useful for attaching events and popups to features.\r
- * The default is to do nothing with the newly created layers:\r
- * ```js\r
- * function (feature, layer) {}\r
- * ```\r
- *\r
- * @option filter: Function = *\r
- * A `Function` that will be used to decide whether to include a feature or not.\r
- * The default is to include all features:\r
- * ```js\r
- * function (geoJsonFeature) {\r
- * return true;\r
- * }\r
- * ```\r
- * Note: dynamically changing the `filter` option will have effect only on newly\r
- * added data. It will _not_ re-evaluate already included features.\r
- *\r
- * @option coordsToLatLng: Function = *\r
- * A `Function` that will be used for converting GeoJSON coordinates to `LatLng`s.\r
- * The default is the `coordsToLatLng` static method.\r
- *\r
- * @option markersInheritOptions: Boolean = false\r
- * Whether default Markers for "Point" type Features inherit from group options.\r
- */\r
-\r
- initialize: function (geojson, options) {\r
- setOptions(this, options);\r
-\r
- this._layers = {};\r
-\r
- if (geojson) {\r
- this.addData(geojson);\r
- }\r
- },\r
-\r
- // @method addData( <GeoJSON> data ): this\r
- // Adds a GeoJSON object to the layer.\r
- addData: function (geojson) {\r
- var features = isArray(geojson) ? geojson : geojson.features,\r
- i, len, feature;\r
-\r
- if (features) {\r
- for (i = 0, len = features.length; i < len; i++) {\r
- // only add this if geometry or geometries are set and not null\r
- feature = features[i];\r
- if (feature.geometries || feature.geometry || feature.features || feature.coordinates) {\r
- this.addData(feature);\r
- }\r
- }\r
- return this;\r
- }\r
-\r
- var options = this.options;\r
-\r
- if (options.filter && !options.filter(geojson)) { return this; }\r
-\r
- var layer = geometryToLayer(geojson, options);\r
- if (!layer) {\r
- return this;\r
- }\r
- layer.feature = asFeature(geojson);\r
-\r
- layer.defaultOptions = layer.options;\r
- this.resetStyle(layer);\r
-\r
- if (options.onEachFeature) {\r
- options.onEachFeature(geojson, layer);\r
- }\r
-\r
- return this.addLayer(layer);\r
- },\r
-\r
- // @method resetStyle( <Path> layer? ): this\r
- // Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.\r
- // If `layer` is omitted, the style of all features in the current layer is reset.\r
- resetStyle: function (layer) {\r
- if (layer === undefined) {\r
- return this.eachLayer(this.resetStyle, this);\r
- }\r
- // reset any custom styles\r
- layer.options = extend({}, layer.defaultOptions);\r
- this._setLayerStyle(layer, this.options.style);\r
- return this;\r
- },\r
-\r
- // @method setStyle( <Function> style ): this\r
- // Changes styles of GeoJSON vector layers with the given style function.\r
- setStyle: function (style) {\r
- return this.eachLayer(function (layer) {\r
- this._setLayerStyle(layer, style);\r
- }, this);\r
- },\r
-\r
- _setLayerStyle: function (layer, style) {\r
- if (layer.setStyle) {\r
- if (typeof style === 'function') {\r
- style = style(layer.feature);\r
- }\r
- layer.setStyle(style);\r
- }\r
- }\r
- });\r
-\r
- // @section\r
- // There are several static functions which can be called without instantiating L.GeoJSON:\r
-\r
- // @function geometryToLayer(featureData: Object, options?: GeoJSON options): Layer\r
- // Creates a `Layer` from a given GeoJSON feature. Can use a custom\r
- // [`pointToLayer`](#geojson-pointtolayer) and/or [`coordsToLatLng`](#geojson-coordstolatlng)\r
- // functions if provided as options.\r
- function geometryToLayer(geojson, options) {\r
-\r
- var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson,\r
- coords = geometry ? geometry.coordinates : null,\r
- layers = [],\r
- pointToLayer = options && options.pointToLayer,\r
- _coordsToLatLng = options && options.coordsToLatLng || coordsToLatLng,\r
- latlng, latlngs, i, len;\r
-\r
- if (!coords && !geometry) {\r
- return null;\r
- }\r
-\r
- switch (geometry.type) {\r
- case 'Point':\r
- latlng = _coordsToLatLng(coords);\r
- return _pointToLayer(pointToLayer, geojson, latlng, options);\r
-\r
- case 'MultiPoint':\r
- for (i = 0, len = coords.length; i < len; i++) {\r
- latlng = _coordsToLatLng(coords[i]);\r
- layers.push(_pointToLayer(pointToLayer, geojson, latlng, options));\r
- }\r
- return new FeatureGroup(layers);\r
-\r
- case 'LineString':\r
- case 'MultiLineString':\r
- latlngs = coordsToLatLngs(coords, geometry.type === 'LineString' ? 0 : 1, _coordsToLatLng);\r
- return new Polyline(latlngs, options);\r
-\r
- case 'Polygon':\r
- case 'MultiPolygon':\r
- latlngs = coordsToLatLngs(coords, geometry.type === 'Polygon' ? 1 : 2, _coordsToLatLng);\r
- return new Polygon(latlngs, options);\r
-\r
- case 'GeometryCollection':\r
- for (i = 0, len = geometry.geometries.length; i < len; i++) {\r
- var layer = geometryToLayer({\r
- geometry: geometry.geometries[i],\r
- type: 'Feature',\r
- properties: geojson.properties\r
- }, options);\r
-\r
- if (layer) {\r
- layers.push(layer);\r
- }\r
- }\r
- return new FeatureGroup(layers);\r
-\r
- default:\r
- throw new Error('Invalid GeoJSON object.');\r
- }\r
- }\r
-\r
- function _pointToLayer(pointToLayerFn, geojson, latlng, options) {\r
- return pointToLayerFn ?\r
- pointToLayerFn(geojson, latlng) :\r
- new Marker(latlng, options && options.markersInheritOptions && options);\r
- }\r
-\r
- // @function coordsToLatLng(coords: Array): LatLng\r
- // Creates a `LatLng` object from an array of 2 numbers (longitude, latitude)\r
- // or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.\r
- function coordsToLatLng(coords) {\r
- return new LatLng(coords[1], coords[0], coords[2]);\r
- }\r
-\r
- // @function coordsToLatLngs(coords: Array, levelsDeep?: Number, coordsToLatLng?: Function): Array\r
- // Creates a multidimensional array of `LatLng`s from a GeoJSON coordinates array.\r
- // `levelsDeep` specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).\r
- // Can use a custom [`coordsToLatLng`](#geojson-coordstolatlng) function.\r
- function coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) {\r
- var latlngs = [];\r
-\r
- for (var i = 0, len = coords.length, latlng; i < len; i++) {\r
- latlng = levelsDeep ?\r
- coordsToLatLngs(coords[i], levelsDeep - 1, _coordsToLatLng) :\r
- (_coordsToLatLng || coordsToLatLng)(coords[i]);\r
-\r
- latlngs.push(latlng);\r
- }\r
-\r
- return latlngs;\r
- }\r
-\r
- // @function latLngToCoords(latlng: LatLng, precision?: Number): Array\r
- // Reverse of [`coordsToLatLng`](#geojson-coordstolatlng)\r
- function latLngToCoords(latlng, precision) {\r
- precision = typeof precision === 'number' ? precision : 6;\r
- return latlng.alt !== undefined ?\r
- [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision), formatNum(latlng.alt, precision)] :\r
- [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision)];\r
- }\r
-\r
- // @function latLngsToCoords(latlngs: Array, levelsDeep?: Number, closed?: Boolean): Array\r
- // Reverse of [`coordsToLatLngs`](#geojson-coordstolatlngs)\r
- // `closed` determines whether the first point should be appended to the end of the array to close the feature, only used when `levelsDeep` is 0. False by default.\r
- function latLngsToCoords(latlngs, levelsDeep, closed, precision) {\r
- var coords = [];\r
-\r
- for (var i = 0, len = latlngs.length; i < len; i++) {\r
- coords.push(levelsDeep ?\r
- latLngsToCoords(latlngs[i], levelsDeep - 1, closed, precision) :\r
- latLngToCoords(latlngs[i], precision));\r
- }\r
-\r
- if (!levelsDeep && closed) {\r
- coords.push(coords[0]);\r
- }\r
-\r
- return coords;\r
- }\r
-\r
- function getFeature(layer, newGeometry) {\r
- return layer.feature ?\r
- extend({}, layer.feature, {geometry: newGeometry}) :\r
- asFeature(newGeometry);\r
- }\r
-\r
- // @function asFeature(geojson: Object): Object\r
- // Normalize GeoJSON geometries/features into GeoJSON features.\r
- function asFeature(geojson) {\r
- if (geojson.type === 'Feature' || geojson.type === 'FeatureCollection') {\r
- return geojson;\r
- }\r
-\r
- return {\r
- type: 'Feature',\r
- properties: {},\r
- geometry: geojson\r
- };\r
- }\r
-\r
- var PointToGeoJSON = {\r
- toGeoJSON: function (precision) {\r
- return getFeature(this, {\r
- type: 'Point',\r
- coordinates: latLngToCoords(this.getLatLng(), precision)\r
- });\r
- }\r
- };\r
-\r
- // @namespace Marker\r
- // @section Other methods\r
- // @method toGeoJSON(precision?: Number): Object\r
- // `precision` is the number of decimal places for coordinates.\r
- // The default value is 6 places.\r
- // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the marker (as a GeoJSON `Point` Feature).\r
- Marker.include(PointToGeoJSON);\r
-\r
- // @namespace CircleMarker\r
- // @method toGeoJSON(precision?: Number): Object\r
- // `precision` is the number of decimal places for coordinates.\r
- // The default value is 6 places.\r
- // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the circle marker (as a GeoJSON `Point` Feature).\r
- Circle.include(PointToGeoJSON);\r
- CircleMarker.include(PointToGeoJSON);\r
-\r
-\r
- // @namespace Polyline\r
- // @method toGeoJSON(precision?: Number): Object\r
- // `precision` is the number of decimal places for coordinates.\r
- // The default value is 6 places.\r
- // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polyline (as a GeoJSON `LineString` or `MultiLineString` Feature).\r
- Polyline.include({\r
- toGeoJSON: function (precision) {\r
- var multi = !isFlat(this._latlngs);\r
-\r
- var coords = latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision);\r
-\r
- return getFeature(this, {\r
- type: (multi ? 'Multi' : '') + 'LineString',\r
- coordinates: coords\r
- });\r
- }\r
- });\r
-\r
- // @namespace Polygon\r
- // @method toGeoJSON(precision?: Number): Object\r
- // `precision` is the number of decimal places for coordinates.\r
- // The default value is 6 places.\r
- // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polygon (as a GeoJSON `Polygon` or `MultiPolygon` Feature).\r
- Polygon.include({\r
- toGeoJSON: function (precision) {\r
- var holes = !isFlat(this._latlngs),\r
- multi = holes && !isFlat(this._latlngs[0]);\r
-\r
- var coords = latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision);\r
-\r
- if (!holes) {\r
- coords = [coords];\r
- }\r
-\r
- return getFeature(this, {\r
- type: (multi ? 'Multi' : '') + 'Polygon',\r
- coordinates: coords\r
- });\r
- }\r
- });\r
-\r
-\r
- // @namespace LayerGroup\r
- LayerGroup.include({\r
- toMultiPoint: function (precision) {\r
- var coords = [];\r
-\r
- this.eachLayer(function (layer) {\r
- coords.push(layer.toGeoJSON(precision).geometry.coordinates);\r
- });\r
-\r
- return getFeature(this, {\r
- type: 'MultiPoint',\r
- coordinates: coords\r
- });\r
- },\r
-\r
- // @method toGeoJSON(precision?: Number): Object\r
- // `precision` is the number of decimal places for coordinates.\r
- // The default value is 6 places.\r
- // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the layer group (as a GeoJSON `FeatureCollection`, `GeometryCollection`, or `MultiPoint`).\r
- toGeoJSON: function (precision) {\r
-\r
- var type = this.feature && this.feature.geometry && this.feature.geometry.type;\r
-\r
- if (type === 'MultiPoint') {\r
- return this.toMultiPoint(precision);\r
- }\r
-\r
- var isGeometryCollection = type === 'GeometryCollection',\r
- jsons = [];\r
-\r
- this.eachLayer(function (layer) {\r
- if (layer.toGeoJSON) {\r
- var json = layer.toGeoJSON(precision);\r
- if (isGeometryCollection) {\r
- jsons.push(json.geometry);\r
- } else {\r
- var feature = asFeature(json);\r
- // Squash nested feature collections\r
- if (feature.type === 'FeatureCollection') {\r
- jsons.push.apply(jsons, feature.features);\r
- } else {\r
- jsons.push(feature);\r
- }\r
- }\r
- }\r
- });\r
-\r
- if (isGeometryCollection) {\r
- return getFeature(this, {\r
- geometries: jsons,\r
- type: 'GeometryCollection'\r
- });\r
- }\r
-\r
- return {\r
- type: 'FeatureCollection',\r
- features: jsons\r
- };\r
- }\r
- });\r
-\r
- // @namespace GeoJSON\r
- // @factory L.geoJSON(geojson?: Object, options?: GeoJSON options)\r
- // Creates a GeoJSON layer. Optionally accepts an object in\r
- // [GeoJSON format](https://tools.ietf.org/html/rfc7946) to display on the map\r
- // (you can alternatively add it later with `addData` method) and an `options` object.\r
- function geoJSON(geojson, options) {\r
- return new GeoJSON(geojson, options);\r
- }\r
-\r
- // Backward compatibility.\r
- var geoJson = geoJSON;
-
- /*\r
- * @class ImageOverlay\r
- * @aka L.ImageOverlay\r
- * @inherits Interactive layer\r
- *\r
- * Used to load and display a single image over specific bounds of the map. Extends `Layer`.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',\r
- * imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];\r
- * L.imageOverlay(imageUrl, imageBounds).addTo(map);\r
- * ```\r
- */\r
-\r
- var ImageOverlay = Layer.extend({\r
-\r
- // @section\r
- // @aka ImageOverlay options\r
- options: {\r
- // @option opacity: Number = 1.0\r
- // The opacity of the image overlay.\r
- opacity: 1,\r
-\r
- // @option alt: String = ''\r
- // Text for the `alt` attribute of the image (useful for accessibility).\r
- alt: '',\r
-\r
- // @option interactive: Boolean = false\r
- // If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered.\r
- interactive: false,\r
-\r
- // @option crossOrigin: Boolean|String = false\r
- // Whether the crossOrigin attribute will be added to the image.\r
- // If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.\r
- // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.\r
- crossOrigin: false,\r
-\r
- // @option errorOverlayUrl: String = ''\r
- // URL to the overlay image to show in place of the overlay that failed to load.\r
- errorOverlayUrl: '',\r
-\r
- // @option zIndex: Number = 1\r
- // The explicit [zIndex](https://developer.mozilla.org/docs/Web/CSS/CSS_Positioning/Understanding_z_index) of the overlay layer.\r
- zIndex: 1,\r
-\r
- // @option className: String = ''\r
- // A custom class name to assign to the image. Empty by default.\r
- className: ''\r
- },\r
-\r
- initialize: function (url, bounds, options) { // (String, LatLngBounds, Object)\r
- this._url = url;\r
- this._bounds = toLatLngBounds(bounds);\r
-\r
- setOptions(this, options);\r
- },\r
-\r
- onAdd: function () {\r
- if (!this._image) {\r
- this._initImage();\r
-\r
- if (this.options.opacity < 1) {\r
- this._updateOpacity();\r
- }\r
- }\r
-\r
- if (this.options.interactive) {\r
- addClass(this._image, 'leaflet-interactive');\r
- this.addInteractiveTarget(this._image);\r
- }\r
-\r
- this.getPane().appendChild(this._image);\r
- this._reset();\r
- },\r
-\r
- onRemove: function () {\r
- remove(this._image);\r
- if (this.options.interactive) {\r
- this.removeInteractiveTarget(this._image);\r
- }\r
- },\r
-\r
- // @method setOpacity(opacity: Number): this\r
- // Sets the opacity of the overlay.\r
- setOpacity: function (opacity) {\r
- this.options.opacity = opacity;\r
-\r
- if (this._image) {\r
- this._updateOpacity();\r
- }\r
- return this;\r
- },\r
-\r
- setStyle: function (styleOpts) {\r
- if (styleOpts.opacity) {\r
- this.setOpacity(styleOpts.opacity);\r
- }\r
- return this;\r
- },\r
-\r
- // @method bringToFront(): this\r
- // Brings the layer to the top of all overlays.\r
- bringToFront: function () {\r
- if (this._map) {\r
- toFront(this._image);\r
- }\r
- return this;\r
- },\r
-\r
- // @method bringToBack(): this\r
- // Brings the layer to the bottom of all overlays.\r
- bringToBack: function () {\r
- if (this._map) {\r
- toBack(this._image);\r
- }\r
- return this;\r
- },\r
-\r
- // @method setUrl(url: String): this\r
- // Changes the URL of the image.\r
- setUrl: function (url) {\r
- this._url = url;\r
-\r
- if (this._image) {\r
- this._image.src = url;\r
- }\r
- return this;\r
- },\r
-\r
- // @method setBounds(bounds: LatLngBounds): this\r
- // Update the bounds that this ImageOverlay covers\r
- setBounds: function (bounds) {\r
- this._bounds = toLatLngBounds(bounds);\r
-\r
- if (this._map) {\r
- this._reset();\r
- }\r
- return this;\r
- },\r
-\r
- getEvents: function () {\r
- var events = {\r
- zoom: this._reset,\r
- viewreset: this._reset\r
- };\r
-\r
- if (this._zoomAnimated) {\r
- events.zoomanim = this._animateZoom;\r
- }\r
-\r
- return events;\r
- },\r
-\r
- // @method setZIndex(value: Number): this\r
- // Changes the [zIndex](#imageoverlay-zindex) of the image overlay.\r
- setZIndex: function (value) {\r
- this.options.zIndex = value;\r
- this._updateZIndex();\r
- return this;\r
- },\r
-\r
- // @method getBounds(): LatLngBounds\r
- // Get the bounds that this ImageOverlay covers\r
- getBounds: function () {\r
- return this._bounds;\r
- },\r
-\r
- // @method getElement(): HTMLElement\r
- // Returns the instance of [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement)\r
- // used by this overlay.\r
- getElement: function () {\r
- return this._image;\r
- },\r
-\r
- _initImage: function () {\r
- var wasElementSupplied = this._url.tagName === 'IMG';\r
- var img = this._image = wasElementSupplied ? this._url : create$1('img');\r
-\r
- addClass(img, 'leaflet-image-layer');\r
- if (this._zoomAnimated) { addClass(img, 'leaflet-zoom-animated'); }\r
- if (this.options.className) { addClass(img, this.options.className); }\r
-\r
- img.onselectstart = falseFn;\r
- img.onmousemove = falseFn;\r
-\r
- // @event load: Event\r
- // Fired when the ImageOverlay layer has loaded its image\r
- img.onload = bind(this.fire, this, 'load');\r
- img.onerror = bind(this._overlayOnError, this, 'error');\r
-\r
- if (this.options.crossOrigin || this.options.crossOrigin === '') {\r
- img.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin;\r
- }\r
-\r
- if (this.options.zIndex) {\r
- this._updateZIndex();\r
- }\r
-\r
- if (wasElementSupplied) {\r
- this._url = img.src;\r
- return;\r
- }\r
-\r
- img.src = this._url;\r
- img.alt = this.options.alt;\r
- },\r
-\r
- _animateZoom: function (e) {\r
- var scale = this._map.getZoomScale(e.zoom),\r
- offset = this._map._latLngBoundsToNewLayerBounds(this._bounds, e.zoom, e.center).min;\r
-\r
- setTransform(this._image, offset, scale);\r
- },\r
-\r
- _reset: function () {\r
- var image = this._image,\r
- bounds = new Bounds(\r
- this._map.latLngToLayerPoint(this._bounds.getNorthWest()),\r
- this._map.latLngToLayerPoint(this._bounds.getSouthEast())),\r
- size = bounds.getSize();\r
-\r
- setPosition(image, bounds.min);\r
-\r
- image.style.width = size.x + 'px';\r
- image.style.height = size.y + 'px';\r
- },\r
-\r
- _updateOpacity: function () {\r
- setOpacity(this._image, this.options.opacity);\r
- },\r
-\r
- _updateZIndex: function () {\r
- if (this._image && this.options.zIndex !== undefined && this.options.zIndex !== null) {\r
- this._image.style.zIndex = this.options.zIndex;\r
- }\r
- },\r
-\r
- _overlayOnError: function () {\r
- // @event error: Event\r
- // Fired when the ImageOverlay layer fails to load its image\r
- this.fire('error');\r
-\r
- var errorUrl = this.options.errorOverlayUrl;\r
- if (errorUrl && this._url !== errorUrl) {\r
- this._url = errorUrl;\r
- this._image.src = errorUrl;\r
- }\r
- }\r
- });\r
-\r
- // @factory L.imageOverlay(imageUrl: String, bounds: LatLngBounds, options?: ImageOverlay options)\r
- // Instantiates an image overlay object given the URL of the image and the\r
- // geographical bounds it is tied to.\r
- var imageOverlay = function (url, bounds, options) {\r
- return new ImageOverlay(url, bounds, options);\r
- };
-
- /*\r
- * @class VideoOverlay\r
- * @aka L.VideoOverlay\r
- * @inherits ImageOverlay\r
- *\r
- * Used to load and display a video player over specific bounds of the map. Extends `ImageOverlay`.\r
- *\r
- * A video overlay uses the [`<video>`](https://developer.mozilla.org/docs/Web/HTML/Element/video)\r
- * HTML5 element.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm',\r
- * videoBounds = [[ 32, -130], [ 13, -100]];\r
- * L.videoOverlay(videoUrl, videoBounds ).addTo(map);\r
- * ```\r
- */\r
-\r
- var VideoOverlay = ImageOverlay.extend({\r
-\r
- // @section\r
- // @aka VideoOverlay options\r
- options: {\r
- // @option autoplay: Boolean = true\r
- // Whether the video starts playing automatically when loaded.\r
- autoplay: true,\r
-\r
- // @option loop: Boolean = true\r
- // Whether the video will loop back to the beginning when played.\r
- loop: true,\r
-\r
- // @option keepAspectRatio: Boolean = true\r
- // Whether the video will save aspect ratio after the projection.\r
- // Relevant for supported browsers. Browser compatibility- https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit\r
- keepAspectRatio: true,\r
-\r
- // @option muted: Boolean = false\r
- // Whether the video starts on mute when loaded.\r
- muted: false\r
- },\r
-\r
- _initImage: function () {\r
- var wasElementSupplied = this._url.tagName === 'VIDEO';\r
- var vid = this._image = wasElementSupplied ? this._url : create$1('video');\r
-\r
- addClass(vid, 'leaflet-image-layer');\r
- if (this._zoomAnimated) { addClass(vid, 'leaflet-zoom-animated'); }\r
- if (this.options.className) { addClass(vid, this.options.className); }\r
-\r
- vid.onselectstart = falseFn;\r
- vid.onmousemove = falseFn;\r
-\r
- // @event load: Event\r
- // Fired when the video has finished loading the first frame\r
- vid.onloadeddata = bind(this.fire, this, 'load');\r
-\r
- if (wasElementSupplied) {\r
- var sourceElements = vid.getElementsByTagName('source');\r
- var sources = [];\r
- for (var j = 0; j < sourceElements.length; j++) {\r
- sources.push(sourceElements[j].src);\r
- }\r
-\r
- this._url = (sourceElements.length > 0) ? sources : [vid.src];\r
- return;\r
- }\r
-\r
- if (!isArray(this._url)) { this._url = [this._url]; }\r
-\r
- if (!this.options.keepAspectRatio && Object.prototype.hasOwnProperty.call(vid.style, 'objectFit')) {\r
- vid.style['objectFit'] = 'fill';\r
- }\r
- vid.autoplay = !!this.options.autoplay;\r
- vid.loop = !!this.options.loop;\r
- vid.muted = !!this.options.muted;\r
- for (var i = 0; i < this._url.length; i++) {\r
- var source = create$1('source');\r
- source.src = this._url[i];\r
- vid.appendChild(source);\r
- }\r
- }\r
-\r
- // @method getElement(): HTMLVideoElement\r
- // Returns the instance of [`HTMLVideoElement`](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement)\r
- // used by this overlay.\r
- });\r
-\r
-\r
- // @factory L.videoOverlay(video: String|Array|HTMLVideoElement, bounds: LatLngBounds, options?: VideoOverlay options)\r
- // Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the\r
- // geographical bounds it is tied to.\r
-\r
- function videoOverlay(video, bounds, options) {\r
- return new VideoOverlay(video, bounds, options);\r
- }
-
- /*
- * @class SVGOverlay
- * @aka L.SVGOverlay
- * @inherits ImageOverlay
- *
- * Used to load, display and provide DOM access to an SVG file over specific bounds of the map. Extends `ImageOverlay`.
- *
- * An SVG overlay uses the [`<svg>`](https://developer.mozilla.org/docs/Web/SVG/Element/svg) element.
- *
- * @example
- *
- * ```js
- * var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
- * svgElement.setAttribute('xmlns', "http://www.w3.org/2000/svg");
- * svgElement.setAttribute('viewBox', "0 0 200 200");
- * svgElement.innerHTML = '<rect width="200" height="200"/><rect x="75" y="23" width="50" height="50" style="fill:red"/><rect x="75" y="123" width="50" height="50" style="fill:#0013ff"/>';
- * var svgElementBounds = [ [ 32, -130 ], [ 13, -100 ] ];
- * L.svgOverlay(svgElement, svgElementBounds).addTo(map);
- * ```
- */
-
- var SVGOverlay = ImageOverlay.extend({
- _initImage: function () {
- var el = this._image = this._url;
-
- addClass(el, 'leaflet-image-layer');
- if (this._zoomAnimated) { addClass(el, 'leaflet-zoom-animated'); }
- if (this.options.className) { addClass(el, this.options.className); }
-
- el.onselectstart = falseFn;
- el.onmousemove = falseFn;
- }
-
- // @method getElement(): SVGElement
- // Returns the instance of [`SVGElement`](https://developer.mozilla.org/docs/Web/API/SVGElement)
- // used by this overlay.
- });
-
-
- // @factory L.svgOverlay(svg: String|SVGElement, bounds: LatLngBounds, options?: SVGOverlay options)
- // Instantiates an image overlay object given an SVG element and the geographical bounds it is tied to.
- // A viewBox attribute is required on the SVG element to zoom in and out properly.
-
- function svgOverlay(el, bounds, options) {
- return new SVGOverlay(el, bounds, options);
- }
-
- /*\r
- * @class DivOverlay\r
- * @inherits Layer\r
- * @aka L.DivOverlay\r
- * Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins.\r
- */\r
-\r
- // @namespace DivOverlay\r
- var DivOverlay = Layer.extend({\r
-\r
- // @section\r
- // @aka DivOverlay options\r
- options: {\r
- // @option offset: Point = Point(0, 7)\r
- // The offset of the popup position. Useful to control the anchor\r
- // of the popup when opening it on some overlays.\r
- offset: [0, 7],\r
-\r
- // @option className: String = ''\r
- // A custom CSS class name to assign to the popup.\r
- className: '',\r
-\r
- // @option pane: String = 'popupPane'\r
- // `Map pane` where the popup will be added.\r
- pane: 'popupPane'\r
- },\r
-\r
- initialize: function (options, source) {\r
- setOptions(this, options);\r
-\r
- this._source = source;\r
- },\r
-\r
- onAdd: function (map) {\r
- this._zoomAnimated = map._zoomAnimated;\r
-\r
- if (!this._container) {\r
- this._initLayout();\r
- }\r
-\r
- if (map._fadeAnimated) {\r
- setOpacity(this._container, 0);\r
- }\r
-\r
- clearTimeout(this._removeTimeout);\r
- this.getPane().appendChild(this._container);\r
- this.update();\r
-\r
- if (map._fadeAnimated) {\r
- setOpacity(this._container, 1);\r
- }\r
-\r
- this.bringToFront();\r
- },\r
-\r
- onRemove: function (map) {\r
- if (map._fadeAnimated) {\r
- setOpacity(this._container, 0);\r
- this._removeTimeout = setTimeout(bind(remove, undefined, this._container), 200);\r
- } else {\r
- remove(this._container);\r
- }\r
- },\r
-\r
- // @namespace Popup\r
- // @method getLatLng: LatLng\r
- // Returns the geographical point of popup.\r
- getLatLng: function () {\r
- return this._latlng;\r
- },\r
-\r
- // @method setLatLng(latlng: LatLng): this\r
- // Sets the geographical point where the popup will open.\r
- setLatLng: function (latlng) {\r
- this._latlng = toLatLng(latlng);\r
- if (this._map) {\r
- this._updatePosition();\r
- this._adjustPan();\r
- }\r
- return this;\r
- },\r
-\r
- // @method getContent: String|HTMLElement\r
- // Returns the content of the popup.\r
- getContent: function () {\r
- return this._content;\r
- },\r
-\r
- // @method setContent(htmlContent: String|HTMLElement|Function): this\r
- // Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a `String` or `HTMLElement` to be used in the popup.\r
- setContent: function (content) {\r
- this._content = content;\r
- this.update();\r
- return this;\r
- },\r
-\r
- // @method getElement: String|HTMLElement\r
- // Returns the HTML container of the popup.\r
- getElement: function () {\r
- return this._container;\r
- },\r
-\r
- // @method update: null\r
- // Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.\r
- update: function () {\r
- if (!this._map) { return; }\r
-\r
- this._container.style.visibility = 'hidden';\r
-\r
- this._updateContent();\r
- this._updateLayout();\r
- this._updatePosition();\r
-\r
- this._container.style.visibility = '';\r
-\r
- this._adjustPan();\r
- },\r
-\r
- getEvents: function () {\r
- var events = {\r
- zoom: this._updatePosition,\r
- viewreset: this._updatePosition\r
- };\r
-\r
- if (this._zoomAnimated) {\r
- events.zoomanim = this._animateZoom;\r
- }\r
- return events;\r
- },\r
-\r
- // @method isOpen: Boolean\r
- // Returns `true` when the popup is visible on the map.\r
- isOpen: function () {\r
- return !!this._map && this._map.hasLayer(this);\r
- },\r
-\r
- // @method bringToFront: this\r
- // Brings this popup in front of other popups (in the same map pane).\r
- bringToFront: function () {\r
- if (this._map) {\r
- toFront(this._container);\r
- }\r
- return this;\r
- },\r
-\r
- // @method bringToBack: this\r
- // Brings this popup to the back of other popups (in the same map pane).\r
- bringToBack: function () {\r
- if (this._map) {\r
- toBack(this._container);\r
- }\r
- return this;\r
- },\r
-\r
- _prepareOpen: function (parent, layer, latlng) {\r
- if (!(layer instanceof Layer)) {\r
- latlng = layer;\r
- layer = parent;\r
- }\r
-\r
- if (layer instanceof FeatureGroup) {\r
- for (var id in parent._layers) {\r
- layer = parent._layers[id];\r
- break;\r
- }\r
- }\r
-\r
- if (!latlng) {\r
- if (layer.getCenter) {\r
- latlng = layer.getCenter();\r
- } else if (layer.getLatLng) {\r
- latlng = layer.getLatLng();\r
- } else {\r
- throw new Error('Unable to get source layer LatLng.');\r
- }\r
- }\r
-\r
- // set overlay source to this layer\r
- this._source = layer;\r
-\r
- // update the overlay (content, layout, ect...)\r
- this.update();\r
-\r
- return latlng;\r
- },\r
-\r
- _updateContent: function () {\r
- if (!this._content) { return; }\r
-\r
- var node = this._contentNode;\r
- var content = (typeof this._content === 'function') ? this._content(this._source || this) : this._content;\r
-\r
- if (typeof content === 'string') {\r
- node.innerHTML = content;\r
- } else {\r
- while (node.hasChildNodes()) {\r
- node.removeChild(node.firstChild);\r
- }\r
- node.appendChild(content);\r
- }\r
- this.fire('contentupdate');\r
- },\r
-\r
- _updatePosition: function () {\r
- if (!this._map) { return; }\r
-\r
- var pos = this._map.latLngToLayerPoint(this._latlng),\r
- offset = toPoint(this.options.offset),\r
- anchor = this._getAnchor();\r
-\r
- if (this._zoomAnimated) {\r
- setPosition(this._container, pos.add(anchor));\r
- } else {\r
- offset = offset.add(pos).add(anchor);\r
- }\r
-\r
- var bottom = this._containerBottom = -offset.y,\r
- left = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x;\r
-\r
- // bottom position the popup in case the height of the popup changes (images loading etc)\r
- this._container.style.bottom = bottom + 'px';\r
- this._container.style.left = left + 'px';\r
- },\r
-\r
- _getAnchor: function () {\r
- return [0, 0];\r
- }\r
-\r
- });
-
- /*\r
- * @class Popup\r
- * @inherits DivOverlay\r
- * @aka L.Popup\r
- * Used to open popups in certain places of the map. Use [Map.openPopup](#map-openpopup) to\r
- * open popups while making sure that only one popup is open at one time\r
- * (recommended for usability), or use [Map.addLayer](#map-addlayer) to open as many as you want.\r
- *\r
- * @example\r
- *\r
- * If you want to just bind a popup to marker click and then open it, it's really easy:\r
- *\r
- * ```js\r
- * marker.bindPopup(popupContent).openPopup();\r
- * ```\r
- * Path overlays like polylines also have a `bindPopup` method.\r
- * Here's a more complicated way to open a popup on a map:\r
- *\r
- * ```js\r
- * var popup = L.popup()\r
- * .setLatLng(latlng)\r
- * .setContent('<p>Hello world!<br />This is a nice popup.</p>')\r
- * .openOn(map);\r
- * ```\r
- */\r
-\r
-\r
- // @namespace Popup\r
- var Popup = DivOverlay.extend({\r
-\r
- // @section\r
- // @aka Popup options\r
- options: {\r
- // @option maxWidth: Number = 300\r
- // Max width of the popup, in pixels.\r
- maxWidth: 300,\r
-\r
- // @option minWidth: Number = 50\r
- // Min width of the popup, in pixels.\r
- minWidth: 50,\r
-\r
- // @option maxHeight: Number = null\r
- // If set, creates a scrollable container of the given height\r
- // inside a popup if its content exceeds it.\r
- maxHeight: null,\r
-\r
- // @option autoPan: Boolean = true\r
- // Set it to `false` if you don't want the map to do panning animation\r
- // to fit the opened popup.\r
- autoPan: true,\r
-\r
- // @option autoPanPaddingTopLeft: Point = null\r
- // The margin between the popup and the top left corner of the map\r
- // view after autopanning was performed.\r
- autoPanPaddingTopLeft: null,\r
-\r
- // @option autoPanPaddingBottomRight: Point = null\r
- // The margin between the popup and the bottom right corner of the map\r
- // view after autopanning was performed.\r
- autoPanPaddingBottomRight: null,\r
-\r
- // @option autoPanPadding: Point = Point(5, 5)\r
- // Equivalent of setting both top left and bottom right autopan padding to the same value.\r
- autoPanPadding: [5, 5],\r
-\r
- // @option keepInView: Boolean = false\r
- // Set it to `true` if you want to prevent users from panning the popup\r
- // off of the screen while it is open.\r
- keepInView: false,\r
-\r
- // @option closeButton: Boolean = true\r
- // Controls the presence of a close button in the popup.\r
- closeButton: true,\r
-\r
- // @option autoClose: Boolean = true\r
- // Set it to `false` if you want to override the default behavior of\r
- // the popup closing when another popup is opened.\r
- autoClose: true,\r
-\r
- // @option closeOnEscapeKey: Boolean = true\r
- // Set it to `false` if you want to override the default behavior of\r
- // the ESC key for closing of the popup.\r
- closeOnEscapeKey: true,\r
-\r
- // @option closeOnClick: Boolean = *\r
- // Set it if you want to override the default behavior of the popup closing when user clicks\r
- // on the map. Defaults to the map's [`closePopupOnClick`](#map-closepopuponclick) option.\r
-\r
- // @option className: String = ''\r
- // A custom CSS class name to assign to the popup.\r
- className: ''\r
- },\r
-\r
- // @namespace Popup\r
- // @method openOn(map: Map): this\r
- // Adds the popup to the map and closes the previous one. The same as `map.openPopup(popup)`.\r
- openOn: function (map) {\r
- map.openPopup(this);\r
- return this;\r
- },\r
-\r
- onAdd: function (map) {\r
- DivOverlay.prototype.onAdd.call(this, map);\r
-\r
- // @namespace Map\r
- // @section Popup events\r
- // @event popupopen: PopupEvent\r
- // Fired when a popup is opened in the map\r
- map.fire('popupopen', {popup: this});\r
-\r
- if (this._source) {\r
- // @namespace Layer\r
- // @section Popup events\r
- // @event popupopen: PopupEvent\r
- // Fired when a popup bound to this layer is opened\r
- this._source.fire('popupopen', {popup: this}, true);\r
- // For non-path layers, we toggle the popup when clicking\r
- // again the layer, so prevent the map to reopen it.\r
- if (!(this._source instanceof Path)) {\r
- this._source.on('preclick', stopPropagation);\r
- }\r
- }\r
- },\r
-\r
- onRemove: function (map) {\r
- DivOverlay.prototype.onRemove.call(this, map);\r
-\r
- // @namespace Map\r
- // @section Popup events\r
- // @event popupclose: PopupEvent\r
- // Fired when a popup in the map is closed\r
- map.fire('popupclose', {popup: this});\r
-\r
- if (this._source) {\r
- // @namespace Layer\r
- // @section Popup events\r
- // @event popupclose: PopupEvent\r
- // Fired when a popup bound to this layer is closed\r
- this._source.fire('popupclose', {popup: this}, true);\r
- if (!(this._source instanceof Path)) {\r
- this._source.off('preclick', stopPropagation);\r
- }\r
- }\r
- },\r
-\r
- getEvents: function () {\r
- var events = DivOverlay.prototype.getEvents.call(this);\r
-\r
- if (this.options.closeOnClick !== undefined ? this.options.closeOnClick : this._map.options.closePopupOnClick) {\r
- events.preclick = this._close;\r
- }\r
-\r
- if (this.options.keepInView) {\r
- events.moveend = this._adjustPan;\r
- }\r
-\r
- return events;\r
- },\r
-\r
- _close: function () {\r
- if (this._map) {\r
- this._map.closePopup(this);\r
- }\r
- },\r
-\r
- _initLayout: function () {\r
- var prefix = 'leaflet-popup',\r
- container = this._container = create$1('div',\r
- prefix + ' ' + (this.options.className || '') +\r
- ' leaflet-zoom-animated');\r
-\r
- var wrapper = this._wrapper = create$1('div', prefix + '-content-wrapper', container);\r
- this._contentNode = create$1('div', prefix + '-content', wrapper);\r
-\r
- disableClickPropagation(container);\r
- disableScrollPropagation(this._contentNode);\r
- on(container, 'contextmenu', stopPropagation);\r
-\r
- this._tipContainer = create$1('div', prefix + '-tip-container', container);\r
- this._tip = create$1('div', prefix + '-tip', this._tipContainer);\r
-\r
- if (this.options.closeButton) {\r
- var closeButton = this._closeButton = create$1('a', prefix + '-close-button', container);\r
- closeButton.href = '#close';\r
- closeButton.innerHTML = '×';\r
-\r
- on(closeButton, 'click', this._onCloseButtonClick, this);\r
- }\r
- },\r
-\r
- _updateLayout: function () {\r
- var container = this._contentNode,\r
- style = container.style;\r
-\r
- style.width = '';\r
- style.whiteSpace = 'nowrap';\r
-\r
- var width = container.offsetWidth;\r
- width = Math.min(width, this.options.maxWidth);\r
- width = Math.max(width, this.options.minWidth);\r
-\r
- style.width = (width + 1) + 'px';\r
- style.whiteSpace = '';\r
-\r
- style.height = '';\r
-\r
- var height = container.offsetHeight,\r
- maxHeight = this.options.maxHeight,\r
- scrolledClass = 'leaflet-popup-scrolled';\r
-\r
- if (maxHeight && height > maxHeight) {\r
- style.height = maxHeight + 'px';\r
- addClass(container, scrolledClass);\r
- } else {\r
- removeClass(container, scrolledClass);\r
- }\r
-\r
- this._containerWidth = this._container.offsetWidth;\r
- },\r
-\r
- _animateZoom: function (e) {\r
- var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center),\r
- anchor = this._getAnchor();\r
- setPosition(this._container, pos.add(anchor));\r
- },\r
-\r
- _adjustPan: function () {\r
- if (!this.options.autoPan) { return; }\r
- if (this._map._panAnim) { this._map._panAnim.stop(); }\r
-\r
- var map = this._map,\r
- marginBottom = parseInt(getStyle(this._container, 'marginBottom'), 10) || 0,\r
- containerHeight = this._container.offsetHeight + marginBottom,\r
- containerWidth = this._containerWidth,\r
- layerPos = new Point(this._containerLeft, -containerHeight - this._containerBottom);\r
-\r
- layerPos._add(getPosition(this._container));\r
-\r
- var containerPos = map.layerPointToContainerPoint(layerPos),\r
- padding = toPoint(this.options.autoPanPadding),\r
- paddingTL = toPoint(this.options.autoPanPaddingTopLeft || padding),\r
- paddingBR = toPoint(this.options.autoPanPaddingBottomRight || padding),\r
- size = map.getSize(),\r
- dx = 0,\r
- dy = 0;\r
-\r
- if (containerPos.x + containerWidth + paddingBR.x > size.x) { // right\r
- dx = containerPos.x + containerWidth - size.x + paddingBR.x;\r
- }\r
- if (containerPos.x - dx - paddingTL.x < 0) { // left\r
- dx = containerPos.x - paddingTL.x;\r
- }\r
- if (containerPos.y + containerHeight + paddingBR.y > size.y) { // bottom\r
- dy = containerPos.y + containerHeight - size.y + paddingBR.y;\r
- }\r
- if (containerPos.y - dy - paddingTL.y < 0) { // top\r
- dy = containerPos.y - paddingTL.y;\r
- }\r
-\r
- // @namespace Map\r
- // @section Popup events\r
- // @event autopanstart: Event\r
- // Fired when the map starts autopanning when opening a popup.\r
- if (dx || dy) {\r
- map\r
- .fire('autopanstart')\r
- .panBy([dx, dy]);\r
- }\r
- },\r
-\r
- _onCloseButtonClick: function (e) {\r
- this._close();\r
- stop(e);\r
- },\r
-\r
- _getAnchor: function () {\r
- // Where should we anchor the popup on the source layer?\r
- return toPoint(this._source && this._source._getPopupAnchor ? this._source._getPopupAnchor() : [0, 0]);\r
- }\r
-\r
- });\r
-\r
- // @namespace Popup\r
- // @factory L.popup(options?: Popup options, source?: Layer)\r
- // Instantiates a `Popup` object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the popup with a reference to the Layer to which it refers.\r
- var popup = function (options, source) {\r
- return new Popup(options, source);\r
- };\r
-\r
-\r
- /* @namespace Map\r
- * @section Interaction Options\r
- * @option closePopupOnClick: Boolean = true\r
- * Set it to `false` if you don't want popups to close when user clicks the map.\r
- */\r
- Map.mergeOptions({\r
- closePopupOnClick: true\r
- });\r
-\r
-\r
- // @namespace Map\r
- // @section Methods for Layers and Controls\r
- Map.include({\r
- // @method openPopup(popup: Popup): this\r
- // Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).\r
- // @alternative\r
- // @method openPopup(content: String|HTMLElement, latlng: LatLng, options?: Popup options): this\r
- // Creates a popup with the specified content and options and opens it in the given point on a map.\r
- openPopup: function (popup, latlng, options) {\r
- if (!(popup instanceof Popup)) {\r
- popup = new Popup(options).setContent(popup);\r
- }\r
-\r
- if (latlng) {\r
- popup.setLatLng(latlng);\r
- }\r
-\r
- if (this.hasLayer(popup)) {\r
- return this;\r
- }\r
-\r
- if (this._popup && this._popup.options.autoClose) {\r
- this.closePopup();\r
- }\r
-\r
- this._popup = popup;\r
- return this.addLayer(popup);\r
- },\r
-\r
- // @method closePopup(popup?: Popup): this\r
- // Closes the popup previously opened with [openPopup](#map-openpopup) (or the given one).\r
- closePopup: function (popup) {\r
- if (!popup || popup === this._popup) {\r
- popup = this._popup;\r
- this._popup = null;\r
- }\r
- if (popup) {\r
- this.removeLayer(popup);\r
- }\r
- return this;\r
- }\r
- });\r
-\r
- /*\r
- * @namespace Layer\r
- * @section Popup methods example\r
- *\r
- * All layers share a set of methods convenient for binding popups to it.\r
- *\r
- * ```js\r
- * var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map);\r
- * layer.openPopup();\r
- * layer.closePopup();\r
- * ```\r
- *\r
- * Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened.\r
- */\r
-\r
- // @section Popup methods\r
- Layer.include({\r
-\r
- // @method bindPopup(content: String|HTMLElement|Function|Popup, options?: Popup options): this\r
- // Binds a popup to the layer with the passed `content` and sets up the\r
- // necessary event listeners. If a `Function` is passed it will receive\r
- // the layer as the first argument and should return a `String` or `HTMLElement`.\r
- bindPopup: function (content, options) {\r
-\r
- if (content instanceof Popup) {\r
- setOptions(content, options);\r
- this._popup = content;\r
- content._source = this;\r
- } else {\r
- if (!this._popup || options) {\r
- this._popup = new Popup(options, this);\r
- }\r
- this._popup.setContent(content);\r
- }\r
-\r
- if (!this._popupHandlersAdded) {\r
- this.on({\r
- click: this._openPopup,\r
- keypress: this._onKeyPress,\r
- remove: this.closePopup,\r
- move: this._movePopup\r
- });\r
- this._popupHandlersAdded = true;\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method unbindPopup(): this\r
- // Removes the popup previously bound with `bindPopup`.\r
- unbindPopup: function () {\r
- if (this._popup) {\r
- this.off({\r
- click: this._openPopup,\r
- keypress: this._onKeyPress,\r
- remove: this.closePopup,\r
- move: this._movePopup\r
- });\r
- this._popupHandlersAdded = false;\r
- this._popup = null;\r
- }\r
- return this;\r
- },\r
-\r
- // @method openPopup(latlng?: LatLng): this\r
- // Opens the bound popup at the specified `latlng` or at the default popup anchor if no `latlng` is passed.\r
- openPopup: function (layer, latlng) {\r
- if (this._popup && this._map) {\r
- latlng = this._popup._prepareOpen(this, layer, latlng);\r
-\r
- // open the popup on the map\r
- this._map.openPopup(this._popup, latlng);\r
- }\r
-\r
- return this;\r
- },\r
-\r
- // @method closePopup(): this\r
- // Closes the popup bound to this layer if it is open.\r
- closePopup: function () {\r
- if (this._popup) {\r
- this._popup._close();\r
- }\r
- return this;\r
- },\r
-\r
- // @method togglePopup(): this\r
- // Opens or closes the popup bound to this layer depending on its current state.\r
- togglePopup: function (target) {\r
- if (this._popup) {\r
- if (this._popup._map) {\r
- this.closePopup();\r
- } else {\r
- this.openPopup(target);\r
- }\r
- }\r
- return this;\r
- },\r
-\r
- // @method isPopupOpen(): boolean\r
- // Returns `true` if the popup bound to this layer is currently open.\r
- isPopupOpen: function () {\r
- return (this._popup ? this._popup.isOpen() : false);\r
- },\r
-\r
- // @method setPopupContent(content: String|HTMLElement|Popup): this\r
- // Sets the content of the popup bound to this layer.\r
- setPopupContent: function (content) {\r
- if (this._popup) {\r
- this._popup.setContent(content);\r
- }\r
- return this;\r
- },\r
-\r
- // @method getPopup(): Popup\r
- // Returns the popup bound to this layer.\r
- getPopup: function () {\r
- return this._popup;\r
- },\r
-\r
- _openPopup: function (e) {\r
- var layer = e.layer || e.target;\r
-\r
- if (!this._popup) {\r
- return;\r
- }\r
-\r
- if (!this._map) {\r
- return;\r
- }\r
-\r
- // prevent map click\r
- stop(e);\r
-\r
- // if this inherits from Path its a vector and we can just\r
- // open the popup at the new location\r
- if (layer instanceof Path) {\r
- this.openPopup(e.layer || e.target, e.latlng);\r
- return;\r
- }\r
-\r
- // otherwise treat it like a marker and figure out\r
- // if we should toggle it open/closed\r
- if (this._map.hasLayer(this._popup) && this._popup._source === layer) {\r
- this.closePopup();\r
- } else {\r
- this.openPopup(layer, e.latlng);\r
- }\r
- },\r
-\r
- _movePopup: function (e) {\r
- this._popup.setLatLng(e.latlng);\r
- },\r
-\r
- _onKeyPress: function (e) {\r
- if (e.originalEvent.keyCode === 13) {\r
- this._openPopup(e);\r
- }\r
- }\r
- });
-
- /*
- * @class Tooltip
- * @inherits DivOverlay
- * @aka L.Tooltip
- * Used to display small texts on top of map layers.
- *
- * @example
- *
- * ```js
- * marker.bindTooltip("my tooltip text").openTooltip();
- * ```
- * Note about tooltip offset. Leaflet takes two options in consideration
- * for computing tooltip offsetting:
- * - the `offset` Tooltip option: it defaults to [0, 0], and it's specific to one tooltip.
- * Add a positive x offset to move the tooltip to the right, and a positive y offset to
- * move it to the bottom. Negatives will move to the left and top.
- * - the `tooltipAnchor` Icon option: this will only be considered for Marker. You
- * should adapt this value if you use a custom icon.
- */
-
-
- // @namespace Tooltip
- var Tooltip = DivOverlay.extend({
-
- // @section
- // @aka Tooltip options
- options: {
- // @option pane: String = 'tooltipPane'
- // `Map pane` where the tooltip will be added.
- pane: 'tooltipPane',
-
- // @option offset: Point = Point(0, 0)
- // Optional offset of the tooltip position.
- offset: [0, 0],
-
- // @option direction: String = 'auto'
- // Direction where to open the tooltip. Possible values are: `right`, `left`,
- // `top`, `bottom`, `center`, `auto`.
- // `auto` will dynamically switch between `right` and `left` according to the tooltip
- // position on the map.
- direction: 'auto',
-
- // @option permanent: Boolean = false
- // Whether to open the tooltip permanently or only on mouseover.
- permanent: false,
-
- // @option sticky: Boolean = false
- // If true, the tooltip will follow the mouse instead of being fixed at the feature center.
- sticky: false,
-
- // @option interactive: Boolean = false
- // If true, the tooltip will listen to the feature events.
- interactive: false,
-
- // @option opacity: Number = 0.9
- // Tooltip container opacity.
- opacity: 0.9
- },
-
- onAdd: function (map) {
- DivOverlay.prototype.onAdd.call(this, map);
- this.setOpacity(this.options.opacity);
-
- // @namespace Map
- // @section Tooltip events
- // @event tooltipopen: TooltipEvent
- // Fired when a tooltip is opened in the map.
- map.fire('tooltipopen', {tooltip: this});
-
- if (this._source) {
- // @namespace Layer
- // @section Tooltip events
- // @event tooltipopen: TooltipEvent
- // Fired when a tooltip bound to this layer is opened.
- this._source.fire('tooltipopen', {tooltip: this}, true);
- }
- },
-
- onRemove: function (map) {
- DivOverlay.prototype.onRemove.call(this, map);
-
- // @namespace Map
- // @section Tooltip events
- // @event tooltipclose: TooltipEvent
- // Fired when a tooltip in the map is closed.
- map.fire('tooltipclose', {tooltip: this});
-
- if (this._source) {
- // @namespace Layer
- // @section Tooltip events
- // @event tooltipclose: TooltipEvent
- // Fired when a tooltip bound to this layer is closed.
- this._source.fire('tooltipclose', {tooltip: this}, true);
- }
- },
-
- getEvents: function () {
- var events = DivOverlay.prototype.getEvents.call(this);
-
- if (touch && !this.options.permanent) {
- events.preclick = this._close;
- }
-
- return events;
- },
-
- _close: function () {
- if (this._map) {
- this._map.closeTooltip(this);
- }
- },
-
- _initLayout: function () {
- var prefix = 'leaflet-tooltip',
- className = prefix + ' ' + (this.options.className || '') + ' leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');
-
- this._contentNode = this._container = create$1('div', className);
- },
-
- _updateLayout: function () {},
-
- _adjustPan: function () {},
-
- _setPosition: function (pos) {
- var subX, subY,
- map = this._map,
- container = this._container,
- centerPoint = map.latLngToContainerPoint(map.getCenter()),
- tooltipPoint = map.layerPointToContainerPoint(pos),
- direction = this.options.direction,
- tooltipWidth = container.offsetWidth,
- tooltipHeight = container.offsetHeight,
- offset = toPoint(this.options.offset),
- anchor = this._getAnchor();
-
- if (direction === 'top') {
- subX = tooltipWidth / 2;
- subY = tooltipHeight;
- } else if (direction === 'bottom') {
- subX = tooltipWidth / 2;
- subY = 0;
- } else if (direction === 'center') {
- subX = tooltipWidth / 2;
- subY = tooltipHeight / 2;
- } else if (direction === 'right') {
- subX = 0;
- subY = tooltipHeight / 2;
- } else if (direction === 'left') {
- subX = tooltipWidth;
- subY = tooltipHeight / 2;
- } else if (tooltipPoint.x < centerPoint.x) {
- direction = 'right';
- subX = 0;
- subY = tooltipHeight / 2;
- } else {
- direction = 'left';
- subX = tooltipWidth + (offset.x + anchor.x) * 2;
- subY = tooltipHeight / 2;
- }
-
- pos = pos.subtract(toPoint(subX, subY, true)).add(offset).add(anchor);
-
- removeClass(container, 'leaflet-tooltip-right');
- removeClass(container, 'leaflet-tooltip-left');
- removeClass(container, 'leaflet-tooltip-top');
- removeClass(container, 'leaflet-tooltip-bottom');
- addClass(container, 'leaflet-tooltip-' + direction);
- setPosition(container, pos);
- },
-
- _updatePosition: function () {
- var pos = this._map.latLngToLayerPoint(this._latlng);
- this._setPosition(pos);
- },
-
- setOpacity: function (opacity) {
- this.options.opacity = opacity;
-
- if (this._container) {
- setOpacity(this._container, opacity);
- }
- },
-
- _animateZoom: function (e) {
- var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);
- this._setPosition(pos);
- },
-
- _getAnchor: function () {
- // Where should we anchor the tooltip on the source layer?
- return toPoint(this._source && this._source._getTooltipAnchor && !this.options.sticky ? this._source._getTooltipAnchor() : [0, 0]);
- }
-
- });
-
- // @namespace Tooltip
- // @factory L.tooltip(options?: Tooltip options, source?: Layer)
- // Instantiates a Tooltip object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the tooltip with a reference to the Layer to which it refers.
- var tooltip = function (options, source) {
- return new Tooltip(options, source);
- };
-
- // @namespace Map
- // @section Methods for Layers and Controls
- Map.include({
-
- // @method openTooltip(tooltip: Tooltip): this
- // Opens the specified tooltip.
- // @alternative
- // @method openTooltip(content: String|HTMLElement, latlng: LatLng, options?: Tooltip options): this
- // Creates a tooltip with the specified content and options and open it.
- openTooltip: function (tooltip, latlng, options) {
- if (!(tooltip instanceof Tooltip)) {
- tooltip = new Tooltip(options).setContent(tooltip);
- }
-
- if (latlng) {
- tooltip.setLatLng(latlng);
- }
-
- if (this.hasLayer(tooltip)) {
- return this;
- }
-
- return this.addLayer(tooltip);
- },
-
- // @method closeTooltip(tooltip?: Tooltip): this
- // Closes the tooltip given as parameter.
- closeTooltip: function (tooltip) {
- if (tooltip) {
- this.removeLayer(tooltip);
- }
- return this;
- }
-
- });
-
- /*
- * @namespace Layer
- * @section Tooltip methods example
- *
- * All layers share a set of methods convenient for binding tooltips to it.
- *
- * ```js
- * var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map);
- * layer.openTooltip();
- * layer.closeTooltip();
- * ```
- */
-
- // @section Tooltip methods
- Layer.include({
-
- // @method bindTooltip(content: String|HTMLElement|Function|Tooltip, options?: Tooltip options): this
- // Binds a tooltip to the layer with the passed `content` and sets up the
- // necessary event listeners. If a `Function` is passed it will receive
- // the layer as the first argument and should return a `String` or `HTMLElement`.
- bindTooltip: function (content, options) {
-
- if (content instanceof Tooltip) {
- setOptions(content, options);
- this._tooltip = content;
- content._source = this;
- } else {
- if (!this._tooltip || options) {
- this._tooltip = new Tooltip(options, this);
- }
- this._tooltip.setContent(content);
-
- }
-
- this._initTooltipInteractions();
-
- if (this._tooltip.options.permanent && this._map && this._map.hasLayer(this)) {
- this.openTooltip();
- }
-
- return this;
- },
-
- // @method unbindTooltip(): this
- // Removes the tooltip previously bound with `bindTooltip`.
- unbindTooltip: function () {
- if (this._tooltip) {
- this._initTooltipInteractions(true);
- this.closeTooltip();
- this._tooltip = null;
- }
- return this;
- },
-
- _initTooltipInteractions: function (remove$$1) {
- if (!remove$$1 && this._tooltipHandlersAdded) { return; }
- var onOff = remove$$1 ? 'off' : 'on',
- events = {
- remove: this.closeTooltip,
- move: this._moveTooltip
- };
- if (!this._tooltip.options.permanent) {
- events.mouseover = this._openTooltip;
- events.mouseout = this.closeTooltip;
- if (this._tooltip.options.sticky) {
- events.mousemove = this._moveTooltip;
- }
- if (touch) {
- events.click = this._openTooltip;
- }
- } else {
- events.add = this._openTooltip;
- }
- this[onOff](events);
- this._tooltipHandlersAdded = !remove$$1;
- },
-
- // @method openTooltip(latlng?: LatLng): this
- // Opens the bound tooltip at the specified `latlng` or at the default tooltip anchor if no `latlng` is passed.
- openTooltip: function (layer, latlng) {
- if (this._tooltip && this._map) {
- latlng = this._tooltip._prepareOpen(this, layer, latlng);
-
- // open the tooltip on the map
- this._map.openTooltip(this._tooltip, latlng);
-
- // Tooltip container may not be defined if not permanent and never
- // opened.
- if (this._tooltip.options.interactive && this._tooltip._container) {
- addClass(this._tooltip._container, 'leaflet-clickable');
- this.addInteractiveTarget(this._tooltip._container);
- }
- }
-
- return this;
- },
-
- // @method closeTooltip(): this
- // Closes the tooltip bound to this layer if it is open.
- closeTooltip: function () {
- if (this._tooltip) {
- this._tooltip._close();
- if (this._tooltip.options.interactive && this._tooltip._container) {
- removeClass(this._tooltip._container, 'leaflet-clickable');
- this.removeInteractiveTarget(this._tooltip._container);
- }
- }
- return this;
- },
-
- // @method toggleTooltip(): this
- // Opens or closes the tooltip bound to this layer depending on its current state.
- toggleTooltip: function (target) {
- if (this._tooltip) {
- if (this._tooltip._map) {
- this.closeTooltip();
- } else {
- this.openTooltip(target);
- }
- }
- return this;
- },
-
- // @method isTooltipOpen(): boolean
- // Returns `true` if the tooltip bound to this layer is currently open.
- isTooltipOpen: function () {
- return this._tooltip.isOpen();
- },
-
- // @method setTooltipContent(content: String|HTMLElement|Tooltip): this
- // Sets the content of the tooltip bound to this layer.
- setTooltipContent: function (content) {
- if (this._tooltip) {
- this._tooltip.setContent(content);
- }
- return this;
- },
-
- // @method getTooltip(): Tooltip
- // Returns the tooltip bound to this layer.
- getTooltip: function () {
- return this._tooltip;
- },
-
- _openTooltip: function (e) {
- var layer = e.layer || e.target;
-
- if (!this._tooltip || !this._map) {
- return;
- }
- this.openTooltip(layer, this._tooltip.options.sticky ? e.latlng : undefined);
- },
-
- _moveTooltip: function (e) {
- var latlng = e.latlng, containerPoint, layerPoint;
- if (this._tooltip.options.sticky && e.originalEvent) {
- containerPoint = this._map.mouseEventToContainerPoint(e.originalEvent);
- layerPoint = this._map.containerPointToLayerPoint(containerPoint);
- latlng = this._map.layerPointToLatLng(layerPoint);
- }
- this._tooltip.setLatLng(latlng);
- }
- });
-
- /*
- * @class DivIcon
- * @aka L.DivIcon
- * @inherits Icon
- *
- * Represents a lightweight icon for markers that uses a simple `<div>`
- * element instead of an image. Inherits from `Icon` but ignores the `iconUrl` and shadow options.
- *
- * @example
- * ```js
- * var myIcon = L.divIcon({className: 'my-div-icon'});
- * // you can set .my-div-icon styles in CSS
- *
- * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
- * ```
- *
- * By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
- */
-
- var DivIcon = Icon.extend({
- options: {
- // @section
- // @aka DivIcon options
- iconSize: [12, 12], // also can be set through CSS
-
- // iconAnchor: (Point),
- // popupAnchor: (Point),
-
- // @option html: String|HTMLElement = ''
- // Custom HTML code to put inside the div element, empty by default. Alternatively,
- // an instance of `HTMLElement`.
- html: false,
-
- // @option bgPos: Point = [0, 0]
- // Optional relative position of the background, in pixels
- bgPos: null,
-
- className: 'leaflet-div-icon'
- },
-
- createIcon: function (oldIcon) {
- var div = (oldIcon && oldIcon.tagName === 'DIV') ? oldIcon : document.createElement('div'),
- options = this.options;
-
- if (options.html instanceof Element) {
- empty(div);
- div.appendChild(options.html);
- } else {
- div.innerHTML = options.html !== false ? options.html : '';
- }
-
- if (options.bgPos) {
- var bgPos = toPoint(options.bgPos);
- div.style.backgroundPosition = (-bgPos.x) + 'px ' + (-bgPos.y) + 'px';
- }
- this._setIconStyles(div, 'icon');
-
- return div;
- },
-
- createShadow: function () {
- return null;
- }
- });
-
- // @factory L.divIcon(options: DivIcon options)
- // Creates a `DivIcon` instance with the given options.
- function divIcon(options) {
- return new DivIcon(options);
- }
-
- Icon.Default = IconDefault;
-
- /*
- * @class GridLayer
- * @inherits Layer
- * @aka L.GridLayer
- *
- * Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces `TileLayer.Canvas`.
- * GridLayer can be extended to create a tiled grid of HTML elements like `<canvas>`, `<img>` or `<div>`. GridLayer will handle creating and animating these DOM elements for you.
- *
- *
- * @section Synchronous usage
- * @example
- *
- * To create a custom layer, extend GridLayer and implement the `createTile()` method, which will be passed a `Point` object with the `x`, `y`, and `z` (zoom level) coordinates to draw your tile.
- *
- * ```js
- * var CanvasLayer = L.GridLayer.extend({
- * createTile: function(coords){
- * // create a <canvas> element for drawing
- * var tile = L.DomUtil.create('canvas', 'leaflet-tile');
- *
- * // setup tile width and height according to the options
- * var size = this.getTileSize();
- * tile.width = size.x;
- * tile.height = size.y;
- *
- * // get a canvas context and draw something on it using coords.x, coords.y and coords.z
- * var ctx = tile.getContext('2d');
- *
- * // return the tile so it can be rendered on screen
- * return tile;
- * }
- * });
- * ```
- *
- * @section Asynchronous usage
- * @example
- *
- * Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the `done()` callback.
- *
- * ```js
- * var CanvasLayer = L.GridLayer.extend({
- * createTile: function(coords, done){
- * var error;
- *
- * // create a <canvas> element for drawing
- * var tile = L.DomUtil.create('canvas', 'leaflet-tile');
- *
- * // setup tile width and height according to the options
- * var size = this.getTileSize();
- * tile.width = size.x;
- * tile.height = size.y;
- *
- * // draw something asynchronously and pass the tile to the done() callback
- * setTimeout(function() {
- * done(error, tile);
- * }, 1000);
- *
- * return tile;
- * }
- * });
- * ```
- *
- * @section
- */
-
-
- var GridLayer = Layer.extend({
-
- // @section
- // @aka GridLayer options
- options: {
- // @option tileSize: Number|Point = 256
- // Width and height of tiles in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise.
- tileSize: 256,
-
- // @option opacity: Number = 1.0
- // Opacity of the tiles. Can be used in the `createTile()` function.
- opacity: 1,
-
- // @option updateWhenIdle: Boolean = (depends)
- // Load new tiles only when panning ends.
- // `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
- // `false` otherwise in order to display new tiles _during_ panning, since it is easy to pan outside the
- // [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers.
- updateWhenIdle: mobile,
-
- // @option updateWhenZooming: Boolean = true
- // By default, a smooth zoom animation (during a [touch zoom](#map-touchzoom) or a [`flyTo()`](#map-flyto)) will update grid layers every integer zoom level. Setting this option to `false` will update the grid layer only when the smooth animation ends.
- updateWhenZooming: true,
-
- // @option updateInterval: Number = 200
- // Tiles will not update more than once every `updateInterval` milliseconds when panning.
- updateInterval: 200,
-
- // @option zIndex: Number = 1
- // The explicit zIndex of the tile layer.
- zIndex: 1,
-
- // @option bounds: LatLngBounds = undefined
- // If set, tiles will only be loaded inside the set `LatLngBounds`.
- bounds: null,
-
- // @option minZoom: Number = 0
- // The minimum zoom level down to which this layer will be displayed (inclusive).
- minZoom: 0,
-
- // @option maxZoom: Number = undefined
- // The maximum zoom level up to which this layer will be displayed (inclusive).
- maxZoom: undefined,
-
- // @option maxNativeZoom: Number = undefined
- // Maximum zoom number the tile source has available. If it is specified,
- // the tiles on all zoom levels higher than `maxNativeZoom` will be loaded
- // from `maxNativeZoom` level and auto-scaled.
- maxNativeZoom: undefined,
-
- // @option minNativeZoom: Number = undefined
- // Minimum zoom number the tile source has available. If it is specified,
- // the tiles on all zoom levels lower than `minNativeZoom` will be loaded
- // from `minNativeZoom` level and auto-scaled.
- minNativeZoom: undefined,
-
- // @option noWrap: Boolean = false
- // Whether the layer is wrapped around the antimeridian. If `true`, the
- // GridLayer will only be displayed once at low zoom levels. Has no
- // effect when the [map CRS](#map-crs) doesn't wrap around. Can be used
- // in combination with [`bounds`](#gridlayer-bounds) to prevent requesting
- // tiles outside the CRS limits.
- noWrap: false,
-
- // @option pane: String = 'tilePane'
- // `Map pane` where the grid layer will be added.
- pane: 'tilePane',
-
- // @option className: String = ''
- // A custom class name to assign to the tile layer. Empty by default.
- className: '',
-
- // @option keepBuffer: Number = 2
- // When panning the map, keep this many rows and columns of tiles before unloading them.
- keepBuffer: 2
- },
-
- initialize: function (options) {
- setOptions(this, options);
- },
-
- onAdd: function () {
- this._initContainer();
-
- this._levels = {};
- this._tiles = {};
-
- this._resetView();
- this._update();
- },
-
- beforeAdd: function (map) {
- map._addZoomLimit(this);
- },
-
- onRemove: function (map) {
- this._removeAllTiles();
- remove(this._container);
- map._removeZoomLimit(this);
- this._container = null;
- this._tileZoom = undefined;
- },
-
- // @method bringToFront: this
- // Brings the tile layer to the top of all tile layers.
- bringToFront: function () {
- if (this._map) {
- toFront(this._container);
- this._setAutoZIndex(Math.max);
- }
- return this;
- },
-
- // @method bringToBack: this
- // Brings the tile layer to the bottom of all tile layers.
- bringToBack: function () {
- if (this._map) {
- toBack(this._container);
- this._setAutoZIndex(Math.min);
- }
- return this;
- },
-
- // @method getContainer: HTMLElement
- // Returns the HTML element that contains the tiles for this layer.
- getContainer: function () {
- return this._container;
- },
-
- // @method setOpacity(opacity: Number): this
- // Changes the [opacity](#gridlayer-opacity) of the grid layer.
- setOpacity: function (opacity) {
- this.options.opacity = opacity;
- this._updateOpacity();
- return this;
- },
-
- // @method setZIndex(zIndex: Number): this
- // Changes the [zIndex](#gridlayer-zindex) of the grid layer.
- setZIndex: function (zIndex) {
- this.options.zIndex = zIndex;
- this._updateZIndex();
-
- return this;
- },
-
- // @method isLoading: Boolean
- // Returns `true` if any tile in the grid layer has not finished loading.
- isLoading: function () {
- return this._loading;
- },
-
- // @method redraw: this
- // Causes the layer to clear all the tiles and request them again.
- redraw: function () {
- if (this._map) {
- this._removeAllTiles();
- this._update();
- }
- return this;
- },
-
- getEvents: function () {
- var events = {
- viewprereset: this._invalidateAll,
- viewreset: this._resetView,
- zoom: this._resetView,
- moveend: this._onMoveEnd
- };
-
- if (!this.options.updateWhenIdle) {
- // update tiles on move, but not more often than once per given interval
- if (!this._onMove) {
- this._onMove = throttle(this._onMoveEnd, this.options.updateInterval, this);
- }
-
- events.move = this._onMove;
- }
-
- if (this._zoomAnimated) {
- events.zoomanim = this._animateZoom;
- }
-
- return events;
- },
-
- // @section Extension methods
- // Layers extending `GridLayer` shall reimplement the following method.
- // @method createTile(coords: Object, done?: Function): HTMLElement
- // Called only internally, must be overridden by classes extending `GridLayer`.
- // Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback
- // is specified, it must be called when the tile has finished loading and drawing.
- createTile: function () {
- return document.createElement('div');
- },
-
- // @section
- // @method getTileSize: Point
- // Normalizes the [tileSize option](#gridlayer-tilesize) into a point. Used by the `createTile()` method.
- getTileSize: function () {
- var s = this.options.tileSize;
- return s instanceof Point ? s : new Point(s, s);
- },
-
- _updateZIndex: function () {
- if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
- this._container.style.zIndex = this.options.zIndex;
- }
- },
-
- _setAutoZIndex: function (compare) {
- // go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back)
-
- var layers = this.getPane().children,
- edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min
-
- for (var i = 0, len = layers.length, zIndex; i < len; i++) {
-
- zIndex = layers[i].style.zIndex;
-
- if (layers[i] !== this._container && zIndex) {
- edgeZIndex = compare(edgeZIndex, +zIndex);
- }
- }
-
- if (isFinite(edgeZIndex)) {
- this.options.zIndex = edgeZIndex + compare(-1, 1);
- this._updateZIndex();
- }
- },
-
- _updateOpacity: function () {
- if (!this._map) { return; }
-
- // IE doesn't inherit filter opacity properly, so we're forced to set it on tiles
- if (ielt9) { return; }
-
- setOpacity(this._container, this.options.opacity);
-
- var now = +new Date(),
- nextFrame = false,
- willPrune = false;
-
- for (var key in this._tiles) {
- var tile = this._tiles[key];
- if (!tile.current || !tile.loaded) { continue; }
-
- var fade = Math.min(1, (now - tile.loaded) / 200);
-
- setOpacity(tile.el, fade);
- if (fade < 1) {
- nextFrame = true;
- } else {
- if (tile.active) {
- willPrune = true;
- } else {
- this._onOpaqueTile(tile);
- }
- tile.active = true;
- }
- }
-
- if (willPrune && !this._noPrune) { this._pruneTiles(); }
-
- if (nextFrame) {
- cancelAnimFrame(this._fadeFrame);
- this._fadeFrame = requestAnimFrame(this._updateOpacity, this);
- }
- },
-
- _onOpaqueTile: falseFn,
-
- _initContainer: function () {
- if (this._container) { return; }
-
- this._container = create$1('div', 'leaflet-layer ' + (this.options.className || ''));
- this._updateZIndex();
-
- if (this.options.opacity < 1) {
- this._updateOpacity();
- }
-
- this.getPane().appendChild(this._container);
- },
-
- _updateLevels: function () {
-
- var zoom = this._tileZoom,
- maxZoom = this.options.maxZoom;
-
- if (zoom === undefined) { return undefined; }
-
- for (var z in this._levels) {
- z = Number(z);
- if (this._levels[z].el.children.length || z === zoom) {
- this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);
- this._onUpdateLevel(z);
- } else {
- remove(this._levels[z].el);
- this._removeTilesAtZoom(z);
- this._onRemoveLevel(z);
- delete this._levels[z];
- }
- }
-
- var level = this._levels[zoom],
- map = this._map;
-
- if (!level) {
- level = this._levels[zoom] = {};
-
- level.el = create$1('div', 'leaflet-tile-container leaflet-zoom-animated', this._container);
- level.el.style.zIndex = maxZoom;
-
- level.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round();
- level.zoom = zoom;
-
- this._setZoomTransform(level, map.getCenter(), map.getZoom());
-
- // force the browser to consider the newly added element for transition
- falseFn(level.el.offsetWidth);
-
- this._onCreateLevel(level);
- }
-
- this._level = level;
-
- return level;
- },
-
- _onUpdateLevel: falseFn,
-
- _onRemoveLevel: falseFn,
-
- _onCreateLevel: falseFn,
-
- _pruneTiles: function () {
- if (!this._map) {
- return;
- }
-
- var key, tile;
-
- var zoom = this._map.getZoom();
- if (zoom > this.options.maxZoom ||
- zoom < this.options.minZoom) {
- this._removeAllTiles();
- return;
- }
-
- for (key in this._tiles) {
- tile = this._tiles[key];
- tile.retain = tile.current;
- }
-
- for (key in this._tiles) {
- tile = this._tiles[key];
- if (tile.current && !tile.active) {
- var coords = tile.coords;
- if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) {
- this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);
- }
- }
- }
-
- for (key in this._tiles) {
- if (!this._tiles[key].retain) {
- this._removeTile(key);
- }
- }
- },
-
- _removeTilesAtZoom: function (zoom) {
- for (var key in this._tiles) {
- if (this._tiles[key].coords.z !== zoom) {
- continue;
- }
- this._removeTile(key);
- }
- },
-
- _removeAllTiles: function () {
- for (var key in this._tiles) {
- this._removeTile(key);
- }
- },
-
- _invalidateAll: function () {
- for (var z in this._levels) {
- remove(this._levels[z].el);
- this._onRemoveLevel(Number(z));
- delete this._levels[z];
- }
- this._removeAllTiles();
-
- this._tileZoom = undefined;
- },
-
- _retainParent: function (x, y, z, minZoom) {
- var x2 = Math.floor(x / 2),
- y2 = Math.floor(y / 2),
- z2 = z - 1,
- coords2 = new Point(+x2, +y2);
- coords2.z = +z2;
-
- var key = this._tileCoordsToKey(coords2),
- tile = this._tiles[key];
-
- if (tile && tile.active) {
- tile.retain = true;
- return true;
-
- } else if (tile && tile.loaded) {
- tile.retain = true;
- }
-
- if (z2 > minZoom) {
- return this._retainParent(x2, y2, z2, minZoom);
- }
-
- return false;
- },
-
- _retainChildren: function (x, y, z, maxZoom) {
-
- for (var i = 2 * x; i < 2 * x + 2; i++) {
- for (var j = 2 * y; j < 2 * y + 2; j++) {
-
- var coords = new Point(i, j);
- coords.z = z + 1;
-
- var key = this._tileCoordsToKey(coords),
- tile = this._tiles[key];
-
- if (tile && tile.active) {
- tile.retain = true;
- continue;
-
- } else if (tile && tile.loaded) {
- tile.retain = true;
- }
-
- if (z + 1 < maxZoom) {
- this._retainChildren(i, j, z + 1, maxZoom);
- }
- }
- }
- },
-
- _resetView: function (e) {
- var animating = e && (e.pinch || e.flyTo);
- this._setView(this._map.getCenter(), this._map.getZoom(), animating, animating);
- },
-
- _animateZoom: function (e) {
- this._setView(e.center, e.zoom, true, e.noUpdate);
- },
-
- _clampZoom: function (zoom) {
- var options = this.options;
-
- if (undefined !== options.minNativeZoom && zoom < options.minNativeZoom) {
- return options.minNativeZoom;
- }
-
- if (undefined !== options.maxNativeZoom && options.maxNativeZoom < zoom) {
- return options.maxNativeZoom;
- }
-
- return zoom;
- },
-
- _setView: function (center, zoom, noPrune, noUpdate) {
- var tileZoom = Math.round(zoom);
- if ((this.options.maxZoom !== undefined && tileZoom > this.options.maxZoom) ||
- (this.options.minZoom !== undefined && tileZoom < this.options.minZoom)) {
- tileZoom = undefined;
- } else {
- tileZoom = this._clampZoom(tileZoom);
- }
-
- var tileZoomChanged = this.options.updateWhenZooming && (tileZoom !== this._tileZoom);
-
- if (!noUpdate || tileZoomChanged) {
-
- this._tileZoom = tileZoom;
-
- if (this._abortLoading) {
- this._abortLoading();
- }
-
- this._updateLevels();
- this._resetGrid();
-
- if (tileZoom !== undefined) {
- this._update(center);
- }
-
- if (!noPrune) {
- this._pruneTiles();
- }
-
- // Flag to prevent _updateOpacity from pruning tiles during
- // a zoom anim or a pinch gesture
- this._noPrune = !!noPrune;
- }
-
- this._setZoomTransforms(center, zoom);
- },
-
- _setZoomTransforms: function (center, zoom) {
- for (var i in this._levels) {
- this._setZoomTransform(this._levels[i], center, zoom);
- }
- },
-
- _setZoomTransform: function (level, center, zoom) {
- var scale = this._map.getZoomScale(zoom, level.zoom),
- translate = level.origin.multiplyBy(scale)
- .subtract(this._map._getNewPixelOrigin(center, zoom)).round();
-
- if (any3d) {
- setTransform(level.el, translate, scale);
- } else {
- setPosition(level.el, translate);
- }
- },
-
- _resetGrid: function () {
- var map = this._map,
- crs = map.options.crs,
- tileSize = this._tileSize = this.getTileSize(),
- tileZoom = this._tileZoom;
-
- var bounds = this._map.getPixelWorldBounds(this._tileZoom);
- if (bounds) {
- this._globalTileRange = this._pxBoundsToTileRange(bounds);
- }
-
- this._wrapX = crs.wrapLng && !this.options.noWrap && [
- Math.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x),
- Math.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.y)
- ];
- this._wrapY = crs.wrapLat && !this.options.noWrap && [
- Math.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.x),
- Math.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y)
- ];
- },
-
- _onMoveEnd: function () {
- if (!this._map || this._map._animatingZoom) { return; }
-
- this._update();
- },
-
- _getTiledPixelBounds: function (center) {
- var map = this._map,
- mapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(),
- scale = map.getZoomScale(mapZoom, this._tileZoom),
- pixelCenter = map.project(center, this._tileZoom).floor(),
- halfSize = map.getSize().divideBy(scale * 2);
-
- return new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));
- },
-
- // Private method to load tiles in the grid's active zoom level according to map bounds
- _update: function (center) {
- var map = this._map;
- if (!map) { return; }
- var zoom = this._clampZoom(map.getZoom());
-
- if (center === undefined) { center = map.getCenter(); }
- if (this._tileZoom === undefined) { return; } // if out of minzoom/maxzoom
-
- var pixelBounds = this._getTiledPixelBounds(center),
- tileRange = this._pxBoundsToTileRange(pixelBounds),
- tileCenter = tileRange.getCenter(),
- queue = [],
- margin = this.options.keepBuffer,
- noPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]),
- tileRange.getTopRight().add([margin, -margin]));
-
- // Sanity check: panic if the tile range contains Infinity somewhere.
- if (!(isFinite(tileRange.min.x) &&
- isFinite(tileRange.min.y) &&
- isFinite(tileRange.max.x) &&
- isFinite(tileRange.max.y))) { throw new Error('Attempted to load an infinite number of tiles'); }
-
- for (var key in this._tiles) {
- var c = this._tiles[key].coords;
- if (c.z !== this._tileZoom || !noPruneRange.contains(new Point(c.x, c.y))) {
- this._tiles[key].current = false;
- }
- }
-
- // _update just loads more tiles. If the tile zoom level differs too much
- // from the map's, let _setView reset levels and prune old tiles.
- if (Math.abs(zoom - this._tileZoom) > 1) { this._setView(center, zoom); return; }
-
- // create a queue of coordinates to load tiles from
- for (var j = tileRange.min.y; j <= tileRange.max.y; j++) {
- for (var i = tileRange.min.x; i <= tileRange.max.x; i++) {
- var coords = new Point(i, j);
- coords.z = this._tileZoom;
-
- if (!this._isValidTile(coords)) { continue; }
-
- var tile = this._tiles[this._tileCoordsToKey(coords)];
- if (tile) {
- tile.current = true;
- } else {
- queue.push(coords);
- }
- }
- }
-
- // sort tile queue to load tiles in order of their distance to center
- queue.sort(function (a, b) {
- return a.distanceTo(tileCenter) - b.distanceTo(tileCenter);
- });
-
- if (queue.length !== 0) {
- // if it's the first batch of tiles to load
- if (!this._loading) {
- this._loading = true;
- // @event loading: Event
- // Fired when the grid layer starts loading tiles.
- this.fire('loading');
- }
-
- // create DOM fragment to append tiles in one batch
- var fragment = document.createDocumentFragment();
-
- for (i = 0; i < queue.length; i++) {
- this._addTile(queue[i], fragment);
- }
-
- this._level.el.appendChild(fragment);
- }
- },
-
- _isValidTile: function (coords) {
- var crs = this._map.options.crs;
-
- if (!crs.infinite) {
- // don't load tile if it's out of bounds and not wrapped
- var bounds = this._globalTileRange;
- if ((!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||
- (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))) { return false; }
- }
-
- if (!this.options.bounds) { return true; }
-
- // don't load tile if it doesn't intersect the bounds in options
- var tileBounds = this._tileCoordsToBounds(coords);
- return toLatLngBounds(this.options.bounds).overlaps(tileBounds);
- },
-
- _keyToBounds: function (key) {
- return this._tileCoordsToBounds(this._keyToTileCoords(key));
- },
-
- _tileCoordsToNwSe: function (coords) {
- var map = this._map,
- tileSize = this.getTileSize(),
- nwPoint = coords.scaleBy(tileSize),
- sePoint = nwPoint.add(tileSize),
- nw = map.unproject(nwPoint, coords.z),
- se = map.unproject(sePoint, coords.z);
- return [nw, se];
- },
-
- // converts tile coordinates to its geographical bounds
- _tileCoordsToBounds: function (coords) {
- var bp = this._tileCoordsToNwSe(coords),
- bounds = new LatLngBounds(bp[0], bp[1]);
-
- if (!this.options.noWrap) {
- bounds = this._map.wrapLatLngBounds(bounds);
- }
- return bounds;
- },
- // converts tile coordinates to key for the tile cache
- _tileCoordsToKey: function (coords) {
- return coords.x + ':' + coords.y + ':' + coords.z;
- },
-
- // converts tile cache key to coordinates
- _keyToTileCoords: function (key) {
- var k = key.split(':'),
- coords = new Point(+k[0], +k[1]);
- coords.z = +k[2];
- return coords;
- },
-
- _removeTile: function (key) {
- var tile = this._tiles[key];
- if (!tile) { return; }
-
- remove(tile.el);
-
- delete this._tiles[key];
-
- // @event tileunload: TileEvent
- // Fired when a tile is removed (e.g. when a tile goes off the screen).
- this.fire('tileunload', {
- tile: tile.el,
- coords: this._keyToTileCoords(key)
- });
- },
-
- _initTile: function (tile) {
- addClass(tile, 'leaflet-tile');
-
- var tileSize = this.getTileSize();
- tile.style.width = tileSize.x + 'px';
- tile.style.height = tileSize.y + 'px';
-
- tile.onselectstart = falseFn;
- tile.onmousemove = falseFn;
-
- // update opacity on tiles in IE7-8 because of filter inheritance problems
- if (ielt9 && this.options.opacity < 1) {
- setOpacity(tile, this.options.opacity);
- }
-
- // without this hack, tiles disappear after zoom on Chrome for Android
- // https://github.com/Leaflet/Leaflet/issues/2078
- if (android && !android23) {
- tile.style.WebkitBackfaceVisibility = 'hidden';
- }
- },
-
- _addTile: function (coords, container) {
- var tilePos = this._getTilePos(coords),
- key = this._tileCoordsToKey(coords);
-
- var tile = this.createTile(this._wrapCoords(coords), bind(this._tileReady, this, coords));
-
- this._initTile(tile);
-
- // if createTile is defined with a second argument ("done" callback),
- // we know that tile is async and will be ready later; otherwise
- if (this.createTile.length < 2) {
- // mark tile as ready, but delay one frame for opacity animation to happen
- requestAnimFrame(bind(this._tileReady, this, coords, null, tile));
- }
-
- setPosition(tile, tilePos);
-
- // save tile in cache
- this._tiles[key] = {
- el: tile,
- coords: coords,
- current: true
- };
-
- container.appendChild(tile);
- // @event tileloadstart: TileEvent
- // Fired when a tile is requested and starts loading.
- this.fire('tileloadstart', {
- tile: tile,
- coords: coords
- });
- },
-
- _tileReady: function (coords, err, tile) {
- if (err) {
- // @event tileerror: TileErrorEvent
- // Fired when there is an error loading a tile.
- this.fire('tileerror', {
- error: err,
- tile: tile,
- coords: coords
- });
- }
-
- var key = this._tileCoordsToKey(coords);
-
- tile = this._tiles[key];
- if (!tile) { return; }
-
- tile.loaded = +new Date();
- if (this._map._fadeAnimated) {
- setOpacity(tile.el, 0);
- cancelAnimFrame(this._fadeFrame);
- this._fadeFrame = requestAnimFrame(this._updateOpacity, this);
- } else {
- tile.active = true;
- this._pruneTiles();
- }
-
- if (!err) {
- addClass(tile.el, 'leaflet-tile-loaded');
-
- // @event tileload: TileEvent
- // Fired when a tile loads.
- this.fire('tileload', {
- tile: tile.el,
- coords: coords
- });
- }
-
- if (this._noTilesToLoad()) {
- this._loading = false;
- // @event load: Event
- // Fired when the grid layer loaded all visible tiles.
- this.fire('load');
-
- if (ielt9 || !this._map._fadeAnimated) {
- requestAnimFrame(this._pruneTiles, this);
- } else {
- // Wait a bit more than 0.2 secs (the duration of the tile fade-in)
- // to trigger a pruning.
- setTimeout(bind(this._pruneTiles, this), 250);
- }
- }
- },
-
- _getTilePos: function (coords) {
- return coords.scaleBy(this.getTileSize()).subtract(this._level.origin);
- },
-
- _wrapCoords: function (coords) {
- var newCoords = new Point(
- this._wrapX ? wrapNum(coords.x, this._wrapX) : coords.x,
- this._wrapY ? wrapNum(coords.y, this._wrapY) : coords.y);
- newCoords.z = coords.z;
- return newCoords;
- },
-
- _pxBoundsToTileRange: function (bounds) {
- var tileSize = this.getTileSize();
- return new Bounds(
- bounds.min.unscaleBy(tileSize).floor(),
- bounds.max.unscaleBy(tileSize).ceil().subtract([1, 1]));
- },
-
- _noTilesToLoad: function () {
- for (var key in this._tiles) {
- if (!this._tiles[key].loaded) { return false; }
- }
- return true;
- }
- });
-
- // @factory L.gridLayer(options?: GridLayer options)
- // Creates a new instance of GridLayer with the supplied options.
- function gridLayer(options) {
- return new GridLayer(options);
- }
-
- /*\r
- * @class TileLayer\r
- * @inherits GridLayer\r
- * @aka L.TileLayer\r
- * Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under `Layer`. Extends `GridLayer`.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'}).addTo(map);\r
- * ```\r
- *\r
- * @section URL template\r
- * @example\r
- *\r
- * A string of the following form:\r
- *\r
- * ```\r
- * 'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png'\r
- * ```\r
- *\r
- * `{s}` means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; `a`, `b` or `c` by default, can be omitted), `{z}` — zoom level, `{x}` and `{y}` — tile coordinates. `{r}` can be used to add "@2x" to the URL to load retina tiles.\r
- *\r
- * You can use custom keys in the template, which will be [evaluated](#util-template) from TileLayer options, like this:\r
- *\r
- * ```\r
- * L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'});\r
- * ```\r
- */\r
-\r
-\r
- var TileLayer = GridLayer.extend({\r
-\r
- // @section\r
- // @aka TileLayer options\r
- options: {\r
- // @option minZoom: Number = 0\r
- // The minimum zoom level down to which this layer will be displayed (inclusive).\r
- minZoom: 0,\r
-\r
- // @option maxZoom: Number = 18\r
- // The maximum zoom level up to which this layer will be displayed (inclusive).\r
- maxZoom: 18,\r
-\r
- // @option subdomains: String|String[] = 'abc'\r
- // Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.\r
- subdomains: 'abc',\r
-\r
- // @option errorTileUrl: String = ''\r
- // URL to the tile image to show in place of the tile that failed to load.\r
- errorTileUrl: '',\r
-\r
- // @option zoomOffset: Number = 0\r
- // The zoom number used in tile URLs will be offset with this value.\r
- zoomOffset: 0,\r
-\r
- // @option tms: Boolean = false\r
- // If `true`, inverses Y axis numbering for tiles (turn this on for [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) services).\r
- tms: false,\r
-\r
- // @option zoomReverse: Boolean = false\r
- // If set to true, the zoom number used in tile URLs will be reversed (`maxZoom - zoom` instead of `zoom`)\r
- zoomReverse: false,\r
-\r
- // @option detectRetina: Boolean = false\r
- // If `true` and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.\r
- detectRetina: false,\r
-\r
- // @option crossOrigin: Boolean|String = false\r
- // Whether the crossOrigin attribute will be added to the tiles.\r
- // If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.\r
- // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.\r
- crossOrigin: false\r
- },\r
-\r
- initialize: function (url, options) {\r
-\r
- this._url = url;\r
-\r
- options = setOptions(this, options);\r
-\r
- // detecting retina displays, adjusting tileSize and zoom levels\r
- if (options.detectRetina && retina && options.maxZoom > 0) {\r
-\r
- options.tileSize = Math.floor(options.tileSize / 2);\r
-\r
- if (!options.zoomReverse) {\r
- options.zoomOffset++;\r
- options.maxZoom--;\r
- } else {\r
- options.zoomOffset--;\r
- options.minZoom++;\r
- }\r
-\r
- options.minZoom = Math.max(0, options.minZoom);\r
- }\r
-\r
- if (typeof options.subdomains === 'string') {\r
- options.subdomains = options.subdomains.split('');\r
- }\r
-\r
- // for https://github.com/Leaflet/Leaflet/issues/137\r
- if (!android) {\r
- this.on('tileunload', this._onTileRemove);\r
- }\r
- },\r
-\r
- // @method setUrl(url: String, noRedraw?: Boolean): this\r
- // Updates the layer's URL template and redraws it (unless `noRedraw` is set to `true`).\r
- // If the URL does not change, the layer will not be redrawn unless\r
- // the noRedraw parameter is set to false.\r
- setUrl: function (url, noRedraw) {\r
- if (this._url === url && noRedraw === undefined) {\r
- noRedraw = true;\r
- }\r
-\r
- this._url = url;\r
-\r
- if (!noRedraw) {\r
- this.redraw();\r
- }\r
- return this;\r
- },\r
-\r
- // @method createTile(coords: Object, done?: Function): HTMLElement\r
- // Called only internally, overrides GridLayer's [`createTile()`](#gridlayer-createtile)\r
- // to return an `<img>` HTML element with the appropriate image URL given `coords`. The `done`\r
- // callback is called when the tile has been loaded.\r
- createTile: function (coords, done) {\r
- var tile = document.createElement('img');\r
-\r
- on(tile, 'load', bind(this._tileOnLoad, this, done, tile));\r
- on(tile, 'error', bind(this._tileOnError, this, done, tile));\r
-\r
- if (this.options.crossOrigin || this.options.crossOrigin === '') {\r
- tile.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin;\r
- }\r
-\r
- /*\r
- Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons\r
- http://www.w3.org/TR/WCAG20-TECHS/H67\r
- */\r
- tile.alt = '';\r
-\r
- /*\r
- Set role="presentation" to force screen readers to ignore this\r
- https://www.w3.org/TR/wai-aria/roles#textalternativecomputation\r
- */\r
- tile.setAttribute('role', 'presentation');\r
-\r
- tile.src = this.getTileUrl(coords);\r
-\r
- return tile;\r
- },\r
-\r
- // @section Extension methods\r
- // @uninheritable\r
- // Layers extending `TileLayer` might reimplement the following method.\r
- // @method getTileUrl(coords: Object): String\r
- // Called only internally, returns the URL for a tile given its coordinates.\r
- // Classes extending `TileLayer` can override this function to provide custom tile URL naming schemes.\r
- getTileUrl: function (coords) {\r
- var data = {\r
- r: retina ? '@2x' : '',\r
- s: this._getSubdomain(coords),\r
- x: coords.x,\r
- y: coords.y,\r
- z: this._getZoomForUrl()\r
- };\r
- if (this._map && !this._map.options.crs.infinite) {\r
- var invertedY = this._globalTileRange.max.y - coords.y;\r
- if (this.options.tms) {\r
- data['y'] = invertedY;\r
- }\r
- data['-y'] = invertedY;\r
- }\r
-\r
- return template(this._url, extend(data, this.options));\r
- },\r
-\r
- _tileOnLoad: function (done, tile) {\r
- // For https://github.com/Leaflet/Leaflet/issues/3332\r
- if (ielt9) {\r
- setTimeout(bind(done, this, null, tile), 0);\r
- } else {\r
- done(null, tile);\r
- }\r
- },\r
-\r
- _tileOnError: function (done, tile, e) {\r
- var errorUrl = this.options.errorTileUrl;\r
- if (errorUrl && tile.getAttribute('src') !== errorUrl) {\r
- tile.src = errorUrl;\r
- }\r
- done(e, tile);\r
- },\r
-\r
- _onTileRemove: function (e) {\r
- e.tile.onload = null;\r
- },\r
-\r
- _getZoomForUrl: function () {\r
- var zoom = this._tileZoom,\r
- maxZoom = this.options.maxZoom,\r
- zoomReverse = this.options.zoomReverse,\r
- zoomOffset = this.options.zoomOffset;\r
-\r
- if (zoomReverse) {\r
- zoom = maxZoom - zoom;\r
- }\r
-\r
- return zoom + zoomOffset;\r
- },\r
-\r
- _getSubdomain: function (tilePoint) {\r
- var index = Math.abs(tilePoint.x + tilePoint.y) % this.options.subdomains.length;\r
- return this.options.subdomains[index];\r
- },\r
-\r
- // stops loading all tiles in the background layer\r
- _abortLoading: function () {\r
- var i, tile;\r
- for (i in this._tiles) {\r
- if (this._tiles[i].coords.z !== this._tileZoom) {\r
- tile = this._tiles[i].el;\r
-\r
- tile.onload = falseFn;\r
- tile.onerror = falseFn;\r
-\r
- if (!tile.complete) {\r
- tile.src = emptyImageUrl;\r
- remove(tile);\r
- delete this._tiles[i];\r
- }\r
- }\r
- }\r
- },\r
-\r
- _removeTile: function (key) {\r
- var tile = this._tiles[key];\r
- if (!tile) { return; }\r
-\r
- // Cancels any pending http requests associated with the tile\r
- // unless we're on Android's stock browser,\r
- // see https://github.com/Leaflet/Leaflet/issues/137\r
- if (!androidStock) {\r
- tile.el.setAttribute('src', emptyImageUrl);\r
- }\r
-\r
- return GridLayer.prototype._removeTile.call(this, key);\r
- },\r
-\r
- _tileReady: function (coords, err, tile) {\r
- if (!this._map || (tile && tile.getAttribute('src') === emptyImageUrl)) {\r
- return;\r
- }\r
-\r
- return GridLayer.prototype._tileReady.call(this, coords, err, tile);\r
- }\r
- });\r
-\r
-\r
- // @factory L.tilelayer(urlTemplate: String, options?: TileLayer options)\r
- // Instantiates a tile layer object given a `URL template` and optionally an options object.\r
-\r
- function tileLayer(url, options) {\r
- return new TileLayer(url, options);\r
- }
-
- /*\r
- * @class TileLayer.WMS\r
- * @inherits TileLayer\r
- * @aka L.TileLayer.WMS\r
- * Used to display [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services as tile layers on the map. Extends `TileLayer`.\r
- *\r
- * @example\r
- *\r
- * ```js\r
- * var nexrad = L.tileLayer.wms("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", {\r
- * layers: 'nexrad-n0r-900913',\r
- * format: 'image/png',\r
- * transparent: true,\r
- * attribution: "Weather data © 2012 IEM Nexrad"\r
- * });\r
- * ```\r
- */\r
-\r
- var TileLayerWMS = TileLayer.extend({\r
-\r
- // @section\r
- // @aka TileLayer.WMS options\r
- // If any custom options not documented here are used, they will be sent to the\r
- // WMS server as extra parameters in each request URL. This can be useful for\r
- // [non-standard vendor WMS parameters](http://docs.geoserver.org/stable/en/user/services/wms/vendor.html).\r
- defaultWmsParams: {\r
- service: 'WMS',\r
- request: 'GetMap',\r
-\r
- // @option layers: String = ''\r
- // **(required)** Comma-separated list of WMS layers to show.\r
- layers: '',\r
-\r
- // @option styles: String = ''\r
- // Comma-separated list of WMS styles.\r
- styles: '',\r
-\r
- // @option format: String = 'image/jpeg'\r
- // WMS image format (use `'image/png'` for layers with transparency).\r
- format: 'image/jpeg',\r
-\r
- // @option transparent: Boolean = false\r
- // If `true`, the WMS service will return images with transparency.\r
- transparent: false,\r
-\r
- // @option version: String = '1.1.1'\r
- // Version of the WMS service to use\r
- version: '1.1.1'\r
- },\r
-\r
- options: {\r
- // @option crs: CRS = null\r
- // Coordinate Reference System to use for the WMS requests, defaults to\r
- // map CRS. Don't change this if you're not sure what it means.\r
- crs: null,\r
-\r
- // @option uppercase: Boolean = false\r
- // If `true`, WMS request parameter keys will be uppercase.\r
- uppercase: false\r
- },\r
-\r
- initialize: function (url, options) {\r
-\r
- this._url = url;\r
-\r
- var wmsParams = extend({}, this.defaultWmsParams);\r
-\r
- // all keys that are not TileLayer options go to WMS params\r
- for (var i in options) {\r
- if (!(i in this.options)) {\r
- wmsParams[i] = options[i];\r
- }\r
- }\r
-\r
- options = setOptions(this, options);\r
-\r
- var realRetina = options.detectRetina && retina ? 2 : 1;\r
- var tileSize = this.getTileSize();\r
- wmsParams.width = tileSize.x * realRetina;\r
- wmsParams.height = tileSize.y * realRetina;\r
-\r
- this.wmsParams = wmsParams;\r
- },\r
-\r
- onAdd: function (map) {\r
-\r
- this._crs = this.options.crs || map.options.crs;\r
- this._wmsVersion = parseFloat(this.wmsParams.version);\r
-\r
- var projectionKey = this._wmsVersion >= 1.3 ? 'crs' : 'srs';\r
- this.wmsParams[projectionKey] = this._crs.code;\r
-\r
- TileLayer.prototype.onAdd.call(this, map);\r
- },\r
-\r
- getTileUrl: function (coords) {\r
-\r
- var tileBounds = this._tileCoordsToNwSe(coords),\r
- crs = this._crs,\r
- bounds = toBounds(crs.project(tileBounds[0]), crs.project(tileBounds[1])),\r
- min = bounds.min,\r
- max = bounds.max,\r
- bbox = (this._wmsVersion >= 1.3 && this._crs === EPSG4326 ?\r
- [min.y, min.x, max.y, max.x] :\r
- [min.x, min.y, max.x, max.y]).join(','),\r
- url = TileLayer.prototype.getTileUrl.call(this, coords);\r
- return url +\r
- getParamString(this.wmsParams, url, this.options.uppercase) +\r
- (this.options.uppercase ? '&BBOX=' : '&bbox=') + bbox;\r
- },\r
-\r
- // @method setParams(params: Object, noRedraw?: Boolean): this\r
- // Merges an object with the new parameters and re-requests tiles on the current screen (unless `noRedraw` was set to true).\r
- setParams: function (params, noRedraw) {\r
-\r
- extend(this.wmsParams, params);\r
-\r
- if (!noRedraw) {\r
- this.redraw();\r
- }\r
-\r
- return this;\r
- }\r
- });\r
-\r
-\r
- // @factory L.tileLayer.wms(baseUrl: String, options: TileLayer.WMS options)\r
- // Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object.\r
- function tileLayerWMS(url, options) {\r
- return new TileLayerWMS(url, options);\r
- }
-
- TileLayer.WMS = TileLayerWMS;
- tileLayer.wms = tileLayerWMS;
-
- /*
- * @class Renderer
- * @inherits Layer
- * @aka L.Renderer
- *
- * Base class for vector renderer implementations (`SVG`, `Canvas`). Handles the
- * DOM container of the renderer, its bounds, and its zoom animation.
- *
- * A `Renderer` works as an implicit layer group for all `Path`s - the renderer
- * itself can be added or removed to the map. All paths use a renderer, which can
- * be implicit (the map will decide the type of renderer and use it automatically)
- * or explicit (using the [`renderer`](#path-renderer) option of the path).
- *
- * Do not use this class directly, use `SVG` and `Canvas` instead.
- *
- * @event update: Event
- * Fired when the renderer updates its bounds, center and zoom, for example when
- * its map has moved
- */
-
- var Renderer = Layer.extend({
-
- // @section
- // @aka Renderer options
- options: {
- // @option padding: Number = 0.1
- // How much to extend the clip area around the map view (relative to its size)
- // e.g. 0.1 would be 10% of map view in each direction
- padding: 0.1,
-
- // @option tolerance: Number = 0
- // How much to extend click tolerance round a path/object on the map
- tolerance : 0
- },
-
- initialize: function (options) {
- setOptions(this, options);
- stamp(this);
- this._layers = this._layers || {};
- },
-
- onAdd: function () {
- if (!this._container) {
- this._initContainer(); // defined by renderer implementations
-
- if (this._zoomAnimated) {
- addClass(this._container, 'leaflet-zoom-animated');
- }
- }
-
- this.getPane().appendChild(this._container);
- this._update();
- this.on('update', this._updatePaths, this);
- },
-
- onRemove: function () {
- this.off('update', this._updatePaths, this);
- this._destroyContainer();
- },
-
- getEvents: function () {
- var events = {
- viewreset: this._reset,
- zoom: this._onZoom,
- moveend: this._update,
- zoomend: this._onZoomEnd
- };
- if (this._zoomAnimated) {
- events.zoomanim = this._onAnimZoom;
- }
- return events;
- },
-
- _onAnimZoom: function (ev) {
- this._updateTransform(ev.center, ev.zoom);
- },
-
- _onZoom: function () {
- this._updateTransform(this._map.getCenter(), this._map.getZoom());
- },
-
- _updateTransform: function (center, zoom) {
- var scale = this._map.getZoomScale(zoom, this._zoom),
- position = getPosition(this._container),
- viewHalf = this._map.getSize().multiplyBy(0.5 + this.options.padding),
- currentCenterPoint = this._map.project(this._center, zoom),
- destCenterPoint = this._map.project(center, zoom),
- centerOffset = destCenterPoint.subtract(currentCenterPoint),
-
- topLeftOffset = viewHalf.multiplyBy(-scale).add(position).add(viewHalf).subtract(centerOffset);
-
- if (any3d) {
- setTransform(this._container, topLeftOffset, scale);
- } else {
- setPosition(this._container, topLeftOffset);
- }
- },
-
- _reset: function () {
- this._update();
- this._updateTransform(this._center, this._zoom);
-
- for (var id in this._layers) {
- this._layers[id]._reset();
- }
- },
-
- _onZoomEnd: function () {
- for (var id in this._layers) {
- this._layers[id]._project();
- }
- },
-
- _updatePaths: function () {
- for (var id in this._layers) {
- this._layers[id]._update();
- }
- },
-
- _update: function () {
- // Update pixel bounds of renderer container (for positioning/sizing/clipping later)
- // Subclasses are responsible of firing the 'update' event.
- var p = this.options.padding,
- size = this._map.getSize(),
- min = this._map.containerPointToLayerPoint(size.multiplyBy(-p)).round();
-
- this._bounds = new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round());
-
- this._center = this._map.getCenter();
- this._zoom = this._map.getZoom();
- }
- });
-
- /*
- * @class Canvas
- * @inherits Renderer
- * @aka L.Canvas
- *
- * Allows vector layers to be displayed with [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).
- * Inherits `Renderer`.
- *
- * Due to [technical limitations](http://caniuse.com/#search=canvas), Canvas is not
- * available in all web browsers, notably IE8, and overlapping geometries might
- * not display properly in some edge cases.
- *
- * @example
- *
- * Use Canvas by default for all paths in the map:
- *
- * ```js
- * var map = L.map('map', {
- * renderer: L.canvas()
- * });
- * ```
- *
- * Use a Canvas renderer with extra padding for specific vector geometries:
- *
- * ```js
- * var map = L.map('map');
- * var myRenderer = L.canvas({ padding: 0.5 });
- * var line = L.polyline( coordinates, { renderer: myRenderer } );
- * var circle = L.circle( center, { renderer: myRenderer } );
- * ```
- */
-
- var Canvas = Renderer.extend({
- getEvents: function () {
- var events = Renderer.prototype.getEvents.call(this);
- events.viewprereset = this._onViewPreReset;
- return events;
- },
-
- _onViewPreReset: function () {
- // Set a flag so that a viewprereset+moveend+viewreset only updates&redraws once
- this._postponeUpdatePaths = true;
- },
-
- onAdd: function () {
- Renderer.prototype.onAdd.call(this);
-
- // Redraw vectors since canvas is cleared upon removal,
- // in case of removing the renderer itself from the map.
- this._draw();
- },
-
- _initContainer: function () {
- var container = this._container = document.createElement('canvas');
-
- on(container, 'mousemove', this._onMouseMove, this);
- on(container, 'click dblclick mousedown mouseup contextmenu', this._onClick, this);
- on(container, 'mouseout', this._handleMouseOut, this);
-
- this._ctx = container.getContext('2d');
- },
-
- _destroyContainer: function () {
- cancelAnimFrame(this._redrawRequest);
- delete this._ctx;
- remove(this._container);
- off(this._container);
- delete this._container;
- },
-
- _updatePaths: function () {
- if (this._postponeUpdatePaths) { return; }
-
- var layer;
- this._redrawBounds = null;
- for (var id in this._layers) {
- layer = this._layers[id];
- layer._update();
- }
- this._redraw();
- },
-
- _update: function () {
- if (this._map._animatingZoom && this._bounds) { return; }
-
- Renderer.prototype._update.call(this);
-
- var b = this._bounds,
- container = this._container,
- size = b.getSize(),
- m = retina ? 2 : 1;
-
- setPosition(container, b.min);
-
- // set canvas size (also clearing it); use double size on retina
- container.width = m * size.x;
- container.height = m * size.y;
- container.style.width = size.x + 'px';
- container.style.height = size.y + 'px';
-
- if (retina) {
- this._ctx.scale(2, 2);
- }
-
- // translate so we use the same path coordinates after canvas element moves
- this._ctx.translate(-b.min.x, -b.min.y);
-
- // Tell paths to redraw themselves
- this.fire('update');
- },
-
- _reset: function () {
- Renderer.prototype._reset.call(this);
-
- if (this._postponeUpdatePaths) {
- this._postponeUpdatePaths = false;
- this._updatePaths();
- }
- },
-
- _initPath: function (layer) {
- this._updateDashArray(layer);
- this._layers[stamp(layer)] = layer;
-
- var order = layer._order = {
- layer: layer,
- prev: this._drawLast,
- next: null
- };
- if (this._drawLast) { this._drawLast.next = order; }
- this._drawLast = order;
- this._drawFirst = this._drawFirst || this._drawLast;
- },
-
- _addPath: function (layer) {
- this._requestRedraw(layer);
- },
-
- _removePath: function (layer) {
- var order = layer._order;
- var next = order.next;
- var prev = order.prev;
-
- if (next) {
- next.prev = prev;
- } else {
- this._drawLast = prev;
- }
- if (prev) {
- prev.next = next;
- } else {
- this._drawFirst = next;
- }
-
- delete layer._order;
-
- delete this._layers[stamp(layer)];
-
- this._requestRedraw(layer);
- },
-
- _updatePath: function (layer) {
- // Redraw the union of the layer's old pixel
- // bounds and the new pixel bounds.
- this._extendRedrawBounds(layer);
- layer._project();
- layer._update();
- // The redraw will extend the redraw bounds
- // with the new pixel bounds.
- this._requestRedraw(layer);
- },
-
- _updateStyle: function (layer) {
- this._updateDashArray(layer);
- this._requestRedraw(layer);
- },
-
- _updateDashArray: function (layer) {
- if (typeof layer.options.dashArray === 'string') {
- var parts = layer.options.dashArray.split(/[, ]+/),
- dashArray = [],
- dashValue,
- i;
- for (i = 0; i < parts.length; i++) {
- dashValue = Number(parts[i]);
- // Ignore dash array containing invalid lengths
- if (isNaN(dashValue)) { return; }
- dashArray.push(dashValue);
- }
- layer.options._dashArray = dashArray;
- } else {
- layer.options._dashArray = layer.options.dashArray;
- }
- },
-
- _requestRedraw: function (layer) {
- if (!this._map) { return; }
-
- this._extendRedrawBounds(layer);
- this._redrawRequest = this._redrawRequest || requestAnimFrame(this._redraw, this);
- },
-
- _extendRedrawBounds: function (layer) {
- if (layer._pxBounds) {
- var padding = (layer.options.weight || 0) + 1;
- this._redrawBounds = this._redrawBounds || new Bounds();
- this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding]));
- this._redrawBounds.extend(layer._pxBounds.max.add([padding, padding]));
- }
- },
-
- _redraw: function () {
- this._redrawRequest = null;
-
- if (this._redrawBounds) {
- this._redrawBounds.min._floor();
- this._redrawBounds.max._ceil();
- }
-
- this._clear(); // clear layers in redraw bounds
- this._draw(); // draw layers
-
- this._redrawBounds = null;
- },
-
- _clear: function () {
- var bounds = this._redrawBounds;
- if (bounds) {
- var size = bounds.getSize();
- this._ctx.clearRect(bounds.min.x, bounds.min.y, size.x, size.y);
- } else {
- this._ctx.save();
- this._ctx.setTransform(1, 0, 0, 1, 0, 0);
- this._ctx.clearRect(0, 0, this._container.width, this._container.height);
- this._ctx.restore();
- }
- },
-
- _draw: function () {
- var layer, bounds = this._redrawBounds;
- this._ctx.save();
- if (bounds) {
- var size = bounds.getSize();
- this._ctx.beginPath();
- this._ctx.rect(bounds.min.x, bounds.min.y, size.x, size.y);
- this._ctx.clip();
- }
-
- this._drawing = true;
-
- for (var order = this._drawFirst; order; order = order.next) {
- layer = order.layer;
- if (!bounds || (layer._pxBounds && layer._pxBounds.intersects(bounds))) {
- layer._updatePath();
- }
- }
-
- this._drawing = false;
-
- this._ctx.restore(); // Restore state before clipping.
- },
-
- _updatePoly: function (layer, closed) {
- if (!this._drawing) { return; }
-
- var i, j, len2, p,
- parts = layer._parts,
- len = parts.length,
- ctx = this._ctx;
-
- if (!len) { return; }
-
- ctx.beginPath();
-
- for (i = 0; i < len; i++) {
- for (j = 0, len2 = parts[i].length; j < len2; j++) {
- p = parts[i][j];
- ctx[j ? 'lineTo' : 'moveTo'](p.x, p.y);
- }
- if (closed) {
- ctx.closePath();
- }
- }
-
- this._fillStroke(ctx, layer);
-
- // TODO optimization: 1 fill/stroke for all features with equal style instead of 1 for each feature
- },
-
- _updateCircle: function (layer) {
-
- if (!this._drawing || layer._empty()) { return; }
-
- var p = layer._point,
- ctx = this._ctx,
- r = Math.max(Math.round(layer._radius), 1),
- s = (Math.max(Math.round(layer._radiusY), 1) || r) / r;
-
- if (s !== 1) {
- ctx.save();
- ctx.scale(1, s);
- }
-
- ctx.beginPath();
- ctx.arc(p.x, p.y / s, r, 0, Math.PI * 2, false);
-
- if (s !== 1) {
- ctx.restore();
- }
-
- this._fillStroke(ctx, layer);
- },
-
- _fillStroke: function (ctx, layer) {
- var options = layer.options;
-
- if (options.fill) {
- ctx.globalAlpha = options.fillOpacity;
- ctx.fillStyle = options.fillColor || options.color;
- ctx.fill(options.fillRule || 'evenodd');
- }
-
- if (options.stroke && options.weight !== 0) {
- if (ctx.setLineDash) {
- ctx.setLineDash(layer.options && layer.options._dashArray || []);
- }
- ctx.globalAlpha = options.opacity;
- ctx.lineWidth = options.weight;
- ctx.strokeStyle = options.color;
- ctx.lineCap = options.lineCap;
- ctx.lineJoin = options.lineJoin;
- ctx.stroke();
- }
- },
-
- // Canvas obviously doesn't have mouse events for individual drawn objects,
- // so we emulate that by calculating what's under the mouse on mousemove/click manually
-
- _onClick: function (e) {
- var point = this._map.mouseEventToLayerPoint(e), layer, clickedLayer;
-
- for (var order = this._drawFirst; order; order = order.next) {
- layer = order.layer;
- if (layer.options.interactive && layer._containsPoint(point)) {
- if (!(e.type === 'click' || e.type !== 'preclick') || !this._map._draggableMoved(layer)) {
- clickedLayer = layer;
- }
- }
- }
- if (clickedLayer) {
- fakeStop(e);
- this._fireEvent([clickedLayer], e);
- }
- },
-
- _onMouseMove: function (e) {
- if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) { return; }
-
- var point = this._map.mouseEventToLayerPoint(e);
- this._handleMouseHover(e, point);
- },
-
-
- _handleMouseOut: function (e) {
- var layer = this._hoveredLayer;
- if (layer) {
- // if we're leaving the layer, fire mouseout
- removeClass(this._container, 'leaflet-interactive');
- this._fireEvent([layer], e, 'mouseout');
- this._hoveredLayer = null;
- this._mouseHoverThrottled = false;
- }
- },
-
- _handleMouseHover: function (e, point) {
- if (this._mouseHoverThrottled) {
- return;
- }
-
- var layer, candidateHoveredLayer;
-
- for (var order = this._drawFirst; order; order = order.next) {
- layer = order.layer;
- if (layer.options.interactive && layer._containsPoint(point)) {
- candidateHoveredLayer = layer;
- }
- }
-
- if (candidateHoveredLayer !== this._hoveredLayer) {
- this._handleMouseOut(e);
-
- if (candidateHoveredLayer) {
- addClass(this._container, 'leaflet-interactive'); // change cursor
- this._fireEvent([candidateHoveredLayer], e, 'mouseover');
- this._hoveredLayer = candidateHoveredLayer;
- }
- }
-
- if (this._hoveredLayer) {
- this._fireEvent([this._hoveredLayer], e);
- }
-
- this._mouseHoverThrottled = true;
- setTimeout(bind(function () {
- this._mouseHoverThrottled = false;
- }, this), 32);
- },
-
- _fireEvent: function (layers, e, type) {
- this._map._fireDOMEvent(e, type || e.type, layers);
- },
-
- _bringToFront: function (layer) {
- var order = layer._order;
-
- if (!order) { return; }
-
- var next = order.next;
- var prev = order.prev;
-
- if (next) {
- next.prev = prev;
- } else {
- // Already last
- return;
- }
- if (prev) {
- prev.next = next;
- } else if (next) {
- // Update first entry unless this is the
- // single entry
- this._drawFirst = next;
- }
-
- order.prev = this._drawLast;
- this._drawLast.next = order;
-
- order.next = null;
- this._drawLast = order;
-
- this._requestRedraw(layer);
- },
-
- _bringToBack: function (layer) {
- var order = layer._order;
-
- if (!order) { return; }
-
- var next = order.next;
- var prev = order.prev;
-
- if (prev) {
- prev.next = next;
- } else {
- // Already first
- return;
- }
- if (next) {
- next.prev = prev;
- } else if (prev) {
- // Update last entry unless this is the
- // single entry
- this._drawLast = prev;
- }
-
- order.prev = null;
-
- order.next = this._drawFirst;
- this._drawFirst.prev = order;
- this._drawFirst = order;
-
- this._requestRedraw(layer);
- }
- });
-
- // @factory L.canvas(options?: Renderer options)
- // Creates a Canvas renderer with the given options.
- function canvas$1(options) {
- return canvas ? new Canvas(options) : null;
- }
-
- /*
- * Thanks to Dmitry Baranovsky and his Raphael library for inspiration!
- */
-
-
- var vmlCreate = (function () {
- try {
- document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml');
- return function (name) {
- return document.createElement('<lvml:' + name + ' class="lvml">');
- };
- } catch (e) {
- return function (name) {
- return document.createElement('<' + name + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">');
- };
- }
- })();
-
-
- /*
- * @class SVG
- *
- *
- * VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
- * with old versions of Internet Explorer.
- */
-
- // mixin to redefine some SVG methods to handle VML syntax which is similar but with some differences
- var vmlMixin = {
-
- _initContainer: function () {
- this._container = create$1('div', 'leaflet-vml-container');
- },
-
- _update: function () {
- if (this._map._animatingZoom) { return; }
- Renderer.prototype._update.call(this);
- this.fire('update');
- },
-
- _initPath: function (layer) {
- var container = layer._container = vmlCreate('shape');
-
- addClass(container, 'leaflet-vml-shape ' + (this.options.className || ''));
-
- container.coordsize = '1 1';
-
- layer._path = vmlCreate('path');
- container.appendChild(layer._path);
-
- this._updateStyle(layer);
- this._layers[stamp(layer)] = layer;
- },
-
- _addPath: function (layer) {
- var container = layer._container;
- this._container.appendChild(container);
-
- if (layer.options.interactive) {
- layer.addInteractiveTarget(container);
- }
- },
-
- _removePath: function (layer) {
- var container = layer._container;
- remove(container);
- layer.removeInteractiveTarget(container);
- delete this._layers[stamp(layer)];
- },
-
- _updateStyle: function (layer) {
- var stroke = layer._stroke,
- fill = layer._fill,
- options = layer.options,
- container = layer._container;
-
- container.stroked = !!options.stroke;
- container.filled = !!options.fill;
-
- if (options.stroke) {
- if (!stroke) {
- stroke = layer._stroke = vmlCreate('stroke');
- }
- container.appendChild(stroke);
- stroke.weight = options.weight + 'px';
- stroke.color = options.color;
- stroke.opacity = options.opacity;
-
- if (options.dashArray) {
- stroke.dashStyle = isArray(options.dashArray) ?
- options.dashArray.join(' ') :
- options.dashArray.replace(/( *, *)/g, ' ');
- } else {
- stroke.dashStyle = '';
- }
- stroke.endcap = options.lineCap.replace('butt', 'flat');
- stroke.joinstyle = options.lineJoin;
-
- } else if (stroke) {
- container.removeChild(stroke);
- layer._stroke = null;
- }
-
- if (options.fill) {
- if (!fill) {
- fill = layer._fill = vmlCreate('fill');
- }
- container.appendChild(fill);
- fill.color = options.fillColor || options.color;
- fill.opacity = options.fillOpacity;
-
- } else if (fill) {
- container.removeChild(fill);
- layer._fill = null;
- }
- },
-
- _updateCircle: function (layer) {
- var p = layer._point.round(),
- r = Math.round(layer._radius),
- r2 = Math.round(layer._radiusY || r);
-
- this._setPath(layer, layer._empty() ? 'M0 0' :
- 'AL ' + p.x + ',' + p.y + ' ' + r + ',' + r2 + ' 0,' + (65535 * 360));
- },
-
- _setPath: function (layer, path) {
- layer._path.v = path;
- },
-
- _bringToFront: function (layer) {
- toFront(layer._container);
- },
-
- _bringToBack: function (layer) {
- toBack(layer._container);
- }
- };
-
- var create$2 = vml ? vmlCreate : svgCreate;
-
- /*
- * @class SVG
- * @inherits Renderer
- * @aka L.SVG
- *
- * Allows vector layers to be displayed with [SVG](https://developer.mozilla.org/docs/Web/SVG).
- * Inherits `Renderer`.
- *
- * Due to [technical limitations](http://caniuse.com/#search=svg), SVG is not
- * available in all web browsers, notably Android 2.x and 3.x.
- *
- * Although SVG is not available on IE7 and IE8, these browsers support
- * [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language)
- * (a now deprecated technology), and the SVG renderer will fall back to VML in
- * this case.
- *
- * @example
- *
- * Use SVG by default for all paths in the map:
- *
- * ```js
- * var map = L.map('map', {
- * renderer: L.svg()
- * });
- * ```
- *
- * Use a SVG renderer with extra padding for specific vector geometries:
- *
- * ```js
- * var map = L.map('map');
- * var myRenderer = L.svg({ padding: 0.5 });
- * var line = L.polyline( coordinates, { renderer: myRenderer } );
- * var circle = L.circle( center, { renderer: myRenderer } );
- * ```
- */
-
- var SVG = Renderer.extend({
-
- getEvents: function () {
- var events = Renderer.prototype.getEvents.call(this);
- events.zoomstart = this._onZoomStart;
- return events;
- },
-
- _initContainer: function () {
- this._container = create$2('svg');
-
- // makes it possible to click through svg root; we'll reset it back in individual paths
- this._container.setAttribute('pointer-events', 'none');
-
- this._rootGroup = create$2('g');
- this._container.appendChild(this._rootGroup);
- },
-
- _destroyContainer: function () {
- remove(this._container);
- off(this._container);
- delete this._container;
- delete this._rootGroup;
- delete this._svgSize;
- },
-
- _onZoomStart: function () {
- // Drag-then-pinch interactions might mess up the center and zoom.
- // In this case, the easiest way to prevent this is re-do the renderer
- // bounds and padding when the zooming starts.
- this._update();
- },
-
- _update: function () {
- if (this._map._animatingZoom && this._bounds) { return; }
-
- Renderer.prototype._update.call(this);
-
- var b = this._bounds,
- size = b.getSize(),
- container = this._container;
-
- // set size of svg-container if changed
- if (!this._svgSize || !this._svgSize.equals(size)) {
- this._svgSize = size;
- container.setAttribute('width', size.x);
- container.setAttribute('height', size.y);
- }
-
- // movement: update container viewBox so that we don't have to change coordinates of individual layers
- setPosition(container, b.min);
- container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' '));
-
- this.fire('update');
- },
-
- // methods below are called by vector layers implementations
-
- _initPath: function (layer) {
- var path = layer._path = create$2('path');
-
- // @namespace Path
- // @option className: String = null
- // Custom class name set on an element. Only for SVG renderer.
- if (layer.options.className) {
- addClass(path, layer.options.className);
- }
-
- if (layer.options.interactive) {
- addClass(path, 'leaflet-interactive');
- }
-
- this._updateStyle(layer);
- this._layers[stamp(layer)] = layer;
- },
-
- _addPath: function (layer) {
- if (!this._rootGroup) { this._initContainer(); }
- this._rootGroup.appendChild(layer._path);
- layer.addInteractiveTarget(layer._path);
- },
-
- _removePath: function (layer) {
- remove(layer._path);
- layer.removeInteractiveTarget(layer._path);
- delete this._layers[stamp(layer)];
- },
-
- _updatePath: function (layer) {
- layer._project();
- layer._update();
- },
-
- _updateStyle: function (layer) {
- var path = layer._path,
- options = layer.options;
-
- if (!path) { return; }
-
- if (options.stroke) {
- path.setAttribute('stroke', options.color);
- path.setAttribute('stroke-opacity', options.opacity);
- path.setAttribute('stroke-width', options.weight);
- path.setAttribute('stroke-linecap', options.lineCap);
- path.setAttribute('stroke-linejoin', options.lineJoin);
-
- if (options.dashArray) {
- path.setAttribute('stroke-dasharray', options.dashArray);
- } else {
- path.removeAttribute('stroke-dasharray');
- }
-
- if (options.dashOffset) {
- path.setAttribute('stroke-dashoffset', options.dashOffset);
- } else {
- path.removeAttribute('stroke-dashoffset');
- }
- } else {
- path.setAttribute('stroke', 'none');
- }
-
- if (options.fill) {
- path.setAttribute('fill', options.fillColor || options.color);
- path.setAttribute('fill-opacity', options.fillOpacity);
- path.setAttribute('fill-rule', options.fillRule || 'evenodd');
- } else {
- path.setAttribute('fill', 'none');
- }
- },
-
- _updatePoly: function (layer, closed) {
- this._setPath(layer, pointsToPath(layer._parts, closed));
- },
-
- _updateCircle: function (layer) {
- var p = layer._point,
- r = Math.max(Math.round(layer._radius), 1),
- r2 = Math.max(Math.round(layer._radiusY), 1) || r,
- arc = 'a' + r + ',' + r2 + ' 0 1,0 ';
-
- // drawing a circle with two half-arcs
- var d = layer._empty() ? 'M0 0' :
- 'M' + (p.x - r) + ',' + p.y +
- arc + (r * 2) + ',0 ' +
- arc + (-r * 2) + ',0 ';
-
- this._setPath(layer, d);
- },
-
- _setPath: function (layer, path) {
- layer._path.setAttribute('d', path);
- },
-
- // SVG does not have the concept of zIndex so we resort to changing the DOM order of elements
- _bringToFront: function (layer) {
- toFront(layer._path);
- },
-
- _bringToBack: function (layer) {
- toBack(layer._path);
- }
- });
-
- if (vml) {
- SVG.include(vmlMixin);
- }
-
- // @namespace SVG
- // @factory L.svg(options?: Renderer options)
- // Creates a SVG renderer with the given options.
- function svg$1(options) {
- return svg || vml ? new SVG(options) : null;
- }
-
- Map.include({
- // @namespace Map; @method getRenderer(layer: Path): Renderer
- // Returns the instance of `Renderer` that should be used to render the given
- // `Path`. It will ensure that the `renderer` options of the map and paths
- // are respected, and that the renderers do exist on the map.
- getRenderer: function (layer) {
- // @namespace Path; @option renderer: Renderer
- // Use this specific instance of `Renderer` for this path. Takes
- // precedence over the map's [default renderer](#map-renderer).
- var renderer = layer.options.renderer || this._getPaneRenderer(layer.options.pane) || this.options.renderer || this._renderer;
-
- if (!renderer) {
- renderer = this._renderer = this._createRenderer();
- }
-
- if (!this.hasLayer(renderer)) {
- this.addLayer(renderer);
- }
- return renderer;
- },
-
- _getPaneRenderer: function (name) {
- if (name === 'overlayPane' || name === undefined) {
- return false;
- }
-
- var renderer = this._paneRenderers[name];
- if (renderer === undefined) {
- renderer = this._createRenderer({pane: name});
- this._paneRenderers[name] = renderer;
- }
- return renderer;
- },
-
- _createRenderer: function (options) {
- // @namespace Map; @option preferCanvas: Boolean = false
- // Whether `Path`s should be rendered on a `Canvas` renderer.
- // By default, all `Path`s are rendered in a `SVG` renderer.
- return (this.options.preferCanvas && canvas$1(options)) || svg$1(options);
- }
- });
-
- /*
- * L.Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object.
- */
-
- /*
- * @class Rectangle
- * @aka L.Rectangle
- * @inherits Polygon
- *
- * A class for drawing rectangle overlays on a map. Extends `Polygon`.
- *
- * @example
- *
- * ```js
- * // define rectangle geographical bounds
- * var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];
- *
- * // create an orange rectangle
- * L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
- *
- * // zoom the map to the rectangle bounds
- * map.fitBounds(bounds);
- * ```
- *
- */
-
-
- var Rectangle = Polygon.extend({
- initialize: function (latLngBounds, options) {
- Polygon.prototype.initialize.call(this, this._boundsToLatLngs(latLngBounds), options);
- },
-
- // @method setBounds(latLngBounds: LatLngBounds): this
- // Redraws the rectangle with the passed bounds.
- setBounds: function (latLngBounds) {
- return this.setLatLngs(this._boundsToLatLngs(latLngBounds));
- },
-
- _boundsToLatLngs: function (latLngBounds) {
- latLngBounds = toLatLngBounds(latLngBounds);
- return [
- latLngBounds.getSouthWest(),
- latLngBounds.getNorthWest(),
- latLngBounds.getNorthEast(),
- latLngBounds.getSouthEast()
- ];
- }
- });
-
-
- // @factory L.rectangle(latLngBounds: LatLngBounds, options?: Polyline options)
- function rectangle(latLngBounds, options) {
- return new Rectangle(latLngBounds, options);
- }
-
- SVG.create = create$2;
- SVG.pointsToPath = pointsToPath;
-
- GeoJSON.geometryToLayer = geometryToLayer;
- GeoJSON.coordsToLatLng = coordsToLatLng;
- GeoJSON.coordsToLatLngs = coordsToLatLngs;
- GeoJSON.latLngToCoords = latLngToCoords;
- GeoJSON.latLngsToCoords = latLngsToCoords;
- GeoJSON.getFeature = getFeature;
- GeoJSON.asFeature = asFeature;
-
- /*
- * L.Handler.BoxZoom is used to add shift-drag zoom interaction to the map
- * (zoom to a selected bounding box), enabled by default.
- */
-
- // @namespace Map
- // @section Interaction Options
- Map.mergeOptions({
- // @option boxZoom: Boolean = true
- // Whether the map can be zoomed to a rectangular area specified by
- // dragging the mouse while pressing the shift key.
- boxZoom: true
- });
-
- var BoxZoom = Handler.extend({
- initialize: function (map) {
- this._map = map;
- this._container = map._container;
- this._pane = map._panes.overlayPane;
- this._resetStateTimeout = 0;
- map.on('unload', this._destroy, this);
- },
-
- addHooks: function () {
- on(this._container, 'mousedown', this._onMouseDown, this);
- },
-
- removeHooks: function () {
- off(this._container, 'mousedown', this._onMouseDown, this);
- },
-
- moved: function () {
- return this._moved;
- },
-
- _destroy: function () {
- remove(this._pane);
- delete this._pane;
- },
-
- _resetState: function () {
- this._resetStateTimeout = 0;
- this._moved = false;
- },
-
- _clearDeferredResetState: function () {
- if (this._resetStateTimeout !== 0) {
- clearTimeout(this._resetStateTimeout);
- this._resetStateTimeout = 0;
- }
- },
-
- _onMouseDown: function (e) {
- if (!e.shiftKey || ((e.which !== 1) && (e.button !== 1))) { return false; }
-
- // Clear the deferred resetState if it hasn't executed yet, otherwise it
- // will interrupt the interaction and orphan a box element in the container.
- this._clearDeferredResetState();
- this._resetState();
-
- disableTextSelection();
- disableImageDrag();
-
- this._startPoint = this._map.mouseEventToContainerPoint(e);
-
- on(document, {
- contextmenu: stop,
- mousemove: this._onMouseMove,
- mouseup: this._onMouseUp,
- keydown: this._onKeyDown
- }, this);
- },
-
- _onMouseMove: function (e) {
- if (!this._moved) {
- this._moved = true;
-
- this._box = create$1('div', 'leaflet-zoom-box', this._container);
- addClass(this._container, 'leaflet-crosshair');
-
- this._map.fire('boxzoomstart');
- }
-
- this._point = this._map.mouseEventToContainerPoint(e);
-
- var bounds = new Bounds(this._point, this._startPoint),
- size = bounds.getSize();
-
- setPosition(this._box, bounds.min);
-
- this._box.style.width = size.x + 'px';
- this._box.style.height = size.y + 'px';
- },
-
- _finish: function () {
- if (this._moved) {
- remove(this._box);
- removeClass(this._container, 'leaflet-crosshair');
- }
-
- enableTextSelection();
- enableImageDrag();
-
- off(document, {
- contextmenu: stop,
- mousemove: this._onMouseMove,
- mouseup: this._onMouseUp,
- keydown: this._onKeyDown
- }, this);
- },
-
- _onMouseUp: function (e) {
- if ((e.which !== 1) && (e.button !== 1)) { return; }
-
- this._finish();
-
- if (!this._moved) { return; }
- // Postpone to next JS tick so internal click event handling
- // still see it as "moved".
- this._clearDeferredResetState();
- this._resetStateTimeout = setTimeout(bind(this._resetState, this), 0);
-
- var bounds = new LatLngBounds(
- this._map.containerPointToLatLng(this._startPoint),
- this._map.containerPointToLatLng(this._point));
-
- this._map
- .fitBounds(bounds)
- .fire('boxzoomend', {boxZoomBounds: bounds});
- },
-
- _onKeyDown: function (e) {
- if (e.keyCode === 27) {
- this._finish();
- }
- }
- });
-
- // @section Handlers
- // @property boxZoom: Handler
- // Box (shift-drag with mouse) zoom handler.
- Map.addInitHook('addHandler', 'boxZoom', BoxZoom);
-
- /*
- * L.Handler.DoubleClickZoom is used to handle double-click zoom on the map, enabled by default.
- */
-
- // @namespace Map
- // @section Interaction Options
-
- Map.mergeOptions({
- // @option doubleClickZoom: Boolean|String = true
- // Whether the map can be zoomed in by double clicking on it and
- // zoomed out by double clicking while holding shift. If passed
- // `'center'`, double-click zoom will zoom to the center of the
- // view regardless of where the mouse was.
- doubleClickZoom: true
- });
-
- var DoubleClickZoom = Handler.extend({
- addHooks: function () {
- this._map.on('dblclick', this._onDoubleClick, this);
- },
-
- removeHooks: function () {
- this._map.off('dblclick', this._onDoubleClick, this);
- },
-
- _onDoubleClick: function (e) {
- var map = this._map,
- oldZoom = map.getZoom(),
- delta = map.options.zoomDelta,
- zoom = e.originalEvent.shiftKey ? oldZoom - delta : oldZoom + delta;
-
- if (map.options.doubleClickZoom === 'center') {
- map.setZoom(zoom);
- } else {
- map.setZoomAround(e.containerPoint, zoom);
- }
- }
- });
-
- // @section Handlers
- //
- // Map properties include interaction handlers that allow you to control
- // interaction behavior in runtime, enabling or disabling certain features such
- // as dragging or touch zoom (see `Handler` methods). For example:
- //
- // ```js
- // map.doubleClickZoom.disable();
- // ```
- //
- // @property doubleClickZoom: Handler
- // Double click zoom handler.
- Map.addInitHook('addHandler', 'doubleClickZoom', DoubleClickZoom);
-
- /*
- * L.Handler.MapDrag is used to make the map draggable (with panning inertia), enabled by default.
- */
-
- // @namespace Map
- // @section Interaction Options
- Map.mergeOptions({
- // @option dragging: Boolean = true
- // Whether the map be draggable with mouse/touch or not.
- dragging: true,
-
- // @section Panning Inertia Options
- // @option inertia: Boolean = *
- // If enabled, panning of the map will have an inertia effect where
- // the map builds momentum while dragging and continues moving in
- // the same direction for some time. Feels especially nice on touch
- // devices. Enabled by default unless running on old Android devices.
- inertia: !android23,
-
- // @option inertiaDeceleration: Number = 3000
- // The rate with which the inertial movement slows down, in pixels/second².
- inertiaDeceleration: 3400, // px/s^2
-
- // @option inertiaMaxSpeed: Number = Infinity
- // Max speed of the inertial movement, in pixels/second.
- inertiaMaxSpeed: Infinity, // px/s
-
- // @option easeLinearity: Number = 0.2
- easeLinearity: 0.2,
-
- // TODO refactor, move to CRS
- // @option worldCopyJump: Boolean = false
- // With this option enabled, the map tracks when you pan to another "copy"
- // of the world and seamlessly jumps to the original one so that all overlays
- // like markers and vector layers are still visible.
- worldCopyJump: false,
-
- // @option maxBoundsViscosity: Number = 0.0
- // If `maxBounds` is set, this option will control how solid the bounds
- // are when dragging the map around. The default value of `0.0` allows the
- // user to drag outside the bounds at normal speed, higher values will
- // slow down map dragging outside bounds, and `1.0` makes the bounds fully
- // solid, preventing the user from dragging outside the bounds.
- maxBoundsViscosity: 0.0
- });
-
- var Drag = Handler.extend({
- addHooks: function () {
- if (!this._draggable) {
- var map = this._map;
-
- this._draggable = new Draggable(map._mapPane, map._container);
-
- this._draggable.on({
- dragstart: this._onDragStart,
- drag: this._onDrag,
- dragend: this._onDragEnd
- }, this);
-
- this._draggable.on('predrag', this._onPreDragLimit, this);
- if (map.options.worldCopyJump) {
- this._draggable.on('predrag', this._onPreDragWrap, this);
- map.on('zoomend', this._onZoomEnd, this);
-
- map.whenReady(this._onZoomEnd, this);
- }
- }
- addClass(this._map._container, 'leaflet-grab leaflet-touch-drag');
- this._draggable.enable();
- this._positions = [];
- this._times = [];
- },
-
- removeHooks: function () {
- removeClass(this._map._container, 'leaflet-grab');
- removeClass(this._map._container, 'leaflet-touch-drag');
- this._draggable.disable();
- },
-
- moved: function () {
- return this._draggable && this._draggable._moved;
- },
-
- moving: function () {
- return this._draggable && this._draggable._moving;
- },
-
- _onDragStart: function () {
- var map = this._map;
-
- map._stop();
- if (this._map.options.maxBounds && this._map.options.maxBoundsViscosity) {
- var bounds = toLatLngBounds(this._map.options.maxBounds);
-
- this._offsetLimit = toBounds(
- this._map.latLngToContainerPoint(bounds.getNorthWest()).multiplyBy(-1),
- this._map.latLngToContainerPoint(bounds.getSouthEast()).multiplyBy(-1)
- .add(this._map.getSize()));
-
- this._viscosity = Math.min(1.0, Math.max(0.0, this._map.options.maxBoundsViscosity));
- } else {
- this._offsetLimit = null;
- }
-
- map
- .fire('movestart')
- .fire('dragstart');
-
- if (map.options.inertia) {
- this._positions = [];
- this._times = [];
- }
- },
-
- _onDrag: function (e) {
- if (this._map.options.inertia) {
- var time = this._lastTime = +new Date(),
- pos = this._lastPos = this._draggable._absPos || this._draggable._newPos;
-
- this._positions.push(pos);
- this._times.push(time);
-
- this._prunePositions(time);
- }
-
- this._map
- .fire('move', e)
- .fire('drag', e);
- },
-
- _prunePositions: function (time) {
- while (this._positions.length > 1 && time - this._times[0] > 50) {
- this._positions.shift();
- this._times.shift();
- }
- },
-
- _onZoomEnd: function () {
- var pxCenter = this._map.getSize().divideBy(2),
- pxWorldCenter = this._map.latLngToLayerPoint([0, 0]);
-
- this._initialWorldOffset = pxWorldCenter.subtract(pxCenter).x;
- this._worldWidth = this._map.getPixelWorldBounds().getSize().x;
- },
-
- _viscousLimit: function (value, threshold) {
- return value - (value - threshold) * this._viscosity;
- },
-
- _onPreDragLimit: function () {
- if (!this._viscosity || !this._offsetLimit) { return; }
-
- var offset = this._draggable._newPos.subtract(this._draggable._startPos);
-
- var limit = this._offsetLimit;
- if (offset.x < limit.min.x) { offset.x = this._viscousLimit(offset.x, limit.min.x); }
- if (offset.y < limit.min.y) { offset.y = this._viscousLimit(offset.y, limit.min.y); }
- if (offset.x > limit.max.x) { offset.x = this._viscousLimit(offset.x, limit.max.x); }
- if (offset.y > limit.max.y) { offset.y = this._viscousLimit(offset.y, limit.max.y); }
-
- this._draggable._newPos = this._draggable._startPos.add(offset);
- },
-
- _onPreDragWrap: function () {
- // TODO refactor to be able to adjust map pane position after zoom
- var worldWidth = this._worldWidth,
- halfWidth = Math.round(worldWidth / 2),
- dx = this._initialWorldOffset,
- x = this._draggable._newPos.x,
- newX1 = (x - halfWidth + dx) % worldWidth + halfWidth - dx,
- newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx,
- newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2;
-
- this._draggable._absPos = this._draggable._newPos.clone();
- this._draggable._newPos.x = newX;
- },
-
- _onDragEnd: function (e) {
- var map = this._map,
- options = map.options,
-
- noInertia = !options.inertia || this._times.length < 2;
-
- map.fire('dragend', e);
-
- if (noInertia) {
- map.fire('moveend');
-
- } else {
- this._prunePositions(+new Date());
-
- var direction = this._lastPos.subtract(this._positions[0]),
- duration = (this._lastTime - this._times[0]) / 1000,
- ease = options.easeLinearity,
-
- speedVector = direction.multiplyBy(ease / duration),
- speed = speedVector.distanceTo([0, 0]),
-
- limitedSpeed = Math.min(options.inertiaMaxSpeed, speed),
- limitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed),
-
- decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease),
- offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();
-
- if (!offset.x && !offset.y) {
- map.fire('moveend');
-
- } else {
- offset = map._limitOffset(offset, map.options.maxBounds);
-
- requestAnimFrame(function () {
- map.panBy(offset, {
- duration: decelerationDuration,
- easeLinearity: ease,
- noMoveStart: true,
- animate: true
- });
- });
- }
- }
- }
- });
-
- // @section Handlers
- // @property dragging: Handler
- // Map dragging handler (by both mouse and touch).
- Map.addInitHook('addHandler', 'dragging', Drag);
-
- /*
- * L.Map.Keyboard is handling keyboard interaction with the map, enabled by default.
- */
-
- // @namespace Map
- // @section Keyboard Navigation Options
- Map.mergeOptions({
- // @option keyboard: Boolean = true
- // Makes the map focusable and allows users to navigate the map with keyboard
- // arrows and `+`/`-` keys.
- keyboard: true,
-
- // @option keyboardPanDelta: Number = 80
- // Amount of pixels to pan when pressing an arrow key.
- keyboardPanDelta: 80
- });
-
- var Keyboard = Handler.extend({
-
- keyCodes: {
- left: [37],
- right: [39],
- down: [40],
- up: [38],
- zoomIn: [187, 107, 61, 171],
- zoomOut: [189, 109, 54, 173]
- },
-
- initialize: function (map) {
- this._map = map;
-
- this._setPanDelta(map.options.keyboardPanDelta);
- this._setZoomDelta(map.options.zoomDelta);
- },
-
- addHooks: function () {
- var container = this._map._container;
-
- // make the container focusable by tabbing
- if (container.tabIndex <= 0) {
- container.tabIndex = '0';
- }
-
- on(container, {
- focus: this._onFocus,
- blur: this._onBlur,
- mousedown: this._onMouseDown
- }, this);
-
- this._map.on({
- focus: this._addHooks,
- blur: this._removeHooks
- }, this);
- },
-
- removeHooks: function () {
- this._removeHooks();
-
- off(this._map._container, {
- focus: this._onFocus,
- blur: this._onBlur,
- mousedown: this._onMouseDown
- }, this);
-
- this._map.off({
- focus: this._addHooks,
- blur: this._removeHooks
- }, this);
- },
-
- _onMouseDown: function () {
- if (this._focused) { return; }
-
- var body = document.body,
- docEl = document.documentElement,
- top = body.scrollTop || docEl.scrollTop,
- left = body.scrollLeft || docEl.scrollLeft;
-
- this._map._container.focus();
-
- window.scrollTo(left, top);
- },
-
- _onFocus: function () {
- this._focused = true;
- this._map.fire('focus');
- },
-
- _onBlur: function () {
- this._focused = false;
- this._map.fire('blur');
- },
-
- _setPanDelta: function (panDelta) {
- var keys = this._panKeys = {},
- codes = this.keyCodes,
- i, len;
-
- for (i = 0, len = codes.left.length; i < len; i++) {
- keys[codes.left[i]] = [-1 * panDelta, 0];
- }
- for (i = 0, len = codes.right.length; i < len; i++) {
- keys[codes.right[i]] = [panDelta, 0];
- }
- for (i = 0, len = codes.down.length; i < len; i++) {
- keys[codes.down[i]] = [0, panDelta];
- }
- for (i = 0, len = codes.up.length; i < len; i++) {
- keys[codes.up[i]] = [0, -1 * panDelta];
- }
- },
-
- _setZoomDelta: function (zoomDelta) {
- var keys = this._zoomKeys = {},
- codes = this.keyCodes,
- i, len;
-
- for (i = 0, len = codes.zoomIn.length; i < len; i++) {
- keys[codes.zoomIn[i]] = zoomDelta;
- }
- for (i = 0, len = codes.zoomOut.length; i < len; i++) {
- keys[codes.zoomOut[i]] = -zoomDelta;
- }
- },
-
- _addHooks: function () {
- on(document, 'keydown', this._onKeyDown, this);
- },
-
- _removeHooks: function () {
- off(document, 'keydown', this._onKeyDown, this);
- },
-
- _onKeyDown: function (e) {
- if (e.altKey || e.ctrlKey || e.metaKey) { return; }
-
- var key = e.keyCode,
- map = this._map,
- offset;
-
- if (key in this._panKeys) {
- if (!map._panAnim || !map._panAnim._inProgress) {
- offset = this._panKeys[key];
- if (e.shiftKey) {
- offset = toPoint(offset).multiplyBy(3);
- }
-
- map.panBy(offset);
-
- if (map.options.maxBounds) {
- map.panInsideBounds(map.options.maxBounds);
- }
- }
- } else if (key in this._zoomKeys) {
- map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
-
- } else if (key === 27 && map._popup && map._popup.options.closeOnEscapeKey) {
- map.closePopup();
-
- } else {
- return;
- }
-
- stop(e);
- }
- });
-
- // @section Handlers
- // @section Handlers
- // @property keyboard: Handler
- // Keyboard navigation handler.
- Map.addInitHook('addHandler', 'keyboard', Keyboard);
-
- /*
- * L.Handler.ScrollWheelZoom is used by L.Map to enable mouse scroll wheel zoom on the map.
- */
-
- // @namespace Map
- // @section Interaction Options
- Map.mergeOptions({
- // @section Mouse wheel options
- // @option scrollWheelZoom: Boolean|String = true
- // Whether the map can be zoomed by using the mouse wheel. If passed `'center'`,
- // it will zoom to the center of the view regardless of where the mouse was.
- scrollWheelZoom: true,
-
- // @option wheelDebounceTime: Number = 40
- // Limits the rate at which a wheel can fire (in milliseconds). By default
- // user can't zoom via wheel more often than once per 40 ms.
- wheelDebounceTime: 40,
-
- // @option wheelPxPerZoomLevel: Number = 60
- // How many scroll pixels (as reported by [L.DomEvent.getWheelDelta](#domevent-getwheeldelta))
- // mean a change of one full zoom level. Smaller values will make wheel-zooming
- // faster (and vice versa).
- wheelPxPerZoomLevel: 60
- });
-
- var ScrollWheelZoom = Handler.extend({
- addHooks: function () {
- on(this._map._container, 'wheel', this._onWheelScroll, this);
-
- this._delta = 0;
- },
-
- removeHooks: function () {
- off(this._map._container, 'wheel', this._onWheelScroll, this);
- },
-
- _onWheelScroll: function (e) {
- var delta = getWheelDelta(e);
-
- var debounce = this._map.options.wheelDebounceTime;
-
- this._delta += delta;
- this._lastMousePos = this._map.mouseEventToContainerPoint(e);
-
- if (!this._startTime) {
- this._startTime = +new Date();
- }
-
- var left = Math.max(debounce - (+new Date() - this._startTime), 0);
-
- clearTimeout(this._timer);
- this._timer = setTimeout(bind(this._performZoom, this), left);
-
- stop(e);
- },
-
- _performZoom: function () {
- var map = this._map,
- zoom = map.getZoom(),
- snap = this._map.options.zoomSnap || 0;
-
- map._stop(); // stop panning and fly animations if any
-
- // map the delta with a sigmoid function to -4..4 range leaning on -1..1
- var d2 = this._delta / (this._map.options.wheelPxPerZoomLevel * 4),
- d3 = 4 * Math.log(2 / (1 + Math.exp(-Math.abs(d2)))) / Math.LN2,
- d4 = snap ? Math.ceil(d3 / snap) * snap : d3,
- delta = map._limitZoom(zoom + (this._delta > 0 ? d4 : -d4)) - zoom;
-
- this._delta = 0;
- this._startTime = null;
-
- if (!delta) { return; }
-
- if (map.options.scrollWheelZoom === 'center') {
- map.setZoom(zoom + delta);
- } else {
- map.setZoomAround(this._lastMousePos, zoom + delta);
- }
- }
- });
-
- // @section Handlers
- // @property scrollWheelZoom: Handler
- // Scroll wheel zoom handler.
- Map.addInitHook('addHandler', 'scrollWheelZoom', ScrollWheelZoom);
-
- /*
- * L.Map.Tap is used to enable mobile hacks like quick taps and long hold.
- */
-
- // @namespace Map
- // @section Interaction Options
- Map.mergeOptions({
- // @section Touch interaction options
- // @option tap: Boolean = true
- // Enables mobile hacks for supporting instant taps (fixing 200ms click
- // delay on iOS/Android) and touch holds (fired as `contextmenu` events).
- tap: true,
-
- // @option tapTolerance: Number = 15
- // The max number of pixels a user can shift his finger during touch
- // for it to be considered a valid tap.
- tapTolerance: 15
- });
-
- var Tap = Handler.extend({
- addHooks: function () {
- on(this._map._container, 'touchstart', this._onDown, this);
- },
-
- removeHooks: function () {
- off(this._map._container, 'touchstart', this._onDown, this);
- },
-
- _onDown: function (e) {
- if (!e.touches) { return; }
-
- preventDefault(e);
-
- this._fireClick = true;
-
- // don't simulate click or track longpress if more than 1 touch
- if (e.touches.length > 1) {
- this._fireClick = false;
- clearTimeout(this._holdTimeout);
- return;
- }
-
- var first = e.touches[0],
- el = first.target;
-
- this._startPos = this._newPos = new Point(first.clientX, first.clientY);
-
- // if touching a link, highlight it
- if (el.tagName && el.tagName.toLowerCase() === 'a') {
- addClass(el, 'leaflet-active');
- }
-
- // simulate long hold but setting a timeout
- this._holdTimeout = setTimeout(bind(function () {
- if (this._isTapValid()) {
- this._fireClick = false;
- this._onUp();
- this._simulateEvent('contextmenu', first);
- }
- }, this), 1000);
-
- this._simulateEvent('mousedown', first);
-
- on(document, {
- touchmove: this._onMove,
- touchend: this._onUp
- }, this);
- },
-
- _onUp: function (e) {
- clearTimeout(this._holdTimeout);
-
- off(document, {
- touchmove: this._onMove,
- touchend: this._onUp
- }, this);
-
- if (this._fireClick && e && e.changedTouches) {
-
- var first = e.changedTouches[0],
- el = first.target;
-
- if (el && el.tagName && el.tagName.toLowerCase() === 'a') {
- removeClass(el, 'leaflet-active');
- }
-
- this._simulateEvent('mouseup', first);
-
- // simulate click if the touch didn't move too much
- if (this._isTapValid()) {
- this._simulateEvent('click', first);
- }
- }
- },
-
- _isTapValid: function () {
- return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance;
- },
-
- _onMove: function (e) {
- var first = e.touches[0];
- this._newPos = new Point(first.clientX, first.clientY);
- this._simulateEvent('mousemove', first);
- },
-
- _simulateEvent: function (type, e) {
- var simulatedEvent = document.createEvent('MouseEvents');
-
- simulatedEvent._simulated = true;
- e.target._simulatedClick = true;
-
- simulatedEvent.initMouseEvent(
- type, true, true, window, 1,
- e.screenX, e.screenY,
- e.clientX, e.clientY,
- false, false, false, false, 0, null);
-
- e.target.dispatchEvent(simulatedEvent);
- }
- });
-
- // @section Handlers
- // @property tap: Handler
- // Mobile touch hacks (quick tap and touch hold) handler.
- if (touch && (!pointer || safari)) {
- Map.addInitHook('addHandler', 'tap', Tap);
- }
-
- /*
- * L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers.
- */
-
- // @namespace Map
- // @section Interaction Options
- Map.mergeOptions({
- // @section Touch interaction options
- // @option touchZoom: Boolean|String = *
- // Whether the map can be zoomed by touch-dragging with two fingers. If
- // passed `'center'`, it will zoom to the center of the view regardless of
- // where the touch events (fingers) were. Enabled for touch-capable web
- // browsers except for old Androids.
- touchZoom: touch && !android23,
-
- // @option bounceAtZoomLimits: Boolean = true
- // Set it to false if you don't want the map to zoom beyond min/max zoom
- // and then bounce back when pinch-zooming.
- bounceAtZoomLimits: true
- });
-
- var TouchZoom = Handler.extend({
- addHooks: function () {
- addClass(this._map._container, 'leaflet-touch-zoom');
- on(this._map._container, 'touchstart', this._onTouchStart, this);
- },
-
- removeHooks: function () {
- removeClass(this._map._container, 'leaflet-touch-zoom');
- off(this._map._container, 'touchstart', this._onTouchStart, this);
- },
-
- _onTouchStart: function (e) {
- var map = this._map;
- if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; }
-
- var p1 = map.mouseEventToContainerPoint(e.touches[0]),
- p2 = map.mouseEventToContainerPoint(e.touches[1]);
-
- this._centerPoint = map.getSize()._divideBy(2);
- this._startLatLng = map.containerPointToLatLng(this._centerPoint);
- if (map.options.touchZoom !== 'center') {
- this._pinchStartLatLng = map.containerPointToLatLng(p1.add(p2)._divideBy(2));
- }
-
- this._startDist = p1.distanceTo(p2);
- this._startZoom = map.getZoom();
-
- this._moved = false;
- this._zooming = true;
-
- map._stop();
-
- on(document, 'touchmove', this._onTouchMove, this);
- on(document, 'touchend', this._onTouchEnd, this);
-
- preventDefault(e);
- },
-
- _onTouchMove: function (e) {
- if (!e.touches || e.touches.length !== 2 || !this._zooming) { return; }
-
- var map = this._map,
- p1 = map.mouseEventToContainerPoint(e.touches[0]),
- p2 = map.mouseEventToContainerPoint(e.touches[1]),
- scale = p1.distanceTo(p2) / this._startDist;
-
- this._zoom = map.getScaleZoom(scale, this._startZoom);
-
- if (!map.options.bounceAtZoomLimits && (
- (this._zoom < map.getMinZoom() && scale < 1) ||
- (this._zoom > map.getMaxZoom() && scale > 1))) {
- this._zoom = map._limitZoom(this._zoom);
- }
-
- if (map.options.touchZoom === 'center') {
- this._center = this._startLatLng;
- if (scale === 1) { return; }
- } else {
- // Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng
- var delta = p1._add(p2)._divideBy(2)._subtract(this._centerPoint);
- if (scale === 1 && delta.x === 0 && delta.y === 0) { return; }
- this._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom);
- }
-
- if (!this._moved) {
- map._moveStart(true, false);
- this._moved = true;
- }
-
- cancelAnimFrame(this._animRequest);
-
- var moveFn = bind(map._move, map, this._center, this._zoom, {pinch: true, round: false});
- this._animRequest = requestAnimFrame(moveFn, this, true);
-
- preventDefault(e);
- },
-
- _onTouchEnd: function () {
- if (!this._moved || !this._zooming) {
- this._zooming = false;
- return;
- }
-
- this._zooming = false;
- cancelAnimFrame(this._animRequest);
-
- off(document, 'touchmove', this._onTouchMove, this);
- off(document, 'touchend', this._onTouchEnd, this);
-
- // Pinch updates GridLayers' levels only when zoomSnap is off, so zoomSnap becomes noUpdate.
- if (this._map.options.zoomAnimation) {
- this._map._animateZoom(this._center, this._map._limitZoom(this._zoom), true, this._map.options.zoomSnap);
- } else {
- this._map._resetView(this._center, this._map._limitZoom(this._zoom));
- }
- }
- });
-
- // @section Handlers
- // @property touchZoom: Handler
- // Touch zoom handler.
- Map.addInitHook('addHandler', 'touchZoom', TouchZoom);
-
- Map.BoxZoom = BoxZoom;
- Map.DoubleClickZoom = DoubleClickZoom;
- Map.Drag = Drag;
- Map.Keyboard = Keyboard;
- Map.ScrollWheelZoom = ScrollWheelZoom;
- Map.Tap = Tap;
- Map.TouchZoom = TouchZoom;
-
- exports.version = version;
- exports.Control = Control;
- exports.control = control;
- exports.Browser = Browser;
- exports.Evented = Evented;
- exports.Mixin = Mixin;
- exports.Util = Util;
- exports.Class = Class;
- exports.Handler = Handler;
- exports.extend = extend;
- exports.bind = bind;
- exports.stamp = stamp;
- exports.setOptions = setOptions;
- exports.DomEvent = DomEvent;
- exports.DomUtil = DomUtil;
- exports.PosAnimation = PosAnimation;
- exports.Draggable = Draggable;
- exports.LineUtil = LineUtil;
- exports.PolyUtil = PolyUtil;
- exports.Point = Point;
- exports.point = toPoint;
- exports.Bounds = Bounds;
- exports.bounds = toBounds;
- exports.Transformation = Transformation;
- exports.transformation = toTransformation;
- exports.Projection = index;
- exports.LatLng = LatLng;
- exports.latLng = toLatLng;
- exports.LatLngBounds = LatLngBounds;
- exports.latLngBounds = toLatLngBounds;
- exports.CRS = CRS;
- exports.GeoJSON = GeoJSON;
- exports.geoJSON = geoJSON;
- exports.geoJson = geoJson;
- exports.Layer = Layer;
- exports.LayerGroup = LayerGroup;
- exports.layerGroup = layerGroup;
- exports.FeatureGroup = FeatureGroup;
- exports.featureGroup = featureGroup;
- exports.ImageOverlay = ImageOverlay;
- exports.imageOverlay = imageOverlay;
- exports.VideoOverlay = VideoOverlay;
- exports.videoOverlay = videoOverlay;
- exports.SVGOverlay = SVGOverlay;
- exports.svgOverlay = svgOverlay;
- exports.DivOverlay = DivOverlay;
- exports.Popup = Popup;
- exports.popup = popup;
- exports.Tooltip = Tooltip;
- exports.tooltip = tooltip;
- exports.Icon = Icon;
- exports.icon = icon;
- exports.DivIcon = DivIcon;
- exports.divIcon = divIcon;
- exports.Marker = Marker;
- exports.marker = marker;
- exports.TileLayer = TileLayer;
- exports.tileLayer = tileLayer;
- exports.GridLayer = GridLayer;
- exports.gridLayer = gridLayer;
- exports.SVG = SVG;
- exports.svg = svg$1;
- exports.Renderer = Renderer;
- exports.Canvas = Canvas;
- exports.canvas = canvas$1;
- exports.Path = Path;
- exports.CircleMarker = CircleMarker;
- exports.circleMarker = circleMarker;
- exports.Circle = Circle;
- exports.circle = circle;
- exports.Polyline = Polyline;
- exports.polyline = polyline;
- exports.Polygon = Polygon;
- exports.polygon = polygon;
- exports.Rectangle = Rectangle;
- exports.rectangle = rectangle;
- exports.Map = Map;
- exports.map = createMap;
-
- var oldL = window.L;
- exports.noConflict = function() {
- window.L = oldL;
- return this;
- };
-
- // Always export us to window global (see #2364)
- window.L = exports;
-
- })));
-
- });
-
- var L$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), leafletSrc, {
- 'default': leafletSrc
- }));
-
- var Control_MiniMap_min = createCommonjsModule(function (module, exports) {
- (function(factory,window){{module.exports=factory(leafletSrc);}if(typeof window!=="undefined"&&window.L){window.L.Control.MiniMap=factory(L);window.L.control.minimap=function(layer,options){return new window.L.Control.MiniMap(layer,options)};}})(function(L){var MiniMap=L.Control.extend({includes:L.Evented?L.Evented.prototype:L.Mixin.Events,options:{position:"bottomright",toggleDisplay:false,zoomLevelOffset:-5,zoomLevelFixed:false,centerFixed:false,zoomAnimation:false,autoToggleDisplay:false,minimized:false,width:150,height:150,collapsedWidth:19,collapsedHeight:19,aimingRectOptions:{color:"#ff7800",weight:1,clickable:false},shadowRectOptions:{color:"#000000",weight:1,clickable:false,opacity:0,fillOpacity:0},strings:{hideText:"Hide MiniMap",showText:"Show MiniMap"},mapOptions:{}},initialize:function(layer,options){L.Util.setOptions(this,options);this.options.aimingRectOptions.clickable=false;this.options.shadowRectOptions.clickable=false;this._layer=layer;},onAdd:function(map){this._mainMap=map;this._container=L.DomUtil.create("div","leaflet-control-minimap");this._container.style.width=this.options.width+"px";this._container.style.height=this.options.height+"px";L.DomEvent.disableClickPropagation(this._container);L.DomEvent.on(this._container,"mousewheel",L.DomEvent.stopPropagation);var mapOptions={attributionControl:false,dragging:!this.options.centerFixed,zoomControl:false,zoomAnimation:this.options.zoomAnimation,autoToggleDisplay:this.options.autoToggleDisplay,touchZoom:this.options.centerFixed?"center":!this._isZoomLevelFixed(),scrollWheelZoom:this.options.centerFixed?"center":!this._isZoomLevelFixed(),doubleClickZoom:this.options.centerFixed?"center":!this._isZoomLevelFixed(),boxZoom:!this._isZoomLevelFixed(),crs:map.options.crs};mapOptions=L.Util.extend(this.options.mapOptions,mapOptions);this._miniMap=new L.Map(this._container,mapOptions);this._miniMap.addLayer(this._layer);this._mainMapMoving=false;this._miniMapMoving=false;this._userToggledDisplay=false;this._minimized=false;if(this.options.toggleDisplay){this._addToggleButton();}this._miniMap.whenReady(L.Util.bind(function(){this._aimingRect=L.rectangle(this._mainMap.getBounds(),this.options.aimingRectOptions).addTo(this._miniMap);this._shadowRect=L.rectangle(this._mainMap.getBounds(),this.options.shadowRectOptions).addTo(this._miniMap);this._mainMap.on("moveend",this._onMainMapMoved,this);this._mainMap.on("move",this._onMainMapMoving,this);this._miniMap.on("movestart",this._onMiniMapMoveStarted,this);this._miniMap.on("move",this._onMiniMapMoving,this);this._miniMap.on("moveend",this._onMiniMapMoved,this);},this));return this._container},addTo:function(map){L.Control.prototype.addTo.call(this,map);var center=this.options.centerFixed||this._mainMap.getCenter();this._miniMap.setView(center,this._decideZoom(true));this._setDisplay(this.options.minimized);return this},onRemove:function(map){this._mainMap.off("moveend",this._onMainMapMoved,this);this._mainMap.off("move",this._onMainMapMoving,this);this._miniMap.off("moveend",this._onMiniMapMoved,this);this._miniMap.removeLayer(this._layer);},changeLayer:function(layer){this._miniMap.removeLayer(this._layer);this._layer=layer;this._miniMap.addLayer(this._layer);},_addToggleButton:function(){this._toggleDisplayButton=this.options.toggleDisplay?this._createButton("",this._toggleButtonInitialTitleText(),"leaflet-control-minimap-toggle-display leaflet-control-minimap-toggle-display-"+this.options.position,this._container,this._toggleDisplayButtonClicked,this):undefined;this._toggleDisplayButton.style.width=this.options.collapsedWidth+"px";this._toggleDisplayButton.style.height=this.options.collapsedHeight+"px";},_toggleButtonInitialTitleText:function(){if(this.options.minimized){return this.options.strings.showText}else {return this.options.strings.hideText}},_createButton:function(html,title,className,container,fn,context){var link=L.DomUtil.create("a",className,container);link.innerHTML=html;link.href="#";link.title=title;var stop=L.DomEvent.stopPropagation;L.DomEvent.on(link,"click",stop).on(link,"mousedown",stop).on(link,"dblclick",stop).on(link,"click",L.DomEvent.preventDefault).on(link,"click",fn,context);return link},_toggleDisplayButtonClicked:function(){this._userToggledDisplay=true;if(!this._minimized){this._minimize();}else {this._restore();}},_setDisplay:function(minimize){if(minimize!==this._minimized){if(!this._minimized){this._minimize();}else {this._restore();}}},_minimize:function(){if(this.options.toggleDisplay){this._container.style.width=this.options.collapsedWidth+"px";this._container.style.height=this.options.collapsedHeight+"px";this._toggleDisplayButton.className+=" minimized-"+this.options.position;this._toggleDisplayButton.title=this.options.strings.showText;}else {this._container.style.display="none";}this._minimized=true;this._onToggle();},_restore:function(){if(this.options.toggleDisplay){this._container.style.width=this.options.width+"px";this._container.style.height=this.options.height+"px";this._toggleDisplayButton.className=this._toggleDisplayButton.className.replace("minimized-"+this.options.position,"");this._toggleDisplayButton.title=this.options.strings.hideText;}else {this._container.style.display="block";}this._minimized=false;this._onToggle();},_onMainMapMoved:function(e){if(!this._miniMapMoving){var center=this.options.centerFixed||this._mainMap.getCenter();this._mainMapMoving=true;this._miniMap.setView(center,this._decideZoom(true));this._setDisplay(this._decideMinimized());}else {this._miniMapMoving=false;}this._aimingRect.setBounds(this._mainMap.getBounds());},_onMainMapMoving:function(e){this._aimingRect.setBounds(this._mainMap.getBounds());},_onMiniMapMoveStarted:function(e){if(!this.options.centerFixed){var lastAimingRect=this._aimingRect.getBounds();var sw=this._miniMap.latLngToContainerPoint(lastAimingRect.getSouthWest());var ne=this._miniMap.latLngToContainerPoint(lastAimingRect.getNorthEast());this._lastAimingRectPosition={sw:sw,ne:ne};}},_onMiniMapMoving:function(e){if(!this.options.centerFixed){if(!this._mainMapMoving&&this._lastAimingRectPosition){this._shadowRect.setBounds(new L.LatLngBounds(this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.sw),this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.ne)));this._shadowRect.setStyle({opacity:1,fillOpacity:.3});}}},_onMiniMapMoved:function(e){if(!this._mainMapMoving){this._miniMapMoving=true;this._mainMap.setView(this._miniMap.getCenter(),this._decideZoom(false));this._shadowRect.setStyle({opacity:0,fillOpacity:0});}else {this._mainMapMoving=false;}},_isZoomLevelFixed:function(){var zoomLevelFixed=this.options.zoomLevelFixed;return this._isDefined(zoomLevelFixed)&&this._isInteger(zoomLevelFixed)},_decideZoom:function(fromMaintoMini){if(!this._isZoomLevelFixed()){if(fromMaintoMini){return this._mainMap.getZoom()+this.options.zoomLevelOffset}else {var currentDiff=this._miniMap.getZoom()-this._mainMap.getZoom();var proposedZoom=this._miniMap.getZoom()-this.options.zoomLevelOffset;var toRet;if(currentDiff>this.options.zoomLevelOffset&&this._mainMap.getZoom()<this._miniMap.getMinZoom()-this.options.zoomLevelOffset){if(this._miniMap.getZoom()>this._lastMiniMapZoom){toRet=this._mainMap.getZoom()+1;this._miniMap.setZoom(this._miniMap.getZoom()-1);}else {toRet=this._mainMap.getZoom();}}else {toRet=proposedZoom;}this._lastMiniMapZoom=this._miniMap.getZoom();return toRet}}else {if(fromMaintoMini){return this.options.zoomLevelFixed}else {return this._mainMap.getZoom()}}},_decideMinimized:function(){if(this._userToggledDisplay){return this._minimized}if(this.options.autoToggleDisplay){if(this._mainMap.getBounds().contains(this._miniMap.getBounds())){return true}return false}return this._minimized},_isInteger:function(value){return typeof value==="number"},_isDefined:function(value){return typeof value!=="undefined"},_onToggle:function(){L.Util.requestAnimFrame(function(){L.DomEvent.on(this._container,"transitionend",this._fireToggleEvents,this);if(!L.Browser.any3d){L.Util.requestAnimFrame(this._fireToggleEvents,this);}},this);},_fireToggleEvents:function(){L.DomEvent.off(this._container,"transitionend",this._fireToggleEvents,this);var data={minimized:this._minimized};this.fire(this._minimized?"minimize":"restore",data);this.fire("toggle",data);}});L.Map.mergeOptions({miniMapControl:false});L.Map.addInitHook(function(){if(this.options.miniMapControl){this.miniMapControl=(new MiniMap).addTo(this);}});return MiniMap},window);
- });
-
- var LMM = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), Control_MiniMap_min, {
- 'default': Control_MiniMap_min
- }));
-
- /* src/components/MapPosition.svelte generated by Svelte v3.31.2 */
- const file$7 = "src/components/MapPosition.svelte";
-
- function create_fragment$7(ctx) {
- let div2;
- let div0;
- let t0;
- let t1;
- let t2;
- let a0;
- let t3;
- let t4;
- let br0;
- let t5;
- let t6;
- let t7;
- let br1;
- let t8;
- let t9;
- let t10;
- let br2;
- let t11;
- let t12;
- let t13;
- let br3;
- let t14;
- let t15;
- let t16;
- let div1;
- let a1;
- let mounted;
- let dispose;
-
- const block = {
- c: function create() {
- div2 = element("div");
- div0 = element("div");
- t0 = text("map center: ");
- t1 = text(/*map_center*/ ctx[0]);
- t2 = space();
- a0 = element("a");
- t3 = text("view on osm.org");
- t4 = space();
- br0 = element("br");
- t5 = text("\n map zoom: ");
- t6 = text(/*map_zoom*/ ctx[1]);
- t7 = space();
- br1 = element("br");
- t8 = text("\n viewbox: ");
- t9 = text(/*map_viewbox*/ ctx[2]);
- t10 = space();
- br2 = element("br");
- t11 = text("\n last click: ");
- t12 = text(/*last_click*/ ctx[4]);
- t13 = space();
- br3 = element("br");
- t14 = text("\n mouse position: ");
- t15 = text(/*mouse_position*/ ctx[5]);
- t16 = space();
- div1 = element("div");
- a1 = element("a");
- a1.textContent = "hide";
- attr_dev(a0, "target", "_blank");
- attr_dev(a0, "href", /*view_on_osm_link*/ ctx[3]);
- add_location(a0, file$7, 86, 4, 2297);
- add_location(br0, file$7, 87, 4, 2366);
- add_location(br1, file$7, 89, 4, 2400);
- add_location(br2, file$7, 91, 4, 2436);
- add_location(br3, file$7, 93, 4, 2474);
- attr_dev(div0, "id", "map-position-inner");
- add_location(div0, file$7, 84, 2, 2234);
- attr_dev(a1, "href", "#");
- add_location(a1, file$7, 96, 31, 2556);
- attr_dev(div1, "id", "map-position-close");
- attr_dev(div1, "class", "svelte-1b30dq3");
- add_location(div1, file$7, 96, 2, 2527);
- attr_dev(div2, "id", "map-position");
- attr_dev(div2, "class", "svelte-1b30dq3");
- add_location(div2, file$7, 83, 0, 2208);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- insert_dev(target, div2, anchor);
- append_dev(div2, div0);
- append_dev(div0, t0);
- append_dev(div0, t1);
- append_dev(div0, t2);
- append_dev(div0, a0);
- append_dev(a0, t3);
- append_dev(div0, t4);
- append_dev(div0, br0);
- append_dev(div0, t5);
- append_dev(div0, t6);
- append_dev(div0, t7);
- append_dev(div0, br1);
- append_dev(div0, t8);
- append_dev(div0, t9);
- append_dev(div0, t10);
- append_dev(div0, br2);
- append_dev(div0, t11);
- append_dev(div0, t12);
- append_dev(div0, t13);
- append_dev(div0, br3);
- append_dev(div0, t14);
- append_dev(div0, t15);
- append_dev(div2, t16);
- append_dev(div2, div1);
- append_dev(div1, a1);
-
- if (!mounted) {
- dispose = listen_dev(a1, "click", handleHideClick, false, false, false);
- mounted = true;
- }
- },
- p: function update(ctx, [dirty]) {
- if (dirty & /*map_center*/ 1) set_data_dev(t1, /*map_center*/ ctx[0]);
-
- if (dirty & /*view_on_osm_link*/ 8) {
- attr_dev(a0, "href", /*view_on_osm_link*/ ctx[3]);
- }
-
- if (dirty & /*map_zoom*/ 2) set_data_dev(t6, /*map_zoom*/ ctx[1]);
- if (dirty & /*map_viewbox*/ 4) set_data_dev(t9, /*map_viewbox*/ ctx[2]);
- if (dirty & /*last_click*/ 16) set_data_dev(t12, /*last_click*/ ctx[4]);
- if (dirty & /*mouse_position*/ 32) set_data_dev(t15, /*mouse_position*/ ctx[5]);
- },
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(div2);
- mounted = false;
- dispose();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$7.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function map_link_to_osm(map) {
- var zoom = map.getZoom();
- var lat = map.getCenter().lat.toFixed(5);
- var lng = map.getCenter().lng.toFixed(5);
- return "https://openstreetmap.org/#map=" + zoom + "/" + lat + "/" + lng;
- }
-
- function map_viewbox_as_string$1(map) {
- var bounds = map.getBounds();
- var west = bounds.getWest();
- var east = bounds.getEast();
-
- if (east - west >= 360) {
- // covers more than whole planet
- west = map.getCenter().lng - 179.999;
-
- east = map.getCenter().lng + 179.999;
- }
-
- east = L.latLng(77, east).wrap().lng;
- west = L.latLng(77, west).wrap().lng;
-
- return [
- west.toFixed(5),
- bounds.getNorth().toFixed(5),
- east.toFixed(5),
- bounds.getSouth().toFixed(5)
- ].join(","); // left
- // top
- // right
- // bottom
- }
-
- function handleHideClick(e) {
- document.getElementById("map-position").style.display = "none";
- document.getElementById("show-map-position").style.display = "block";
- }
-
- function instance$7($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("MapPosition", slots, []);
- let last_click_latlng;
- let map_center;
- let map_zoom;
- let map_viewbox;
- let view_on_osm_link;
- let last_click;
- let mouse_position;
-
- function display_map_position(map, mouse_lat_lng) {
- $$invalidate(0, map_center = map.getCenter().lat.toFixed(5) + "," + map.getCenter().lng.toFixed(5));
- $$invalidate(3, view_on_osm_link = map_link_to_osm(map));
- $$invalidate(1, map_zoom = map.getZoom());
- $$invalidate(2, map_viewbox = map_viewbox_as_string$1(map));
- $$invalidate(5, mouse_position = "-");
-
- if (mouse_lat_lng) {
- $$invalidate(5, mouse_position = [mouse_lat_lng.lat.toFixed(5), mouse_lat_lng.lng.toFixed(5)].join(","));
- }
-
- if (last_click_latlng) {
- $$invalidate(4, last_click = [last_click_latlng.lat.toFixed(5), last_click_latlng.lng.toFixed(5)].join(","));
- }
- }
-
- map_store.subscribe(map => {
- if (!map) {
- return;
- }
-
- map.on("move", function () {
- display_map_position(map);
- }); // update_viewbox_field();
-
- map.on("mousemove", function (e) {
- display_map_position(map, e.latlng);
- });
-
- map.on("click", function (e) {
- last_click_latlng = e.latlng;
- display_map_position(map);
- });
-
- map.on("load", function () {
- display_map_position(map);
- });
- });
-
- const writable_props = [];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<MapPosition> was created with unknown prop '${key}'`);
- });
-
- $$self.$capture_state = () => ({
- map_store,
- last_click_latlng,
- map_center,
- map_zoom,
- map_viewbox,
- view_on_osm_link,
- last_click,
- mouse_position,
- map_link_to_osm,
- map_viewbox_as_string: map_viewbox_as_string$1,
- display_map_position,
- handleHideClick
- });
-
- $$self.$inject_state = $$props => {
- if ("last_click_latlng" in $$props) last_click_latlng = $$props.last_click_latlng;
- if ("map_center" in $$props) $$invalidate(0, map_center = $$props.map_center);
- if ("map_zoom" in $$props) $$invalidate(1, map_zoom = $$props.map_zoom);
- if ("map_viewbox" in $$props) $$invalidate(2, map_viewbox = $$props.map_viewbox);
- if ("view_on_osm_link" in $$props) $$invalidate(3, view_on_osm_link = $$props.view_on_osm_link);
- if ("last_click" in $$props) $$invalidate(4, last_click = $$props.last_click);
- if ("mouse_position" in $$props) $$invalidate(5, mouse_position = $$props.mouse_position);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [
- map_center,
- map_zoom,
- map_viewbox,
- view_on_osm_link,
- last_click,
- mouse_position
- ];
- }
-
- class MapPosition extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$7, create_fragment$7, safe_not_equal, {});
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "MapPosition",
- options,
- id: create_fragment$7.name
- });
- }
- }
-
- /* src/components/Map.svelte generated by Svelte v3.31.2 */
- const file$8 = "src/components/Map.svelte";
-
- function create_fragment$8(ctx) {
- let mapposition;
- let t0;
- let div0;
- let t1;
- let div1;
- let current;
- let mounted;
- let dispose;
- mapposition = new MapPosition({ $$inline: true });
-
- const block = {
- c: function create() {
- create_component(mapposition.$$.fragment);
- t0 = space();
- div0 = element("div");
- t1 = space();
- div1 = element("div");
- div1.textContent = "show map bounds";
- attr_dev(div0, "id", "map");
- attr_dev(div0, "class", "svelte-1vbvdrk");
- add_location(div0, file$8, 173, 0, 4682);
- attr_dev(div1, "id", "show-map-position");
- attr_dev(div1, "class", "leaflet-bar btn btn-sm btn-outline-secondary svelte-1vbvdrk");
- add_location(div1, file$8, 174, 0, 4713);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- mount_component(mapposition, target, anchor);
- insert_dev(target, t0, anchor);
- insert_dev(target, div0, anchor);
- insert_dev(target, t1, anchor);
- insert_dev(target, div1, anchor);
- current = true;
-
- if (!mounted) {
- dispose = [
- action_destroyer(/*mapAction*/ ctx[0].call(null, div0)),
- listen_dev(div1, "click", stop_propagation(show_map_position_click), false, false, true)
- ];
-
- mounted = true;
- }
- },
- p: noop,
- i: function intro(local) {
- if (current) return;
- transition_in(mapposition.$$.fragment, local);
- current = true;
- },
- o: function outro(local) {
- transition_out(mapposition.$$.fragment, local);
- current = false;
- },
- d: function destroy(detaching) {
- destroy_component(mapposition, detaching);
- if (detaching) detach_dev(t0);
- if (detaching) detach_dev(div0);
- if (detaching) detach_dev(t1);
- if (detaching) detach_dev(div1);
- mounted = false;
- run_all(dispose);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$8.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function parse_and_normalize_geojson_string(part) {
- // normalize places the geometry into a featurecollection, similar to
- // https://github.com/mapbox/geojson-normalize
- var parsed_geojson = {
- type: "FeatureCollection",
- features: [
- {
- type: "Feature",
- geometry: part,
- properties: {}
- }
- ]
- };
-
- return parsed_geojson;
- }
-
- function show_map_position_click(e) {
- e.target.style.display = "none";
- document.getElementById("map-position").style.display = "block";
- }
-
- function instance$8($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("Map", slots, []);
- let { display_minimap = false } = $$props;
- let dataLayers = [];
-
- function createMap(container) {
- const attribution = get_config_value_1("Map_Tile_Attribution") || null;
-
- let map = new leafletSrc.map(container,
- {
- attributionControl: attribution && attribution.length,
- scrollWheelZoom: true, // !L.Browser.touch,
- touchZoom: false,
- center: [get_config_value_1("Map_Default_Lat"), get_config_value_1("Map_Default_Lon")],
- zoom: get_config_value_1("Map_Default_Zoom")
- });
-
- leafletSrc.tileLayer(get_config_value_1("Map_Tile_URL"), { attribution }).addTo(map);
-
- if (display_minimap) {
- let osm2 = new leafletSrc.TileLayer(get_config_value_1("Map_Tile_URL"), { minZoom: 0, maxZoom: 13, attribution });
- new leafletSrc.Control.MiniMap(osm2, { toggleDisplay: true }).addTo(map);
- }
-
- const MapPositionControl = leafletSrc.Control.extend({
- options: { position: "topright" },
- onAdd: () => {
- return document.getElementById("show-map-position");
- }
- });
-
- map.addControl(new MapPositionControl());
- return map;
- }
-
- function mapAction(container) {
- let map = createMap(container);
- map_store.set(map);
- setMapData(get_store_value(current_result_store));
-
- return {
- destroy: () => {
- map.remove();
- }
- };
- }
-
- function resetMapData() {
- let map = get_store_value(map_store);
-
- if (!map) {
- return;
- }
-
- dataLayers.forEach(function (layer) {
- map.removeLayer(layer);
- });
- }
-
- function setMapData(aFeature) {
- let map = get_store_value(map_store);
-
- if (!map) {
- return;
- }
-
- resetMapData();
- let request_latlon = get_store_value(current_request_latlon);
-
- if (request_latlon) {
- // We don't need a marker, but an L.circle instance changes radius once you zoom in/out
- let cm = leafletSrc.circleMarker(request_latlon, {
- radius: 5,
- weight: 2,
- fillColor: "#ff7800",
- color: "red",
- opacity: 0.75,
- zIndexOffset: 100,
- clickable: false
- });
-
- cm.addTo(map);
- dataLayers.push(cm);
- }
-
- var search_params = new URLSearchParams(window.location.search);
- var viewbox = search_params.get("viewbox");
-
- if (viewbox) {
- let coords = viewbox.split(","); // <x1>,<y1>,<x2>,<y2>
- let bounds = leafletSrc.latLngBounds([coords[1], coords[0]], [coords[3], coords[2]]);
-
- leafletSrc.rectangle(bounds, {
- color: "#69d53e",
- weight: 3,
- dashArray: "5 5",
- opacity: 0.8,
- fill: false
- }).addTo(map);
- }
-
- // nothing to do
- if (!aFeature) {
- return;
- }
-
- let lat = aFeature.centroid
- ? aFeature.centroid.coordinates[1]
- : aFeature.lat;
-
- let lon = aFeature.centroid
- ? aFeature.centroid.coordinates[0]
- : aFeature.lon;
-
- let geojson = aFeature.geometry || aFeature.geojson;
-
- if (lat && lon) {
- let circle = leafletSrc.circleMarker([lat, lon], {
- radius: 10,
- weight: 2,
- fillColor: "#ff7800",
- color: "blue",
- opacity: 0.75
- });
-
- map.addLayer(circle);
- dataLayers.push(circle);
- }
-
- if (geojson) {
- var geojson_layer = leafletSrc.geoJson(
- // https://leafletjs.com/reference-1.0.3.html#path-option
- parse_and_normalize_geojson_string(geojson),
- {
- style() {
- return { interactive: false, color: "blue" };
- }
- }
- );
-
- map.addLayer(geojson_layer);
- dataLayers.push(geojson_layer);
- map.fitBounds(geojson_layer.getBounds());
- } else if (lat && lon) {
- map.setView([lat, lon], 10);
- } else {
- map.fitWorld();
- }
- }
-
- current_result_store.subscribe(aFeature => {
- setMapData(aFeature);
- });
-
- const writable_props = ["display_minimap"];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Map> was created with unknown prop '${key}'`);
- });
-
- $$self.$$set = $$props => {
- if ("display_minimap" in $$props) $$invalidate(1, display_minimap = $$props.display_minimap);
- };
-
- $$self.$capture_state = () => ({
- L: L$1,
- LMM,
- get: get_store_value,
- get_config_value: get_config_value_1,
- map_store,
- current_result_store,
- current_request_latlon,
- MapPosition,
- display_minimap,
- dataLayers,
- createMap,
- mapAction,
- parse_and_normalize_geojson_string,
- resetMapData,
- setMapData,
- show_map_position_click
- });
-
- $$self.$inject_state = $$props => {
- if ("display_minimap" in $$props) $$invalidate(1, display_minimap = $$props.display_minimap);
- if ("dataLayers" in $$props) dataLayers = $$props.dataLayers;
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [mapAction, display_minimap];
- }
-
- class Map$1 extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$8, create_fragment$8, safe_not_equal, { display_minimap: 1 });
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "Map",
- options,
- id: create_fragment$8.name
- });
- }
-
- get display_minimap() {
- throw new Error("<Map>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- set display_minimap(value) {
- throw new Error("<Map>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
- }
-
- /* src/pages/SearchPage.svelte generated by Svelte v3.31.2 */
- const file$9 = "src/pages/SearchPage.svelte";
-
- function create_fragment$9(ctx) {
- let searchbar;
- let t0;
- let div2;
- let div0;
- let resultslist;
- let t1;
- let div1;
- let map;
- let current;
-
- searchbar = new SearchBar({
- props: {
- reverse_search: /*reverse_search*/ ctx[0],
- api_request_params: /*api_request_params*/ ctx[1],
- bStructuredSearch: /*bStructuredSearch*/ ctx[2]
- },
- $$inline: true
- });
-
- resultslist = new ResultsList({
- props: {
- reverse_search: /*reverse_search*/ ctx[0]
- },
- $$inline: true
- });
-
- map = new Map$1({
- props: { display_minimap: true },
- $$inline: true
- });
-
- const block = {
- c: function create() {
- create_component(searchbar.$$.fragment);
- t0 = space();
- div2 = element("div");
- div0 = element("div");
- create_component(resultslist.$$.fragment);
- t1 = space();
- div1 = element("div");
- create_component(map.$$.fragment);
- attr_dev(div0, "class", "sidebar svelte-1wb4w3");
- add_location(div0, file$9, 93, 2, 3393);
- attr_dev(div1, "id", "map-wrapper");
- attr_dev(div1, "class", "svelte-1wb4w3");
- add_location(div1, file$9, 96, 2, 3478);
- attr_dev(div2, "id", "content");
- attr_dev(div2, "class", "svelte-1wb4w3");
- add_location(div2, file$9, 92, 0, 3372);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- mount_component(searchbar, target, anchor);
- insert_dev(target, t0, anchor);
- insert_dev(target, div2, anchor);
- append_dev(div2, div0);
- mount_component(resultslist, div0, null);
- append_dev(div2, t1);
- append_dev(div2, div1);
- mount_component(map, div1, null);
- current = true;
- },
- p: function update(ctx, [dirty]) {
- const searchbar_changes = {};
- if (dirty & /*reverse_search*/ 1) searchbar_changes.reverse_search = /*reverse_search*/ ctx[0];
- if (dirty & /*api_request_params*/ 2) searchbar_changes.api_request_params = /*api_request_params*/ ctx[1];
- searchbar.$set(searchbar_changes);
- const resultslist_changes = {};
- if (dirty & /*reverse_search*/ 1) resultslist_changes.reverse_search = /*reverse_search*/ ctx[0];
- resultslist.$set(resultslist_changes);
- },
- i: function intro(local) {
- if (current) return;
- transition_in(searchbar.$$.fragment, local);
- transition_in(resultslist.$$.fragment, local);
- transition_in(map.$$.fragment, local);
- current = true;
- },
- o: function outro(local) {
- transition_out(searchbar.$$.fragment, local);
- transition_out(resultslist.$$.fragment, local);
- transition_out(map.$$.fragment, local);
- current = false;
- },
- d: function destroy(detaching) {
- destroy_component(searchbar, detaching);
- if (detaching) detach_dev(t0);
- if (detaching) detach_dev(div2);
- destroy_component(resultslist);
- destroy_component(map);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$9.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance$9($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("SearchPage", slots, []);
- let { reverse_search = false } = $$props;
- let api_request_params;
- let bStructuredSearch;
-
- function loaddata() {
- let search_params = new URLSearchParams(window.location.search);
- update_html_title();
-
- if (reverse_search) {
- $$invalidate(1, api_request_params = {
- lat: search_params.get("lat"),
- lon: search_params.get("lon"),
- zoom: search_params.get("zoom") > 1
- ? Number(search_params.get("zoom"))
- : Number(get_config_value_1("Reverse_Default_Search_Zoom")),
- format: "jsonv2"
- });
-
- if (api_request_params.lat || api_request_params.lat) {
- fetch_from_api("reverse", api_request_params, function (data) {
- if (data && !data.error) {
- current_request_latlon.set([api_request_params.lat, api_request_params.lon]);
- results_store.set([data]);
- } else {
- results_store.set([]);
- }
-
- update_html_title("Reverse result for " + api_request_params.lat + "," + api_request_params.lon);
- document.querySelector("input[name=lat]").focus();
- });
- }
- } else {
- $$invalidate(1, api_request_params = {
- q: search_params.get("q"),
- street: search_params.get("street"),
- city: search_params.get("city"),
- county: search_params.get("county"),
- state: search_params.get("state"),
- country: search_params.get("country"),
- postalcode: search_params.get("postalcode"),
- polygon_geojson: get_config_value_1("Search_AreaPolygons", false) ? 1 : 0,
- viewbox: search_params.get("viewbox"),
- bounded: search_params.get("bounded"),
- dedupe: search_params.get("dedupe"),
- "accept-language": search_params.get("accept-language"),
- countrycodes: search_params.get("countrycodes"),
- limit: search_params.get("limit"),
- polygon_threshold: search_params.get("polygon_threshold"),
- exclude_place_ids: search_params.get("exclude_place_ids"),
- format: "jsonv2"
- });
-
- let bStructuredSearch = api_request_params.street || api_request_params.city || api_request_params.county || api_request_params.state || api_request_params.country || api_request_params.postalcode;
-
- if (api_request_params.q || bStructuredSearch) {
- fetch_from_api("search", api_request_params, function (data) {
- results_store.set(data);
- update_html_title("Result for " + api_request_params.q);
- document.querySelector("input[name=q]").focus();
- });
- }
- }
- }
-
- onMount(loaddata);
- const writable_props = ["reverse_search"];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<SearchPage> was created with unknown prop '${key}'`);
- });
-
- $$self.$$set = $$props => {
- if ("reverse_search" in $$props) $$invalidate(0, reverse_search = $$props.reverse_search);
- };
-
- $$self.$capture_state = () => ({
- onMount,
- results_store,
- current_result_store,
- current_request_latlon,
- get_config_value: get_config_value_1,
- fetch_from_api,
- update_html_title,
- SearchBar,
- ResultsList,
- Map: Map$1,
- reverse_search,
- api_request_params,
- bStructuredSearch,
- loaddata
- });
-
- $$self.$inject_state = $$props => {
- if ("reverse_search" in $$props) $$invalidate(0, reverse_search = $$props.reverse_search);
- if ("api_request_params" in $$props) $$invalidate(1, api_request_params = $$props.api_request_params);
- if ("bStructuredSearch" in $$props) $$invalidate(2, bStructuredSearch = $$props.bStructuredSearch);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [reverse_search, api_request_params, bStructuredSearch];
- }
-
- class SearchPage extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$9, create_fragment$9, safe_not_equal, { reverse_search: 0 });
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "SearchPage",
- options,
- id: create_fragment$9.name
- });
- }
-
- get reverse_search() {
- throw new Error("<SearchPage>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- set reverse_search(value) {
- throw new Error("<SearchPage>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
- }
-
- /* src/components/DetailsIndex.svelte generated by Svelte v3.31.2 */
-
- const file$a = "src/components/DetailsIndex.svelte";
-
- function create_fragment$a(ctx) {
- let div5;
- let div4;
- let div3;
- let h1;
- let t1;
- let div0;
- let h40;
- let t3;
- let form0;
- let input0;
- let t4;
- let input1;
- let t5;
- let div1;
- let h41;
- let t7;
- let form1;
- let input2;
- let t8;
- let input3;
- let t9;
- let input4;
- let t10;
- let input5;
- let t11;
- let div2;
- let h42;
- let t13;
- let form2;
- let input6;
- let t14;
- let input7;
- let t15;
- let input8;
- let t16;
- let input9;
- let mounted;
- let dispose;
-
- const block = {
- c: function create() {
- div5 = element("div");
- div4 = element("div");
- div3 = element("div");
- h1 = element("h1");
- h1.textContent = "Show details for place";
- t1 = space();
- div0 = element("div");
- h40 = element("h4");
- h40.textContent = "Search by place id";
- t3 = space();
- form0 = element("form");
- input0 = element("input");
- t4 = space();
- input1 = element("input");
- t5 = space();
- div1 = element("div");
- h41 = element("h4");
- h41.textContent = "Search by OSM type and OSM id";
- t7 = space();
- form1 = element("form");
- input2 = element("input");
- t8 = space();
- input3 = element("input");
- t9 = space();
- input4 = element("input");
- t10 = space();
- input5 = element("input");
- t11 = space();
- div2 = element("div");
- h42 = element("h4");
- h42.textContent = "Search by openstreetmap.org URL";
- t13 = space();
- form2 = element("form");
- input6 = element("input");
- t14 = space();
- input7 = element("input");
- t15 = space();
- input8 = element("input");
- t16 = space();
- input9 = element("input");
- add_location(h1, file$a, 25, 6, 687);
- attr_dev(h40, "class", "svelte-k5v90i");
- add_location(h40, file$a, 28, 8, 760);
- attr_dev(input0, "type", "edit");
- attr_dev(input0, "class", "form-control form-control-sm svelte-k5v90i");
- attr_dev(input0, "pattern", "^[0-9]+$");
- attr_dev(input0, "name", "place_id");
- attr_dev(input0, "placeholder", "12345");
- add_location(input0, file$a, 31, 10, 856);
- attr_dev(input1, "type", "submit");
- attr_dev(input1, "class", "btn btn-primary btn-sm");
- input1.value = "Show";
- add_location(input1, file$a, 36, 10, 1048);
- attr_dev(form0, "class", "form-inline");
- attr_dev(form0, "action", "details.html");
- add_location(form0, file$a, 30, 8, 797);
- attr_dev(div0, "class", "search-form svelte-k5v90i");
- add_location(div0, file$a, 27, 6, 726);
- attr_dev(h41, "class", "svelte-k5v90i");
- add_location(h41, file$a, 43, 8, 1220);
- attr_dev(input2, "type", "edit");
- attr_dev(input2, "class", "form-control form-control-sm svelte-k5v90i");
- attr_dev(input2, "pattern", "^[NWR][0-9]+$");
- attr_dev(input2, "placeholder", "N123 or W123 or R123");
- add_location(input2, file$a, 49, 10, 1438);
- attr_dev(input3, "type", "hidden");
- attr_dev(input3, "name", "osmtype");
- add_location(input3, file$a, 53, 10, 1617);
- attr_dev(input4, "type", "hidden");
- attr_dev(input4, "name", "osmid");
- add_location(input4, file$a, 54, 10, 1666);
- attr_dev(input5, "type", "submit");
- attr_dev(input5, "class", "btn btn-primary btn-sm");
- input5.value = "Show";
- add_location(input5, file$a, 55, 10, 1713);
- attr_dev(form1, "id", "form-by-type-and-id");
- attr_dev(form1, "class", "form-inline");
- attr_dev(form1, "action", "details.html");
- add_location(form1, file$a, 45, 8, 1268);
- attr_dev(div1, "class", "search-form svelte-k5v90i");
- add_location(div1, file$a, 42, 6, 1186);
- attr_dev(h42, "class", "svelte-k5v90i");
- add_location(h42, file$a, 60, 8, 1851);
- attr_dev(input6, "type", "edit");
- attr_dev(input6, "class", "form-control form-control-sm svelte-k5v90i");
- attr_dev(input6, "pattern", ".*openstreetmap.*");
- attr_dev(input6, "placeholder", "https://www.openstreetmap.org/relation/123");
- add_location(input6, file$a, 66, 10, 2067);
- attr_dev(input7, "type", "hidden");
- attr_dev(input7, "name", "osmtype");
- add_location(input7, file$a, 70, 10, 2272);
- attr_dev(input8, "type", "hidden");
- attr_dev(input8, "name", "osmid");
- add_location(input8, file$a, 71, 10, 2321);
- attr_dev(input9, "type", "submit");
- attr_dev(input9, "class", "btn btn-primary btn-sm");
- input9.value = "Show";
- add_location(input9, file$a, 72, 10, 2368);
- attr_dev(form2, "id", "form-by-osm-url");
- attr_dev(form2, "class", "form-inline");
- attr_dev(form2, "action", "details.html");
- add_location(form2, file$a, 62, 8, 1901);
- attr_dev(div2, "class", "search-form svelte-k5v90i");
- add_location(div2, file$a, 59, 6, 1817);
- attr_dev(div3, "class", "col-md-12");
- add_location(div3, file$a, 23, 4, 656);
- attr_dev(div4, "class", "row");
- add_location(div4, file$a, 22, 2, 634);
- attr_dev(div5, "class", "container");
- attr_dev(div5, "id", "details-index-page");
- add_location(div5, file$a, 21, 0, 584);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- insert_dev(target, div5, anchor);
- append_dev(div5, div4);
- append_dev(div4, div3);
- append_dev(div3, h1);
- append_dev(div3, t1);
- append_dev(div3, div0);
- append_dev(div0, h40);
- append_dev(div0, t3);
- append_dev(div0, form0);
- append_dev(form0, input0);
- append_dev(form0, t4);
- append_dev(form0, input1);
- append_dev(div3, t5);
- append_dev(div3, div1);
- append_dev(div1, h41);
- append_dev(div1, t7);
- append_dev(div1, form1);
- append_dev(form1, input2);
- append_dev(form1, t8);
- append_dev(form1, input3);
- append_dev(form1, t9);
- append_dev(form1, input4);
- append_dev(form1, t10);
- append_dev(form1, input5);
- append_dev(div3, t11);
- append_dev(div3, div2);
- append_dev(div2, h42);
- append_dev(div2, t13);
- append_dev(div2, form2);
- append_dev(form2, input6);
- append_dev(form2, t14);
- append_dev(form2, input7);
- append_dev(form2, t15);
- append_dev(form2, input8);
- append_dev(form2, t16);
- append_dev(form2, input9);
-
- if (!mounted) {
- dispose = [
- listen_dev(form1, "submit", prevent_default(handleFormSubmit), false, true, false),
- listen_dev(form2, "submit", prevent_default(handleFormSubmit), false, true, false)
- ];
-
- mounted = true;
- }
- },
- p: noop,
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(div5);
- mounted = false;
- run_all(dispose);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$a.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function handleFormSubmit(event) {
- let form_el = event.target;
- let val = form_el.querySelector("input[type=edit]").value;
- let matches = val.match(/^\s*([NWR])(\d+)\s*$/i);
-
- if (!matches) {
- matches = val.match(/\/(relation|way|node)\/(\d+)\s*$/);
- }
-
- if (!matches) {
- alert("invalid input");
- return;
- }
-
- form_el.querySelector("input[name=osmtype]").setAttribute("value", matches[1].charAt(0).toUpperCase());
- form_el.querySelector("input[name=osmid]").setAttribute("value", matches[2]);
- form_el.submit();
- }
-
- function instance$a($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("DetailsIndex", slots, []);
- const writable_props = [];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<DetailsIndex> was created with unknown prop '${key}'`);
- });
-
- $$self.$capture_state = () => ({ handleFormSubmit });
- return [];
- }
-
- class DetailsIndex extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$a, create_fragment$a, safe_not_equal, {});
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "DetailsIndex",
- options,
- id: create_fragment$a.name
- });
- }
- }
-
- /* src/components/DetailsOneRow.svelte generated by Svelte v3.31.2 */
-
- const file$b = "src/components/DetailsOneRow.svelte";
-
- // (16:4) {:else}
- function create_else_block$2(ctx) {
- let span;
-
- const block = {
- c: function create() {
- span = element("span");
- span.textContent = "No Name";
- attr_dev(span, "class", "noname svelte-rtfpp8");
- add_location(span, file$b, 16, 6, 377);
- },
- m: function mount(target, anchor) {
- insert_dev(target, span, anchor);
- },
- p: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(span);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_else_block$2.name,
- type: "else",
- source: "(16:4) {:else}",
- ctx
- });
-
- return block;
- }
-
- // (14:4) {#if addressLine.localname}
- function create_if_block_1$1(ctx) {
- let t_value = /*addressLine*/ ctx[0].localname + "";
- let t;
-
- const block = {
- c: function create() {
- t = text(t_value);
- },
- m: function mount(target, anchor) {
- insert_dev(target, t, anchor);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*addressLine*/ 1 && t_value !== (t_value = /*addressLine*/ ctx[0].localname + "")) set_data_dev(t, t_value);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(t);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_1$1.name,
- type: "if",
- source: "(14:4) {#if addressLine.localname}",
- ctx
- });
-
- return block;
- }
-
- // (25:6) {#if addressLine.osm_id}
- function create_if_block$4(ctx) {
- let a;
- let t;
- let a_href_value;
-
- const block = {
- c: function create() {
- a = element("a");
- t = text("details");
- attr_dev(a, "href", a_href_value = detailsURL_1(/*addressLine*/ ctx[0]));
- add_location(a, file$b, 24, 30, 711);
- },
- m: function mount(target, anchor) {
- insert_dev(target, a, anchor);
- append_dev(a, t);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*addressLine*/ 1 && a_href_value !== (a_href_value = detailsURL_1(/*addressLine*/ ctx[0]))) {
- attr_dev(a, "href", a_href_value);
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(a);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block$4.name,
- type: "if",
- source: "(25:6) {#if addressLine.osm_id}",
- ctx
- });
-
- return block;
- }
-
- function create_fragment$b(ctx) {
- let tr;
- let td0;
- let t0;
- let td1;
- let t1_value = formatPlaceType_1(/*addressLine*/ ctx[0]) + "";
- let t1;
- let t2;
- let td2;
- let raw0_value = osmLink_1(/*addressLine*/ ctx[0]) + "";
- let t3;
- let td3;
- let t4_value = /*addressLine*/ ctx[0].rank_address + "";
- let t4;
- let t5;
- let td4;
- let t6_value = formatAdminLevel_1(/*addressLine*/ ctx[0].admin_level) + "";
- let t6;
- let t7;
- let td5;
- let raw1_value = formatDistance_1(/*addressLine*/ ctx[0].distance, /*bDistanceInMeters*/ ctx[1]) + "";
- let t8;
- let td6;
-
- function select_block_type(ctx, dirty) {
- if (/*addressLine*/ ctx[0].localname) return create_if_block_1$1;
- return create_else_block$2;
- }
-
- let current_block_type = select_block_type(ctx);
- let if_block0 = current_block_type(ctx);
- let if_block1 = /*addressLine*/ ctx[0].osm_id && create_if_block$4(ctx);
-
- const block = {
- c: function create() {
- tr = element("tr");
- td0 = element("td");
- if_block0.c();
- t0 = space();
- td1 = element("td");
- t1 = text(t1_value);
- t2 = space();
- td2 = element("td");
- t3 = space();
- td3 = element("td");
- t4 = text(t4_value);
- t5 = space();
- td4 = element("td");
- t6 = text(t6_value);
- t7 = space();
- td5 = element("td");
- t8 = space();
- td6 = element("td");
- if (if_block1) if_block1.c();
- attr_dev(td0, "class", "name svelte-rtfpp8");
- add_location(td0, file$b, 12, 2, 279);
- add_location(td1, file$b, 19, 2, 433);
- add_location(td2, file$b, 20, 2, 475);
- add_location(td3, file$b, 21, 2, 515);
- add_location(td4, file$b, 22, 2, 553);
- add_location(td5, file$b, 23, 2, 608);
- add_location(td6, file$b, 24, 2, 683);
- attr_dev(tr, "class", "svelte-rtfpp8");
- toggle_class(tr, "notused", !/*bAddressLineUsed*/ ctx[2]);
- add_location(tr, file$b, 11, 0, 238);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td0);
- if_block0.m(td0, null);
- append_dev(tr, t0);
- append_dev(tr, td1);
- append_dev(td1, t1);
- append_dev(tr, t2);
- append_dev(tr, td2);
- td2.innerHTML = raw0_value;
- append_dev(tr, t3);
- append_dev(tr, td3);
- append_dev(td3, t4);
- append_dev(tr, t5);
- append_dev(tr, td4);
- append_dev(td4, t6);
- append_dev(tr, t7);
- append_dev(tr, td5);
- td5.innerHTML = raw1_value;
- append_dev(tr, t8);
- append_dev(tr, td6);
- if (if_block1) if_block1.m(td6, null);
- },
- p: function update(ctx, [dirty]) {
- if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block0) {
- if_block0.p(ctx, dirty);
- } else {
- if_block0.d(1);
- if_block0 = current_block_type(ctx);
-
- if (if_block0) {
- if_block0.c();
- if_block0.m(td0, null);
- }
- }
-
- if (dirty & /*addressLine*/ 1 && t1_value !== (t1_value = formatPlaceType_1(/*addressLine*/ ctx[0]) + "")) set_data_dev(t1, t1_value);
- if (dirty & /*addressLine*/ 1 && raw0_value !== (raw0_value = osmLink_1(/*addressLine*/ ctx[0]) + "")) td2.innerHTML = raw0_value; if (dirty & /*addressLine*/ 1 && t4_value !== (t4_value = /*addressLine*/ ctx[0].rank_address + "")) set_data_dev(t4, t4_value);
- if (dirty & /*addressLine*/ 1 && t6_value !== (t6_value = formatAdminLevel_1(/*addressLine*/ ctx[0].admin_level) + "")) set_data_dev(t6, t6_value);
- if (dirty & /*addressLine, bDistanceInMeters*/ 3 && raw1_value !== (raw1_value = formatDistance_1(/*addressLine*/ ctx[0].distance, /*bDistanceInMeters*/ ctx[1]) + "")) td5.innerHTML = raw1_value;
- if (/*addressLine*/ ctx[0].osm_id) {
- if (if_block1) {
- if_block1.p(ctx, dirty);
- } else {
- if_block1 = create_if_block$4(ctx);
- if_block1.c();
- if_block1.m(td6, null);
- }
- } else if (if_block1) {
- if_block1.d(1);
- if_block1 = null;
- }
-
- if (dirty & /*bAddressLineUsed*/ 4) {
- toggle_class(tr, "notused", !/*bAddressLineUsed*/ ctx[2]);
- }
- },
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- if_block0.d();
- if (if_block1) if_block1.d();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$b.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance$b($$self, $$props, $$invalidate) {
- let bAddressLineUsed;
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("DetailsOneRow", slots, []);
- let { addressLine } = $$props;
- let { bDistanceInMeters } = $$props;
- const writable_props = ["addressLine", "bDistanceInMeters"];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<DetailsOneRow> was created with unknown prop '${key}'`);
- });
-
- $$self.$$set = $$props => {
- if ("addressLine" in $$props) $$invalidate(0, addressLine = $$props.addressLine);
- if ("bDistanceInMeters" in $$props) $$invalidate(1, bDistanceInMeters = $$props.bDistanceInMeters);
- };
-
- $$self.$capture_state = () => ({
- addressLine,
- bDistanceInMeters,
- formatPlaceType: formatPlaceType_1,
- osmLink: osmLink_1,
- formatAdminLevel: formatAdminLevel_1,
- formatDistance: formatDistance_1,
- detailsURL: detailsURL_1,
- bAddressLineUsed
- });
-
- $$self.$inject_state = $$props => {
- if ("addressLine" in $$props) $$invalidate(0, addressLine = $$props.addressLine);
- if ("bDistanceInMeters" in $$props) $$invalidate(1, bDistanceInMeters = $$props.bDistanceInMeters);
- if ("bAddressLineUsed" in $$props) $$invalidate(2, bAddressLineUsed = $$props.bAddressLineUsed);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- $$self.$$.update = () => {
- if ($$self.$$.dirty & /*addressLine*/ 1) {
- $$invalidate(2, bAddressLineUsed = addressLine.isaddress);
- }
- };
-
- return [addressLine, bDistanceInMeters, bAddressLineUsed];
- }
-
- class DetailsOneRow extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$b, create_fragment$b, safe_not_equal, { addressLine: 0, bDistanceInMeters: 1 });
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "DetailsOneRow",
- options,
- id: create_fragment$b.name
- });
-
- const { ctx } = this.$$;
- const props = options.props || {};
-
- if (/*addressLine*/ ctx[0] === undefined && !("addressLine" in props)) {
- console.warn("<DetailsOneRow> was created without expected prop 'addressLine'");
- }
-
- if (/*bDistanceInMeters*/ ctx[1] === undefined && !("bDistanceInMeters" in props)) {
- console.warn("<DetailsOneRow> was created without expected prop 'bDistanceInMeters'");
- }
- }
-
- get addressLine() {
- throw new Error("<DetailsOneRow>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- set addressLine(value) {
- throw new Error("<DetailsOneRow>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- get bDistanceInMeters() {
- throw new Error("<DetailsOneRow>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
-
- set bDistanceInMeters(value) {
- throw new Error("<DetailsOneRow>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
- }
- }
-
- /* src/pages/DetailsPage.svelte generated by Svelte v3.31.2 */
-
- const { Object: Object_1 } = globals;
- const file$c = "src/pages/DetailsPage.svelte";
-
- function get_each_context$2(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[3] = list[i];
- return child_ctx;
- }
-
- function get_each_context_1(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[6] = list[i];
- return child_ctx;
- }
-
- function get_each_context_2(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[9] = list[i];
- return child_ctx;
- }
-
- function get_each_context_3(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[9] = list[i];
- return child_ctx;
- }
-
- function get_each_context_4(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[14] = list[i];
- return child_ctx;
- }
-
- function get_each_context_5(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[14] = list[i];
- return child_ctx;
- }
-
- function get_each_context_6(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[19] = list[i];
- return child_ctx;
- }
-
- function get_each_context_7(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[19] = list[i];
- return child_ctx;
- }
-
- function get_each_context_8(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[19] = list[i];
- return child_ctx;
- }
-
- // (258:0) {:else}
- function create_else_block_2(ctx) {
- let t;
-
- const block = {
- c: function create() {
- t = text("No such place found.");
- },
- m: function mount(target, anchor) {
- insert_dev(target, t, anchor);
- },
- p: noop,
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(t);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_else_block_2.name,
- type: "else",
- source: "(258:0) {:else}",
- ctx
- });
-
- return block;
- }
-
- // (256:35)
- function create_if_block_12(ctx) {
- let detailsindex;
- let current;
- detailsindex = new DetailsIndex({ $$inline: true });
-
- const block = {
- c: function create() {
- create_component(detailsindex.$$.fragment);
- },
- m: function mount(target, anchor) {
- mount_component(detailsindex, target, anchor);
- current = true;
- },
- p: noop,
- i: function intro(local) {
- if (current) return;
- transition_in(detailsindex.$$.fragment, local);
- current = true;
- },
- o: function outro(local) {
- transition_out(detailsindex.$$.fragment, local);
- current = false;
- },
- d: function destroy(detaching) {
- destroy_component(detailsindex, detaching);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_12.name,
- type: "if",
- source: "(256:35) ",
- ctx
- });
-
- return block;
- }
-
- // (53:0) {#if aPlace}
- function create_if_block$5(ctx) {
- let div9;
- let div2;
- let div0;
- let h1;
- let t0_value = /*aPlace*/ ctx[0].localname + "";
- let t0;
- let t1;
- let small;
- let a0;
- let t2;
- let a0_href_value;
- let t3;
- let div1;
- let mapicon;
- let t4;
- let div6;
- let div3;
- let table0;
- let tbody0;
- let tr0;
- let td0;
- let t6;
- let td1;
- let t7;
- let tr1;
- let td2;
- let t9;
- let td3;
- let t10_value = /*aPlace*/ ctx[0].category + "";
- let t10;
- let t11;
- let t12_value = /*aPlace*/ ctx[0].type + "";
- let t12;
- let t13;
- let tr2;
- let td4;
- let t15;
- let td5;
- let t16_value = /*aPlace*/ ctx[0].indexed_date + "";
- let t16;
- let t17;
- let show_if = isAdminBoundary_1(/*aPlace*/ ctx[0]);
- let t18;
- let tr3;
- let td6;
- let t20;
- let td7;
- let t21_value = /*aPlace*/ ctx[0].rank_search + "";
- let t21;
- let t22;
- let tr4;
- let td8;
- let t24;
- let td9;
- let t25_value = /*aPlace*/ ctx[0].rank_address + "";
- let t25;
- let t26;
- let t27_value = formatAddressRank_1(/*aPlace*/ ctx[0].rank_address) + "";
- let t27;
- let t28;
- let t29;
- let t30;
- let tr5;
- let td10;
- let t32;
- let td11;
- let t33_value = coverageType_1(/*aPlace*/ ctx[0]) + "";
- let t33;
- let t34;
- let tr6;
- let td12;
- let t36;
- let td13;
- let t37_value = /*aPlace*/ ctx[0].centroid.coordinates[1] + "";
- let t37;
- let t38;
- let t39_value = /*aPlace*/ ctx[0].centroid.coordinates[0] + "";
- let t39;
- let t40;
- let tr7;
- let td14;
- let t42;
- let td15;
- let raw_value = osmLink_1(/*aPlace*/ ctx[0]) + "";
- let t43;
- let tr8;
- let td16;
- let t44;
- let a1;
- let t46;
- let t47;
- let td17;
- let t48_value = /*aPlace*/ ctx[0].place_id + "";
- let t48;
- let t49;
- let t50;
- let tr9;
- let td18;
- let t52;
- let td19;
- let t53_value = /*aPlace*/ ctx[0].calculated_postcode + "";
- let t53;
- let t54;
- let tr10;
- let td20;
- let t56;
- let td21;
- let t57;
- let tr11;
- let td22;
- let t59;
- let td23;
- let t60;
- let div5;
- let div4;
- let map;
- let t61;
- let div8;
- let div7;
- let h20;
- let t63;
- let table1;
- let thead;
- let tr12;
- let th0;
- let t65;
- let th1;
- let t67;
- let th2;
- let t69;
- let th3;
- let t71;
- let th4;
- let t73;
- let th5;
- let t75;
- let th6;
- let t76;
- let tbody1;
- let t77;
- let t78;
- let tr13;
- let td24;
- let h21;
- let t80;
- let t81;
- let tr14;
- let td25;
- let h22;
- let t83;
- let current_block_type_index;
- let if_block6;
- let current;
-
- mapicon = new MapIcon({
- props: { aPlace: /*aPlace*/ ctx[0] },
- $$inline: true
- });
-
- let each_value_8 = Object.keys(/*aPlace*/ ctx[0].names);
- validate_each_argument(each_value_8);
- let each_blocks_2 = [];
-
- for (let i = 0; i < each_value_8.length; i += 1) {
- each_blocks_2[i] = create_each_block_8(get_each_context_8(ctx, each_value_8, i));
- }
-
- let if_block0 = show_if && create_if_block_11(ctx);
- let if_block1 = /*aPlace*/ ctx[0].calculated_importance && create_if_block_9(ctx);
- let if_block2 = /*aPlace*/ ctx[0].calculated_wikipedia && create_if_block_8(ctx);
- let each_value_7 = Object.keys(/*aPlace*/ ctx[0].addresstags);
- validate_each_argument(each_value_7);
- let each_blocks_1 = [];
-
- for (let i = 0; i < each_value_7.length; i += 1) {
- each_blocks_1[i] = create_each_block_7(get_each_context_7(ctx, each_value_7, i));
- }
-
- let each_value_6 = Object.keys(/*aPlace*/ ctx[0].extratags);
- validate_each_argument(each_value_6);
- let each_blocks = [];
-
- for (let i = 0; i < each_value_6.length; i += 1) {
- each_blocks[i] = create_each_block_6(get_each_context_6(ctx, each_value_6, i));
- }
-
- map = new Map$1({ $$inline: true });
- let if_block3 = /*aPlace*/ ctx[0].address && create_if_block_7(ctx);
- let if_block4 = /*aPlace*/ ctx[0].linked_places && create_if_block_6(ctx);
-
- function select_block_type_1(ctx, dirty) {
- if (/*aPlace*/ ctx[0].keywords) return create_if_block_3$1;
- return create_else_block_1$1;
- }
-
- let current_block_type = select_block_type_1(ctx);
- let if_block5 = current_block_type(ctx);
- const if_block_creators = [create_if_block_1$2, create_else_block$3];
- const if_blocks = [];
-
- function select_block_type_2(ctx, dirty) {
- if (/*aPlace*/ ctx[0].hierarchy) return 0;
- return 1;
- }
-
- current_block_type_index = select_block_type_2(ctx);
- if_block6 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
-
- const block = {
- c: function create() {
- div9 = element("div");
- div2 = element("div");
- div0 = element("div");
- h1 = element("h1");
- t0 = text(t0_value);
- t1 = space();
- small = element("small");
- a0 = element("a");
- t2 = text("link to this page");
- t3 = space();
- div1 = element("div");
- create_component(mapicon.$$.fragment);
- t4 = space();
- div6 = element("div");
- div3 = element("div");
- table0 = element("table");
- tbody0 = element("tbody");
- tr0 = element("tr");
- td0 = element("td");
- td0.textContent = "Name";
- t6 = space();
- td1 = element("td");
-
- for (let i = 0; i < each_blocks_2.length; i += 1) {
- each_blocks_2[i].c();
- }
-
- t7 = space();
- tr1 = element("tr");
- td2 = element("td");
- td2.textContent = "Type";
- t9 = space();
- td3 = element("td");
- t10 = text(t10_value);
- t11 = text(":");
- t12 = text(t12_value);
- t13 = space();
- tr2 = element("tr");
- td4 = element("td");
- td4.textContent = "Last Updated";
- t15 = space();
- td5 = element("td");
- t16 = text(t16_value);
- t17 = space();
- if (if_block0) if_block0.c();
- t18 = space();
- tr3 = element("tr");
- td6 = element("td");
- td6.textContent = "Search Rank";
- t20 = space();
- td7 = element("td");
- t21 = text(t21_value);
- t22 = space();
- tr4 = element("tr");
- td8 = element("td");
- td8.textContent = "Address Rank";
- t24 = space();
- td9 = element("td");
- t25 = text(t25_value);
- t26 = text(" (");
- t27 = text(t27_value);
- t28 = text(")");
- t29 = space();
- if (if_block1) if_block1.c();
- t30 = space();
- tr5 = element("tr");
- td10 = element("td");
- td10.textContent = "Coverage";
- t32 = space();
- td11 = element("td");
- t33 = text(t33_value);
- t34 = space();
- tr6 = element("tr");
- td12 = element("td");
- td12.textContent = "Centre Point (lat,lon)";
- t36 = space();
- td13 = element("td");
- t37 = text(t37_value);
- t38 = text(",");
- t39 = text(t39_value);
- t40 = space();
- tr7 = element("tr");
- td14 = element("td");
- td14.textContent = "OSM";
- t42 = space();
- td15 = element("td");
- t43 = space();
- tr8 = element("tr");
- td16 = element("td");
- t44 = text("Place Id\n (");
- a1 = element("a");
- a1.textContent = "on this server";
- t46 = text(")");
- t47 = space();
- td17 = element("td");
- t48 = text(t48_value);
- t49 = space();
- if (if_block2) if_block2.c();
- t50 = space();
- tr9 = element("tr");
- td18 = element("td");
- td18.textContent = "Computed Postcode";
- t52 = space();
- td19 = element("td");
- t53 = text(t53_value);
- t54 = space();
- tr10 = element("tr");
- td20 = element("td");
- td20.textContent = "Address Tags";
- t56 = space();
- td21 = element("td");
-
- for (let i = 0; i < each_blocks_1.length; i += 1) {
- each_blocks_1[i].c();
- }
-
- t57 = space();
- tr11 = element("tr");
- td22 = element("td");
- td22.textContent = "Extra Tags";
- t59 = space();
- td23 = element("td");
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- t60 = space();
- div5 = element("div");
- div4 = element("div");
- create_component(map.$$.fragment);
- t61 = space();
- div8 = element("div");
- div7 = element("div");
- h20 = element("h2");
- h20.textContent = "Address";
- t63 = space();
- table1 = element("table");
- thead = element("thead");
- tr12 = element("tr");
- th0 = element("th");
- th0.textContent = "Local name";
- t65 = space();
- th1 = element("th");
- th1.textContent = "Type";
- t67 = space();
- th2 = element("th");
- th2.textContent = "OSM";
- t69 = space();
- th3 = element("th");
- th3.textContent = "Address rank";
- t71 = space();
- th4 = element("th");
- th4.textContent = "Admin level";
- t73 = space();
- th5 = element("th");
- th5.textContent = "Distance";
- t75 = space();
- th6 = element("th");
- t76 = space();
- tbody1 = element("tbody");
- if (if_block3) if_block3.c();
- t77 = space();
- if (if_block4) if_block4.c();
- t78 = space();
- tr13 = element("tr");
- td24 = element("td");
- h21 = element("h2");
- h21.textContent = "Keywords";
- t80 = space();
- if_block5.c();
- t81 = space();
- tr14 = element("tr");
- td25 = element("td");
- h22 = element("h2");
- h22.textContent = "Parent Of";
- t83 = space();
- if_block6.c();
- attr_dev(a0, "href", a0_href_value = detailsURL_1(/*aPlace*/ ctx[0]));
- attr_dev(a0, "class", "svelte-j6zgmy");
- add_location(a0, file$c, 58, 17, 1869);
- add_location(small, file$c, 58, 10, 1862);
- attr_dev(h1, "class", "svelte-j6zgmy");
- add_location(h1, file$c, 56, 8, 1818);
- attr_dev(div0, "class", "col-sm-10");
- add_location(div0, file$c, 55, 6, 1786);
- attr_dev(div1, "class", "col-sm-2 text-right");
- add_location(div1, file$c, 61, 6, 1963);
- attr_dev(div2, "class", "row");
- add_location(div2, file$c, 54, 4, 1762);
- attr_dev(td0, "class", "svelte-j6zgmy");
- add_location(td0, file$c, 70, 14, 2222);
- attr_dev(td1, "class", "svelte-j6zgmy");
- add_location(td1, file$c, 71, 14, 2250);
- attr_dev(tr0, "class", "svelte-j6zgmy");
- add_location(tr0, file$c, 69, 12, 2203);
- attr_dev(td2, "class", "svelte-j6zgmy");
- add_location(td2, file$c, 80, 14, 2544);
- attr_dev(td3, "class", "svelte-j6zgmy");
- add_location(td3, file$c, 81, 14, 2572);
- attr_dev(tr1, "class", "svelte-j6zgmy");
- add_location(tr1, file$c, 79, 12, 2525);
- attr_dev(td4, "class", "svelte-j6zgmy");
- add_location(td4, file$c, 84, 14, 2662);
- attr_dev(td5, "class", "svelte-j6zgmy");
- add_location(td5, file$c, 85, 14, 2698);
- attr_dev(tr2, "class", "svelte-j6zgmy");
- add_location(tr2, file$c, 83, 12, 2643);
- attr_dev(td6, "class", "svelte-j6zgmy");
- add_location(td6, file$c, 94, 14, 2955);
- attr_dev(td7, "class", "svelte-j6zgmy");
- add_location(td7, file$c, 95, 14, 2990);
- attr_dev(tr3, "class", "svelte-j6zgmy");
- add_location(tr3, file$c, 93, 12, 2936);
- attr_dev(td8, "class", "svelte-j6zgmy");
- add_location(td8, file$c, 98, 14, 3069);
- attr_dev(td9, "class", "svelte-j6zgmy");
- add_location(td9, file$c, 99, 14, 3105);
- attr_dev(tr4, "class", "svelte-j6zgmy");
- add_location(tr4, file$c, 97, 12, 3050);
- attr_dev(td10, "class", "svelte-j6zgmy");
- add_location(td10, file$c, 111, 14, 3520);
- attr_dev(td11, "class", "svelte-j6zgmy");
- add_location(td11, file$c, 112, 14, 3552);
- attr_dev(tr5, "class", "svelte-j6zgmy");
- add_location(tr5, file$c, 110, 12, 3501);
- attr_dev(td12, "class", "svelte-j6zgmy");
- add_location(td12, file$c, 115, 14, 3633);
- attr_dev(td13, "class", "svelte-j6zgmy");
- add_location(td13, file$c, 116, 14, 3679);
- attr_dev(tr6, "class", "svelte-j6zgmy");
- add_location(tr6, file$c, 114, 12, 3614);
- attr_dev(td14, "class", "svelte-j6zgmy");
- add_location(td14, file$c, 121, 14, 3835);
- attr_dev(td15, "class", "svelte-j6zgmy");
- add_location(td15, file$c, 122, 14, 3862);
- attr_dev(tr7, "class", "svelte-j6zgmy");
- add_location(tr7, file$c, 120, 12, 3816);
- attr_dev(a1, "href", "https://nominatim.org/release-docs/develop/api/Output/#place_id-is-not-a-persistent-id");
- add_location(a1, file$c, 127, 17, 3986);
- attr_dev(td16, "class", "svelte-j6zgmy");
- add_location(td16, file$c, 125, 14, 3939);
- attr_dev(td17, "class", "svelte-j6zgmy");
- add_location(td17, file$c, 129, 14, 4137);
- attr_dev(tr8, "class", "svelte-j6zgmy");
- add_location(tr8, file$c, 124, 12, 3920);
- attr_dev(td18, "class", "svelte-j6zgmy");
- add_location(td18, file$c, 138, 14, 4417);
- attr_dev(td19, "class", "svelte-j6zgmy");
- add_location(td19, file$c, 139, 14, 4458);
- attr_dev(tr9, "class", "svelte-j6zgmy");
- add_location(tr9, file$c, 137, 12, 4398);
- attr_dev(td20, "class", "svelte-j6zgmy");
- add_location(td20, file$c, 142, 14, 4545);
- attr_dev(td21, "class", "svelte-j6zgmy");
- add_location(td21, file$c, 143, 14, 4581);
- attr_dev(tr10, "class", "svelte-j6zgmy");
- add_location(tr10, file$c, 141, 12, 4526);
- attr_dev(td22, "class", "svelte-j6zgmy");
- add_location(td22, file$c, 152, 14, 4887);
- attr_dev(td23, "class", "svelte-j6zgmy");
- add_location(td23, file$c, 153, 14, 4921);
- attr_dev(tr11, "class", "svelte-j6zgmy");
- add_location(tr11, file$c, 151, 12, 4868);
- attr_dev(tbody0, "class", "svelte-j6zgmy");
- add_location(tbody0, file$c, 68, 10, 2183);
- attr_dev(table0, "id", "locationdetails");
- attr_dev(table0, "class", "table table-striped svelte-j6zgmy");
- add_location(table0, file$c, 67, 8, 2116);
- attr_dev(div3, "class", "col-md-6");
- add_location(div3, file$c, 66, 6, 2085);
- attr_dev(div4, "id", "map-wrapper");
- attr_dev(div4, "class", "svelte-j6zgmy");
- add_location(div4, file$c, 165, 8, 5278);
- attr_dev(div5, "class", "col-md-6");
- add_location(div5, file$c, 164, 6, 5247);
- attr_dev(div6, "class", "row");
- add_location(div6, file$c, 65, 4, 2061);
- attr_dev(h20, "class", "svelte-j6zgmy");
- add_location(h20, file$c, 172, 8, 5417);
- attr_dev(th0, "class", "svelte-j6zgmy");
- add_location(th0, file$c, 176, 14, 5553);
- attr_dev(th1, "class", "svelte-j6zgmy");
- add_location(th1, file$c, 177, 14, 5587);
- attr_dev(th2, "class", "svelte-j6zgmy");
- add_location(th2, file$c, 178, 14, 5615);
- attr_dev(th3, "class", "svelte-j6zgmy");
- add_location(th3, file$c, 179, 14, 5642);
- attr_dev(th4, "class", "svelte-j6zgmy");
- add_location(th4, file$c, 180, 14, 5678);
- attr_dev(th5, "class", "svelte-j6zgmy");
- add_location(th5, file$c, 181, 14, 5713);
- attr_dev(th6, "class", "svelte-j6zgmy");
- add_location(th6, file$c, 182, 14, 5745);
- attr_dev(tr12, "class", "svelte-j6zgmy");
- add_location(tr12, file$c, 175, 12, 5534);
- attr_dev(thead, "class", "svelte-j6zgmy");
- add_location(thead, file$c, 174, 10, 5514);
- attr_dev(h21, "class", "svelte-j6zgmy");
- add_location(h21, file$c, 199, 52, 6380);
- attr_dev(td24, "colspan", "6");
- attr_dev(td24, "class", "svelte-j6zgmy");
- add_location(td24, file$c, 199, 36, 6364);
- attr_dev(tr13, "class", "all-columns svelte-j6zgmy");
- add_location(tr13, file$c, 199, 12, 6340);
- attr_dev(h22, "class", "svelte-j6zgmy");
- add_location(h22, file$c, 229, 52, 7511);
- attr_dev(td25, "colspan", "6");
- attr_dev(td25, "class", "svelte-j6zgmy");
- add_location(td25, file$c, 229, 36, 7495);
- attr_dev(tr14, "class", "all-columns svelte-j6zgmy");
- add_location(tr14, file$c, 229, 12, 7471);
- attr_dev(tbody1, "class", "svelte-j6zgmy");
- add_location(tbody1, file$c, 185, 10, 5802);
- attr_dev(table1, "id", "address");
- attr_dev(table1, "class", "table table-striped table-small svelte-j6zgmy");
- add_location(table1, file$c, 173, 9, 5443);
- attr_dev(div7, "class", "col-md-12");
- add_location(div7, file$c, 171, 6, 5385);
- attr_dev(div8, "class", "row");
- add_location(div8, file$c, 170, 4, 5361);
- attr_dev(div9, "class", "container");
- add_location(div9, file$c, 53, 2, 1734);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div9, anchor);
- append_dev(div9, div2);
- append_dev(div2, div0);
- append_dev(div0, h1);
- append_dev(h1, t0);
- append_dev(h1, t1);
- append_dev(h1, small);
- append_dev(small, a0);
- append_dev(a0, t2);
- append_dev(div2, t3);
- append_dev(div2, div1);
- mount_component(mapicon, div1, null);
- append_dev(div9, t4);
- append_dev(div9, div6);
- append_dev(div6, div3);
- append_dev(div3, table0);
- append_dev(table0, tbody0);
- append_dev(tbody0, tr0);
- append_dev(tr0, td0);
- append_dev(tr0, t6);
- append_dev(tr0, td1);
-
- for (let i = 0; i < each_blocks_2.length; i += 1) {
- each_blocks_2[i].m(td1, null);
- }
-
- append_dev(tbody0, t7);
- append_dev(tbody0, tr1);
- append_dev(tr1, td2);
- append_dev(tr1, t9);
- append_dev(tr1, td3);
- append_dev(td3, t10);
- append_dev(td3, t11);
- append_dev(td3, t12);
- append_dev(tbody0, t13);
- append_dev(tbody0, tr2);
- append_dev(tr2, td4);
- append_dev(tr2, t15);
- append_dev(tr2, td5);
- append_dev(td5, t16);
- append_dev(tbody0, t17);
- if (if_block0) if_block0.m(tbody0, null);
- append_dev(tbody0, t18);
- append_dev(tbody0, tr3);
- append_dev(tr3, td6);
- append_dev(tr3, t20);
- append_dev(tr3, td7);
- append_dev(td7, t21);
- append_dev(tbody0, t22);
- append_dev(tbody0, tr4);
- append_dev(tr4, td8);
- append_dev(tr4, t24);
- append_dev(tr4, td9);
- append_dev(td9, t25);
- append_dev(td9, t26);
- append_dev(td9, t27);
- append_dev(td9, t28);
- append_dev(tbody0, t29);
- if (if_block1) if_block1.m(tbody0, null);
- append_dev(tbody0, t30);
- append_dev(tbody0, tr5);
- append_dev(tr5, td10);
- append_dev(tr5, t32);
- append_dev(tr5, td11);
- append_dev(td11, t33);
- append_dev(tbody0, t34);
- append_dev(tbody0, tr6);
- append_dev(tr6, td12);
- append_dev(tr6, t36);
- append_dev(tr6, td13);
- append_dev(td13, t37);
- append_dev(td13, t38);
- append_dev(td13, t39);
- append_dev(tbody0, t40);
- append_dev(tbody0, tr7);
- append_dev(tr7, td14);
- append_dev(tr7, t42);
- append_dev(tr7, td15);
- td15.innerHTML = raw_value;
- append_dev(tbody0, t43);
- append_dev(tbody0, tr8);
- append_dev(tr8, td16);
- append_dev(td16, t44);
- append_dev(td16, a1);
- append_dev(td16, t46);
- append_dev(tr8, t47);
- append_dev(tr8, td17);
- append_dev(td17, t48);
- append_dev(tbody0, t49);
- if (if_block2) if_block2.m(tbody0, null);
- append_dev(tbody0, t50);
- append_dev(tbody0, tr9);
- append_dev(tr9, td18);
- append_dev(tr9, t52);
- append_dev(tr9, td19);
- append_dev(td19, t53);
- append_dev(tbody0, t54);
- append_dev(tbody0, tr10);
- append_dev(tr10, td20);
- append_dev(tr10, t56);
- append_dev(tr10, td21);
-
- for (let i = 0; i < each_blocks_1.length; i += 1) {
- each_blocks_1[i].m(td21, null);
- }
-
- append_dev(tbody0, t57);
- append_dev(tbody0, tr11);
- append_dev(tr11, td22);
- append_dev(tr11, t59);
- append_dev(tr11, td23);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(td23, null);
- }
-
- append_dev(div6, t60);
- append_dev(div6, div5);
- append_dev(div5, div4);
- mount_component(map, div4, null);
- append_dev(div9, t61);
- append_dev(div9, div8);
- append_dev(div8, div7);
- append_dev(div7, h20);
- append_dev(div7, t63);
- append_dev(div7, table1);
- append_dev(table1, thead);
- append_dev(thead, tr12);
- append_dev(tr12, th0);
- append_dev(tr12, t65);
- append_dev(tr12, th1);
- append_dev(tr12, t67);
- append_dev(tr12, th2);
- append_dev(tr12, t69);
- append_dev(tr12, th3);
- append_dev(tr12, t71);
- append_dev(tr12, th4);
- append_dev(tr12, t73);
- append_dev(tr12, th5);
- append_dev(tr12, t75);
- append_dev(tr12, th6);
- append_dev(table1, t76);
- append_dev(table1, tbody1);
- if (if_block3) if_block3.m(tbody1, null);
- append_dev(tbody1, t77);
- if (if_block4) if_block4.m(tbody1, null);
- append_dev(tbody1, t78);
- append_dev(tbody1, tr13);
- append_dev(tr13, td24);
- append_dev(td24, h21);
- append_dev(tbody1, t80);
- if_block5.m(tbody1, null);
- append_dev(tbody1, t81);
- append_dev(tbody1, tr14);
- append_dev(tr14, td25);
- append_dev(td25, h22);
- append_dev(tbody1, t83);
- if_blocks[current_block_type_index].m(tbody1, null);
- current = true;
- },
- p: function update(ctx, dirty) {
- if ((!current || dirty & /*aPlace*/ 1) && t0_value !== (t0_value = /*aPlace*/ ctx[0].localname + "")) set_data_dev(t0, t0_value);
-
- if (!current || dirty & /*aPlace*/ 1 && a0_href_value !== (a0_href_value = detailsURL_1(/*aPlace*/ ctx[0]))) {
- attr_dev(a0, "href", a0_href_value);
- }
-
- const mapicon_changes = {};
- if (dirty & /*aPlace*/ 1) mapicon_changes.aPlace = /*aPlace*/ ctx[0];
- mapicon.$set(mapicon_changes);
-
- if (dirty & /*Object, aPlace*/ 1) {
- each_value_8 = Object.keys(/*aPlace*/ ctx[0].names);
- validate_each_argument(each_value_8);
- let i;
-
- for (i = 0; i < each_value_8.length; i += 1) {
- const child_ctx = get_each_context_8(ctx, each_value_8, i);
-
- if (each_blocks_2[i]) {
- each_blocks_2[i].p(child_ctx, dirty);
- } else {
- each_blocks_2[i] = create_each_block_8(child_ctx);
- each_blocks_2[i].c();
- each_blocks_2[i].m(td1, null);
- }
- }
-
- for (; i < each_blocks_2.length; i += 1) {
- each_blocks_2[i].d(1);
- }
-
- each_blocks_2.length = each_value_8.length;
- }
-
- if ((!current || dirty & /*aPlace*/ 1) && t10_value !== (t10_value = /*aPlace*/ ctx[0].category + "")) set_data_dev(t10, t10_value);
- if ((!current || dirty & /*aPlace*/ 1) && t12_value !== (t12_value = /*aPlace*/ ctx[0].type + "")) set_data_dev(t12, t12_value);
- if ((!current || dirty & /*aPlace*/ 1) && t16_value !== (t16_value = /*aPlace*/ ctx[0].indexed_date + "")) set_data_dev(t16, t16_value);
- if (dirty & /*aPlace*/ 1) show_if = isAdminBoundary_1(/*aPlace*/ ctx[0]);
-
- if (show_if) {
- if (if_block0) {
- if_block0.p(ctx, dirty);
- } else {
- if_block0 = create_if_block_11(ctx);
- if_block0.c();
- if_block0.m(tbody0, t18);
- }
- } else if (if_block0) {
- if_block0.d(1);
- if_block0 = null;
- }
-
- if ((!current || dirty & /*aPlace*/ 1) && t21_value !== (t21_value = /*aPlace*/ ctx[0].rank_search + "")) set_data_dev(t21, t21_value);
- if ((!current || dirty & /*aPlace*/ 1) && t25_value !== (t25_value = /*aPlace*/ ctx[0].rank_address + "")) set_data_dev(t25, t25_value);
- if ((!current || dirty & /*aPlace*/ 1) && t27_value !== (t27_value = formatAddressRank_1(/*aPlace*/ ctx[0].rank_address) + "")) set_data_dev(t27, t27_value);
-
- if (/*aPlace*/ ctx[0].calculated_importance) {
- if (if_block1) {
- if_block1.p(ctx, dirty);
- } else {
- if_block1 = create_if_block_9(ctx);
- if_block1.c();
- if_block1.m(tbody0, t30);
- }
- } else if (if_block1) {
- if_block1.d(1);
- if_block1 = null;
- }
-
- if ((!current || dirty & /*aPlace*/ 1) && t33_value !== (t33_value = coverageType_1(/*aPlace*/ ctx[0]) + "")) set_data_dev(t33, t33_value);
- if ((!current || dirty & /*aPlace*/ 1) && t37_value !== (t37_value = /*aPlace*/ ctx[0].centroid.coordinates[1] + "")) set_data_dev(t37, t37_value);
- if ((!current || dirty & /*aPlace*/ 1) && t39_value !== (t39_value = /*aPlace*/ ctx[0].centroid.coordinates[0] + "")) set_data_dev(t39, t39_value);
- if ((!current || dirty & /*aPlace*/ 1) && raw_value !== (raw_value = osmLink_1(/*aPlace*/ ctx[0]) + "")) td15.innerHTML = raw_value; if ((!current || dirty & /*aPlace*/ 1) && t48_value !== (t48_value = /*aPlace*/ ctx[0].place_id + "")) set_data_dev(t48, t48_value);
-
- if (/*aPlace*/ ctx[0].calculated_wikipedia) {
- if (if_block2) {
- if_block2.p(ctx, dirty);
- } else {
- if_block2 = create_if_block_8(ctx);
- if_block2.c();
- if_block2.m(tbody0, t50);
- }
- } else if (if_block2) {
- if_block2.d(1);
- if_block2 = null;
- }
-
- if ((!current || dirty & /*aPlace*/ 1) && t53_value !== (t53_value = /*aPlace*/ ctx[0].calculated_postcode + "")) set_data_dev(t53, t53_value);
-
- if (dirty & /*Object, aPlace*/ 1) {
- each_value_7 = Object.keys(/*aPlace*/ ctx[0].addresstags);
- validate_each_argument(each_value_7);
- let i;
-
- for (i = 0; i < each_value_7.length; i += 1) {
- const child_ctx = get_each_context_7(ctx, each_value_7, i);
-
- if (each_blocks_1[i]) {
- each_blocks_1[i].p(child_ctx, dirty);
- } else {
- each_blocks_1[i] = create_each_block_7(child_ctx);
- each_blocks_1[i].c();
- each_blocks_1[i].m(td21, null);
- }
- }
-
- for (; i < each_blocks_1.length; i += 1) {
- each_blocks_1[i].d(1);
- }
-
- each_blocks_1.length = each_value_7.length;
- }
-
- if (dirty & /*Object, aPlace*/ 1) {
- each_value_6 = Object.keys(/*aPlace*/ ctx[0].extratags);
- validate_each_argument(each_value_6);
- let i;
-
- for (i = 0; i < each_value_6.length; i += 1) {
- const child_ctx = get_each_context_6(ctx, each_value_6, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- } else {
- each_blocks[i] = create_each_block_6(child_ctx);
- each_blocks[i].c();
- each_blocks[i].m(td23, null);
- }
- }
-
- for (; i < each_blocks.length; i += 1) {
- each_blocks[i].d(1);
- }
-
- each_blocks.length = each_value_6.length;
- }
-
- if (/*aPlace*/ ctx[0].address) {
- if (if_block3) {
- if_block3.p(ctx, dirty);
-
- if (dirty & /*aPlace*/ 1) {
- transition_in(if_block3, 1);
- }
- } else {
- if_block3 = create_if_block_7(ctx);
- if_block3.c();
- transition_in(if_block3, 1);
- if_block3.m(tbody1, t77);
- }
- } else if (if_block3) {
- group_outros();
-
- transition_out(if_block3, 1, 1, () => {
- if_block3 = null;
- });
-
- check_outros();
- }
-
- if (/*aPlace*/ ctx[0].linked_places) {
- if (if_block4) {
- if_block4.p(ctx, dirty);
-
- if (dirty & /*aPlace*/ 1) {
- transition_in(if_block4, 1);
- }
- } else {
- if_block4 = create_if_block_6(ctx);
- if_block4.c();
- transition_in(if_block4, 1);
- if_block4.m(tbody1, t78);
- }
- } else if (if_block4) {
- group_outros();
-
- transition_out(if_block4, 1, 1, () => {
- if_block4 = null;
- });
-
- check_outros();
- }
-
- if (current_block_type === (current_block_type = select_block_type_1(ctx)) && if_block5) {
- if_block5.p(ctx, dirty);
- } else {
- if_block5.d(1);
- if_block5 = current_block_type(ctx);
-
- if (if_block5) {
- if_block5.c();
- if_block5.m(tbody1, t81);
- }
- }
-
- let previous_block_index = current_block_type_index;
- current_block_type_index = select_block_type_2(ctx);
-
- if (current_block_type_index === previous_block_index) {
- if_blocks[current_block_type_index].p(ctx, dirty);
- } else {
- group_outros();
-
- transition_out(if_blocks[previous_block_index], 1, 1, () => {
- if_blocks[previous_block_index] = null;
- });
-
- check_outros();
- if_block6 = if_blocks[current_block_type_index];
-
- if (!if_block6) {
- if_block6 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
- if_block6.c();
- } else {
- if_block6.p(ctx, dirty);
- }
-
- transition_in(if_block6, 1);
- if_block6.m(tbody1, null);
- }
- },
- i: function intro(local) {
- if (current) return;
- transition_in(mapicon.$$.fragment, local);
- transition_in(map.$$.fragment, local);
- transition_in(if_block3);
- transition_in(if_block4);
- transition_in(if_block6);
- current = true;
- },
- o: function outro(local) {
- transition_out(mapicon.$$.fragment, local);
- transition_out(map.$$.fragment, local);
- transition_out(if_block3);
- transition_out(if_block4);
- transition_out(if_block6);
- current = false;
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div9);
- destroy_component(mapicon);
- destroy_each(each_blocks_2, detaching);
- if (if_block0) if_block0.d();
- if (if_block1) if_block1.d();
- if (if_block2) if_block2.d();
- destroy_each(each_blocks_1, detaching);
- destroy_each(each_blocks, detaching);
- destroy_component(map);
- if (if_block3) if_block3.d();
- if (if_block4) if_block4.d();
- if_block5.d();
- if_blocks[current_block_type_index].d();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block$5.name,
- type: "if",
- source: "(53:0) {#if aPlace}",
- ctx
- });
-
- return block;
- }
-
- // (73:16) {#each Object.keys(aPlace.names) as name}
- function create_each_block_8(ctx) {
- let div;
- let span;
- let t0_value = /*aPlace*/ ctx[0].names[/*name*/ ctx[19]] + "";
- let t0;
- let t1;
- let t2_value = /*name*/ ctx[19] + "";
- let t2;
- let t3;
-
- const block = {
- c: function create() {
- div = element("div");
- span = element("span");
- t0 = text(t0_value);
- t1 = text(" (");
- t2 = text(t2_value);
- t3 = text(")\n ");
- attr_dev(span, "class", "name svelte-j6zgmy");
- add_location(span, file$c, 74, 20, 2370);
- attr_dev(div, "class", "line");
- add_location(div, file$c, 73, 18, 2331);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div, anchor);
- append_dev(div, span);
- append_dev(span, t0);
- append_dev(div, t1);
- append_dev(div, t2);
- append_dev(div, t3);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && t0_value !== (t0_value = /*aPlace*/ ctx[0].names[/*name*/ ctx[19]] + "")) set_data_dev(t0, t0_value);
- if (dirty & /*aPlace*/ 1 && t2_value !== (t2_value = /*name*/ ctx[19] + "")) set_data_dev(t2, t2_value);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block_8.name,
- type: "each",
- source: "(73:16) {#each Object.keys(aPlace.names) as name}",
- ctx
- });
-
- return block;
- }
-
- // (88:12) {#if (isAdminBoundary(aPlace)) }
- function create_if_block_11(ctx) {
- let tr;
- let td0;
- let t1;
- let td1;
- let t2_value = /*aPlace*/ ctx[0].admin_level + "";
- let t2;
-
- const block = {
- c: function create() {
- tr = element("tr");
- td0 = element("td");
- td0.textContent = "Admin Level";
- t1 = space();
- td1 = element("td");
- t2 = text(t2_value);
- attr_dev(td0, "class", "svelte-j6zgmy");
- add_location(td0, file$c, 89, 14, 2823);
- attr_dev(td1, "class", "svelte-j6zgmy");
- add_location(td1, file$c, 90, 14, 2858);
- attr_dev(tr, "class", "svelte-j6zgmy");
- add_location(tr, file$c, 88, 12, 2804);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td0);
- append_dev(tr, t1);
- append_dev(tr, td1);
- append_dev(td1, t2);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && t2_value !== (t2_value = /*aPlace*/ ctx[0].admin_level + "")) set_data_dev(t2, t2_value);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_11.name,
- type: "if",
- source: "(88:12) {#if (isAdminBoundary(aPlace)) }",
- ctx
- });
-
- return block;
- }
-
- // (102:12) {#if aPlace.calculated_importance}
- function create_if_block_9(ctx) {
- let tr;
- let td0;
- let t1;
- let td1;
- let t2_value = /*aPlace*/ ctx[0].calculated_importance + "";
- let t2;
- let t3;
- let if_block = !/*aPlace*/ ctx[0].importance && create_if_block_10(ctx);
-
- const block = {
- c: function create() {
- tr = element("tr");
- td0 = element("td");
- td0.textContent = "Importance";
- t1 = space();
- td1 = element("td");
- t2 = text(t2_value);
- t3 = space();
- if (if_block) if_block.c();
- attr_dev(td0, "class", "svelte-j6zgmy");
- add_location(td0, file$c, 103, 16, 3279);
- attr_dev(td1, "class", "svelte-j6zgmy");
- add_location(td1, file$c, 104, 16, 3315);
- attr_dev(tr, "class", "svelte-j6zgmy");
- add_location(tr, file$c, 102, 14, 3258);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td0);
- append_dev(tr, t1);
- append_dev(tr, td1);
- append_dev(td1, t2);
- append_dev(td1, t3);
- if (if_block) if_block.m(td1, null);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && t2_value !== (t2_value = /*aPlace*/ ctx[0].calculated_importance + "")) set_data_dev(t2, t2_value);
-
- if (!/*aPlace*/ ctx[0].importance) {
- if (if_block) ; else {
- if_block = create_if_block_10(ctx);
- if_block.c();
- if_block.m(td1, null);
- }
- } else if (if_block) {
- if_block.d(1);
- if_block = null;
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- if (if_block) if_block.d();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_9.name,
- type: "if",
- source: "(102:12) {#if aPlace.calculated_importance}",
- ctx
- });
-
- return block;
- }
-
- // (107:18) {#if !aPlace.importance}
- function create_if_block_10(ctx) {
- let t;
-
- const block = {
- c: function create() {
- t = text("(estimated)");
- },
- m: function mount(target, anchor) {
- insert_dev(target, t, anchor);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(t);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_10.name,
- type: "if",
- source: "(107:18) {#if !aPlace.importance}",
- ctx
- });
-
- return block;
- }
-
- // (132:12) {#if aPlace.calculated_wikipedia}
- function create_if_block_8(ctx) {
- let tr;
- let td0;
- let t1;
- let td1;
- let raw_value = wikipediaLink_1(/*aPlace*/ ctx[0]) + "";
-
- const block = {
- c: function create() {
- tr = element("tr");
- td0 = element("td");
- td0.textContent = "Wikipedia Calculated";
- t1 = space();
- td1 = element("td");
- attr_dev(td0, "class", "svelte-j6zgmy");
- add_location(td0, file$c, 133, 16, 4263);
- attr_dev(td1, "class", "svelte-j6zgmy");
- add_location(td1, file$c, 134, 16, 4309);
- attr_dev(tr, "class", "svelte-j6zgmy");
- add_location(tr, file$c, 132, 14, 4242);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td0);
- append_dev(tr, t1);
- append_dev(tr, td1);
- td1.innerHTML = raw_value;
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && raw_value !== (raw_value = wikipediaLink_1(/*aPlace*/ ctx[0]) + "")) td1.innerHTML = raw_value; },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_8.name,
- type: "if",
- source: "(132:12) {#if aPlace.calculated_wikipedia}",
- ctx
- });
-
- return block;
- }
-
- // (145:16) {#each Object.keys(aPlace.addresstags) as name}
- function create_each_block_7(ctx) {
- let div;
- let span;
- let t0_value = /*aPlace*/ ctx[0].addresstags[/*name*/ ctx[19]] + "";
- let t0;
- let t1;
- let t2_value = /*name*/ ctx[19] + "";
- let t2;
- let t3;
-
- const block = {
- c: function create() {
- div = element("div");
- span = element("span");
- t0 = text(t0_value);
- t1 = text(" (");
- t2 = text(t2_value);
- t3 = text(")\n ");
- attr_dev(span, "class", "name svelte-j6zgmy");
- add_location(span, file$c, 146, 20, 4707);
- attr_dev(div, "class", "line");
- add_location(div, file$c, 145, 18, 4668);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div, anchor);
- append_dev(div, span);
- append_dev(span, t0);
- append_dev(div, t1);
- append_dev(div, t2);
- append_dev(div, t3);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && t0_value !== (t0_value = /*aPlace*/ ctx[0].addresstags[/*name*/ ctx[19]] + "")) set_data_dev(t0, t0_value);
- if (dirty & /*aPlace*/ 1 && t2_value !== (t2_value = /*name*/ ctx[19] + "")) set_data_dev(t2, t2_value);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block_7.name,
- type: "each",
- source: "(145:16) {#each Object.keys(aPlace.addresstags) as name}",
- ctx
- });
-
- return block;
- }
-
- // (155:16) {#each Object.keys(aPlace.extratags) as name}
- function create_each_block_6(ctx) {
- let div;
- let span;
- let t0_value = /*aPlace*/ ctx[0].extratags[/*name*/ ctx[19]] + "";
- let t0;
- let t1;
- let t2_value = /*name*/ ctx[19] + "";
- let t2;
- let t3;
-
- const block = {
- c: function create() {
- div = element("div");
- span = element("span");
- t0 = text(t0_value);
- t1 = text(" (");
- t2 = text(t2_value);
- t3 = text(")\n ");
- attr_dev(span, "class", "name svelte-j6zgmy");
- add_location(span, file$c, 156, 20, 5045);
- attr_dev(div, "class", "line");
- add_location(div, file$c, 155, 18, 5006);
- },
- m: function mount(target, anchor) {
- insert_dev(target, div, anchor);
- append_dev(div, span);
- append_dev(span, t0);
- append_dev(div, t1);
- append_dev(div, t2);
- append_dev(div, t3);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && t0_value !== (t0_value = /*aPlace*/ ctx[0].extratags[/*name*/ ctx[19]] + "")) set_data_dev(t0, t0_value);
- if (dirty & /*aPlace*/ 1 && t2_value !== (t2_value = /*name*/ ctx[19] + "")) set_data_dev(t2, t2_value);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(div);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block_6.name,
- type: "each",
- source: "(155:16) {#each Object.keys(aPlace.extratags) as name}",
- ctx
- });
-
- return block;
- }
-
- // (187:12) {#if aPlace.address}
- function create_if_block_7(ctx) {
- let each_1_anchor;
- let current;
- let each_value_5 = /*aPlace*/ ctx[0].address;
- validate_each_argument(each_value_5);
- let each_blocks = [];
-
- for (let i = 0; i < each_value_5.length; i += 1) {
- each_blocks[i] = create_each_block_5(get_each_context_5(ctx, each_value_5, i));
- }
-
- const out = i => transition_out(each_blocks[i], 1, 1, () => {
- each_blocks[i] = null;
- });
-
- const block = {
- c: function create() {
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- each_1_anchor = empty();
- },
- m: function mount(target, anchor) {
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(target, anchor);
- }
-
- insert_dev(target, each_1_anchor, anchor);
- current = true;
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1) {
- each_value_5 = /*aPlace*/ ctx[0].address;
- validate_each_argument(each_value_5);
- let i;
-
- for (i = 0; i < each_value_5.length; i += 1) {
- const child_ctx = get_each_context_5(ctx, each_value_5, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- transition_in(each_blocks[i], 1);
- } else {
- each_blocks[i] = create_each_block_5(child_ctx);
- each_blocks[i].c();
- transition_in(each_blocks[i], 1);
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
- }
- }
-
- group_outros();
-
- for (i = each_value_5.length; i < each_blocks.length; i += 1) {
- out(i);
- }
-
- check_outros();
- }
- },
- i: function intro(local) {
- if (current) return;
-
- for (let i = 0; i < each_value_5.length; i += 1) {
- transition_in(each_blocks[i]);
- }
-
- current = true;
- },
- o: function outro(local) {
- each_blocks = each_blocks.filter(Boolean);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- transition_out(each_blocks[i]);
- }
-
- current = false;
- },
- d: function destroy(detaching) {
- destroy_each(each_blocks, detaching);
- if (detaching) detach_dev(each_1_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_7.name,
- type: "if",
- source: "(187:12) {#if aPlace.address}",
- ctx
- });
-
- return block;
- }
-
- // (188:14) {#each aPlace.address as addressLine}
- function create_each_block_5(ctx) {
- let detailsonerow;
- let current;
-
- detailsonerow = new DetailsOneRow({
- props: {
- addressLine: /*addressLine*/ ctx[14],
- bDistanceInMeters: "false"
- },
- $$inline: true
- });
-
- const block = {
- c: function create() {
- create_component(detailsonerow.$$.fragment);
- },
- m: function mount(target, anchor) {
- mount_component(detailsonerow, target, anchor);
- current = true;
- },
- p: function update(ctx, dirty) {
- const detailsonerow_changes = {};
- if (dirty & /*aPlace*/ 1) detailsonerow_changes.addressLine = /*addressLine*/ ctx[14];
- detailsonerow.$set(detailsonerow_changes);
- },
- i: function intro(local) {
- if (current) return;
- transition_in(detailsonerow.$$.fragment, local);
- current = true;
- },
- o: function outro(local) {
- transition_out(detailsonerow.$$.fragment, local);
- current = false;
- },
- d: function destroy(detaching) {
- destroy_component(detailsonerow, detaching);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block_5.name,
- type: "each",
- source: "(188:14) {#each aPlace.address as addressLine}",
- ctx
- });
-
- return block;
- }
-
- // (193:12) {#if aPlace.linked_places}
- function create_if_block_6(ctx) {
- let tr;
- let td;
- let h2;
- let t1;
- let each_1_anchor;
- let current;
- let each_value_4 = /*aPlace*/ ctx[0].linked_places;
- validate_each_argument(each_value_4);
- let each_blocks = [];
-
- for (let i = 0; i < each_value_4.length; i += 1) {
- each_blocks[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i));
- }
-
- const out = i => transition_out(each_blocks[i], 1, 1, () => {
- each_blocks[i] = null;
- });
-
- const block = {
- c: function create() {
- tr = element("tr");
- td = element("td");
- h2 = element("h2");
- h2.textContent = "Linked Places";
- t1 = space();
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- each_1_anchor = empty();
- attr_dev(h2, "class", "svelte-j6zgmy");
- add_location(h2, file$c, 193, 54, 6113);
- attr_dev(td, "colspan", "6");
- attr_dev(td, "class", "svelte-j6zgmy");
- add_location(td, file$c, 193, 38, 6097);
- attr_dev(tr, "class", "all-columns svelte-j6zgmy");
- add_location(tr, file$c, 193, 14, 6073);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td);
- append_dev(td, h2);
- insert_dev(target, t1, anchor);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(target, anchor);
- }
-
- insert_dev(target, each_1_anchor, anchor);
- current = true;
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1) {
- each_value_4 = /*aPlace*/ ctx[0].linked_places;
- validate_each_argument(each_value_4);
- let i;
-
- for (i = 0; i < each_value_4.length; i += 1) {
- const child_ctx = get_each_context_4(ctx, each_value_4, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- transition_in(each_blocks[i], 1);
- } else {
- each_blocks[i] = create_each_block_4(child_ctx);
- each_blocks[i].c();
- transition_in(each_blocks[i], 1);
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
- }
- }
-
- group_outros();
-
- for (i = each_value_4.length; i < each_blocks.length; i += 1) {
- out(i);
- }
-
- check_outros();
- }
- },
- i: function intro(local) {
- if (current) return;
-
- for (let i = 0; i < each_value_4.length; i += 1) {
- transition_in(each_blocks[i]);
- }
-
- current = true;
- },
- o: function outro(local) {
- each_blocks = each_blocks.filter(Boolean);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- transition_out(each_blocks[i]);
- }
-
- current = false;
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- if (detaching) detach_dev(t1);
- destroy_each(each_blocks, detaching);
- if (detaching) detach_dev(each_1_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_6.name,
- type: "if",
- source: "(193:12) {#if aPlace.linked_places}",
- ctx
- });
-
- return block;
- }
-
- // (195:14) {#each aPlace.linked_places as addressLine}
- function create_each_block_4(ctx) {
- let detailsonerow;
- let current;
-
- detailsonerow = new DetailsOneRow({
- props: {
- addressLine: /*addressLine*/ ctx[14],
- bDistanceInMeters: "true"
- },
- $$inline: true
- });
-
- const block = {
- c: function create() {
- create_component(detailsonerow.$$.fragment);
- },
- m: function mount(target, anchor) {
- mount_component(detailsonerow, target, anchor);
- current = true;
- },
- p: function update(ctx, dirty) {
- const detailsonerow_changes = {};
- if (dirty & /*aPlace*/ 1) detailsonerow_changes.addressLine = /*addressLine*/ ctx[14];
- detailsonerow.$set(detailsonerow_changes);
- },
- i: function intro(local) {
- if (current) return;
- transition_in(detailsonerow.$$.fragment, local);
- current = true;
- },
- o: function outro(local) {
- transition_out(detailsonerow.$$.fragment, local);
- current = false;
- },
- d: function destroy(detaching) {
- destroy_component(detailsonerow, detaching);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block_4.name,
- type: "each",
- source: "(195:14) {#each aPlace.linked_places as addressLine}",
- ctx
- });
-
- return block;
- }
-
- // (221:12) {:else}
- function create_else_block_1$1(ctx) {
- let tr;
- let td;
- let a;
- let t;
-
- const block = {
- c: function create() {
- tr = element("tr");
- td = element("td");
- a = element("a");
- t = text("display keywords");
- attr_dev(a, "class", "btn btn-outline-secondary btn-sm");
- attr_dev(a, "href", "" + (/*base_url*/ ctx[1] + "&keywords=1"));
- add_location(a, file$c, 223, 19, 7284);
- attr_dev(td, "class", "svelte-j6zgmy");
- add_location(td, file$c, 222, 16, 7260);
- attr_dev(tr, "class", "svelte-j6zgmy");
- add_location(tr, file$c, 221, 14, 7239);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td);
- append_dev(td, a);
- append_dev(a, t);
- },
- p: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_else_block_1$1.name,
- type: "else",
- source: "(221:12) {:else}",
- ctx
- });
-
- return block;
- }
-
- // (201:12) {#if aPlace.keywords}
- function create_if_block_3$1(ctx) {
- let tr0;
- let td0;
- let h30;
- let t1;
- let t2;
- let tr1;
- let td1;
- let h31;
- let t4;
- let each1_anchor;
- let each_value_3 = /*aPlace*/ ctx[0].keywords.name;
- validate_each_argument(each_value_3);
- let each_blocks_1 = [];
-
- for (let i = 0; i < each_value_3.length; i += 1) {
- each_blocks_1[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
- }
-
- let each_value_2 = /*aPlace*/ ctx[0].keywords.address;
- validate_each_argument(each_value_2);
- let each_blocks = [];
-
- for (let i = 0; i < each_value_2.length; i += 1) {
- each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
- }
-
- const block = {
- c: function create() {
- tr0 = element("tr");
- td0 = element("td");
- h30 = element("h3");
- h30.textContent = "Name Keywords";
- t1 = space();
-
- for (let i = 0; i < each_blocks_1.length; i += 1) {
- each_blocks_1[i].c();
- }
-
- t2 = space();
- tr1 = element("tr");
- td1 = element("td");
- h31 = element("h3");
- h31.textContent = "Address Keywords";
- t4 = space();
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- each1_anchor = empty();
- attr_dev(h30, "class", "svelte-j6zgmy");
- add_location(h30, file$c, 201, 54, 6496);
- attr_dev(td0, "colspan", "6");
- attr_dev(td0, "class", "svelte-j6zgmy");
- add_location(td0, file$c, 201, 38, 6480);
- attr_dev(tr0, "class", "all-columns svelte-j6zgmy");
- add_location(tr0, file$c, 201, 14, 6456);
- attr_dev(h31, "class", "svelte-j6zgmy");
- add_location(h31, file$c, 211, 54, 6876);
- attr_dev(td1, "colspan", "6");
- attr_dev(td1, "class", "svelte-j6zgmy");
- add_location(td1, file$c, 211, 38, 6860);
- attr_dev(tr1, "class", "all-columns svelte-j6zgmy");
- add_location(tr1, file$c, 211, 14, 6836);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr0, anchor);
- append_dev(tr0, td0);
- append_dev(td0, h30);
- insert_dev(target, t1, anchor);
-
- for (let i = 0; i < each_blocks_1.length; i += 1) {
- each_blocks_1[i].m(target, anchor);
- }
-
- insert_dev(target, t2, anchor);
- insert_dev(target, tr1, anchor);
- append_dev(tr1, td1);
- append_dev(td1, h31);
- insert_dev(target, t4, anchor);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(target, anchor);
- }
-
- insert_dev(target, each1_anchor, anchor);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace, formatKeywordToken*/ 1) {
- each_value_3 = /*aPlace*/ ctx[0].keywords.name;
- validate_each_argument(each_value_3);
- let i;
-
- for (i = 0; i < each_value_3.length; i += 1) {
- const child_ctx = get_each_context_3(ctx, each_value_3, i);
-
- if (each_blocks_1[i]) {
- each_blocks_1[i].p(child_ctx, dirty);
- } else {
- each_blocks_1[i] = create_each_block_3(child_ctx);
- each_blocks_1[i].c();
- each_blocks_1[i].m(t2.parentNode, t2);
- }
- }
-
- for (; i < each_blocks_1.length; i += 1) {
- each_blocks_1[i].d(1);
- }
-
- each_blocks_1.length = each_value_3.length;
- }
-
- if (dirty & /*aPlace, formatKeywordToken*/ 1) {
- each_value_2 = /*aPlace*/ ctx[0].keywords.address;
- validate_each_argument(each_value_2);
- let i;
-
- for (i = 0; i < each_value_2.length; i += 1) {
- const child_ctx = get_each_context_2(ctx, each_value_2, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- } else {
- each_blocks[i] = create_each_block_2(child_ctx);
- each_blocks[i].c();
- each_blocks[i].m(each1_anchor.parentNode, each1_anchor);
- }
- }
-
- for (; i < each_blocks.length; i += 1) {
- each_blocks[i].d(1);
- }
-
- each_blocks.length = each_value_2.length;
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr0);
- if (detaching) detach_dev(t1);
- destroy_each(each_blocks_1, detaching);
- if (detaching) detach_dev(t2);
- if (detaching) detach_dev(tr1);
- if (detaching) detach_dev(t4);
- destroy_each(each_blocks, detaching);
- if (detaching) detach_dev(each1_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_3$1.name,
- type: "if",
- source: "(201:12) {#if aPlace.keywords}",
- ctx
- });
-
- return block;
- }
-
- // (206:18) {#if keyword.id}
- function create_if_block_5(ctx) {
- let td;
- let t0;
- let t1_value = /*keyword*/ ctx[9].id + "";
- let t1;
-
- const block = {
- c: function create() {
- td = element("td");
- t0 = text("word id: ");
- t1 = text(t1_value);
- attr_dev(td, "class", "svelte-j6zgmy");
- add_location(td, file$c, 206, 20, 6722);
- },
- m: function mount(target, anchor) {
- insert_dev(target, td, anchor);
- append_dev(td, t0);
- append_dev(td, t1);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && t1_value !== (t1_value = /*keyword*/ ctx[9].id + "")) set_data_dev(t1, t1_value);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(td);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_5.name,
- type: "if",
- source: "(206:18) {#if keyword.id}",
- ctx
- });
-
- return block;
- }
-
- // (203:14) {#each aPlace.keywords.name as keyword}
- function create_each_block_3(ctx) {
- let tr;
- let td;
- let t0_value = formatKeywordToken_1(/*keyword*/ ctx[9].token) + "";
- let t0;
- let t1;
- let if_block = /*keyword*/ ctx[9].id && create_if_block_5(ctx);
-
- const block = {
- c: function create() {
- tr = element("tr");
- td = element("td");
- t0 = text(t0_value);
- t1 = space();
- if (if_block) if_block.c();
- attr_dev(td, "class", "svelte-j6zgmy");
- add_location(td, file$c, 204, 18, 6622);
- attr_dev(tr, "class", "svelte-j6zgmy");
- add_location(tr, file$c, 203, 16, 6599);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td);
- append_dev(td, t0);
- append_dev(tr, t1);
- if (if_block) if_block.m(tr, null);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && t0_value !== (t0_value = formatKeywordToken_1(/*keyword*/ ctx[9].token) + "")) set_data_dev(t0, t0_value);
-
- if (/*keyword*/ ctx[9].id) {
- if (if_block) {
- if_block.p(ctx, dirty);
- } else {
- if_block = create_if_block_5(ctx);
- if_block.c();
- if_block.m(tr, null);
- }
- } else if (if_block) {
- if_block.d(1);
- if_block = null;
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- if (if_block) if_block.d();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block_3.name,
- type: "each",
- source: "(203:14) {#each aPlace.keywords.name as keyword}",
- ctx
- });
-
- return block;
- }
-
- // (216:18) {#if keyword.id}
- function create_if_block_4(ctx) {
- let td;
- let t0;
- let t1_value = /*keyword*/ ctx[9].id + "";
- let t1;
-
- const block = {
- c: function create() {
- td = element("td");
- t0 = text("word id: ");
- t1 = text(t1_value);
- attr_dev(td, "class", "svelte-j6zgmy");
- add_location(td, file$c, 216, 20, 7108);
- },
- m: function mount(target, anchor) {
- insert_dev(target, td, anchor);
- append_dev(td, t0);
- append_dev(td, t1);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && t1_value !== (t1_value = /*keyword*/ ctx[9].id + "")) set_data_dev(t1, t1_value);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(td);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_4.name,
- type: "if",
- source: "(216:18) {#if keyword.id}",
- ctx
- });
-
- return block;
- }
-
- // (213:14) {#each aPlace.keywords.address as keyword}
- function create_each_block_2(ctx) {
- let tr;
- let td;
- let t0_value = formatKeywordToken_1(/*keyword*/ ctx[9].token) + "";
- let t0;
- let t1;
- let t2;
- let if_block = /*keyword*/ ctx[9].id && create_if_block_4(ctx);
-
- const block = {
- c: function create() {
- tr = element("tr");
- td = element("td");
- t0 = text(t0_value);
- t1 = space();
- if (if_block) if_block.c();
- t2 = space();
- attr_dev(td, "class", "svelte-j6zgmy");
- add_location(td, file$c, 214, 18, 7008);
- attr_dev(tr, "class", "svelte-j6zgmy");
- add_location(tr, file$c, 213, 16, 6985);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td);
- append_dev(td, t0);
- append_dev(tr, t1);
- if (if_block) if_block.m(tr, null);
- append_dev(tr, t2);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace*/ 1 && t0_value !== (t0_value = formatKeywordToken_1(/*keyword*/ ctx[9].token) + "")) set_data_dev(t0, t0_value);
-
- if (/*keyword*/ ctx[9].id) {
- if (if_block) {
- if_block.p(ctx, dirty);
- } else {
- if_block = create_if_block_4(ctx);
- if_block.c();
- if_block.m(tr, t2);
- }
- } else if (if_block) {
- if_block.d(1);
- if_block = null;
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- if (if_block) if_block.d();
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block_2.name,
- type: "each",
- source: "(213:14) {#each aPlace.keywords.address as keyword}",
- ctx
- });
-
- return block;
- }
-
- // (243:12) {:else}
- function create_else_block$3(ctx) {
- let tr;
- let td;
- let a;
- let t;
-
- const block = {
- c: function create() {
- tr = element("tr");
- td = element("td");
- a = element("a");
- t = text("display child places");
- attr_dev(a, "class", "btn btn-outline-secondary btn-sm");
- attr_dev(a, "href", "" + (/*base_url*/ ctx[1] + "&hierarchy=1"));
- add_location(a, file$c, 245, 19, 8125);
- attr_dev(td, "class", "svelte-j6zgmy");
- add_location(td, file$c, 244, 16, 8101);
- attr_dev(tr, "class", "svelte-j6zgmy");
- add_location(tr, file$c, 243, 14, 8080);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td);
- append_dev(td, a);
- append_dev(a, t);
- },
- p: noop,
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_else_block$3.name,
- type: "else",
- source: "(243:12) {:else}",
- ctx
- });
-
- return block;
- }
-
- // (231:12) {#if aPlace.hierarchy}
- function create_if_block_1$2(ctx) {
- let t;
- let show_if = Object.keys(/*aPlace*/ ctx[0].hierarchy) > 500;
- let if_block_anchor;
- let current;
- let each_value = Object.keys(/*aPlace*/ ctx[0].hierarchy);
- validate_each_argument(each_value);
- let each_blocks = [];
-
- for (let i = 0; i < each_value.length; i += 1) {
- each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i));
- }
-
- const out = i => transition_out(each_blocks[i], 1, 1, () => {
- each_blocks[i] = null;
- });
-
- let if_block = show_if && create_if_block_2$1(ctx);
-
- const block = {
- c: function create() {
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- t = space();
- if (if_block) if_block.c();
- if_block_anchor = empty();
- },
- m: function mount(target, anchor) {
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(target, anchor);
- }
-
- insert_dev(target, t, anchor);
- if (if_block) if_block.m(target, anchor);
- insert_dev(target, if_block_anchor, anchor);
- current = true;
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPlace, Object*/ 1) {
- each_value = Object.keys(/*aPlace*/ ctx[0].hierarchy);
- validate_each_argument(each_value);
- let i;
-
- for (i = 0; i < each_value.length; i += 1) {
- const child_ctx = get_each_context$2(ctx, each_value, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- transition_in(each_blocks[i], 1);
- } else {
- each_blocks[i] = create_each_block$2(child_ctx);
- each_blocks[i].c();
- transition_in(each_blocks[i], 1);
- each_blocks[i].m(t.parentNode, t);
- }
- }
-
- group_outros();
-
- for (i = each_value.length; i < each_blocks.length; i += 1) {
- out(i);
- }
-
- check_outros();
- }
-
- if (dirty & /*aPlace*/ 1) show_if = Object.keys(/*aPlace*/ ctx[0].hierarchy) > 500;
-
- if (show_if) {
- if (if_block) ; else {
- if_block = create_if_block_2$1(ctx);
- if_block.c();
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
- }
- } else if (if_block) {
- if_block.d(1);
- if_block = null;
- }
- },
- i: function intro(local) {
- if (current) return;
-
- for (let i = 0; i < each_value.length; i += 1) {
- transition_in(each_blocks[i]);
- }
-
- current = true;
- },
- o: function outro(local) {
- each_blocks = each_blocks.filter(Boolean);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- transition_out(each_blocks[i]);
- }
-
- current = false;
- },
- d: function destroy(detaching) {
- destroy_each(each_blocks, detaching);
- if (detaching) detach_dev(t);
- if (if_block) if_block.d(detaching);
- if (detaching) detach_dev(if_block_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_1$2.name,
- type: "if",
- source: "(231:12) {#if aPlace.hierarchy}",
- ctx
- });
-
- return block;
- }
-
- // (235:16) {#each aPlace.hierarchy[type] as line}
- function create_each_block_1(ctx) {
- let detailsonerow;
- let current;
-
- detailsonerow = new DetailsOneRow({
- props: {
- addressLine: /*line*/ ctx[6],
- bDistanceInMeters: "true"
- },
- $$inline: true
- });
-
- const block = {
- c: function create() {
- create_component(detailsonerow.$$.fragment);
- },
- m: function mount(target, anchor) {
- mount_component(detailsonerow, target, anchor);
- current = true;
- },
- p: function update(ctx, dirty) {
- const detailsonerow_changes = {};
- if (dirty & /*aPlace*/ 1) detailsonerow_changes.addressLine = /*line*/ ctx[6];
- detailsonerow.$set(detailsonerow_changes);
- },
- i: function intro(local) {
- if (current) return;
- transition_in(detailsonerow.$$.fragment, local);
- current = true;
- },
- o: function outro(local) {
- transition_out(detailsonerow.$$.fragment, local);
- current = false;
- },
- d: function destroy(detaching) {
- destroy_component(detailsonerow, detaching);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block_1.name,
- type: "each",
- source: "(235:16) {#each aPlace.hierarchy[type] as line}",
- ctx
- });
-
- return block;
- }
-
- // (233:14) {#each Object.keys(aPlace.hierarchy) as type}
- function create_each_block$2(ctx) {
- let tr;
- let td;
- let h3;
- let t0_value = /*type*/ ctx[3] + "";
- let t0;
- let t1;
- let each_1_anchor;
- let current;
- let each_value_1 = /*aPlace*/ ctx[0].hierarchy[/*type*/ ctx[3]];
- validate_each_argument(each_value_1);
- let each_blocks = [];
-
- for (let i = 0; i < each_value_1.length; i += 1) {
- each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
- }
-
- const out = i => transition_out(each_blocks[i], 1, 1, () => {
- each_blocks[i] = null;
- });
-
- const block = {
- c: function create() {
- tr = element("tr");
- td = element("td");
- h3 = element("h3");
- t0 = text(t0_value);
- t1 = space();
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- each_1_anchor = empty();
- attr_dev(h3, "class", "svelte-j6zgmy");
- add_location(h3, file$c, 233, 56, 7692);
- attr_dev(td, "colspan", "6");
- attr_dev(td, "class", "svelte-j6zgmy");
- add_location(td, file$c, 233, 40, 7676);
- attr_dev(tr, "class", "all-columns svelte-j6zgmy");
- add_location(tr, file$c, 233, 16, 7652);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td);
- append_dev(td, h3);
- append_dev(h3, t0);
- insert_dev(target, t1, anchor);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(target, anchor);
- }
-
- insert_dev(target, each_1_anchor, anchor);
- current = true;
- },
- p: function update(ctx, dirty) {
- if ((!current || dirty & /*aPlace*/ 1) && t0_value !== (t0_value = /*type*/ ctx[3] + "")) set_data_dev(t0, t0_value);
-
- if (dirty & /*aPlace, Object*/ 1) {
- each_value_1 = /*aPlace*/ ctx[0].hierarchy[/*type*/ ctx[3]];
- validate_each_argument(each_value_1);
- let i;
-
- for (i = 0; i < each_value_1.length; i += 1) {
- const child_ctx = get_each_context_1(ctx, each_value_1, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- transition_in(each_blocks[i], 1);
- } else {
- each_blocks[i] = create_each_block_1(child_ctx);
- each_blocks[i].c();
- transition_in(each_blocks[i], 1);
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
- }
- }
-
- group_outros();
-
- for (i = each_value_1.length; i < each_blocks.length; i += 1) {
- out(i);
- }
-
- check_outros();
- }
- },
- i: function intro(local) {
- if (current) return;
-
- for (let i = 0; i < each_value_1.length; i += 1) {
- transition_in(each_blocks[i]);
- }
-
- current = true;
- },
- o: function outro(local) {
- each_blocks = each_blocks.filter(Boolean);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- transition_out(each_blocks[i]);
- }
-
- current = false;
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- if (detaching) detach_dev(t1);
- destroy_each(each_blocks, detaching);
- if (detaching) detach_dev(each_1_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block$2.name,
- type: "each",
- source: "(233:14) {#each Object.keys(aPlace.hierarchy) as type}",
- ctx
- });
-
- return block;
- }
-
- // (240:14) {#if Object.keys(aPlace.hierarchy) > 500}
- function create_if_block_2$1(ctx) {
- let p;
-
- const block = {
- c: function create() {
- p = element("p");
- p.textContent = "There are more child objects which are not shown.";
- add_location(p, file$c, 240, 16, 7969);
- },
- m: function mount(target, anchor) {
- insert_dev(target, p, anchor);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(p);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_if_block_2$1.name,
- type: "if",
- source: "(240:14) {#if Object.keys(aPlace.hierarchy) > 500}",
- ctx
- });
-
- return block;
- }
-
- function create_fragment$c(ctx) {
- let current_block_type_index;
- let if_block;
- let if_block_anchor;
- let current;
- const if_block_creators = [create_if_block$5, create_if_block_12, create_else_block_2];
- const if_blocks = [];
-
- function select_block_type(ctx, dirty) {
- if (/*aPlace*/ ctx[0]) return 0;
- if (location.search === "") return 1;
- return 2;
- }
-
- current_block_type_index = select_block_type(ctx);
- if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
-
- const block = {
- c: function create() {
- if_block.c();
- if_block_anchor = empty();
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- if_blocks[current_block_type_index].m(target, anchor);
- insert_dev(target, if_block_anchor, anchor);
- current = true;
- },
- p: function update(ctx, [dirty]) {
- let previous_block_index = current_block_type_index;
- current_block_type_index = select_block_type(ctx);
-
- if (current_block_type_index === previous_block_index) {
- if_blocks[current_block_type_index].p(ctx, dirty);
- } else {
- group_outros();
-
- transition_out(if_blocks[previous_block_index], 1, 1, () => {
- if_blocks[previous_block_index] = null;
- });
-
- check_outros();
- if_block = if_blocks[current_block_type_index];
-
- if (!if_block) {
- if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
- if_block.c();
- } else {
- if_block.p(ctx, dirty);
- }
-
- transition_in(if_block, 1);
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
- }
- },
- i: function intro(local) {
- if (current) return;
- transition_in(if_block);
- current = true;
- },
- o: function outro(local) {
- transition_out(if_block);
- current = false;
- },
- d: function destroy(detaching) {
- if_blocks[current_block_type_index].d(detaching);
- if (detaching) detach_dev(if_block_anchor);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$c.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance$c($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("DetailsPage", slots, []);
- let aPlace;
- let base_url = window.location.search;
-
- function loaddata() {
- var search_params = new URLSearchParams(window.location.search);
-
- var api_request_params = {
- place_id: search_params.get("place_id"),
- osmtype: search_params.get("osmtype"),
- osmid: search_params.get("osmid"),
- class: search_params.get("class"),
- keywords: search_params.get("keywords"),
- addressdetails: 1,
- hierarchy: search_params.get("hierarchy") === "1" ? 1 : 0,
- group_hierarchy: 1,
- polygon_geojson: 1,
- format: "json"
- };
-
- if (api_request_params.place_id || api_request_params.osmtype && api_request_params.osmid) {
- if (api_request_params.place_id) {
- update_html_title("Details for " + api_request_params.place_id);
- } else {
- update_html_title("Details for " + api_request_params.osmtype + api_request_params.osmid);
- }
-
- fetch_from_api("details", api_request_params, function (data) {
- $$invalidate(0, aPlace = data);
- current_result_store.set(data);
- });
- } else {
- $$invalidate(0, aPlace = undefined);
- }
- }
-
- onMount(loaddata);
- const writable_props = [];
-
- Object_1.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<DetailsPage> was created with unknown prop '${key}'`);
- });
-
- $$self.$capture_state = () => ({
- onMount,
- fetch_from_api,
- update_html_title,
- current_result_store,
- osmLink: osmLink_1,
- detailsURL: detailsURL_1,
- wikipediaLink: wikipediaLink_1,
- coverageType: coverageType_1,
- isAdminBoundary: isAdminBoundary_1,
- formatAddressRank: formatAddressRank_1,
- formatKeywordToken: formatKeywordToken_1,
- MapIcon,
- DetailsIndex,
- DetailsOneRow,
- Map: Map$1,
- aPlace,
- base_url,
- loaddata
- });
-
- $$self.$inject_state = $$props => {
- if ("aPlace" in $$props) $$invalidate(0, aPlace = $$props.aPlace);
- if ("base_url" in $$props) $$invalidate(1, base_url = $$props.base_url);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [aPlace, base_url];
- }
-
- class DetailsPage extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$c, create_fragment$c, safe_not_equal, {});
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "DetailsPage",
- options,
- id: create_fragment$c.name
- });
- }
- }
-
- /* src/pages/PolygonsPage.svelte generated by Svelte v3.31.2 */
- const file$d = "src/pages/PolygonsPage.svelte";
-
- function get_each_context$3(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[2] = list[i];
- return child_ctx;
- }
-
- // (40:10) {#each aPolygons as polygon}
- function create_each_block$3(ctx) {
- let tr;
- let td0;
- let t0_value = /*polygon*/ ctx[2].osm_type + "";
- let t0;
- let t1;
- let td1;
- let raw_value = osmLink_1(/*polygon*/ ctx[2]) + "";
- let t2;
- let td2;
- let t3_value = /*polygon*/ ctx[2].class + "";
- let t3;
- let t4;
- let td3;
- let t5_value = /*polygon*/ ctx[2].type + "";
- let t5;
- let t6;
- let td4;
- let t7_value = /*polygon*/ ctx[2].name + "";
- let t7;
- let t8;
- let td5;
- let t9_value = (/*polygon*/ ctx[2].country_code || "") + "";
- let t9;
- let t10;
- let td6;
- let t11_value = /*polygon*/ ctx[2].errormessage + "";
- let t11;
- let t12;
- let td7;
- let t13_value = /*polygon*/ ctx[2].updated + "";
- let t13;
- let t14;
- let td8;
- let a;
- let t15;
- let a_href_value;
- let t16;
-
- const block = {
- c: function create() {
- tr = element("tr");
- td0 = element("td");
- t0 = text(t0_value);
- t1 = space();
- td1 = element("td");
- t2 = space();
- td2 = element("td");
- t3 = text(t3_value);
- t4 = space();
- td3 = element("td");
- t5 = text(t5_value);
- t6 = space();
- td4 = element("td");
- t7 = text(t7_value);
- t8 = space();
- td5 = element("td");
- t9 = text(t9_value);
- t10 = space();
- td6 = element("td");
- t11 = text(t11_value);
- t12 = space();
- td7 = element("td");
- t13 = text(t13_value);
- t14 = space();
- td8 = element("td");
- a = element("a");
- t15 = text("josm");
- t16 = space();
- add_location(td0, file$d, 41, 14, 1005);
- add_location(td1, file$d, 42, 14, 1047);
- add_location(td2, file$d, 43, 14, 1095);
- add_location(td3, file$d, 44, 14, 1134);
- add_location(td4, file$d, 45, 14, 1172);
- add_location(td5, file$d, 46, 14, 1210);
- add_location(td6, file$d, 47, 14, 1262);
- add_location(td7, file$d, 48, 14, 1308);
- attr_dev(a, "href", a_href_value = "http://localhost:8111/import?url=https://www.openstreetmap.org/api/0.6/" + formatOSMType_1(/*polygon*/ ctx[2].osm_type) + "/" + /*polygon*/ ctx[2].osm_id + "/full");
- attr_dev(a, "target", "josm");
- add_location(a, file$d, 50, 16, 1370);
- add_location(td8, file$d, 49, 14, 1349);
- add_location(tr, file$d, 40, 12, 986);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td0);
- append_dev(td0, t0);
- append_dev(tr, t1);
- append_dev(tr, td1);
- td1.innerHTML = raw_value;
- append_dev(tr, t2);
- append_dev(tr, td2);
- append_dev(td2, t3);
- append_dev(tr, t4);
- append_dev(tr, td3);
- append_dev(td3, t5);
- append_dev(tr, t6);
- append_dev(tr, td4);
- append_dev(td4, t7);
- append_dev(tr, t8);
- append_dev(tr, td5);
- append_dev(td5, t9);
- append_dev(tr, t10);
- append_dev(tr, td6);
- append_dev(td6, t11);
- append_dev(tr, t12);
- append_dev(tr, td7);
- append_dev(td7, t13);
- append_dev(tr, t14);
- append_dev(tr, td8);
- append_dev(td8, a);
- append_dev(a, t15);
- append_dev(tr, t16);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPolygons*/ 1 && t0_value !== (t0_value = /*polygon*/ ctx[2].osm_type + "")) set_data_dev(t0, t0_value);
- if (dirty & /*aPolygons*/ 1 && raw_value !== (raw_value = osmLink_1(/*polygon*/ ctx[2]) + "")) td1.innerHTML = raw_value; if (dirty & /*aPolygons*/ 1 && t3_value !== (t3_value = /*polygon*/ ctx[2].class + "")) set_data_dev(t3, t3_value);
- if (dirty & /*aPolygons*/ 1 && t5_value !== (t5_value = /*polygon*/ ctx[2].type + "")) set_data_dev(t5, t5_value);
- if (dirty & /*aPolygons*/ 1 && t7_value !== (t7_value = /*polygon*/ ctx[2].name + "")) set_data_dev(t7, t7_value);
- if (dirty & /*aPolygons*/ 1 && t9_value !== (t9_value = (/*polygon*/ ctx[2].country_code || "") + "")) set_data_dev(t9, t9_value);
- if (dirty & /*aPolygons*/ 1 && t11_value !== (t11_value = /*polygon*/ ctx[2].errormessage + "")) set_data_dev(t11, t11_value);
- if (dirty & /*aPolygons*/ 1 && t13_value !== (t13_value = /*polygon*/ ctx[2].updated + "")) set_data_dev(t13, t13_value);
-
- if (dirty & /*aPolygons*/ 1 && a_href_value !== (a_href_value = "http://localhost:8111/import?url=https://www.openstreetmap.org/api/0.6/" + formatOSMType_1(/*polygon*/ ctx[2].osm_type) + "/" + /*polygon*/ ctx[2].osm_id + "/full")) {
- attr_dev(a, "href", a_href_value);
- }
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block$3.name,
- type: "each",
- source: "(40:10) {#each aPolygons as polygon}",
- ctx
- });
-
- return block;
- }
-
- function create_fragment$d(ctx) {
- let div2;
- let div1;
- let div0;
- let h1;
- let t1;
- let p;
- let t2;
- let t3_value = /*aPolygons*/ ctx[0].length + "";
- let t3;
- let t4;
- let t5;
- let table;
- let thead;
- let th0;
- let t7;
- let th1;
- let t9;
- let th2;
- let t11;
- let th3;
- let t13;
- let th4;
- let t15;
- let th5;
- let t17;
- let th6;
- let t19;
- let th7;
- let t21;
- let th8;
- let t22;
- let tbody;
- let each_value = /*aPolygons*/ ctx[0];
- validate_each_argument(each_value);
- let each_blocks = [];
-
- for (let i = 0; i < each_value.length; i += 1) {
- each_blocks[i] = create_each_block$3(get_each_context$3(ctx, each_value, i));
- }
-
- const block = {
- c: function create() {
- div2 = element("div");
- div1 = element("div");
- div0 = element("div");
- h1 = element("h1");
- h1.textContent = "Broken polygons";
- t1 = space();
- p = element("p");
- t2 = text("Total number of broken polygons: ");
- t3 = text(t3_value);
- t4 = text(".");
- t5 = space();
- table = element("table");
- thead = element("thead");
- th0 = element("th");
- th0.textContent = "OSM type";
- t7 = space();
- th1 = element("th");
- th1.textContent = "OSM id";
- t9 = space();
- th2 = element("th");
- th2.textContent = "Class";
- t11 = space();
- th3 = element("th");
- th3.textContent = "Type";
- t13 = space();
- th4 = element("th");
- th4.textContent = "Name";
- t15 = space();
- th5 = element("th");
- th5.textContent = "Country Code";
- t17 = space();
- th6 = element("th");
- th6.textContent = "Error message";
- t19 = space();
- th7 = element("th");
- th7.textContent = "Updated";
- t21 = space();
- th8 = element("th");
- t22 = space();
- tbody = element("tbody");
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- add_location(h1, file$d, 20, 6, 484);
- add_location(p, file$d, 22, 6, 516);
- add_location(th0, file$d, 28, 10, 673);
- add_location(th1, file$d, 29, 10, 701);
- add_location(th2, file$d, 30, 10, 727);
- add_location(th3, file$d, 31, 10, 752);
- add_location(th4, file$d, 32, 10, 776);
- add_location(th5, file$d, 33, 10, 800);
- add_location(th6, file$d, 34, 10, 832);
- add_location(th7, file$d, 35, 10, 865);
- add_location(th8, file$d, 36, 10, 892);
- add_location(thead, file$d, 27, 8, 655);
- add_location(tbody, file$d, 38, 8, 927);
- attr_dev(table, "class", "table table-striped table-hover");
- add_location(table, file$d, 26, 6, 599);
- attr_dev(div0, "class", "col-sm-12");
- add_location(div0, file$d, 19, 4, 454);
- attr_dev(div1, "class", "row");
- add_location(div1, file$d, 18, 2, 432);
- attr_dev(div2, "class", "container");
- add_location(div2, file$d, 17, 0, 406);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- insert_dev(target, div2, anchor);
- append_dev(div2, div1);
- append_dev(div1, div0);
- append_dev(div0, h1);
- append_dev(div0, t1);
- append_dev(div0, p);
- append_dev(p, t2);
- append_dev(p, t3);
- append_dev(p, t4);
- append_dev(div0, t5);
- append_dev(div0, table);
- append_dev(table, thead);
- append_dev(thead, th0);
- append_dev(thead, t7);
- append_dev(thead, th1);
- append_dev(thead, t9);
- append_dev(thead, th2);
- append_dev(thead, t11);
- append_dev(thead, th3);
- append_dev(thead, t13);
- append_dev(thead, th4);
- append_dev(thead, t15);
- append_dev(thead, th5);
- append_dev(thead, t17);
- append_dev(thead, th6);
- append_dev(thead, t19);
- append_dev(thead, th7);
- append_dev(thead, t21);
- append_dev(thead, th8);
- append_dev(table, t22);
- append_dev(table, tbody);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(tbody, null);
- }
- },
- p: function update(ctx, [dirty]) {
- if (dirty & /*aPolygons*/ 1 && t3_value !== (t3_value = /*aPolygons*/ ctx[0].length + "")) set_data_dev(t3, t3_value);
-
- if (dirty & /*formatOSMType, aPolygons, osmLink*/ 1) {
- each_value = /*aPolygons*/ ctx[0];
- validate_each_argument(each_value);
- let i;
-
- for (i = 0; i < each_value.length; i += 1) {
- const child_ctx = get_each_context$3(ctx, each_value, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- } else {
- each_blocks[i] = create_each_block$3(child_ctx);
- each_blocks[i].c();
- each_blocks[i].m(tbody, null);
- }
- }
-
- for (; i < each_blocks.length; i += 1) {
- each_blocks[i].d(1);
- }
-
- each_blocks.length = each_value.length;
- }
- },
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(div2);
- destroy_each(each_blocks, detaching);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$d.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance$d($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("PolygonsPage", slots, []);
- let aPolygons = [];
-
- function loaddata() {
- fetch_from_api("polygons", { format: "json" }, function (data) {
- $$invalidate(0, aPolygons = data);
- });
-
- update_html_title("Broken polygons");
- }
-
- onMount(loaddata);
- const writable_props = [];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<PolygonsPage> was created with unknown prop '${key}'`);
- });
-
- $$self.$capture_state = () => ({
- onMount,
- fetch_from_api,
- update_html_title,
- formatOSMType: formatOSMType_1,
- osmLink: osmLink_1,
- aPolygons,
- loaddata
- });
-
- $$self.$inject_state = $$props => {
- if ("aPolygons" in $$props) $$invalidate(0, aPolygons = $$props.aPolygons);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [aPolygons];
- }
-
- class PolygonsPage extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$d, create_fragment$d, safe_not_equal, {});
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "PolygonsPage",
- options,
- id: create_fragment$d.name
- });
- }
- }
-
- /* src/pages/DeletablePage.svelte generated by Svelte v3.31.2 */
- const file$e = "src/pages/DeletablePage.svelte";
-
- function get_each_context$4(ctx, list, i) {
- const child_ctx = ctx.slice();
- child_ctx[2] = list[i];
- return child_ctx;
- }
-
- // (37:10) {#each aPolygons as polygon}
- function create_each_block$4(ctx) {
- let tr;
- let td0;
- let a;
- let t0_value = /*polygon*/ ctx[2].place_id + "";
- let t0;
- let a_href_value;
- let t1;
- let td1;
- let t2_value = /*polygon*/ ctx[2].country_code + "";
- let t2;
- let t3;
- let td2;
- let t4_value = /*polygon*/ ctx[2].name + "";
- let t4;
- let t5;
- let td3;
- let raw_value = osmLink_1(/*polygon*/ ctx[2]) + "";
- let t6;
- let td4;
- let t7_value = /*polygon*/ ctx[2].osm_type + "";
- let t7;
- let t8;
- let td5;
- let t9_value = /*polygon*/ ctx[2].class + "";
- let t9;
- let t10;
- let td6;
- let t11_value = /*polygon*/ ctx[2].type + "";
- let t11;
- let t12;
-
- const block = {
- c: function create() {
- tr = element("tr");
- td0 = element("td");
- a = element("a");
- t0 = text(t0_value);
- t1 = space();
- td1 = element("td");
- t2 = text(t2_value);
- t3 = space();
- td2 = element("td");
- t4 = text(t4_value);
- t5 = space();
- td3 = element("td");
- t6 = space();
- td4 = element("td");
- t7 = text(t7_value);
- t8 = space();
- td5 = element("td");
- t9 = text(t9_value);
- t10 = space();
- td6 = element("td");
- t11 = text(t11_value);
- t12 = space();
- attr_dev(a, "href", a_href_value = detailsURL_1(/*polygon*/ ctx[2]));
- add_location(a, file$e, 38, 16, 988);
- add_location(td0, file$e, 38, 12, 984);
- add_location(td1, file$e, 39, 12, 1060);
- add_location(td2, file$e, 40, 12, 1104);
- add_location(td3, file$e, 41, 12, 1140);
- add_location(td4, file$e, 42, 12, 1186);
- add_location(td5, file$e, 43, 12, 1226);
- add_location(td6, file$e, 44, 12, 1263);
- add_location(tr, file$e, 37, 10, 967);
- },
- m: function mount(target, anchor) {
- insert_dev(target, tr, anchor);
- append_dev(tr, td0);
- append_dev(td0, a);
- append_dev(a, t0);
- append_dev(tr, t1);
- append_dev(tr, td1);
- append_dev(td1, t2);
- append_dev(tr, t3);
- append_dev(tr, td2);
- append_dev(td2, t4);
- append_dev(tr, t5);
- append_dev(tr, td3);
- td3.innerHTML = raw_value;
- append_dev(tr, t6);
- append_dev(tr, td4);
- append_dev(td4, t7);
- append_dev(tr, t8);
- append_dev(tr, td5);
- append_dev(td5, t9);
- append_dev(tr, t10);
- append_dev(tr, td6);
- append_dev(td6, t11);
- append_dev(tr, t12);
- },
- p: function update(ctx, dirty) {
- if (dirty & /*aPolygons*/ 1 && t0_value !== (t0_value = /*polygon*/ ctx[2].place_id + "")) set_data_dev(t0, t0_value);
-
- if (dirty & /*aPolygons*/ 1 && a_href_value !== (a_href_value = detailsURL_1(/*polygon*/ ctx[2]))) {
- attr_dev(a, "href", a_href_value);
- }
-
- if (dirty & /*aPolygons*/ 1 && t2_value !== (t2_value = /*polygon*/ ctx[2].country_code + "")) set_data_dev(t2, t2_value);
- if (dirty & /*aPolygons*/ 1 && t4_value !== (t4_value = /*polygon*/ ctx[2].name + "")) set_data_dev(t4, t4_value);
- if (dirty & /*aPolygons*/ 1 && raw_value !== (raw_value = osmLink_1(/*polygon*/ ctx[2]) + "")) td3.innerHTML = raw_value; if (dirty & /*aPolygons*/ 1 && t7_value !== (t7_value = /*polygon*/ ctx[2].osm_type + "")) set_data_dev(t7, t7_value);
- if (dirty & /*aPolygons*/ 1 && t9_value !== (t9_value = /*polygon*/ ctx[2].class + "")) set_data_dev(t9, t9_value);
- if (dirty & /*aPolygons*/ 1 && t11_value !== (t11_value = /*polygon*/ ctx[2].type + "")) set_data_dev(t11, t11_value);
- },
- d: function destroy(detaching) {
- if (detaching) detach_dev(tr);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_each_block$4.name,
- type: "each",
- source: "(37:10) {#each aPolygons as polygon}",
- ctx
- });
-
- return block;
- }
-
- function create_fragment$e(ctx) {
- let div2;
- let div1;
- let div0;
- let h1;
- let t1;
- let p;
- let t2_value = /*aPolygons*/ ctx[0].length + "";
- let t2;
- let t3;
- let t4;
- let table;
- let thead;
- let th0;
- let t6;
- let th1;
- let t8;
- let th2;
- let t10;
- let th3;
- let t12;
- let th4;
- let t14;
- let th5;
- let t16;
- let th6;
- let t18;
- let tbody;
- let each_value = /*aPolygons*/ ctx[0];
- validate_each_argument(each_value);
- let each_blocks = [];
-
- for (let i = 0; i < each_value.length; i += 1) {
- each_blocks[i] = create_each_block$4(get_each_context$4(ctx, each_value, i));
- }
-
- const block = {
- c: function create() {
- div2 = element("div");
- div1 = element("div");
- div0 = element("div");
- h1 = element("h1");
- h1.textContent = "Deletable";
- t1 = space();
- p = element("p");
- t2 = text(t2_value);
- t3 = text(" objects have been deleted in OSM but are still in the Nominatim database.");
- t4 = space();
- table = element("table");
- thead = element("thead");
- th0 = element("th");
- th0.textContent = "Place id";
- t6 = space();
- th1 = element("th");
- th1.textContent = "Country Code";
- t8 = space();
- th2 = element("th");
- th2.textContent = "Name";
- t10 = space();
- th3 = element("th");
- th3.textContent = "OSM id";
- t12 = space();
- th4 = element("th");
- th4.textContent = "OSM type";
- t14 = space();
- th5 = element("th");
- th5.textContent = "Class";
- t16 = space();
- th6 = element("th");
- th6.textContent = "Type";
- t18 = space();
- tbody = element("tbody");
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].c();
- }
-
- add_location(h1, file$e, 19, 6, 483);
- add_location(p, file$e, 21, 6, 509);
- add_location(th0, file$e, 27, 10, 708);
- add_location(th1, file$e, 28, 10, 736);
- add_location(th2, file$e, 29, 10, 768);
- add_location(th3, file$e, 30, 10, 792);
- add_location(th4, file$e, 31, 10, 818);
- add_location(th5, file$e, 32, 10, 846);
- add_location(th6, file$e, 33, 10, 871);
- add_location(thead, file$e, 26, 8, 690);
- add_location(tbody, file$e, 35, 8, 910);
- attr_dev(table, "class", "table table-striped table-hover");
- add_location(table, file$e, 25, 6, 634);
- attr_dev(div0, "class", "col-sm-12");
- add_location(div0, file$e, 18, 4, 453);
- attr_dev(div1, "class", "row");
- add_location(div1, file$e, 17, 2, 431);
- attr_dev(div2, "class", "container");
- add_location(div2, file$e, 16, 0, 405);
- },
- l: function claim(nodes) {
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
- },
- m: function mount(target, anchor) {
- insert_dev(target, div2, anchor);
- append_dev(div2, div1);
- append_dev(div1, div0);
- append_dev(div0, h1);
- append_dev(div0, t1);
- append_dev(div0, p);
- append_dev(p, t2);
- append_dev(p, t3);
- append_dev(div0, t4);
- append_dev(div0, table);
- append_dev(table, thead);
- append_dev(thead, th0);
- append_dev(thead, t6);
- append_dev(thead, th1);
- append_dev(thead, t8);
- append_dev(thead, th2);
- append_dev(thead, t10);
- append_dev(thead, th3);
- append_dev(thead, t12);
- append_dev(thead, th4);
- append_dev(thead, t14);
- append_dev(thead, th5);
- append_dev(thead, t16);
- append_dev(thead, th6);
- append_dev(table, t18);
- append_dev(table, tbody);
-
- for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(tbody, null);
- }
- },
- p: function update(ctx, [dirty]) {
- if (dirty & /*aPolygons*/ 1 && t2_value !== (t2_value = /*aPolygons*/ ctx[0].length + "")) set_data_dev(t2, t2_value);
-
- if (dirty & /*aPolygons, osmLink, detailsURL*/ 1) {
- each_value = /*aPolygons*/ ctx[0];
- validate_each_argument(each_value);
- let i;
-
- for (i = 0; i < each_value.length; i += 1) {
- const child_ctx = get_each_context$4(ctx, each_value, i);
-
- if (each_blocks[i]) {
- each_blocks[i].p(child_ctx, dirty);
- } else {
- each_blocks[i] = create_each_block$4(child_ctx);
- each_blocks[i].c();
- each_blocks[i].m(tbody, null);
- }
- }
-
- for (; i < each_blocks.length; i += 1) {
- each_blocks[i].d(1);
- }
-
- each_blocks.length = each_value.length;
- }
- },
- i: noop,
- o: noop,
- d: function destroy(detaching) {
- if (detaching) detach_dev(div2);
- destroy_each(each_blocks, detaching);
- }
- };
-
- dispatch_dev("SvelteRegisterBlock", {
- block,
- id: create_fragment$e.name,
- type: "component",
- source: "",
- ctx
- });
-
- return block;
- }
-
- function instance$e($$self, $$props, $$invalidate) {
- let { $$slots: slots = {}, $$scope } = $$props;
- validate_slots("DeletablePage", slots, []);
- let aPolygons = [];
-
- function loaddata() {
- fetch_from_api("deletable", { format: "json" }, function (data) {
- $$invalidate(0, aPolygons = data);
- });
-
- update_html_title("Deletable objects");
- }
-
- onMount(loaddata);
- const writable_props = [];
-
- Object.keys($$props).forEach(key => {
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<DeletablePage> was created with unknown prop '${key}'`);
- });
-
- $$self.$capture_state = () => ({
- onMount,
- fetch_from_api,
- update_html_title,
- detailsURL: detailsURL_1,
- osmLink: osmLink_1,
- aPolygons,
- loaddata
- });
-
- $$self.$inject_state = $$props => {
- if ("aPolygons" in $$props) $$invalidate(0, aPolygons = $$props.aPolygons);
- };
-
- if ($$props && "$$inject" in $$props) {
- $$self.$inject_state($$props.$$inject);
- }
-
- return [aPolygons];
- }
-
- class DeletablePage extends SvelteComponentDev {
- constructor(options) {
- super(options);
- init(this, options, instance$e, create_fragment$e, safe_not_equal, {});
-
- dispatch_dev("SvelteRegisterComponent", {
- component: this,
- tagName: "DeletablePage",
- options,
- id: create_fragment$e.name
- });
- }
- }
-
- let myhistory = [];
-
- new App({
- target: document.body
- });
-
-
-
-
- // inspects window.location
- function identify_current_page() {
- var pagename = window.location.pathname.replace('.html', '').replace(/^.*\//, '');
-
- if (pagename === '') { return 'search' }
-
- if (['search', 'reverse', 'details', 'deletable', 'polygons'].indexOf(pagename) != '-1') {
- return pagename;
- }
- }
-
-
-
- function parse_url_and_load_page() {
- let pagename = identify_current_page();
-
- document.getElementById('main').replaceChildren();
-
- if (pagename === 'search' || pagename === 'reverse') {
- new SearchPage({
- target: document.getElementById('main'),
- props: {
- reverse_search: (pagename === 'reverse')
- }
- });
- } else if (pagename === 'details') {
- new DetailsPage({
- target: document.getElementById('main')
- });
- } else if (pagename === 'deletable') {
- new DeletablePage({
- target: document.getElementById('main')
- });
- } else if (pagename === 'polygons') {
- new PolygonsPage({
- target: document.getElementById('main')
- });
- }
- }
-
-
-
- function is_relative_url(url) {
- if (!url) return false;
- if (url.indexOf('?') === 0) return true;
- if (url.indexOf('/') === 0) return true;
- if (url.indexOf('#') === 0) return false;
- if (url.match(/^http/)) return false;
- if (!url.match(/\.html/)) return true;
-
- return false;
- }
-
-
- parse_url_and_load_page();
-
- // load page after form submit
- document.addEventListener('submit', function (e) {
-
- // loop parent nodes from the target to the delegation node
- for (var target = e.target; target && target != this; target = target.parentNode) {
- if (target.matches('form')) {
- e.preventDefault();
-
- var target_url = serialize_form(target);
- target_url = clean_up_url_parameters(target_url);
-
- window.history.pushState(myhistory, '', '?' + target_url);
-
- parse_url_and_load_page();
- break;
- }
- }
-
- });
-
- // load page after click on relative URL
- document.addEventListener('click', function (e) {
-
- // loop parent nodes from the target to the delegation node
- for (var target = e.target; target && target != this; target = target.parentNode) {
- if (target.matches('a')) {
-
- var target_url = target.href;
-
- if (!is_relative_url(target_url)) return;
-
- e.preventDefault();
- e.stopPropagation();
-
- window.history.pushState(myhistory, '', target_url);
-
- parse_url_and_load_page();
- break;
- }
- }
- });
-
- // deal with back-button and other user action
- window.onpopstate = function () {
- parse_url_and_load_page();
- };
-
-}());
+!function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function i(t){t.forEach(e)}function o(t){return"function"==typeof t}function s(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let r,a;function l(t,e){return t===e||(r||(r=document.createElement("a")),r.href=e,t===r.href)}function c(e,...n){if(null==e){for(const t of n)t(void 0);return t}const i=e.subscribe(...n);return i.unsubscribe?()=>i.unsubscribe():i}function h(t){let e;return c(t,(t=>e=t))(),e}function u(t,e,n){t.$$.on_destroy.push(c(e,n))}function d(t,e,n,i){if(t){const o=p(t,e,n,i);return t[0](o)}}function p(t,e,n,i){return t[1]&&i?function(t,e){for(const n in e)t[n]=e[n];return t}(n.ctx.slice(),t[1](i(e))):n.ctx}function m(t,e,n,i){if(t[2]&&i){const o=t[2](i(n));if(void 0===e.dirty)return o;if("object"==typeof o){const t=[],n=Math.max(e.dirty.length,o.length);for(let i=0;i<n;i+=1)t[i]=e.dirty[i]|o[i];return t}return e.dirty|o}return e.dirty}function f(t,e,n,i,o,s){if(o){const r=p(e,n,i,s);t.p(r,o)}}function _(t){if(t.ctx.length>32){const e=[],n=t.ctx.length/32;for(let t=0;t<n;t++)e[t]=-1;return e}return-1}function g(t,e){t.appendChild(e)}function v(t,e,n){t.insertBefore(e,n||null)}function y(t){t.parentNode&&t.parentNode.removeChild(t)}function b(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function w(t){return document.createElement(t)}function x(t){return document.createTextNode(t)}function $(){return x(" ")}function T(){return x("")}function P(t,e,n,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}function M(t){return function(e){return e.preventDefault(),t.call(this,e)}}function k(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function C(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function E(t,e){e=""+e,t.data!==e&&(t.data=e)}function A(t,e){t.value=null==e?"":e}function S(t,e,n){for(let n=0;n<t.options.length;n+=1){const i=t.options[n];if(i.__value===e)return void(i.selected=!0)}n&&void 0===e||(t.selectedIndex=-1)}function O(t,e,n){t.classList.toggle(e,!!n)}class z{is_svg=!1;e=void 0;n=void 0;t=void 0;a=void 0;constructor(t=!1){this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,e,n=null){var i;this.e||(this.is_svg?this.e=(i=e.nodeName,document.createElementNS("http://www.w3.org/2000/svg",i)):this.e=w(11===e.nodeType?"TEMPLATE":e.nodeName),this.t="TEMPLATE"!==e.tagName?e:e.content,this.c(t)),this.i(n)}h(t){this.e.innerHTML=t,this.n=Array.from("TEMPLATE"===this.e.nodeName?this.e.content.childNodes:this.e.childNodes)}i(t){for(let e=0;e<this.n.length;e+=1)v(this.t,this.n[e],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(y)}}function I(t){a=t}function N(t){(function(){if(!a)throw new Error("Function called outside component initialization");return a})().$$.on_mount.push(t)}const B=[],D=[];let Z=[];const j=[],R=Promise.resolve();let H=!1;function F(t){Z.push(t)}function W(t){j.push(t)}const q=new Set;let U=0;function V(){if(0!==U)return;const t=a;do{try{for(;U<B.length;){const t=B[U];U++,I(t),K(t.$$)}}catch(t){throw B.length=0,U=0,t}for(I(null),B.length=0,U=0;D.length;)D.pop()();for(let t=0;t<Z.length;t+=1){const e=Z[t];q.has(e)||(q.add(e),e())}Z.length=0}while(B.length);for(;j.length;)j.pop()();H=!1,q.clear(),I(t)}function K(t){if(null!==t.fragment){t.update(),i(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(F)}}const G=new Set;let Y;function X(){Y={r:0,c:[],p:Y}}function J(){Y.r||i(Y.c),Y=Y.p}function Q(t,e){t&&t.i&&(G.delete(t),t.i(e))}function tt(t,e,n,i){if(t&&t.o){if(G.has(t))return;G.add(t),Y.c.push((()=>{G.delete(t),i&&(n&&t.d(1),i())})),t.o(e)}else i&&i()}function et(t){return void 0!==t?.length?t:Array.from(t)}function nt(t,e,n){const i=t.$$.props[e];void 0!==i&&(t.$$.bound[i]=n,n(t.$$.ctx[i]))}function it(t){t&&t.c()}function ot(t,n,s){const{fragment:r,after_update:a}=t.$$;r&&r.m(n,s),F((()=>{const n=t.$$.on_mount.map(e).filter(o);t.$$.on_destroy?t.$$.on_destroy.push(...n):i(n),t.$$.on_mount=[]})),a.forEach(F)}function st(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];Z.forEach((i=>-1===t.indexOf(i)?e.push(i):n.push(i))),n.forEach((t=>t())),Z=e}(n.after_update),i(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function rt(t,e){-1===t.$$.dirty[0]&&(B.push(t),H||(H=!0,R.then(V)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function at(e,o,s,r,l,c,h=null,u=[-1]){const d=a;I(e);const p=e.$$={fragment:null,ctx:[],props:c,update:t,not_equal:l,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(o.context||(d?d.$$.context:[])),callbacks:n(),dirty:u,skip_bound:!1,root:o.target||d.$$.root};h&&h(p.root);let m=!1;if(p.ctx=s?s(e,o.props||{},((t,n,...i)=>{const o=i.length?i[0]:n;return p.ctx&&l(p.ctx[t],p.ctx[t]=o)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](o),m&&rt(e,t)),n})):[],p.update(),m=!0,i(p.before_update),p.fragment=!!r&&r(p.ctx),o.target){if(o.hydrate){const t=function(t){return Array.from(t.childNodes)}(o.target);p.fragment&&p.fragment.l(t),t.forEach(y)}else p.fragment&&p.fragment.c();o.intro&&Q(e.$$.fragment),ot(e,o.target,o.anchor),V()}I(d)}class lt{$$=void 0;$$set=void 0;$destroy(){st(this,1),this.$destroy=t}$on(e,n){if(!o(n))return t;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const t=i.indexOf(n);-1!==t&&i.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function ct(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(function(){const t=new Map,e={set(e,n,i){t.has(e)||t.set(e,new Map);const o=t.get(e);o.has(n)||0===o.size?o.set(n,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(o.keys())[0]}.`)},get:(e,n)=>t.has(e)&&t.get(e).get(n)||null,remove(e,n){if(!t.has(e))return;const i=t.get(e);i.delete(n),0===i.size&&t.delete(e)}},n=1e6,i=1e3,o="transitionend",s=t=>(t&&window.CSS&&window.CSS.escape&&(t=t.replace(/#([^\s"#']+)/g,((t,e)=>`#${CSS.escape(e)}`))),t),r=t=>null==t?`${t}`:Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase(),a=t=>{do{t+=Math.floor(Math.random()*n)}while(document.getElementById(t));return t},l=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:n}=window.getComputedStyle(t);const o=Number.parseFloat(e),s=Number.parseFloat(n);return o||s?(e=e.split(",")[0],n=n.split(",")[0],(Number.parseFloat(e)+Number.parseFloat(n))*i):0},c=t=>{t.dispatchEvent(new Event(o))},h=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),u=t=>h(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(s(t)):null,d=t=>{if(!h(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),n=t.closest("details:not([open])");if(!n)return e;if(n!==t){const e=t.closest("summary");if(e&&e.parentNode!==n)return!1;if(null===e)return!1}return e},p=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),m=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?m(t.parentNode):null},f=()=>{},_=t=>{t.offsetHeight},g=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,v=[],y=t=>{"loading"===document.readyState?(v.length||document.addEventListener("DOMContentLoaded",(()=>{for(const t of v)t()})),v.push(t)):t()},b=()=>"rtl"===document.documentElement.dir,w=t=>{y((()=>{const e=g();if(e){const n=t.NAME,i=e.fn[n];e.fn[n]=t.jQueryInterface,e.fn[n].Constructor=t,e.fn[n].noConflict=()=>(e.fn[n]=i,t.jQueryInterface)}}))},x=(t,e=[],n=t)=>"function"==typeof t?t(...e):n,$=(t,e,n=!0)=>{if(!n)return void x(t);const i=5,s=l(e)+i;let r=!1;const a=({target:n})=>{n===e&&(r=!0,e.removeEventListener(o,a),x(t))};e.addEventListener(o,a),setTimeout((()=>{r||c(e)}),s)},L=(t,e,n,i)=>{const o=t.length;let s=t.indexOf(e);return-1===s?!n&&i?t[o-1]:t[0]:(s+=n?1:-1,i&&(s=(s+o)%o),t[Math.max(0,Math.min(s,o-1))])},T=/[^.]*(?=\..*)\.|.*/,P=/\..*/,M=/::\d+$/,k={};let C=1;const E={mouseenter:"mouseover",mouseleave:"mouseout"},A=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function S(t,e){return e&&`${e}::${C++}`||t.uidEvent||C++}function O(t){const e=S(t);return t.uidEvent=e,k[e]=k[e]||{},k[e]}function z(t,e){return function n(i){return F(i,{delegateTarget:t}),n.oneOff&&H.off(t,i.type,e),e.apply(t,[i])}}function I(t,e,n){return function i(o){const s=t.querySelectorAll(e);for(let{target:r}=o;r&&r!==this;r=r.parentNode)for(const a of s)if(a===r)return F(o,{delegateTarget:r}),i.oneOff&&H.off(t,o.type,e,n),n.apply(r,[o])}}function N(t,e,n=null){return Object.values(t).find((t=>t.callable===e&&t.delegationSelector===n))}function B(t,e,n){const i="string"==typeof e,o=i?n:e||n;let s=R(t);return A.has(s)||(s=t),[i,o,s]}function D(t,e,n,i,o){if("string"!=typeof e||!t)return;let[s,r,a]=B(e,n,i);if(e in E){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};r=t(r)}const l=O(t),c=l[a]||(l[a]={}),h=N(c,r,s?n:null);if(h)return void(h.oneOff=h.oneOff&&o);const u=S(r,e.replace(T,"")),d=s?I(t,n,r):z(t,r);d.delegationSelector=s?n:null,d.callable=r,d.oneOff=o,d.uidEvent=u,c[u]=d,t.addEventListener(a,d,s)}function Z(t,e,n,i,o){const s=N(e[n],i,o);s&&(t.removeEventListener(n,s,Boolean(o)),delete e[n][s.uidEvent])}function j(t,e,n,i){const o=e[n]||{};for(const[s,r]of Object.entries(o))s.includes(i)&&Z(t,e,n,r.callable,r.delegationSelector)}function R(t){return t=t.replace(P,""),E[t]||t}const H={on(t,e,n,i){D(t,e,n,i,!1)},one(t,e,n,i){D(t,e,n,i,!0)},off(t,e,n,i){if("string"!=typeof e||!t)return;const[o,s,r]=B(e,n,i),a=r!==e,l=O(t),c=l[r]||{},h=e.startsWith(".");if(void 0===s){if(h)for(const n of Object.keys(l))j(t,l,n,e.slice(1));for(const[n,i]of Object.entries(c)){const o=n.replace(M,"");a&&!e.includes(o)||Z(t,l,r,i.callable,i.delegationSelector)}}else{if(!Object.keys(c).length)return;Z(t,l,r,s,o?n:null)}},trigger(t,e,n){if("string"!=typeof e||!t)return null;const i=g();let o=null,s=!0,r=!0,a=!1;e!==R(e)&&i&&(o=i.Event(e,n),i(t).trigger(o),s=!o.isPropagationStopped(),r=!o.isImmediatePropagationStopped(),a=o.isDefaultPrevented());const l=F(new Event(e,{bubbles:s,cancelable:!0}),n);return a&&l.preventDefault(),r&&t.dispatchEvent(l),l.defaultPrevented&&o&&o.preventDefault(),l}};function F(t,e={}){for(const[n,i]of Object.entries(e))try{t[n]=i}catch(e){Object.defineProperty(t,n,{configurable:!0,get:()=>i})}return t}function W(t){if("true"===t)return!0;if("false"===t)return!1;if(t===Number(t).toString())return Number(t);if(""===t||"null"===t)return null;if("string"!=typeof t)return t;try{return JSON.parse(decodeURIComponent(t))}catch(e){return t}}function q(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}const U={setDataAttribute(t,e,n){t.setAttribute(`data-bs-${q(e)}`,n)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${q(e)}`)},getDataAttributes(t){if(!t)return{};const e={},n=Object.keys(t.dataset).filter((t=>t.startsWith("bs")&&!t.startsWith("bsConfig")));for(const i of n){let n=i.replace(/^bs/,"");n=n.charAt(0).toLowerCase()+n.slice(1,n.length),e[n]=W(t.dataset[i])}return e},getDataAttribute:(t,e)=>W(t.getAttribute(`data-bs-${q(e)}`))};class V{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(t){return t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t}_mergeConfigObj(t,e){const n=h(e)?U.getDataAttribute(e,"config"):{};return{...this.constructor.Default,..."object"==typeof n?n:{},...h(e)?U.getDataAttributes(e):{},..."object"==typeof t?t:{}}}_typeCheckConfig(t,e=this.constructor.DefaultType){for(const[n,i]of Object.entries(e)){const e=t[n],o=h(e)?"element":r(e);if(!new RegExp(i).test(o))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${n}" provided type "${o}" but expected type "${i}".`)}}}const K="5.3.3";class G extends V{constructor(t,n){super(),(t=u(t))&&(this._element=t,this._config=this._getConfig(n),e.set(this._element,this.constructor.DATA_KEY,this))}dispose(){e.remove(this._element,this.constructor.DATA_KEY),H.off(this._element,this.constructor.EVENT_KEY);for(const t of Object.getOwnPropertyNames(this))this[t]=null}_queueCallback(t,e,n=!0){$(t,e,n)}_getConfig(t){return t=this._mergeConfigObj(t,this._element),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}static getInstance(t){return e.get(u(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return K}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(t){return`${t}${this.EVENT_KEY}`}}const Y=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let n=t.getAttribute("href");if(!n||!n.includes("#")&&!n.startsWith("."))return null;n.includes("#")&&!n.startsWith("#")&&(n=`#${n.split("#")[1]}`),e=n&&"#"!==n?n.trim():null}return e?e.split(",").map((t=>s(t))).join(","):null},X={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const n=[];let i=t.parentNode.closest(e);for(;i;)n.push(i),i=i.parentNode.closest(e);return n},prev(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return[n];n=n.previousElementSibling}return[]},next(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return[n];n=n.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(",");return this.find(e,t).filter((t=>!p(t)&&d(t)))},getSelectorFromElement(t){const e=Y(t);return e&&X.findOne(e)?e:null},getElementFromSelector(t){const e=Y(t);return e?X.findOne(e):null},getMultipleElementsFromSelector(t){const e=Y(t);return e?X.find(e):[]}},J=(t,e="hide")=>{const n=`click.dismiss${t.EVENT_KEY}`,i=t.NAME;H.on(document,n,`[data-bs-dismiss="${i}"]`,(function(n){if(["A","AREA"].includes(this.tagName)&&n.preventDefault(),p(this))return;const o=X.getElementFromSelector(this)||this.closest(`.${i}`);t.getOrCreateInstance(o)[e]()}))},Q="alert",tt=".bs.alert",et=`close${tt}`,nt=`closed${tt}`,it="fade",ot="show";class st extends G{static get NAME(){return Q}close(){if(H.trigger(this._element,et).defaultPrevented)return;this._element.classList.remove(ot);const t=this._element.classList.contains(it);this._queueCallback((()=>this._destroyElement()),this._element,t)}_destroyElement(){this._element.remove(),H.trigger(this._element,nt),this.dispose()}static jQueryInterface(t){return this.each((function(){const e=st.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}J(st,"close"),w(st);const rt="button",at="active",lt='[data-bs-toggle="button"]',ct="click.bs.button.data-api";class ht extends G{static get NAME(){return rt}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle(at))}static jQueryInterface(t){return this.each((function(){const e=ht.getOrCreateInstance(this);"toggle"===t&&e[t]()}))}}H.on(document,ct,lt,(t=>{t.preventDefault();const e=t.target.closest(lt);ht.getOrCreateInstance(e).toggle()})),w(ht);const ut="swipe",dt=".bs.swipe",pt=`touchstart${dt}`,mt=`touchmove${dt}`,ft=`touchend${dt}`,_t=`pointerdown${dt}`,gt=`pointerup${dt}`,vt="touch",yt="pen",bt="pointer-event",wt=40,xt={endCallback:null,leftCallback:null,rightCallback:null},$t={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class Lt extends V{constructor(t,e){super(),this._element=t,t&&Lt.isSupported()&&(this._config=this._getConfig(e),this._deltaX=0,this._supportPointerEvents=Boolean(window.PointerEvent),this._initEvents())}static get Default(){return xt}static get DefaultType(){return $t}static get NAME(){return ut}dispose(){H.off(this._element,dt)}_start(t){this._supportPointerEvents?this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX):this._deltaX=t.touches[0].clientX}_end(t){this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX-this._deltaX),this._handleSwipe(),x(this._config.endCallback)}_move(t){this._deltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this._deltaX}_handleSwipe(){const t=Math.abs(this._deltaX);if(t<=wt)return;const e=t/this._deltaX;this._deltaX=0,e&&x(e>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(H.on(this._element,_t,(t=>this._start(t))),H.on(this._element,gt,(t=>this._end(t))),this._element.classList.add(bt)):(H.on(this._element,pt,(t=>this._start(t))),H.on(this._element,mt,(t=>this._move(t))),H.on(this._element,ft,(t=>this._end(t))))}_eventIsPointerPenTouch(t){return this._supportPointerEvents&&(t.pointerType===yt||t.pointerType===vt)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const Tt="carousel",Pt=".bs.carousel",Mt=".data-api",kt=500,Ct="next",Et="prev",At="left",St="right",Ot=`slide${Pt}`,zt=`slid${Pt}`,It=`keydown${Pt}`,Nt=`mouseenter${Pt}`,Bt=`mouseleave${Pt}`,Dt=`dragstart${Pt}`,Zt=`load${Pt}${Mt}`,jt=`click${Pt}${Mt}`,Rt="carousel",Ht="active",Ft="slide",Wt="carousel-item-end",qt="carousel-item-start",Ut="carousel-item-next",Vt="carousel-item-prev",Kt=".active",Gt=".carousel-item",Yt=Kt+Gt,Xt=".carousel-item img",Jt=".carousel-indicators",Qt="[data-bs-slide], [data-bs-slide-to]",te='[data-bs-ride="carousel"]',ee={ArrowLeft:St,ArrowRight:At},ne={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},ie={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class oe extends G{constructor(t,e){super(t,e),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=X.findOne(Jt,this._element),this._addEventListeners(),this._config.ride===Rt&&this.cycle()}static get Default(){return ne}static get DefaultType(){return ie}static get NAME(){return Tt}next(){this._slide(Ct)}nextWhenVisible(){!document.hidden&&d(this._element)&&this.next()}prev(){this._slide(Et)}pause(){this._isSliding&&c(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval((()=>this.nextWhenVisible()),this._config.interval)}_maybeEnableCycle(){this._config.ride&&(this._isSliding?H.one(this._element,zt,(()=>this.cycle())):this.cycle())}to(t){const e=this._getItems();if(t>e.length-1||t<0)return;if(this._isSliding)return void H.one(this._element,zt,(()=>this.to(t)));const n=this._getItemIndex(this._getActive());if(n===t)return;const i=t>n?Ct:Et;this._slide(i,e[t])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(t){return t.defaultInterval=t.interval,t}_addEventListeners(){this._config.keyboard&&H.on(this._element,It,(t=>this._keydown(t))),"hover"===this._config.pause&&(H.on(this._element,Nt,(()=>this.pause())),H.on(this._element,Bt,(()=>this._maybeEnableCycle()))),this._config.touch&&Lt.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const t of X.find(Xt,this._element))H.on(t,Dt,(t=>t.preventDefault()));const t={leftCallback:()=>this._slide(this._directionToOrder(At)),rightCallback:()=>this._slide(this._directionToOrder(St)),endCallback:()=>{"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((()=>this._maybeEnableCycle()),kt+this._config.interval))}};this._swipeHelper=new Lt(this._element,t)}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=ee[t.key];e&&(t.preventDefault(),this._slide(this._directionToOrder(e)))}_getItemIndex(t){return this._getItems().indexOf(t)}_setActiveIndicatorElement(t){if(!this._indicatorsElement)return;const e=X.findOne(Kt,this._indicatorsElement);e.classList.remove(Ht),e.removeAttribute("aria-current");const n=X.findOne(`[data-bs-slide-to="${t}"]`,this._indicatorsElement);n&&(n.classList.add(Ht),n.setAttribute("aria-current","true"))}_updateInterval(){const t=this._activeElement||this._getActive();if(!t)return;const e=Number.parseInt(t.getAttribute("data-bs-interval"),10);this._config.interval=e||this._config.defaultInterval}_slide(t,e=null){if(this._isSliding)return;const n=this._getActive(),i=t===Ct,o=e||L(this._getItems(),n,i,this._config.wrap);if(o===n)return;const s=this._getItemIndex(o),r=e=>H.trigger(this._element,e,{relatedTarget:o,direction:this._orderToDirection(t),from:this._getItemIndex(n),to:s});if(r(Ot).defaultPrevented)return;if(!n||!o)return;const a=Boolean(this._interval);this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(s),this._activeElement=o;const l=i?qt:Wt,c=i?Ut:Vt;o.classList.add(c),_(o),n.classList.add(l),o.classList.add(l);const h=()=>{o.classList.remove(l,c),o.classList.add(Ht),n.classList.remove(Ht,c,l),this._isSliding=!1,r(zt)};this._queueCallback(h,n,this._isAnimated()),a&&this.cycle()}_isAnimated(){return this._element.classList.contains(Ft)}_getActive(){return X.findOne(Yt,this._element)}_getItems(){return X.find(Gt,this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(t){return b()?t===At?Et:Ct:t===At?Ct:Et}_orderToDirection(t){return b()?t===Et?At:St:t===Et?St:At}static jQueryInterface(t){return this.each((function(){const e=oe.getOrCreateInstance(this,t);if("number"!=typeof t){if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}else e.to(t)}))}}H.on(document,jt,Qt,(function(t){const e=X.getElementFromSelector(this);if(!e||!e.classList.contains(Rt))return;t.preventDefault();const n=oe.getOrCreateInstance(e),i=this.getAttribute("data-bs-slide-to");return i?(n.to(i),void n._maybeEnableCycle()):"next"===U.getDataAttribute(this,"slide")?(n.next(),void n._maybeEnableCycle()):(n.prev(),void n._maybeEnableCycle())})),H.on(window,Zt,(()=>{const t=X.find(te);for(const e of t)oe.getOrCreateInstance(e)})),w(oe);const se="collapse",re=".bs.collapse",ae=`show${re}`,le=`shown${re}`,ce=`hide${re}`,he=`hidden${re}`,ue=`click${re}.data-api`,de="show",pe="collapse",me="collapsing",fe="collapsed",_e=`:scope .${pe} .${pe}`,ge="collapse-horizontal",ve="width",ye="height",be=".collapse.show, .collapse.collapsing",we='[data-bs-toggle="collapse"]',xe={parent:null,toggle:!0},$e={parent:"(null|element)",toggle:"boolean"};class Le extends G{constructor(t,e){super(t,e),this._isTransitioning=!1,this._triggerArray=[];const n=X.find(we);for(const t of n){const e=X.getSelectorFromElement(t),n=X.find(e).filter((t=>t===this._element));null!==e&&n.length&&this._triggerArray.push(t)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return xe}static get DefaultType(){return $e}static get NAME(){return se}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t=[];if(this._config.parent&&(t=this._getFirstLevelChildren(be).filter((t=>t!==this._element)).map((t=>Le.getOrCreateInstance(t,{toggle:!1})))),t.length&&t[0]._isTransitioning)return;if(H.trigger(this._element,ae).defaultPrevented)return;for(const e of t)e.hide();const e=this._getDimension();this._element.classList.remove(pe),this._element.classList.add(me),this._element.style[e]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const n=()=>{this._isTransitioning=!1,this._element.classList.remove(me),this._element.classList.add(pe,de),this._element.style[e]="",H.trigger(this._element,le)},i=`scroll${e[0].toUpperCase()+e.slice(1)}`;this._queueCallback(n,this._element,!0),this._element.style[e]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(H.trigger(this._element,ce).defaultPrevented)return;const t=this._getDimension();this._element.style[t]=`${this._element.getBoundingClientRect()[t]}px`,_(this._element),this._element.classList.add(me),this._element.classList.remove(pe,de);for(const t of this._triggerArray){const e=X.getElementFromSelector(t);e&&!this._isShown(e)&&this._addAriaAndCollapsedClass([t],!1)}this._isTransitioning=!0;const e=()=>{this._isTransitioning=!1,this._element.classList.remove(me),this._element.classList.add(pe),H.trigger(this._element,he)};this._element.style[t]="",this._queueCallback(e,this._element,!0)}_isShown(t=this._element){return t.classList.contains(de)}_configAfterMerge(t){return t.toggle=Boolean(t.toggle),t.parent=u(t.parent),t}_getDimension(){return this._element.classList.contains(ge)?ve:ye}_initializeChildren(){if(!this._config.parent)return;const t=this._getFirstLevelChildren(we);for(const e of t){const t=X.getElementFromSelector(e);t&&this._addAriaAndCollapsedClass([e],this._isShown(t))}}_getFirstLevelChildren(t){const e=X.find(_e,this._config.parent);return X.find(t,this._config.parent).filter((t=>!e.includes(t)))}_addAriaAndCollapsedClass(t,e){if(t.length)for(const n of t)n.classList.toggle(fe,!e),n.setAttribute("aria-expanded",e)}static jQueryInterface(t){const e={};return"string"==typeof t&&/show|hide/.test(t)&&(e.toggle=!1),this.each((function(){const n=Le.getOrCreateInstance(this,e);if("string"==typeof t){if(void 0===n[t])throw new TypeError(`No method named "${t}"`);n[t]()}}))}}H.on(document,ue,we,(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();for(const t of X.getMultipleElementsFromSelector(this))Le.getOrCreateInstance(t,{toggle:!1}).toggle()})),w(Le);var Te="top",Pe="bottom",Me="right",ke="left",Ce="auto",Ee=[Te,Pe,Me,ke],Ae="start",Se="end",Oe="clippingParents",ze="viewport",Ie="popper",Ne="reference",Be=Ee.reduce((function(t,e){return t.concat([e+"-"+Ae,e+"-"+Se])}),[]),De=[].concat(Ee,[Ce]).reduce((function(t,e){return t.concat([e,e+"-"+Ae,e+"-"+Se])}),[]),Ze="beforeRead",je="read",Re="afterRead",He="beforeMain",Fe="main",We="afterMain",qe="beforeWrite",Ue="write",Ve="afterWrite",Ke=[Ze,je,Re,He,Fe,We,qe,Ue,Ve];function Ge(t){return t?(t.nodeName||"").toLowerCase():null}function Ye(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Xe(t){return t instanceof Ye(t).Element||t instanceof Element}function Je(t){return t instanceof Ye(t).HTMLElement||t instanceof HTMLElement}function Qe(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Ye(t).ShadowRoot||t instanceof ShadowRoot)}function tn(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},o=e.elements[t];Je(o)&&Ge(o)&&(Object.assign(o.style,n),Object.keys(i).forEach((function(t){var e=i[t];!1===e?o.removeAttribute(t):o.setAttribute(t,!0===e?"":e)})))}))}function en(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var i=e.elements[t],o=e.attributes[t]||{},s=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});Je(i)&&Ge(i)&&(Object.assign(i.style,s),Object.keys(o).forEach((function(t){i.removeAttribute(t)})))}))}}const nn={name:"applyStyles",enabled:!0,phase:"write",fn:tn,effect:en,requires:["computeStyles"]};function on(t){return t.split("-")[0]}var sn=Math.max,rn=Math.min,an=Math.round;function ln(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function cn(){return!/^((?!chrome|android).)*safari/i.test(ln())}function hn(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var i=t.getBoundingClientRect(),o=1,s=1;e&&Je(t)&&(o=t.offsetWidth>0&&an(i.width)/t.offsetWidth||1,s=t.offsetHeight>0&&an(i.height)/t.offsetHeight||1);var r=(Xe(t)?Ye(t):window).visualViewport,a=!cn()&&n,l=(i.left+(a&&r?r.offsetLeft:0))/o,c=(i.top+(a&&r?r.offsetTop:0))/s,h=i.width/o,u=i.height/s;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l,x:l,y:c}}function un(t){var e=hn(t),n=t.offsetWidth,i=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:i}}function dn(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Qe(n)){var i=e;do{if(i&&t.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function pn(t){return Ye(t).getComputedStyle(t)}function mn(t){return["table","td","th"].indexOf(Ge(t))>=0}function fn(t){return((Xe(t)?t.ownerDocument:t.document)||window.document).documentElement}function _n(t){return"html"===Ge(t)?t:t.assignedSlot||t.parentNode||(Qe(t)?t.host:null)||fn(t)}function gn(t){return Je(t)&&"fixed"!==pn(t).position?t.offsetParent:null}function vn(t){var e=/firefox/i.test(ln());if(/Trident/i.test(ln())&&Je(t)&&"fixed"===pn(t).position)return null;var n=_n(t);for(Qe(n)&&(n=n.host);Je(n)&&["html","body"].indexOf(Ge(n))<0;){var i=pn(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||e&&"filter"===i.willChange||e&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}function yn(t){for(var e=Ye(t),n=gn(t);n&&mn(n)&&"static"===pn(n).position;)n=gn(n);return n&&("html"===Ge(n)||"body"===Ge(n)&&"static"===pn(n).position)?e:n||vn(t)||e}function bn(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function wn(t,e,n){return sn(t,rn(e,n))}function xn(t,e,n){var i=wn(t,e,n);return i>n?n:i}function $n(){return{top:0,right:0,bottom:0,left:0}}function Ln(t){return Object.assign({},$n(),t)}function Tn(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}var Pn=function(t,e){return Ln("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Tn(t,Ee))};function Mn(t){var e,n=t.state,i=t.name,o=t.options,s=n.elements.arrow,r=n.modifiersData.popperOffsets,a=on(n.placement),l=bn(a),c=[ke,Me].indexOf(a)>=0?"height":"width";if(s&&r){var h=Pn(o.padding,n),u=un(s),d="y"===l?Te:ke,p="y"===l?Pe:Me,m=n.rects.reference[c]+n.rects.reference[l]-r[l]-n.rects.popper[c],f=r[l]-n.rects.reference[l],_=yn(s),g=_?"y"===l?_.clientHeight||0:_.clientWidth||0:0,v=m/2-f/2,y=h[d],b=g-u[c]-h[p],w=g/2-u[c]/2+v,x=wn(y,w,b),$=l;n.modifiersData[i]=((e={})[$]=x,e.centerOffset=x-w,e)}}function kn(t){var e=t.state,n=t.options.element,i=void 0===n?"[data-popper-arrow]":n;null!=i&&("string"!=typeof i||(i=e.elements.popper.querySelector(i)))&&dn(e.elements.popper,i)&&(e.elements.arrow=i)}const Cn={name:"arrow",enabled:!0,phase:"main",fn:Mn,effect:kn,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function En(t){return t.split("-")[1]}var An={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Sn(t,e){var n=t.x,i=t.y,o=e.devicePixelRatio||1;return{x:an(n*o)/o||0,y:an(i*o)/o||0}}function On(t){var e,n=t.popper,i=t.popperRect,o=t.placement,s=t.variation,r=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,h=t.roundOffsets,u=t.isFixed,d=r.x,p=void 0===d?0:d,m=r.y,f=void 0===m?0:m,_="function"==typeof h?h({x:p,y:f}):{x:p,y:f};p=_.x,f=_.y;var g=r.hasOwnProperty("x"),v=r.hasOwnProperty("y"),y=ke,b=Te,w=window;if(c){var x=yn(n),$="clientHeight",L="clientWidth";x===Ye(n)&&"static"!==pn(x=fn(n)).position&&"absolute"===a&&($="scrollHeight",L="scrollWidth"),(o===Te||(o===ke||o===Me)&&s===Se)&&(b=Pe,f-=(u&&x===w&&w.visualViewport?w.visualViewport.height:x[$])-i.height,f*=l?1:-1),o!==ke&&(o!==Te&&o!==Pe||s!==Se)||(y=Me,p-=(u&&x===w&&w.visualViewport?w.visualViewport.width:x[L])-i.width,p*=l?1:-1)}var T,P=Object.assign({position:a},c&&An),M=!0===h?Sn({x:p,y:f},Ye(n)):{x:p,y:f};return p=M.x,f=M.y,l?Object.assign({},P,((T={})[b]=v?"0":"",T[y]=g?"0":"",T.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+f+"px)":"translate3d("+p+"px, "+f+"px, 0)",T)):Object.assign({},P,((e={})[b]=v?f+"px":"",e[y]=g?p+"px":"",e.transform="",e))}function zn(t){var e=t.state,n=t.options,i=n.gpuAcceleration,o=void 0===i||i,s=n.adaptive,r=void 0===s||s,a=n.roundOffsets,l=void 0===a||a,c={placement:on(e.placement),variation:En(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,On(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:r,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,On(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const In={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:zn,data:{}};var Nn={passive:!0};function Bn(t){var e=t.state,n=t.instance,i=t.options,o=i.scroll,s=void 0===o||o,r=i.resize,a=void 0===r||r,l=Ye(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach((function(t){t.addEventListener("scroll",n.update,Nn)})),a&&l.addEventListener("resize",n.update,Nn),function(){s&&c.forEach((function(t){t.removeEventListener("scroll",n.update,Nn)})),a&&l.removeEventListener("resize",n.update,Nn)}}const Dn={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Bn,data:{}};var Zn={left:"right",right:"left",bottom:"top",top:"bottom"};function jn(t){return t.replace(/left|right|bottom|top/g,(function(t){return Zn[t]}))}var Rn={start:"end",end:"start"};function Hn(t){return t.replace(/start|end/g,(function(t){return Rn[t]}))}function Fn(t){var e=Ye(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Wn(t){return hn(fn(t)).left+Fn(t).scrollLeft}function qn(t,e){var n=Ye(t),i=fn(t),o=n.visualViewport,s=i.clientWidth,r=i.clientHeight,a=0,l=0;if(o){s=o.width,r=o.height;var c=cn();(c||!c&&"fixed"===e)&&(a=o.offsetLeft,l=o.offsetTop)}return{width:s,height:r,x:a+Wn(t),y:l}}function Un(t){var e,n=fn(t),i=Fn(t),o=null==(e=t.ownerDocument)?void 0:e.body,s=sn(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),r=sn(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-i.scrollLeft+Wn(t),l=-i.scrollTop;return"rtl"===pn(o||n).direction&&(a+=sn(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:r,x:a,y:l}}function Vn(t){var e=pn(t),n=e.overflow,i=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+i)}function Kn(t){return["html","body","#document"].indexOf(Ge(t))>=0?t.ownerDocument.body:Je(t)&&Vn(t)?t:Kn(_n(t))}function Gn(t,e){var n;void 0===e&&(e=[]);var i=Kn(t),o=i===(null==(n=t.ownerDocument)?void 0:n.body),s=Ye(i),r=o?[s].concat(s.visualViewport||[],Vn(i)?i:[]):i,a=e.concat(r);return o?a:a.concat(Gn(_n(r)))}function Yn(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Xn(t,e){var n=hn(t,!1,"fixed"===e);return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function Jn(t,e,n){return e===ze?Yn(qn(t,n)):Xe(e)?Xn(e,n):Yn(Un(fn(t)))}function Qn(t){var e=Gn(_n(t)),n=["absolute","fixed"].indexOf(pn(t).position)>=0&&Je(t)?yn(t):t;return Xe(n)?e.filter((function(t){return Xe(t)&&dn(t,n)&&"body"!==Ge(t)})):[]}function ti(t,e,n,i){var o="clippingParents"===e?Qn(t):[].concat(e),s=[].concat(o,[n]),r=s[0],a=s.reduce((function(e,n){var o=Jn(t,n,i);return e.top=sn(o.top,e.top),e.right=rn(o.right,e.right),e.bottom=rn(o.bottom,e.bottom),e.left=sn(o.left,e.left),e}),Jn(t,r,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ei(t){var e,n=t.reference,i=t.element,o=t.placement,s=o?on(o):null,r=o?En(o):null,a=n.x+n.width/2-i.width/2,l=n.y+n.height/2-i.height/2;switch(s){case Te:e={x:a,y:n.y-i.height};break;case Pe:e={x:a,y:n.y+n.height};break;case Me:e={x:n.x+n.width,y:l};break;case ke:e={x:n.x-i.width,y:l};break;default:e={x:n.x,y:n.y}}var c=s?bn(s):null;if(null!=c){var h="y"===c?"height":"width";switch(r){case Ae:e[c]=e[c]-(n[h]/2-i[h]/2);break;case Se:e[c]=e[c]+(n[h]/2-i[h]/2)}}return e}function ni(t,e){void 0===e&&(e={});var n=e,i=n.placement,o=void 0===i?t.placement:i,s=n.strategy,r=void 0===s?t.strategy:s,a=n.boundary,l=void 0===a?Oe:a,c=n.rootBoundary,h=void 0===c?ze:c,u=n.elementContext,d=void 0===u?Ie:u,p=n.altBoundary,m=void 0!==p&&p,f=n.padding,_=void 0===f?0:f,g=Ln("number"!=typeof _?_:Tn(_,Ee)),v=d===Ie?Ne:Ie,y=t.rects.popper,b=t.elements[m?v:d],w=ti(Xe(b)?b:b.contextElement||fn(t.elements.popper),l,h,r),x=hn(t.elements.reference),$=ei({reference:x,element:y,strategy:"absolute",placement:o}),L=Yn(Object.assign({},y,$)),T=d===Ie?L:x,P={top:w.top-T.top+g.top,bottom:T.bottom-w.bottom+g.bottom,left:w.left-T.left+g.left,right:T.right-w.right+g.right},M=t.modifiersData.offset;if(d===Ie&&M){var k=M[o];Object.keys(P).forEach((function(t){var e=[Me,Pe].indexOf(t)>=0?1:-1,n=[Te,Pe].indexOf(t)>=0?"y":"x";P[t]+=k[n]*e}))}return P}function ii(t,e){void 0===e&&(e={});var n=e,i=n.placement,o=n.boundary,s=n.rootBoundary,r=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?De:l,h=En(i),u=h?a?Be:Be.filter((function(t){return En(t)===h})):Ee,d=u.filter((function(t){return c.indexOf(t)>=0}));0===d.length&&(d=u);var p=d.reduce((function(e,n){return e[n]=ni(t,{placement:n,boundary:o,rootBoundary:s,padding:r})[on(n)],e}),{});return Object.keys(p).sort((function(t,e){return p[t]-p[e]}))}function oi(t){if(on(t)===Ce)return[];var e=jn(t);return[Hn(t),e,Hn(e)]}function si(t){var e=t.state,n=t.options,i=t.name;if(!e.modifiersData[i]._skip){for(var o=n.mainAxis,s=void 0===o||o,r=n.altAxis,a=void 0===r||r,l=n.fallbackPlacements,c=n.padding,h=n.boundary,u=n.rootBoundary,d=n.altBoundary,p=n.flipVariations,m=void 0===p||p,f=n.allowedAutoPlacements,_=e.options.placement,g=on(_),v=l||(g!==_&&m?oi(_):[jn(_)]),y=[_].concat(v).reduce((function(t,n){return t.concat(on(n)===Ce?ii(e,{placement:n,boundary:h,rootBoundary:u,padding:c,flipVariations:m,allowedAutoPlacements:f}):n)}),[]),b=e.rects.reference,w=e.rects.popper,x=new Map,$=!0,L=y[0],T=0;T<y.length;T++){var P=y[T],M=on(P),k=En(P)===Ae,C=[Te,Pe].indexOf(M)>=0,E=C?"width":"height",A=ni(e,{placement:P,boundary:h,rootBoundary:u,altBoundary:d,padding:c}),S=C?k?Me:ke:k?Pe:Te;b[E]>w[E]&&(S=jn(S));var O=jn(S),z=[];if(s&&z.push(A[M]<=0),a&&z.push(A[S]<=0,A[O]<=0),z.every((function(t){return t}))){L=P,$=!1;break}x.set(P,z)}if($)for(var I=function(t){var e=y.find((function(e){var n=x.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return L=e,"break"},N=m?3:1;N>0&&"break"!==I(N);N--);e.placement!==L&&(e.modifiersData[i]._skip=!0,e.placement=L,e.reset=!0)}}const ri={name:"flip",enabled:!0,phase:"main",fn:si,requiresIfExists:["offset"],data:{_skip:!1}};function ai(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function li(t){return[Te,Me,Pe,ke].some((function(e){return t[e]>=0}))}function ci(t){var e=t.state,n=t.name,i=e.rects.reference,o=e.rects.popper,s=e.modifiersData.preventOverflow,r=ni(e,{elementContext:"reference"}),a=ni(e,{altBoundary:!0}),l=ai(r,i),c=ai(a,o,s),h=li(l),u=li(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":u})}const hi={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ci};function ui(t,e,n){var i=on(t),o=[ke,Te].indexOf(i)>=0?-1:1,s="function"==typeof n?n(Object.assign({},e,{placement:t})):n,r=s[0],a=s[1];return r=r||0,a=(a||0)*o,[ke,Me].indexOf(i)>=0?{x:a,y:r}:{x:r,y:a}}function di(t){var e=t.state,n=t.options,i=t.name,o=n.offset,s=void 0===o?[0,0]:o,r=De.reduce((function(t,n){return t[n]=ui(n,e.rects,s),t}),{}),a=r[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[i]=r}const pi={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:di};function mi(t){var e=t.state,n=t.name;e.modifiersData[n]=ei({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const fi={name:"popperOffsets",enabled:!0,phase:"read",fn:mi,data:{}};function _i(t){return"x"===t?"y":"x"}function gi(t){var e=t.state,n=t.options,i=t.name,o=n.mainAxis,s=void 0===o||o,r=n.altAxis,a=void 0!==r&&r,l=n.boundary,c=n.rootBoundary,h=n.altBoundary,u=n.padding,d=n.tether,p=void 0===d||d,m=n.tetherOffset,f=void 0===m?0:m,_=ni(e,{boundary:l,rootBoundary:c,padding:u,altBoundary:h}),g=on(e.placement),v=En(e.placement),y=!v,b=bn(g),w=_i(b),x=e.modifiersData.popperOffsets,$=e.rects.reference,L=e.rects.popper,T="function"==typeof f?f(Object.assign({},e.rects,{placement:e.placement})):f,P="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),M=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,k={x:0,y:0};if(x){if(s){var C,E="y"===b?Te:ke,A="y"===b?Pe:Me,S="y"===b?"height":"width",O=x[b],z=O+_[E],I=O-_[A],N=p?-L[S]/2:0,B=v===Ae?$[S]:L[S],D=v===Ae?-L[S]:-$[S],Z=e.elements.arrow,j=p&&Z?un(Z):{width:0,height:0},R=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:$n(),H=R[E],F=R[A],W=wn(0,$[S],j[S]),q=y?$[S]/2-N-W-H-P.mainAxis:B-W-H-P.mainAxis,U=y?-$[S]/2+N+W+F+P.mainAxis:D+W+F+P.mainAxis,V=e.elements.arrow&&yn(e.elements.arrow),K=V?"y"===b?V.clientTop||0:V.clientLeft||0:0,G=null!=(C=null==M?void 0:M[b])?C:0,Y=O+U-G,X=wn(p?rn(z,O+q-G-K):z,O,p?sn(I,Y):I);x[b]=X,k[b]=X-O}if(a){var J,Q="x"===b?Te:ke,tt="x"===b?Pe:Me,et=x[w],nt="y"===w?"height":"width",it=et+_[Q],ot=et-_[tt],st=-1!==[Te,ke].indexOf(g),rt=null!=(J=null==M?void 0:M[w])?J:0,at=st?it:et-$[nt]-L[nt]-rt+P.altAxis,lt=st?et+$[nt]+L[nt]-rt-P.altAxis:ot,ct=p&&st?xn(at,et,lt):wn(p?at:it,et,p?lt:ot);x[w]=ct,k[w]=ct-et}e.modifiersData[i]=k}}const vi={name:"preventOverflow",enabled:!0,phase:"main",fn:gi,requiresIfExists:["offset"]};function yi(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function bi(t){return t!==Ye(t)&&Je(t)?yi(t):Fn(t)}function wi(t){var e=t.getBoundingClientRect(),n=an(e.width)/t.offsetWidth||1,i=an(e.height)/t.offsetHeight||1;return 1!==n||1!==i}function xi(t,e,n){void 0===n&&(n=!1);var i=Je(e),o=Je(e)&&wi(e),s=fn(e),r=hn(t,o,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!n)&&(("body"!==Ge(e)||Vn(s))&&(a=bi(e)),Je(e)?((l=hn(e,!0)).x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Wn(s))),{x:r.left+a.scrollLeft-l.x,y:r.top+a.scrollTop-l.y,width:r.width,height:r.height}}function $i(t){var e=new Map,n=new Set,i=[];function o(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!n.has(t)){var i=e.get(t);i&&o(i)}})),i.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){n.has(t.name)||o(t)})),i}function Li(t){var e=$i(t);return Ke.reduce((function(t,n){return t.concat(e.filter((function(t){return t.phase===n})))}),[])}function Ti(t){var e;return function(){return e||(e=new Promise((function(n){Promise.resolve().then((function(){e=void 0,n(t())}))}))),e}}function Pi(t){var e=t.reduce((function(t,e){var n=t[e.name];return t[e.name]=n?Object.assign({},n,e,{options:Object.assign({},n.options,e.options),data:Object.assign({},n.data,e.data)}):e,t}),{});return Object.keys(e).map((function(t){return e[t]}))}var Mi={placement:"bottom",modifiers:[],strategy:"absolute"};function ki(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function Ci(t){void 0===t&&(t={});var e=t,n=e.defaultModifiers,i=void 0===n?[]:n,o=e.defaultOptions,s=void 0===o?Mi:o;return function(t,e,n){void 0===n&&(n=s);var o={placement:"bottom",orderedModifiers:[],options:Object.assign({},Mi,s),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},r=[],a=!1,l={state:o,setOptions:function(n){var r="function"==typeof n?n(o.options):n;h(),o.options=Object.assign({},s,o.options,r),o.scrollParents={reference:Xe(t)?Gn(t):t.contextElement?Gn(t.contextElement):[],popper:Gn(e)};var a=Li(Pi([].concat(i,o.options.modifiers)));return o.orderedModifiers=a.filter((function(t){return t.enabled})),c(),l.update()},forceUpdate:function(){if(!a){var t=o.elements,e=t.reference,n=t.popper;if(ki(e,n)){o.rects={reference:xi(e,yn(n),"fixed"===o.options.strategy),popper:un(n)},o.reset=!1,o.placement=o.options.placement,o.orderedModifiers.forEach((function(t){return o.modifiersData[t.name]=Object.assign({},t.data)}));for(var i=0;i<o.orderedModifiers.length;i++)if(!0!==o.reset){var s=o.orderedModifiers[i],r=s.fn,c=s.options,h=void 0===c?{}:c,u=s.name;"function"==typeof r&&(o=r({state:o,options:h,name:u,instance:l})||o)}else o.reset=!1,i=-1}}},update:Ti((function(){return new Promise((function(t){l.forceUpdate(),t(o)}))})),destroy:function(){h(),a=!0}};if(!ki(t,e))return l;function c(){o.orderedModifiers.forEach((function(t){var e=t.name,n=t.options,i=void 0===n?{}:n,s=t.effect;if("function"==typeof s){var a=s({state:o,name:e,instance:l,options:i}),c=function(){};r.push(a||c)}}))}function h(){r.forEach((function(t){return t()})),r=[]}return l.setOptions(n).then((function(t){!a&&n.onFirstUpdate&&n.onFirstUpdate(t)})),l}}var Ei=Ci(),Ai=Ci({defaultModifiers:[Dn,fi,In,nn]}),Si=Ci({defaultModifiers:[Dn,fi,In,nn,pi,ri,vi,Cn,hi]});const Oi=Object.freeze(Object.defineProperty({__proto__:null,afterMain:We,afterRead:Re,afterWrite:Ve,applyStyles:nn,arrow:Cn,auto:Ce,basePlacements:Ee,beforeMain:He,beforeRead:Ze,beforeWrite:qe,bottom:Pe,clippingParents:Oe,computeStyles:In,createPopper:Si,createPopperBase:Ei,createPopperLite:Ai,detectOverflow:ni,end:Se,eventListeners:Dn,flip:ri,hide:hi,left:ke,main:Fe,modifierPhases:Ke,offset:pi,placements:De,popper:Ie,popperGenerator:Ci,popperOffsets:fi,preventOverflow:vi,read:je,reference:Ne,right:Me,start:Ae,top:Te,variationPlacements:Be,viewport:ze,write:Ue},Symbol.toStringTag,{value:"Module"})),zi="dropdown",Ii=".bs.dropdown",Ni=".data-api",Bi="Escape",Di="Tab",Zi="ArrowUp",ji="ArrowDown",Ri=2,Hi=`hide${Ii}`,Fi=`hidden${Ii}`,Wi=`show${Ii}`,qi=`shown${Ii}`,Ui=`click${Ii}${Ni}`,Vi=`keydown${Ii}${Ni}`,Ki=`keyup${Ii}${Ni}`,Gi="show",Yi="dropup",Xi="dropend",Ji="dropstart",Qi="dropup-center",to="dropdown-center",eo='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)',no=`${eo}.${Gi}`,io=".dropdown-menu",oo=".navbar",so=".navbar-nav",ro=".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",ao=b()?"top-end":"top-start",lo=b()?"top-start":"top-end",co=b()?"bottom-end":"bottom-start",ho=b()?"bottom-start":"bottom-end",uo=b()?"left-start":"right-start",po=b()?"right-start":"left-start",mo="top",fo="bottom",_o={autoClose:!0,boundary:"clippingParents",display:"dynamic",offset:[0,2],popperConfig:null,reference:"toggle"},go={autoClose:"(boolean|string)",boundary:"(string|element)",display:"string",offset:"(array|string|function)",popperConfig:"(null|object|function)",reference:"(string|element|object)"};class vo extends G{constructor(t,e){super(t,e),this._popper=null,this._parent=this._element.parentNode,this._menu=X.next(this._element,io)[0]||X.prev(this._element,io)[0]||X.findOne(io,this._parent),this._inNavbar=this._detectNavbar()}static get Default(){return _o}static get DefaultType(){return go}static get NAME(){return zi}toggle(){return this._isShown()?this.hide():this.show()}show(){if(p(this._element)||this._isShown())return;const t={relatedTarget:this._element};if(!H.trigger(this._element,Wi,t).defaultPrevented){if(this._createPopper(),"ontouchstart"in document.documentElement&&!this._parent.closest(so))for(const t of[].concat(...document.body.children))H.on(t,"mouseover",f);this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(Gi),this._element.classList.add(Gi),H.trigger(this._element,qi,t)}}hide(){if(p(this._element)||!this._isShown())return;const t={relatedTarget:this._element};this._completeHide(t)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(t){if(!H.trigger(this._element,Hi,t).defaultPrevented){if("ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))H.off(t,"mouseover",f);this._popper&&this._popper.destroy(),this._menu.classList.remove(Gi),this._element.classList.remove(Gi),this._element.setAttribute("aria-expanded","false"),U.removeDataAttribute(this._menu,"popper"),H.trigger(this._element,Fi,t)}}_getConfig(t){if("object"==typeof(t=super._getConfig(t)).reference&&!h(t.reference)&&"function"!=typeof t.reference.getBoundingClientRect)throw new TypeError(`${zi.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return t}_createPopper(){if(void 0===Oi)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let t=this._element;"parent"===this._config.reference?t=this._parent:h(this._config.reference)?t=u(this._config.reference):"object"==typeof this._config.reference&&(t=this._config.reference);const e=this._getPopperConfig();this._popper=Si(t,this._menu,e)}_isShown(){return this._menu.classList.contains(Gi)}_getPlacement(){const t=this._parent;if(t.classList.contains(Xi))return uo;if(t.classList.contains(Ji))return po;if(t.classList.contains(Qi))return mo;if(t.classList.contains(to))return fo;const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains(Yi)?e?lo:ao:e?ho:co}_detectNavbar(){return null!==this._element.closest(oo)}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||"static"===this._config.display)&&(U.setDataAttribute(this._menu,"popper","static"),t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,...x(this._config.popperConfig,[t])}}_selectMenuItem({key:t,target:e}){const n=X.find(ro,this._menu).filter((t=>d(t)));n.length&&L(n,e,t===ji,!n.includes(e)).focus()}static jQueryInterface(t){return this.each((function(){const e=vo.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}static clearMenus(t){if(t.button===Ri||"keyup"===t.type&&t.key!==Di)return;const e=X.find(no);for(const n of e){const e=vo.getInstance(n);if(!e||!1===e._config.autoClose)continue;const i=t.composedPath(),o=i.includes(e._menu);if(i.includes(e._element)||"inside"===e._config.autoClose&&!o||"outside"===e._config.autoClose&&o)continue;if(e._menu.contains(t.target)&&("keyup"===t.type&&t.key===Di||/input|select|option|textarea|form/i.test(t.target.tagName)))continue;const s={relatedTarget:e._element};"click"===t.type&&(s.clickEvent=t),e._completeHide(s)}}static dataApiKeydownHandler(t){const e=/input|textarea/i.test(t.target.tagName),n=t.key===Bi,i=[Zi,ji].includes(t.key);if(!i&&!n)return;if(e&&!n)return;t.preventDefault();const o=this.matches(eo)?this:X.prev(this,eo)[0]||X.next(this,eo)[0]||X.findOne(eo,t.delegateTarget.parentNode),s=vo.getOrCreateInstance(o);if(i)return t.stopPropagation(),s.show(),void s._selectMenuItem(t);s._isShown()&&(t.stopPropagation(),s.hide(),o.focus())}}H.on(document,Vi,eo,vo.dataApiKeydownHandler),H.on(document,Vi,io,vo.dataApiKeydownHandler),H.on(document,Ui,vo.clearMenus),H.on(document,Ki,vo.clearMenus),H.on(document,Ui,eo,(function(t){t.preventDefault(),vo.getOrCreateInstance(this).toggle()})),w(vo);const yo="backdrop",bo="fade",wo="show",xo=`mousedown.bs.${yo}`,$o={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},Lo={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class To extends V{constructor(t){super(),this._config=this._getConfig(t),this._isAppended=!1,this._element=null}static get Default(){return $o}static get DefaultType(){return Lo}static get NAME(){return yo}show(t){if(!this._config.isVisible)return void x(t);this._append();const e=this._getElement();this._config.isAnimated&&_(e),e.classList.add(wo),this._emulateAnimation((()=>{x(t)}))}hide(t){this._config.isVisible?(this._getElement().classList.remove(wo),this._emulateAnimation((()=>{this.dispose(),x(t)}))):x(t)}dispose(){this._isAppended&&(H.off(this._element,xo),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add(bo),this._element=t}return this._element}_configAfterMerge(t){return t.rootElement=u(t.rootElement),t}_append(){if(this._isAppended)return;const t=this._getElement();this._config.rootElement.append(t),H.on(t,xo,(()=>{x(this._config.clickCallback)})),this._isAppended=!0}_emulateAnimation(t){$(t,this._getElement(),this._config.isAnimated)}}const Po="focustrap",Mo=".bs.focustrap",ko=`focusin${Mo}`,Co=`keydown.tab${Mo}`,Eo="Tab",Ao="forward",So="backward",Oo={autofocus:!0,trapElement:null},zo={autofocus:"boolean",trapElement:"element"};class Io extends V{constructor(t){super(),this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return Oo}static get DefaultType(){return zo}static get NAME(){return Po}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),H.off(document,Mo),H.on(document,ko,(t=>this._handleFocusin(t))),H.on(document,Co,(t=>this._handleKeydown(t))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,H.off(document,Mo))}_handleFocusin(t){const{trapElement:e}=this._config;if(t.target===document||t.target===e||e.contains(t.target))return;const n=X.focusableChildren(e);0===n.length?e.focus():this._lastTabNavDirection===So?n[n.length-1].focus():n[0].focus()}_handleKeydown(t){t.key===Eo&&(this._lastTabNavDirection=t.shiftKey?So:Ao)}}const No=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",Bo=".sticky-top",Do="padding-right",Zo="margin-right";class jo{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const t=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,Do,(e=>e+t)),this._setElementAttributes(No,Do,(e=>e+t)),this._setElementAttributes(Bo,Zo,(e=>e-t))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,Do),this._resetElementAttributes(No,Do),this._resetElementAttributes(Bo,Zo)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,n){const i=this.getWidth(),o=t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+i)return;this._saveInitialAttribute(t,e);const o=window.getComputedStyle(t).getPropertyValue(e);t.style.setProperty(e,`${n(Number.parseFloat(o))}px`)};this._applyManipulationCallback(t,o)}_saveInitialAttribute(t,e){const n=t.style.getPropertyValue(e);n&&U.setDataAttribute(t,e,n)}_resetElementAttributes(t,e){const n=t=>{const n=U.getDataAttribute(t,e);null!==n?(U.removeDataAttribute(t,e),t.style.setProperty(e,n)):t.style.removeProperty(e)};this._applyManipulationCallback(t,n)}_applyManipulationCallback(t,e){if(h(t))e(t);else for(const n of X.find(t,this._element))e(n)}}const Ro="modal",Ho=".bs.modal",Fo="Escape",Wo=`hide${Ho}`,qo=`hidePrevented${Ho}`,Uo=`hidden${Ho}`,Vo=`show${Ho}`,Ko=`shown${Ho}`,Go=`resize${Ho}`,Yo=`click.dismiss${Ho}`,Xo=`mousedown.dismiss${Ho}`,Jo=`keydown.dismiss${Ho}`,Qo=`click${Ho}.data-api`,ts="modal-open",es="fade",ns="show",is="modal-static",os=".modal.show",ss=".modal-dialog",rs=".modal-body",as='[data-bs-toggle="modal"]',ls={backdrop:!0,focus:!0,keyboard:!0},cs={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class hs extends G{constructor(t,e){super(t,e),this._dialog=X.findOne(ss,this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new jo,this._addEventListeners()}static get Default(){return ls}static get DefaultType(){return cs}static get NAME(){return Ro}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||this._isTransitioning||H.trigger(this._element,Vo,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(ts),this._adjustDialog(),this._backdrop.show((()=>this._showElement(t))))}hide(){this._isShown&&!this._isTransitioning&&(H.trigger(this._element,Wo).defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(ns),this._queueCallback((()=>this._hideModal()),this._element,this._isAnimated())))}dispose(){H.off(window,Ho),H.off(this._dialog,Ho),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new To({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Io({trapElement:this._element})}_showElement(t){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const e=X.findOne(rs,this._dialog);e&&(e.scrollTop=0),_(this._element),this._element.classList.add(ns);const n=()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,H.trigger(this._element,Ko,{relatedTarget:t})};this._queueCallback(n,this._dialog,this._isAnimated())}_addEventListeners(){H.on(this._element,Jo,(t=>{t.key===Fo&&(this._config.keyboard?this.hide():this._triggerBackdropTransition())})),H.on(window,Go,(()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()})),H.on(this._element,Xo,(t=>{H.one(this._element,Yo,(e=>{this._element===t.target&&this._element===e.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())}))}))}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(ts),this._resetAdjustments(),this._scrollBar.reset(),H.trigger(this._element,Uo)}))}_isAnimated(){return this._element.classList.contains(es)}_triggerBackdropTransition(){if(H.trigger(this._element,qo).defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._element.style.overflowY;"hidden"===e||this._element.classList.contains(is)||(t||(this._element.style.overflowY="hidden"),this._element.classList.add(is),this._queueCallback((()=>{this._element.classList.remove(is),this._queueCallback((()=>{this._element.style.overflowY=e}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),n=e>0;if(n&&!t){const t=b()?"paddingLeft":"paddingRight";this._element.style[t]=`${e}px`}if(!n&&t){const t=b()?"paddingRight":"paddingLeft";this._element.style[t]=`${e}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each((function(){const n=hs.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===n[t])throw new TypeError(`No method named "${t}"`);n[t](e)}}))}}H.on(document,Qo,as,(function(t){const e=X.getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),H.one(e,Vo,(t=>{t.defaultPrevented||H.one(e,Uo,(()=>{d(this)&&this.focus()}))}));const n=X.findOne(os);n&&hs.getInstance(n).hide(),hs.getOrCreateInstance(e).toggle(this)})),J(hs),w(hs);const us="offcanvas",ds=".bs.offcanvas",ps=".data-api",ms=`load${ds}${ps}`,fs="Escape",_s="show",gs="showing",vs="hiding",ys="offcanvas-backdrop",bs=".offcanvas.show",ws=`show${ds}`,xs=`shown${ds}`,$s=`hide${ds}`,Ls=`hidePrevented${ds}`,Ts=`hidden${ds}`,Ps=`resize${ds}`,Ms=`click${ds}${ps}`,ks=`keydown.dismiss${ds}`,Cs='[data-bs-toggle="offcanvas"]',Es={backdrop:!0,keyboard:!0,scroll:!1},As={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class Ss extends G{constructor(t,e){super(t,e),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return Es}static get DefaultType(){return As}static get NAME(){return us}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){if(this._isShown)return;if(H.trigger(this._element,ws,{relatedTarget:t}).defaultPrevented)return;this._isShown=!0,this._backdrop.show(),this._config.scroll||(new jo).hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(gs);const e=()=>{this._config.scroll&&!this._config.backdrop||this._focustrap.activate(),this._element.classList.add(_s),this._element.classList.remove(gs),H.trigger(this._element,xs,{relatedTarget:t})};this._queueCallback(e,this._element,!0)}hide(){if(!this._isShown)return;if(H.trigger(this._element,$s).defaultPrevented)return;this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(vs),this._backdrop.hide();const t=()=>{this._element.classList.remove(_s,vs),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||(new jo).reset(),H.trigger(this._element,Ts)};this._queueCallback(t,this._element,!0)}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const t=()=>{"static"!==this._config.backdrop?this.hide():H.trigger(this._element,Ls)},e=Boolean(this._config.backdrop);return new To({className:ys,isVisible:e,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:e?t:null})}_initializeFocusTrap(){return new Io({trapElement:this._element})}_addEventListeners(){H.on(this._element,ks,(t=>{t.key===fs&&(this._config.keyboard?this.hide():H.trigger(this._element,Ls))}))}static jQueryInterface(t){return this.each((function(){const e=Ss.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}H.on(document,Ms,Cs,(function(t){const e=X.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),p(this))return;H.one(e,Ts,(()=>{d(this)&&this.focus()}));const n=X.findOne(bs);n&&n!==e&&Ss.getInstance(n).hide(),Ss.getOrCreateInstance(e).toggle(this)})),H.on(window,ms,(()=>{for(const t of X.find(bs))Ss.getOrCreateInstance(t).show()})),H.on(window,Ps,(()=>{for(const t of X.find("[aria-modal][class*=show][class*=offcanvas-]"))"fixed"!==getComputedStyle(t).position&&Ss.getOrCreateInstance(t).hide()})),J(Ss),w(Ss);const Os={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],dd:[],div:[],dl:[],dt:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},zs=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Is=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,Ns=(t,e)=>{const n=t.nodeName.toLowerCase();return e.includes(n)?!zs.has(n)||Boolean(Is.test(t.nodeValue)):e.filter((t=>t instanceof RegExp)).some((t=>t.test(n)))};function Bs(t,e,n){if(!t.length)return t;if(n&&"function"==typeof n)return n(t);const i=(new window.DOMParser).parseFromString(t,"text/html"),o=[].concat(...i.body.querySelectorAll("*"));for(const t of o){const n=t.nodeName.toLowerCase();if(!Object.keys(e).includes(n)){t.remove();continue}const i=[].concat(...t.attributes),o=[].concat(e["*"]||[],e[n]||[]);for(const e of i)Ns(e,o)||t.removeAttribute(e.nodeName)}return i.body.innerHTML}const Ds="TemplateFactory",Zs={allowList:Os,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"<div></div>"},js={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},Rs={entry:"(string|element|function|null)",selector:"(string|element)"};class Hs extends V{constructor(t){super(),this._config=this._getConfig(t)}static get Default(){return Zs}static get DefaultType(){return js}static get NAME(){return Ds}getContent(){return Object.values(this._config.content).map((t=>this._resolvePossibleFunction(t))).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(t){return this._checkContent(t),this._config.content={...this._config.content,...t},this}toHtml(){const t=document.createElement("div");t.innerHTML=this._maybeSanitize(this._config.template);for(const[e,n]of Object.entries(this._config.content))this._setContent(t,n,e);const e=t.children[0],n=this._resolvePossibleFunction(this._config.extraClass);return n&&e.classList.add(...n.split(" ")),e}_typeCheckConfig(t){super._typeCheckConfig(t),this._checkContent(t.content)}_checkContent(t){for(const[e,n]of Object.entries(t))super._typeCheckConfig({selector:e,entry:n},Rs)}_setContent(t,e,n){const i=X.findOne(n,t);i&&((e=this._resolvePossibleFunction(e))?h(e)?this._putElementInTemplate(u(e),i):this._config.html?i.innerHTML=this._maybeSanitize(e):i.textContent=e:i.remove())}_maybeSanitize(t){return this._config.sanitize?Bs(t,this._config.allowList,this._config.sanitizeFn):t}_resolvePossibleFunction(t){return x(t,[this])}_putElementInTemplate(t,e){if(this._config.html)return e.innerHTML="",void e.append(t);e.textContent=t.textContent}}const Fs="tooltip",Ws=new Set(["sanitize","allowList","sanitizeFn"]),qs="fade",Us="show",Vs=".tooltip-inner",Ks=".modal",Gs="hide.bs.modal",Ys="hover",Xs="focus",Js="click",Qs="manual",tr="hide",er="hidden",nr="show",ir="shown",or="inserted",sr="click",rr="focusin",ar="focusout",lr="mouseenter",cr="mouseleave",hr={AUTO:"auto",TOP:"top",RIGHT:b()?"left":"right",BOTTOM:"bottom",LEFT:b()?"right":"left"},ur={allowList:Os,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,6],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',title:"",trigger:"hover focus"},dr={allowList:"object",animation:"boolean",boundary:"(string|element)",container:"(string|element|boolean)",customClass:"(string|function)",delay:"(number|object)",fallbackPlacements:"array",html:"boolean",offset:"(array|string|function)",placement:"(string|function)",popperConfig:"(null|object|function)",sanitize:"boolean",sanitizeFn:"(null|function)",selector:"(string|boolean)",template:"string",title:"(string|element|function)",trigger:"string"};class pr extends G{constructor(t,e){if(void 0===Oi)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t,e),this._isEnabled=!0,this._timeout=0,this._isHovered=null,this._activeTrigger={},this._popper=null,this._templateFactory=null,this._newContent=null,this.tip=null,this._setListeners(),this._config.selector||this._fixTitle()}static get Default(){return ur}static get DefaultType(){return dr}static get NAME(){return Fs}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){this._isEnabled&&(this._activeTrigger.click=!this._activeTrigger.click,this._isShown()?this._leave():this._enter())}dispose(){clearTimeout(this._timeout),H.off(this._element.closest(Ks),Gs,this._hideModalHandler),this._element.getAttribute("data-bs-original-title")&&this._element.setAttribute("title",this._element.getAttribute("data-bs-original-title")),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const t=H.trigger(this._element,this.constructor.eventName(nr)),e=(m(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(t.defaultPrevented||!e)return;this._disposePopper();const n=this._getTipElement();this._element.setAttribute("aria-describedby",n.getAttribute("id"));const{container:i}=this._config;if(this._element.ownerDocument.documentElement.contains(this.tip)||(i.append(n),H.trigger(this._element,this.constructor.eventName(or))),this._popper=this._createPopper(n),n.classList.add(Us),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))H.on(t,"mouseover",f);const o=()=>{H.trigger(this._element,this.constructor.eventName(ir)),!1===this._isHovered&&this._leave(),this._isHovered=!1};this._queueCallback(o,this.tip,this._isAnimated())}hide(){if(!this._isShown())return;if(H.trigger(this._element,this.constructor.eventName(tr)).defaultPrevented)return;if(this._getTipElement().classList.remove(Us),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))H.off(t,"mouseover",f);this._activeTrigger[Js]=!1,this._activeTrigger[Xs]=!1,this._activeTrigger[Ys]=!1,this._isHovered=null;const t=()=>{this._isWithActiveTrigger()||(this._isHovered||this._disposePopper(),this._element.removeAttribute("aria-describedby"),H.trigger(this._element,this.constructor.eventName(er)))};this._queueCallback(t,this.tip,this._isAnimated())}update(){this._popper&&this._popper.update()}_isWithContent(){return Boolean(this._getTitle())}_getTipElement(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(t){const e=this._getTemplateFactory(t).toHtml();if(!e)return null;e.classList.remove(qs,Us),e.classList.add(`bs-${this.constructor.NAME}-auto`);const n=a(this.constructor.NAME).toString();return e.setAttribute("id",n),this._isAnimated()&&e.classList.add(qs),e}setContent(t){this._newContent=t,this._isShown()&&(this._disposePopper(),this.show())}_getTemplateFactory(t){return this._templateFactory?this._templateFactory.changeContent(t):this._templateFactory=new Hs({...this._config,content:t,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{[Vs]:this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(t){return this.constructor.getOrCreateInstance(t.delegateTarget,this._getDelegateConfig())}_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(qs)}_isShown(){return this.tip&&this.tip.classList.contains(Us)}_createPopper(t){const e=x(this._config.placement,[this,t,this._element]),n=hr[e.toUpperCase()];return Si(this._element,t,this._getPopperConfig(n))}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_resolvePossibleFunction(t){return x(t,[this._element])}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"preSetPlacement",enabled:!0,phase:"beforeMain",fn:t=>{this._getTipElement().setAttribute("data-popper-placement",t.state.placement)}}]};return{...e,...x(this._config.popperConfig,[e])}}_setListeners(){const t=this._config.trigger.split(" ");for(const e of t)if("click"===e)H.on(this._element,this.constructor.eventName(sr),this._config.selector,(t=>{this._initializeOnDelegatedTarget(t).toggle()}));else if(e!==Qs){const t=e===Ys?this.constructor.eventName(lr):this.constructor.eventName(rr),n=e===Ys?this.constructor.eventName(cr):this.constructor.eventName(ar);H.on(this._element,t,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusin"===t.type?Xs:Ys]=!0,e._enter()})),H.on(this._element,n,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusout"===t.type?Xs:Ys]=e._element.contains(t.relatedTarget),e._leave()}))}this._hideModalHandler=()=>{this._element&&this.hide()},H.on(this._element.closest(Ks),Gs,this._hideModalHandler)}_fixTitle(){const t=this._element.getAttribute("title");t&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",t),this._element.setAttribute("data-bs-original-title",t),this._element.removeAttribute("title"))}_enter(){this._isShown()||this._isHovered?this._isHovered=!0:(this._isHovered=!0,this._setTimeout((()=>{this._isHovered&&this.show()}),this._config.delay.show))}_leave(){this._isWithActiveTrigger()||(this._isHovered=!1,this._setTimeout((()=>{this._isHovered||this.hide()}),this._config.delay.hide))}_setTimeout(t,e){clearTimeout(this._timeout),this._timeout=setTimeout(t,e)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(t){const e=U.getDataAttributes(this._element);for(const t of Object.keys(e))Ws.has(t)&&delete e[t];return t={...e,..."object"==typeof t&&t?t:{}},t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t.container=!1===t.container?document.body:u(t.container),"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),t}_getDelegateConfig(){const t={};for(const[e,n]of Object.entries(this._config))this.constructor.Default[e]!==n&&(t[e]=n);return t.selector=!1,t.trigger="manual",t}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null),this.tip&&(this.tip.remove(),this.tip=null)}static jQueryInterface(t){return this.each((function(){const e=pr.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}w(pr);const mr="popover",fr=".popover-header",_r=".popover-body",gr={...pr.Default,content:"",offset:[0,8],placement:"right",template:'<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>',trigger:"click"},vr={...pr.DefaultType,content:"(null|string|element|function)"};class yr extends pr{static get Default(){return gr}static get DefaultType(){return vr}static get NAME(){return mr}_isWithContent(){return this._getTitle()||this._getContent()}_getContentForTemplate(){return{[fr]:this._getTitle(),[_r]:this._getContent()}}_getContent(){return this._resolvePossibleFunction(this._config.content)}static jQueryInterface(t){return this.each((function(){const e=yr.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}w(yr);const br="scrollspy",wr=".bs.scrollspy",xr=`activate${wr}`,$r=`click${wr}`,Lr=`load${wr}.data-api`,Tr="dropdown-item",Pr="active",Mr='[data-bs-spy="scroll"]',kr="[href]",Cr=".nav, .list-group",Er=".nav-link",Ar=`${Er}, .nav-item > ${Er}, .list-group-item`,Sr=".dropdown",Or=".dropdown-toggle",zr={offset:null,rootMargin:"0px 0px -25%",smoothScroll:!1,target:null,threshold:[.1,.5,1]},Ir={offset:"(number|null)",rootMargin:"string",smoothScroll:"boolean",target:"element",threshold:"array"};class Nr extends G{constructor(t,e){super(t,e),this._targetLinks=new Map,this._observableSections=new Map,this._rootElement="visible"===getComputedStyle(this._element).overflowY?null:this._element,this._activeTarget=null,this._observer=null,this._previousScrollData={visibleEntryTop:0,parentScrollTop:0},this.refresh()}static get Default(){return zr}static get DefaultType(){return Ir}static get NAME(){return br}refresh(){this._initializeTargetsAndObservables(),this._maybeEnableSmoothScroll(),this._observer?this._observer.disconnect():this._observer=this._getNewObserver();for(const t of this._observableSections.values())this._observer.observe(t)}dispose(){this._observer.disconnect(),super.dispose()}_configAfterMerge(t){return t.target=u(t.target)||document.body,t.rootMargin=t.offset?`${t.offset}px 0px -30%`:t.rootMargin,"string"==typeof t.threshold&&(t.threshold=t.threshold.split(",").map((t=>Number.parseFloat(t)))),t}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(H.off(this._config.target,$r),H.on(this._config.target,$r,kr,(t=>{const e=this._observableSections.get(t.target.hash);if(e){t.preventDefault();const n=this._rootElement||window,i=e.offsetTop-this._element.offsetTop;if(n.scrollTo)return void n.scrollTo({top:i,behavior:"smooth"});n.scrollTop=i}})))}_getNewObserver(){const t={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver((t=>this._observerCallback(t)),t)}_observerCallback(t){const e=t=>this._targetLinks.get(`#${t.target.id}`),n=t=>{this._previousScrollData.visibleEntryTop=t.target.offsetTop,this._process(e(t))},i=(this._rootElement||document.documentElement).scrollTop,o=i>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=i;for(const s of t){if(!s.isIntersecting){this._activeTarget=null,this._clearActiveClass(e(s));continue}const t=s.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(o&&t){if(n(s),!i)return}else o||t||n(s)}}_initializeTargetsAndObservables(){this._targetLinks=new Map,this._observableSections=new Map;const t=X.find(kr,this._config.target);for(const e of t){if(!e.hash||p(e))continue;const t=X.findOne(decodeURI(e.hash),this._element);d(t)&&(this._targetLinks.set(decodeURI(e.hash),e),this._observableSections.set(e.hash,t))}}_process(t){this._activeTarget!==t&&(this._clearActiveClass(this._config.target),this._activeTarget=t,t.classList.add(Pr),this._activateParents(t),H.trigger(this._element,xr,{relatedTarget:t}))}_activateParents(t){if(t.classList.contains(Tr))X.findOne(Or,t.closest(Sr)).classList.add(Pr);else for(const e of X.parents(t,Cr))for(const t of X.prev(e,Ar))t.classList.add(Pr)}_clearActiveClass(t){t.classList.remove(Pr);const e=X.find(`${kr}.${Pr}`,t);for(const t of e)t.classList.remove(Pr)}static jQueryInterface(t){return this.each((function(){const e=Nr.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}H.on(window,Lr,(()=>{for(const t of X.find(Mr))Nr.getOrCreateInstance(t)})),w(Nr);const Br="tab",Dr=".bs.tab",Zr=`hide${Dr}`,jr=`hidden${Dr}`,Rr=`show${Dr}`,Hr=`shown${Dr}`,Fr=`click${Dr}`,Wr=`keydown${Dr}`,qr=`load${Dr}`,Ur="ArrowLeft",Vr="ArrowRight",Kr="ArrowUp",Gr="ArrowDown",Yr="Home",Xr="End",Jr="active",Qr="fade",ta="show",ea="dropdown",na=".dropdown-toggle",ia=".dropdown-menu",oa=`:not(${na})`,sa='.list-group, .nav, [role="tablist"]',ra=".nav-item, .list-group-item",aa='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',la=`.nav-link${oa}, .list-group-item${oa}, [role="tab"]${oa}, ${aa}`,ca=`.${Jr}[data-bs-toggle="tab"], .${Jr}[data-bs-toggle="pill"], .${Jr}[data-bs-toggle="list"]`;class ha extends G{constructor(t){super(t),this._parent=this._element.closest(sa),this._parent&&(this._setInitialAttributes(this._parent,this._getChildren()),H.on(this._element,Wr,(t=>this._keydown(t))))}static get NAME(){return Br}show(){const t=this._element;if(this._elemIsActive(t))return;const e=this._getActiveElem(),n=e?H.trigger(e,Zr,{relatedTarget:t}):null;H.trigger(t,Rr,{relatedTarget:e}).defaultPrevented||n&&n.defaultPrevented||(this._deactivate(e,t),this._activate(t,e))}_activate(t,e){if(!t)return;t.classList.add(Jr),this._activate(X.getElementFromSelector(t));const n=()=>{"tab"===t.getAttribute("role")?(t.removeAttribute("tabindex"),t.setAttribute("aria-selected",!0),this._toggleDropDown(t,!0),H.trigger(t,Hr,{relatedTarget:e})):t.classList.add(ta)};this._queueCallback(n,t,t.classList.contains(Qr))}_deactivate(t,e){if(!t)return;t.classList.remove(Jr),t.blur(),this._deactivate(X.getElementFromSelector(t));const n=()=>{"tab"===t.getAttribute("role")?(t.setAttribute("aria-selected",!1),t.setAttribute("tabindex","-1"),this._toggleDropDown(t,!1),H.trigger(t,jr,{relatedTarget:e})):t.classList.remove(ta)};this._queueCallback(n,t,t.classList.contains(Qr))}_keydown(t){if(![Ur,Vr,Kr,Gr,Yr,Xr].includes(t.key))return;t.stopPropagation(),t.preventDefault();const e=this._getChildren().filter((t=>!p(t)));let n;if([Yr,Xr].includes(t.key))n=e[t.key===Yr?0:e.length-1];else{const i=[Vr,Gr].includes(t.key);n=L(e,t.target,i,!0)}n&&(n.focus({preventScroll:!0}),ha.getOrCreateInstance(n).show())}_getChildren(){return X.find(la,this._parent)}_getActiveElem(){return this._getChildren().find((t=>this._elemIsActive(t)))||null}_setInitialAttributes(t,e){this._setAttributeIfNotExists(t,"role","tablist");for(const t of e)this._setInitialAttributesOnChild(t)}_setInitialAttributesOnChild(t){t=this._getInnerElement(t);const e=this._elemIsActive(t),n=this._getOuterElement(t);t.setAttribute("aria-selected",e),n!==t&&this._setAttributeIfNotExists(n,"role","presentation"),e||t.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(t,"role","tab"),this._setInitialAttributesOnTargetPanel(t)}_setInitialAttributesOnTargetPanel(t){const e=X.getElementFromSelector(t);e&&(this._setAttributeIfNotExists(e,"role","tabpanel"),t.id&&this._setAttributeIfNotExists(e,"aria-labelledby",`${t.id}`))}_toggleDropDown(t,e){const n=this._getOuterElement(t);if(!n.classList.contains(ea))return;const i=(t,i)=>{const o=X.findOne(t,n);o&&o.classList.toggle(i,e)};i(na,Jr),i(ia,ta),n.setAttribute("aria-expanded",e)}_setAttributeIfNotExists(t,e,n){t.hasAttribute(e)||t.setAttribute(e,n)}_elemIsActive(t){return t.classList.contains(Jr)}_getInnerElement(t){return t.matches(la)?t:X.findOne(la,t)}_getOuterElement(t){return t.closest(ra)||t}static jQueryInterface(t){return this.each((function(){const e=ha.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}H.on(document,Fr,aa,(function(t){["A","AREA"].includes(this.tagName)&&t.preventDefault(),p(this)||ha.getOrCreateInstance(this).show()})),H.on(window,qr,(()=>{for(const t of X.find(ca))ha.getOrCreateInstance(t)})),w(ha);const ua="toast",da=".bs.toast",pa=`mouseover${da}`,ma=`mouseout${da}`,fa=`focusin${da}`,_a=`focusout${da}`,ga=`hide${da}`,va=`hidden${da}`,ya=`show${da}`,ba=`shown${da}`,wa="fade",xa="hide",$a="show",La="showing",Ta={animation:"boolean",autohide:"boolean",delay:"number"},Pa={animation:!0,autohide:!0,delay:5e3};class Ma extends G{constructor(t,e){super(t,e),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Pa}static get DefaultType(){return Ta}static get NAME(){return ua}show(){if(H.trigger(this._element,ya).defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add(wa);const t=()=>{this._element.classList.remove(La),H.trigger(this._element,ba),this._maybeScheduleHide()};this._element.classList.remove(xa),_(this._element),this._element.classList.add($a,La),this._queueCallback(t,this._element,this._config.animation)}hide(){if(!this.isShown())return;if(H.trigger(this._element,ga).defaultPrevented)return;const t=()=>{this._element.classList.add(xa),this._element.classList.remove(La,$a),H.trigger(this._element,va)};this._element.classList.add(La),this._queueCallback(t,this._element,this._config.animation)}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove($a),super.dispose()}isShown(){return this._element.classList.contains($a)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e}if(e)return void this._clearTimeout();const n=t.relatedTarget;this._element===n||this._element.contains(n)||this._maybeScheduleHide()}_setListeners(){H.on(this._element,pa,(t=>this._onInteraction(t,!0))),H.on(this._element,ma,(t=>this._onInteraction(t,!1))),H.on(this._element,fa,(t=>this._onInteraction(t,!0))),H.on(this._element,_a,(t=>this._onInteraction(t,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){const e=Ma.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}J(Ma),w(Ma)})();const ht=[];function ut(e,n=t){let i;const o=new Set;function r(t){if(s(e,t)&&(e=t,i)){const t=!ht.length;for(const t of o)t[1](),ht.push(t,e);if(t){for(let t=0;t<ht.length;t+=2)ht[t][0](ht[t+1]);ht.length=0}}}function a(t){r(t(e))}return{set:r,update:a,subscribe:function(s,l=t){const c=[s,l];return o.add(c),1===o.size&&(i=n(r,a)||t),s(e),()=>{o.delete(c),0===o.size&&i&&(i(),i=null)}}}}
+/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var dt=/["'&<>]/;var pt=ct((function(t){var e,n=""+t,i=dt.exec(n);if(!i)return n;var o="",s=0,r=0;for(s=i.index;s<n.length;s++){switch(n.charCodeAt(s)){case 34:e=""";break;case 38:e="&";break;case 39:e="'";break;case 60:e="<";break;case 62:e=">";break;default:continue}r!==s&&(o+=n.substring(r,s)),r=s+1,o+=e}return r!==s?o+n.substring(r,s):o}));function mt(t,e){return"N"===t?"node":"W"===t?"way":"R"===t?"relation":e&&("T"===t||"I"===t)?"way":""}function ft(t){if(!t.osm_type)return"";var e=mt(t.osm_type,!1);return e?'<a href="https://www.openstreetmap.org/'+e+"/"+t.osm_id+'">'+e+" "+t.osm_id+"</a>":""}function _t(t){if(t.label)return t.label;function e(t){return t&&t[0].toUpperCase()+t.slice(1)}return t.type&&"yes"===t.type&&t.category?e(t.category.replace(/_/g," ")):t.type?e(t.type.replace(/_/g," ")):""}function gt(t){if(!t.calculated_wikipedia)return"";var e=t.calculated_wikipedia.split(":",2),n=pt(t.calculated_wikipedia);return'<a href="https://'+pt(e[0])+".wikipedia.org/wiki/"+pt(e[1])+'" target="_blank">'+n+"</a>"}function vt(t){return t.isarea?"Polygon":"Point"}function yt(t){return"boundary"===t.category&&"administrative"===t.type}function bt(t){return t<4?"other":t<6?"country":t<8?"region":t<10?"state":t<12?"state district":t<14?"county":t<16?"municipality":t<18?"city / town / village":t<20?"city / village district":t<22?"suburb / hamlet":t<24?"neighbourhood":t<26?"city block / square":26===t?"major street":27===t?"minory street / path":t<=30?"house / building":"other"}function wt(t){var e=t.class+":"+t.type;return t.type&&"administrative"===t.type&&t.place_type&&(e=e+" ("+t.place_type+")"),pt(e)}function xt(t){return t&&t<15?t:""}function $t(t,e){return e?t<1?"0":'<abbr class="distance" title="'+t+' meters">~'+(t>=1e3?Math.round(t/1e3,1)+" km":Math.round(t,0)+" m")+"</abbr>":0===t?"0":'<abbr class="distance" title="spheric distance '+t+'">~'+Math.round(1e3*t,4)/1e3+"</abbr>"}function Lt(t){return(" "===t[0]?"*":"")+pt(t)}const Tt=ut(),Pt=ut(),Mt=ut(),kt=ut(),Ct=ut(),Et=Nominatim_Config.Reverse_Only?"reverse":"search",At=[Et,"reverse","details","deletable","polygons","status","about"];function St(t,e){if(void 0===t)t=window.location.pathname.replace(".html","").replace(/^.*\//,""),At.includes(t)||(t=Et),e=new URLSearchParams(window.location.search);else{At.includes(t)||(t=Et),void 0===e&&(e=new URLSearchParams);let n=e.toString();n&&(n="?"+n);let i=t+".html"+n;window.location.protocol.match(/^http/)?window.history.pushState([],"",i):window.location.href=i}if("search"===t&&e.has("q")){const n=function(t){if(!t)return;const e=t.match(/\/(relation|way|node)\/(-?\d+)/)||t.match(/^([nwr])(-?\d+)$/i);return e?[e[1][0].toUpperCase(),Number(e[2])]:void 0}(e.get("q"));n instanceof Array&&(t="details",(e=new URLSearchParams).set("osmtype",n[0]),e.set("osmid",n[1]))}Ct.set({tab:t,params:e}),Mt.set(null),kt.set(null)}function Ot(e){let n;return{c(){n=w("footer"),n.innerHTML='<p class="disclaimer svelte-1f2bd8l">Addresses and postcodes are approximate.\n Blue circle is search result,\n smaller red circle is search position (reverse geocoding).</p> <p class="copyright svelte-1f2bd8l">© <a href="https://osm.org/copyright">OpenStreetMap</a> contributors</p>',C(n,"class","svelte-1f2bd8l")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&y(n)}}}class zt extends lt{constructor(t){super(),at(this,t,null,Ot,s,{})}}function It(t){var e=document.getElementById("loading");e&&(e.style.display="start"===t?"block":null)}async function Nt(t,e,n){var i=function(t,e){1===e.dedupe&&delete e.dedupe;return function(t,e){for(var n=Object.keys(e),i=0;i<n.length;i+=1)t[n[i]]=e[n[i]]}(e,Nominatim_Config.Nominatim_API_Endpoint_Params),Zt(t)+"?"+Object.keys(function(t){for(var e=Object.keys(t),n=0;n<e.length;n+=1){var i=t[e[n]];void 0!==i&&""!==i&&null!==i||delete t[e[n]]}return t}(e)).map((t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t]))).join("&")}(t,e);const o=new URLSearchParams(window.location.search).get("mock_api_error");It("start"),"status"!==t&&Mt.set(null);try{await fetch(i,{headers:Nominatim_Config.Nominatim_API_Endpoint_Headers||{}}).then((async t=>{if((t.status>=200&&t.status<300||404===t.status)&&"fetch"!==o){var e;try{e="parse"===o?JSON.parse("{"):await t.json()}catch(t){return void kt.set(`Error parsing JSON data from ${i} (${t})`)}return e}kt.set(`Error fetching data from ${i} (${t.statusText})`)})).then((t=>{t&&(t.error&&kt.set(t.error.message),n(t)),It("finish")}))}catch(t){kt.set(`Error fetching data from ${i} (${t})`),It("finish")}"status"!==t&&Mt.set(i)}var Bt={};async function Dt(t,e){if(window.location.protocol.match(/^http/))if(Bt[t])e.innerHTML=Bt[t];else try{await fetch(t).then((t=>t.text())).then((n=>{n=n.replace("Nominatim_API_Endpoint",Zt()),e.innerHTML=n,Bt[t]=n}))}catch(n){e.innerHTML=`Error fetching content from ${t} (${n})`}else e.innerHTML=`Cannot display data from ${t} here. Browser security prevents loading content from file:// URLs.`}function Zt(t){var e=Nominatim_Config.Nominatim_API_Endpoint;return"function"==typeof e?e(t):t?e+t+".php":e}function jt(t){document.title=[t,Nominatim_Config.Page_Title].filter((t=>t&&t.length>1)).join(" | ")}function Rt(t){let e,n,i,o;const s=t[6].default,r=d(s,t,t[5],null);return{c(){e=w("a"),r&&r.c(),C(e,"href",t[1]),C(e,"class",t[0])},m(s,a){v(s,e,a),r&&r.m(e,null),n=!0,i||(o=P(e,"click",k(M(t[2]))),i=!0)},p(t,[i]){r&&r.p&&(!n||32&i)&&f(r,s,t,t[5],n?m(s,t[5],i,null):_(t[5]),null),(!n||2&i)&&C(e,"href",t[1]),(!n||1&i)&&C(e,"class",t[0])},i(t){n||(Q(r,t),n=!0)},o(t){tt(r,t),n=!1},d(t){t&&y(e),r&&r.d(t),i=!1,o()}}}function Ht(t,e,n){let{$$slots:i={},$$scope:o}=e,{page:s}=e,{params_hash:r={}}=e,{extra_classes:a=""}=e,l=s+".html";return t.$$set=t=>{"page"in t&&n(3,s=t.page),"params_hash"in t&&n(4,r=t.params_hash),"extra_classes"in t&&n(0,a=t.extra_classes),"$$scope"in t&&n(5,o=t.$$scope)},t.$$.update=()=>{if(24&t.$$.dirty){let t=new URLSearchParams(r).toString();n(1,l=s+".html"+(t?"?":"")+t)}},[a,l,function(){St(s,new URLSearchParams(r))},s,r,o,i]}class Ft extends lt{constructor(t){super(),at(this,t,Ht,Rt,s,{page:3,params_hash:4,extra_classes:0})}}function Wt(t){let e,n,i,o;const s=t[7].default,r=d(s,t,t[6],null);return{c(){e=w("a"),r&&r.c(),C(e,"href",t[2]),C(e,"class",t[0])},m(s,a){v(s,e,a),r&&r.m(e,null),n=!0,i||(o=P(e,"click",k(M(t[8]))),i=!0)},p(t,[i]){r&&r.p&&(!n||64&i)&&f(r,s,t,t[6],n?m(s,t[6],i,null):_(t[6]),null),(!n||4&i)&&C(e,"href",t[2]),(!n||1&i)&&C(e,"class",t[0])},i(t){n||(Q(r,t),n=!0)},o(t){tt(r,t),n=!1},d(t){t&&y(e),r&&r.d(t),i=!1,o()}}}function qt(t,e,n){let{$$slots:i={},$$scope:o}=e,{lat:s=null}=e,{lon:r=null}=e,{zoom:a=null}=e,{extra_classes:l=""}=e,c=new URLSearchParams,h="reverse.html";return t.$$set=t=>{"lat"in t&&n(3,s=t.lat),"lon"in t&&n(4,r=t.lon),"zoom"in t&&n(5,a=t.zoom),"extra_classes"in t&&n(0,l=t.extra_classes),"$$scope"in t&&n(6,o=t.$$scope)},t.$$.update=()=>{if(56&t.$$.dirty){let t=new URLSearchParams;s&&r&&(t.set("lat",s),t.set("lon",r),a&&t.set("zoom",a)),n(1,c=t)}if(2&t.$$.dirty){let t=c.toString();n(2,h="reverse.html"+(t?"?":"")+t)}},[l,c,h,s,r,a,o,i,()=>St("reverse",c)]}class Ut extends lt{constructor(t){super(),at(this,t,qt,Wt,s,{lat:3,lon:4,zoom:5,extra_classes:0})}}var Vt=["second","minute","hour","day","week","month","year"];var Kt=["秒","分钟","小时","天","周","个月","年"];var Gt={},Yt=function(t,e){Gt[t]=e},Xt=[60,60,24,7,365/7/12,12];function Jt(t){return t instanceof Date?t:!isNaN(t)||/^\d+$/.test(t)?new Date(parseInt(t)):(t=(t||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(t))}var Qt=function(t,e,n){var i=function(t,e){return(+(e?Jt(e):new Date)-+Jt(t))/1e3}(t,n&&n.relativeDate);return function(t,e){for(var n=t<0?1:0,i=t=Math.abs(t),o=0;t>=Xt[o]&&o<Xt.length;o++)t/=Xt[o];return(t=Math.floor(t))>(0==(o*=2)?9:1)&&(o+=1),e(t,o,i)[n].replace("%s",t.toString())}(i,function(t){return Gt[t]||Gt.en_US}(e))};function te(t){let e,n,i,o,s,r,a,l,c,h,u;return{c(){e=w("div"),n=x("Data from "),i=w("a"),o=x("API request"),s=$(),r=w("span"),a=x("("),l=w("a"),c=x("debug output"),u=x(")"),C(i,"href",t[1]),C(l,"href",h=t[1]+"&debug=1"),C(r,"id","api-request-debug"),C(e,"id","api-request")},m(t,h){v(t,e,h),g(e,n),g(e,i),g(i,o),g(e,s),g(e,r),g(r,a),g(r,l),g(l,c),g(r,u)},p(t,e){2&e&&C(i,"href",t[1]),2&e&&h!==(h=t[1]+"&debug=1")&&C(l,"href",h)},d(t){t&&y(e)}}}function ee(t){let e,n,i,o,s=Qt(new Date(t[0]))+"";return{c(){e=x("Data last updated:\n "),n=w("abbr"),i=x(s),C(n,"id","data-date"),C(n,"title",o=t[0]+" (UTC timezone)")},m(t,o){v(t,e,o),v(t,n,o),g(n,i)},p(t,e){1&e&&s!==(s=Qt(new Date(t[0]))+"")&&E(i,s),1&e&&o!==(o=t[0]+" (UTC timezone)")&&C(n,"title",o)},d(t){t&&(y(e),y(n))}}}function ne(t){let e;return{c(){e=x("Details")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function ie(t){let e,n,i,o,s,r,a,l,c,h,u,d=t[1]&&te(t),p=t[0]&&ee(t);return c=new Ft({props:{page:"status",$$slots:{default:[ne]},$$scope:{ctx:t}}}),{c(){e=w("div"),n=w("div"),n.innerHTML='<div class="spinner-border spinner-border-sm text-primary me-1" role="status"></div>\n Loading data from API ...',i=$(),o=w("div"),s=w("div"),d&&d.c(),r=$(),a=w("div"),p&&p.c(),l=x("\n ("),it(c.$$.fragment),h=x(")"),C(n,"id","loading"),C(n,"class","py-2 px-4 svelte-1i1228w"),C(s,"class","col-sm-6"),C(a,"class","col-sm-6 text-end"),C(o,"class","row"),C(e,"id","last-updated"),C(e,"class","container-fluid py-2 px-4 mb-3 svelte-1i1228w")},m(t,m){v(t,e,m),g(e,n),g(e,i),g(e,o),g(o,s),d&&d.m(s,null),g(o,r),g(o,a),p&&p.m(a,null),g(a,l),ot(c,a,null),g(a,h),u=!0},p(t,[e]){t[1]?d?d.p(t,e):(d=te(t),d.c(),d.m(s,null)):d&&(d.d(1),d=null),t[0]?p?p.p(t,e):(p=ee(t),p.c(),p.m(a,l)):p&&(p.d(1),p=null);const n={};8&e&&(n.$$scope={dirty:e,ctx:t}),c.$set(n)},i(t){u||(Q(c.$$.fragment,t),u=!0)},o(t){tt(c.$$.fragment,t),u=!1},d(t){t&&y(e),d&&d.d(),p&&p.d(),st(c)}}}function oe(t,e,n){let i,o,s=!1;return Mt.subscribe((t=>{n(1,o=t),o&&(n(1,o=new URL(o,window.location.origin)),o.searchParams.delete("polygon_geojson"),n(1,o=o.toString())),s||i||(s=!0,Nt("status",{format:"json"},(function(t){n(0,i=t.data_updated),s=!1})))})),[i,o]}Yt("en_US",(function(t,e){if(0===e)return["just now","right now"];var n=Vt[Math.floor(e/2)];return t>1&&(n+="s"),[t+" "+n+" ago","in "+t+" "+n]})),Yt("zh_CN",(function(t,e){if(0===e)return["刚刚","片刻后"];var n=Kt[~~(e/2)];return[t+" "+n+"前",t+" "+n+"后"]}));class se extends lt{constructor(t){super(),at(this,t,oe,ie,s,{})}}function re(t){let e,n,i,o,s,r;return{c(){e=w("div"),n=x(t[0]),i=$(),o=w("button"),C(o,"type","button"),C(o,"class","btn-close float-end"),C(o,"aria-label","dismiss"),C(e,"id","error"),C(e,"class","container-fluid alert-danger py-3 px-4")},m(a,l){v(a,e,l),g(e,n),g(e,i),g(e,o),s||(r=P(o,"click",t[1]),s=!0)},p(t,e){1&e&&E(n,t[0])},d(t){t&&y(e),s=!1,r()}}}function ae(e){let n,i=e[0]&&re(e);return{c(){i&&i.c(),n=T()},m(t,e){i&&i.m(t,e),v(t,n,e)},p(t,[e]){t[0]?i?i.p(t,e):(i=re(t),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},i:t,o:t,d(t){t&&y(n),i&&i.d(t)}}}function le(t,e,n){let i;return kt.subscribe((t=>{n(0,i=t)})),[i,function(){kt.set(null)}]}let ce=class extends lt{constructor(t){super(),at(this,t,le,ae,s,{})}};function he(t){let e,n,i,o,s;return{c(){e=w("img"),i=$(),o=w("h1"),s=x(t[3]),C(e,"alt","logo"),C(e,"id","theme-logo"),l(e.src,n="theme/logo.png")||C(e,"src","theme/logo.png"),C(e,"class","svelte-1q88nx"),C(o,"class","svelte-1q88nx")},m(t,n){v(t,e,n),v(t,i,n),v(t,o,n),g(o,s)},p(t,e){8&e&&E(s,t[3])},d(t){t&&(y(e),y(i),y(o))}}}function ue(t){let e,n,i;return n=new Ft({props:{page:"search",extra_classes:"nav-link "+("search"===t[4]?"active":""),$$slots:{default:[de]},$$scope:{ctx:t}}}),{c(){e=w("li"),it(n.$$.fragment),C(e,"class","nav-item svelte-1q88nx")},m(t,o){v(t,e,o),ot(n,e,null),i=!0},p(t,e){const i={};16&e&&(i.extra_classes="nav-link "+("search"===t[4]?"active":"")),128&e&&(i.$$scope={dirty:e,ctx:t}),n.$set(i)},i(t){i||(Q(n.$$.fragment,t),i=!0)},o(t){tt(n.$$.fragment,t),i=!1},d(t){t&&y(e),st(n)}}}function de(t){let e;return{c(){e=x("Search")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function pe(t){let e;return{c(){e=x("Reverse")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function me(t){let e;return{c(){e=x("Search By ID")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function fe(t){let e;return{c(){e=x("About & Help")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function _e(t){let e,n,i,o,s,r,a,l,c,h,u,p,b,L,T,P,M,k,A,S,O,z,I,N,B,D,Z,j,R,H,F;s=new Ft({props:{page:t[2]?"reverse":"search",$$slots:{default:[he]},$$scope:{ctx:t}}});let W=!t[2]&&ue(t);b=new Ut({props:{lat:t[0],lon:t[1],extra_classes:"nav-link "+("reverse"===t[4]?"active":""),$$slots:{default:[pe]},$$scope:{ctx:t}}}),P=new Ft({props:{page:"details",extra_classes:"nav-link "+("details"===t[4]?"active":""),$$slots:{default:[me]},$$scope:{ctx:t}}}),S=new Ft({props:{page:"about",extra_classes:"nav-link "+("about"===t[4]?"active":""),$$slots:{default:[fe]},$$scope:{ctx:t}}});const q=t[6].default,U=d(q,t,t[7],null);return j=new ce({}),H=new se({}),{c(){e=w("header"),n=w("nav"),i=w("div"),o=w("div"),it(s.$$.fragment),r=$(),a=w("button"),a.innerHTML='<span class="navbar-toggler-icon"></span>',l=$(),c=w("div"),h=w("ul"),W&&W.c(),u=$(),p=w("li"),it(b.$$.fragment),L=$(),T=w("li"),it(P.$$.fragment),M=$(),k=w("ul"),A=w("li"),it(S.$$.fragment),O=$(),z=w("section"),I=w("h2"),N=x(t[4]),B=$(),D=w("section"),U&&U.c(),Z=$(),it(j.$$.fragment),R=$(),it(H.$$.fragment),C(o,"class","navbar-brand svelte-1q88nx"),C(a,"class","navbar-toggler"),C(a,"type","button"),C(a,"data-bs-toggle","collapse"),C(a,"data-bs-target","#navbarSupportedContent"),C(a,"aria-controls","navbarSupportedContent"),C(a,"aria-expanded","false"),C(a,"aria-label","Toggle navigation"),C(p,"class","nav-item svelte-1q88nx"),C(T,"class","nav-item svelte-1q88nx"),C(h,"class","navbar-nav me-auto"),C(c,"class","collapse navbar-collapse"),C(c,"id","navbarSupportedContent"),C(A,"class","nav-item svelte-1q88nx"),C(k,"class","navbar-nav"),C(i,"class","container-fluid"),C(n,"class","navbar navbar-expand-sm navbar-light"),C(e,"class","container-fluid"),C(z,"class","page-title-section svelte-1q88nx"),C(D,"class","search-section svelte-1q88nx")},m(t,d){v(t,e,d),g(e,n),g(n,i),g(i,o),ot(s,o,null),g(i,r),g(i,a),g(i,l),g(i,c),g(c,h),W&&W.m(h,null),g(h,u),g(h,p),ot(b,p,null),g(h,L),g(h,T),ot(P,T,null),g(i,M),g(i,k),g(k,A),ot(S,A,null),v(t,O,d),v(t,z,d),g(z,I),g(I,N),v(t,B,d),v(t,D,d),U&&U.m(D,null),v(t,Z,d),ot(j,t,d),v(t,R,d),ot(H,t,d),F=!0},p(t,[e]){const n={};4&e&&(n.page=t[2]?"reverse":"search"),136&e&&(n.$$scope={dirty:e,ctx:t}),s.$set(n),t[2]?W&&(X(),tt(W,1,1,(()=>{W=null})),J()):W?(W.p(t,e),4&e&&Q(W,1)):(W=ue(t),W.c(),Q(W,1),W.m(h,u));const i={};1&e&&(i.lat=t[0]),2&e&&(i.lon=t[1]),16&e&&(i.extra_classes="nav-link "+("reverse"===t[4]?"active":"")),128&e&&(i.$$scope={dirty:e,ctx:t}),b.$set(i);const o={};16&e&&(o.extra_classes="nav-link "+("details"===t[4]?"active":"")),128&e&&(o.$$scope={dirty:e,ctx:t}),P.$set(o);const r={};16&e&&(r.extra_classes="nav-link "+("about"===t[4]?"active":"")),128&e&&(r.$$scope={dirty:e,ctx:t}),S.$set(r),(!F||16&e)&&E(N,t[4]),U&&U.p&&(!F||128&e)&&f(U,q,t,t[7],F?m(q,t[7],e,null):_(t[7]),null)},i(t){F||(Q(s.$$.fragment,t),Q(W),Q(b.$$.fragment,t),Q(P.$$.fragment,t),Q(S.$$.fragment,t),Q(U,t),Q(j.$$.fragment,t),Q(H.$$.fragment,t),F=!0)},o(t){tt(s.$$.fragment,t),tt(W),tt(b.$$.fragment,t),tt(P.$$.fragment,t),tt(S.$$.fragment,t),tt(U,t),tt(j.$$.fragment,t),tt(H.$$.fragment,t),F=!1},d(t){t&&(y(e),y(O),y(z),y(B),y(D),y(Z),y(R)),st(s),W&&W.d(),st(b),st(P),st(S),U&&U.d(t),st(j,t),st(H,t)}}}function ge(t,e,n){let i,o,s,r;u(t,Ct,(t=>n(5,r=t)));let a,l,{$$slots:c={},$$scope:h}=e;return Tt.subscribe((t=>{t&&t.on("move",(function(){n(0,a=t.getCenter().lat.toFixed(5)),n(1,l=t.getCenter().lng.toFixed(5))}))})),t.$$set=t=>{"$$scope"in t&&n(7,h=t.$$scope)},t.$$.update=()=>{32&t.$$.dirty&&n(4,i=r.tab)},n(3,o=Nominatim_Config.Page_Title),n(2,s=Nominatim_Config.Reverse_Only),[a,l,s,o,i,r,c,h]}class ve extends lt{constructor(t){super(),at(this,t,ge,_e,s,{})}}function ye(t){let e,n,i,o,s;const r=t[3].default,a=d(r,t,t[2],null);return{c(){e=w("form"),n=w("div"),a&&a.c(),C(n,"class","row g-2"),C(e,"class","form-inline"),C(e,"role","search"),C(e,"accept-charset","UTF-8"),C(e,"action","")},m(r,l){v(r,e,l),g(e,n),a&&a.m(n,null),i=!0,o||(s=P(e,"submit",M(t[0])),o=!0)},p(t,[e]){a&&a.p&&(!i||4&e)&&f(a,r,t,t[2],i?m(r,t[2],e,null):_(t[2]),null)},i(t){i||(Q(a,t),i=!0)},o(t){tt(a,t),i=!1},d(t){t&&y(e),a&&a.d(t),o=!1,s()}}}function be(t,e,n){let{$$slots:i={},$$scope:o}=e,{page:s}=e;return t.$$set=t=>{"page"in t&&n(1,s=t.page),"$$scope"in t&&n(2,o=t.$$scope)},[function(t){let e=t.target,n=!0;Array.prototype.slice.call(e.elements).forEach((function(t){(function(t){return!("hidden"===t.type&&t.value.length&&t.pattern&&!t.value.match(t.pattern))&&t.checkValidity()})(t)||(alert("Invalid input in "+t.name),n=!1)})),n&&St(s,function(t){var e=new URLSearchParams;return Array.prototype.slice.call(t.elements).forEach((function(t){!t.name||t.disabled||["submit","button"].indexOf(t.type)>-1||["checkbox","radio"].indexOf(t.type)>-1&&!t.checked||void 0!==t.value&&""!==t.value&&("dedupe"!==t.name||1!==t.value&&"1"!==t.value)&&e.set(t.name,t.value)})),e}(e))},s,o,i]}class we extends lt{constructor(t){super(),at(this,t,be,ye,s,{page:1})}}function xe(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,b,x,L,T,P,M,k,E,A,S,O;return{c(){e=w("div"),n=w("input"),o=$(),s=w("div"),r=w("button"),r.textContent="Search",a=$(),l=w("input"),h=$(),u=w("input"),p=$(),m=w("input"),_=$(),b=w("input"),L=$(),T=w("input"),M=$(),k=w("input"),A=$(),S=w("input"),C(n,"id","q"),C(n,"name","q"),C(n,"type","text"),C(n,"class","form-control form-control-sm svelte-1u2ltgo"),C(n,"placeholder","Search"),n.value=i=t[1].q||"",C(e,"class","col-auto"),C(r,"type","submit"),C(r,"class","btn btn-primary btn-sm mx-1"),C(l,"type","hidden"),C(l,"name","viewbox"),l.value=c=t[2]||"",C(u,"type","hidden"),C(u,"name","dedupe"),u.value=d=0===t[1].dedupe?0:1,C(m,"type","hidden"),C(m,"name","bounded"),m.value=f=t[1].bounded?1:"",C(b,"type","hidden"),C(b,"name","accept-language"),b.value=x=t[1]["accept-language"]||"",C(T,"type","hidden"),C(T,"name","countrycodes"),T.value=P=t[1].countrycodes||"",C(T,"pattern","^[a-zA-Z]{2}(,[a-zA-Z]{2})*$"),C(k,"type","hidden"),C(k,"name","limit"),k.value=E=t[1].limit||"",C(S,"type","hidden"),C(S,"name","polygon_threshold"),S.value=O=t[1].polygon_threshold||"",C(s,"class","col-auto")},m(t,i){v(t,e,i),g(e,n),v(t,o,i),v(t,s,i),g(s,r),g(s,a),g(s,l),g(s,h),g(s,u),g(s,p),g(s,m),g(s,_),g(s,b),g(s,L),g(s,T),g(s,M),g(s,k),g(s,A),g(s,S)},p(t,e){2&e&&i!==(i=t[1].q||"")&&n.value!==i&&(n.value=i),4&e&&c!==(c=t[2]||"")&&(l.value=c),2&e&&d!==(d=0===t[1].dedupe?0:1)&&(u.value=d),2&e&&f!==(f=t[1].bounded?1:"")&&(m.value=f),2&e&&x!==(x=t[1]["accept-language"]||"")&&(b.value=x),2&e&&P!==(P=t[1].countrycodes||"")&&(T.value=P),2&e&&E!==(E=t[1].limit||"")&&(k.value=E),2&e&&O!==(O=t[1].polygon_threshold||"")&&(S.value=O)},d(t){t&&(y(e),y(o),y(s))}}}function $e(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,b,x,L,T,P,M,k,E,A,S,O,z,I,N,B,D,Z,j,R,H,F,W,q,U,V,K,G,Y,X,J,Q;return{c(){e=w("div"),n=w("input"),o=$(),s=w("div"),r=w("input"),l=$(),c=w("div"),h=w("input"),d=$(),p=w("div"),m=w("input"),_=$(),b=w("div"),x=w("input"),T=$(),P=w("div"),M=w("input"),E=$(),A=w("div"),S=w("button"),S.textContent="Search",O=$(),z=w("input"),N=$(),B=w("input"),Z=$(),j=w("input"),H=$(),F=w("input"),q=$(),U=w("input"),K=$(),G=w("input"),X=$(),J=w("input"),C(n,"name","street"),C(n,"type","text"),C(n,"class","form-control form-control-sm me-1"),C(n,"placeholder","House number/Street"),n.value=i=t[1].street||"",C(e,"class","col-auto"),C(r,"name","city"),C(r,"type","text"),C(r,"class","form-control form-control-sm me-1"),C(r,"placeholder","City"),r.value=a=t[1].city||"",C(s,"class","col-auto"),C(h,"id","county"),C(h,"name","county"),C(h,"type","text"),C(h,"class","form-control form-control-sm me-1"),C(h,"placeholder","County"),h.value=u=t[1].county||"",C(c,"class","col-auto"),C(m,"name","state"),C(m,"type","text"),C(m,"class","form-control form-control-sm me-1"),C(m,"placeholder","State"),m.value=f=t[1].state||"",C(p,"class","col-auto"),C(x,"name","country"),C(x,"type","text"),C(x,"class","form-control form-control-sm me-1"),C(x,"placeholder","Country"),x.value=L=t[1].country||"",C(b,"class","col-auto"),C(M,"name","postalcode"),C(M,"type","text"),C(M,"class","form-control form-control-sm me-1"),C(M,"placeholder","Postal Code"),M.value=k=t[1].postalcode||"",C(P,"class","col-auto"),C(S,"type","submit"),C(S,"class","btn btn-primary btn-sm"),C(z,"type","hidden"),C(z,"name","viewbox"),z.value=I=t[2]||"",C(B,"type","hidden"),C(B,"name","dedupe"),B.value=D=0===t[1].dedupe?0:1,C(j,"type","hidden"),C(j,"name","bounded"),j.value=R=t[1].bounded?1:"",C(F,"type","hidden"),C(F,"name","accept-language"),F.value=W=t[1]["accept-language"]||"",C(U,"type","hidden"),C(U,"name","countrycodes"),U.value=V=t[1].countrycodes||"",C(U,"pattern","^[a-zA-Z]{2}(,[a-zA-Z]{2})*$"),C(G,"type","hidden"),C(G,"name","limit"),G.value=Y=t[1].limit||"",C(J,"type","hidden"),C(J,"name","polygon_threshold"),J.value=Q=t[1].polygon_threshold||"",C(A,"class","col-auto")},m(t,i){v(t,e,i),g(e,n),v(t,o,i),v(t,s,i),g(s,r),v(t,l,i),v(t,c,i),g(c,h),v(t,d,i),v(t,p,i),g(p,m),v(t,_,i),v(t,b,i),g(b,x),v(t,T,i),v(t,P,i),g(P,M),v(t,E,i),v(t,A,i),g(A,S),g(A,O),g(A,z),g(A,N),g(A,B),g(A,Z),g(A,j),g(A,H),g(A,F),g(A,q),g(A,U),g(A,K),g(A,G),g(A,X),g(A,J)},p(t,e){2&e&&i!==(i=t[1].street||"")&&n.value!==i&&(n.value=i),2&e&&a!==(a=t[1].city||"")&&r.value!==a&&(r.value=a),2&e&&u!==(u=t[1].county||"")&&h.value!==u&&(h.value=u),2&e&&f!==(f=t[1].state||"")&&m.value!==f&&(m.value=f),2&e&&L!==(L=t[1].country||"")&&x.value!==L&&(x.value=L),2&e&&k!==(k=t[1].postalcode||"")&&M.value!==k&&(M.value=k),4&e&&I!==(I=t[2]||"")&&(z.value=I),2&e&&D!==(D=0===t[1].dedupe?0:1)&&(B.value=D),2&e&&R!==(R=t[1].bounded?1:"")&&(j.value=R),2&e&&W!==(W=t[1]["accept-language"]||"")&&(F.value=W),2&e&&V!==(V=t[1].countrycodes||"")&&(U.value=V),2&e&&Y!==(Y=t[1].limit||"")&&(G.value=Y),2&e&&Q!==(Q=t[1].polygon_threshold||"")&&(J.value=Q)},d(t){t&&(y(e),y(o),y(s),y(l),y(c),y(d),y(p),y(_),y(b),y(T),y(P),y(E),y(A))}}}function Le(t){let e,n,o,s,r,a,l,c,h,u,d,p,m,f,_,b,x,L,T,M,k,E,A,S,z,I,N,B,D,Z,j,R,H,F,W,q,U,V,K,G,Y,X,J,et,nt,rt,at,lt,ct,ht,ut,dt,pt,mt,ft,_t,gt,vt,yt,bt,wt,xt,$t,Lt,Tt;return u=new we({props:{page:"search",$$slots:{default:[xe]},$$scope:{ctx:t}}}),m=new we({props:{page:"search",$$slots:{default:[$e]},$$scope:{ctx:t}}}),{c(){e=w("ul"),n=w("li"),o=w("a"),o.textContent="Simple",s=$(),r=w("li"),a=w("a"),a.textContent="Structured",l=$(),c=w("div"),h=w("div"),it(u.$$.fragment),d=$(),p=w("div"),it(m.$$.fragment),f=$(),_=w("details"),b=w("summary"),b.innerHTML="<small>Advanced options</small>",x=$(),L=w("ul"),T=w("li"),M=w("div"),k=w("label"),k.textContent="apply viewbox",E=$(),A=w("input"),z=$(),I=w("li"),N=w("div"),B=w("label"),B.textContent="bounded to viewbox",D=$(),Z=w("input"),R=$(),H=w("li"),F=w("div"),W=w("label"),W.textContent="deduplicate results",q=$(),U=w("input"),K=$(),G=w("li"),Y=w("label"),Y.textContent="Maximum number of results",X=$(),J=w("input"),nt=$(),rt=w("li"),at=w("label"),at.textContent="Polygon simplification",lt=$(),ct=w("input"),ut=$(),dt=w("li"),pt=w("label"),pt.textContent="Languages",mt=$(),ft=w("input"),gt=$(),vt=w("li"),yt=w("label"),yt.textContent="Country Codes",bt=$(),wt=w("input"),C(o,"class","nav-link svelte-1u2ltgo"),C(o,"data-bs-toggle","tab"),C(o,"href","#simple"),O(o,"active",!t[0]),C(n,"class","nav-item"),C(a,"class","nav-link svelte-1u2ltgo"),C(a,"data-bs-toggle","tab"),C(a,"href","#structured"),O(a,"active",t[0]),C(r,"class","nav-item"),C(e,"class","nav nav-tabs svelte-1u2ltgo"),C(h,"class","tab-pane"),C(h,"id","simple"),C(h,"role","tabpanel"),O(h,"active",!t[0]),C(p,"class","tab-pane"),C(p,"id","structured"),C(p,"role","tabpanel"),O(p,"active",t[0]),C(c,"class","tab-content py-2"),C(k,"class","form-check-label svelte-1u2ltgo"),C(k,"for","use_viewbox"),C(A,"type","checkbox"),C(A,"class","form-check-input api-param-setting"),C(A,"id","use_viewbox"),A.checked=S=t[1].viewbox,C(M,"class","form-check form-check-inline"),C(T,"class","svelte-1u2ltgo"),C(B,"class","form-check-label svelte-1u2ltgo"),C(B,"for","option_bounded"),C(Z,"type","checkbox"),C(Z,"class","form-check-input api-param-setting"),C(Z,"id","option_bounded"),Z.checked=j=!!t[1].bounded,C(N,"class","form-check form-check-inline"),C(I,"class","svelte-1u2ltgo"),C(W,"class","form-check-label svelte-1u2ltgo"),C(W,"for","option_dedupe"),C(U,"type","checkbox"),C(U,"class","form-check-input api-param-setting"),C(U,"id","option_dedupe"),U.checked=V=0===t[1].dedupe?0:1,C(F,"class","form-check form-check-inline"),C(H,"class","svelte-1u2ltgo"),C(Y,"for","option_limit"),C(Y,"class","svelte-1u2ltgo"),C(J,"type","number"),C(J,"class","form-control form-control-sm d-inline w-auto api-param-setting"),C(J,"data-api-param","limit"),C(J,"id","option_limit"),C(J,"min","1"),C(J,"max","50"),J.value=et=t[1].limit||"",C(G,"class","svelte-1u2ltgo"),C(at,"for","option_polygon_threshold"),C(at,"class","svelte-1u2ltgo"),C(ct,"type","number"),C(ct,"class","form-control form-control-sm d-inline w-auto api-param-setting"),C(ct,"data-api-param","polygon_threshold"),C(ct,"id","option_polygon_threshold"),C(ct,"min","0.0"),C(ct,"max","1.0"),C(ct,"step","0.001"),ct.value=ht=t[1].polygon_threshold||"",C(rt,"class","svelte-1u2ltgo"),C(pt,"for","accept_lang"),C(pt,"class","svelte-1u2ltgo"),C(ft,"type","text"),C(ft,"placeholder","e.g. en,zh-Hant"),C(ft,"class","form-control form-control-sm d-inline w-auto api-param-setting"),C(ft,"data-api-param","accept-language"),C(ft,"id","accept_lang"),C(ft,"size","15"),ft.value=_t=t[1]["accept-language"]||"",C(dt,"class","svelte-1u2ltgo"),C(yt,"for","option_ccode"),C(yt,"class","svelte-1u2ltgo"),C(wt,"type","text"),C(wt,"placeholder","e.g. de,gb"),C(wt,"class","form-control form-control-sm d-inline w-auto api-param-setting"),C(wt,"data-api-param","countrycodes"),C(wt,"id","option_ccode"),C(wt,"size","15"),wt.value=xt=t[1].countrycodes||"",C(wt,"pattern","^[a-zA-Z]{2}(,[a-zA-Z]{2})*$"),C(vt,"class","svelte-1u2ltgo"),C(L,"class","svelte-1u2ltgo"),C(_,"id","searchAdvancedOptions"),C(_,"class","svelte-1u2ltgo")},m(i,y){v(i,e,y),g(e,n),g(n,o),g(e,s),g(e,r),g(r,a),v(i,l,y),v(i,c,y),g(c,h),ot(u,h,null),g(c,d),g(c,p),ot(m,p,null),v(i,f,y),v(i,_,y),g(_,b),g(_,x),g(_,L),g(L,T),g(T,M),g(M,k),g(M,E),g(M,A),g(L,z),g(L,I),g(I,N),g(N,B),g(N,D),g(N,Z),g(L,R),g(L,H),g(H,F),g(F,W),g(F,q),g(F,U),g(L,K),g(L,G),g(G,Y),g(G,X),g(G,J),g(L,nt),g(L,rt),g(rt,at),g(rt,lt),g(rt,ct),g(L,ut),g(L,dt),g(dt,pt),g(dt,mt),g(dt,ft),g(L,gt),g(L,vt),g(vt,yt),g(vt,bt),g(vt,wt),$t=!0,Lt||(Tt=[P(A,"change",t[3]),P(Z,"change",Te),P(U,"change",Pe),P(J,"change",Me),P(ct,"change",Me),P(ft,"change",Me),P(wt,"change",Me)],Lt=!0)},p(t,[e]){(!$t||1&e)&&O(o,"active",!t[0]),(!$t||1&e)&&O(a,"active",t[0]);const n={};262&e&&(n.$$scope={dirty:e,ctx:t}),u.$set(n),(!$t||1&e)&&O(h,"active",!t[0]);const i={};262&e&&(i.$$scope={dirty:e,ctx:t}),m.$set(i),(!$t||1&e)&&O(p,"active",t[0]),(!$t||2&e&&S!==(S=t[1].viewbox))&&(A.checked=S),(!$t||2&e&&j!==(j=!!t[1].bounded))&&(Z.checked=j),(!$t||2&e&&V!==(V=0===t[1].dedupe?0:1))&&(U.checked=V),(!$t||2&e&&et!==(et=t[1].limit||"")&&J.value!==et)&&(J.value=et),(!$t||2&e&&ht!==(ht=t[1].polygon_threshold||"")&&ct.value!==ht)&&(ct.value=ht),(!$t||2&e&&_t!==(_t=t[1]["accept-language"]||"")&&ft.value!==_t)&&(ft.value=_t),(!$t||2&e&&xt!==(xt=t[1].countrycodes||"")&&wt.value!==xt)&&(wt.value=xt)},i(t){$t||(Q(u.$$.fragment,t),Q(m.$$.fragment,t),$t=!0)},o(t){tt(u.$$.fragment,t),tt(m.$$.fragment,t),$t=!1},d(t){t&&(y(e),y(l),y(c),y(f),y(_)),st(u),st(m),Lt=!1,i(Tt)}}}function Te(t){document.querySelector("input[name=bounded]").value=t.target.checked?1:""}function Pe(t){document.querySelector("input[name=dedupe]").value=t.target.checked?1:0}function Me(t){document.querySelector("input[name="+t.target.dataset.apiParam+"]").value=t.target.value}function ke(t,e,n){let i,{bStructuredSearch:o=!1}=e,{api_request_params:s={}}=e;function r(t){let e=document.getElementById("use_viewbox");e&&e.checked?n(2,i=function(t){var e=t.getBounds(),n=e.getWest(),i=e.getEast();return i-n>=360&&(n=t.getCenter().lng-179.999,i=t.getCenter().lng+179.999),i=L.latLng(77,i).wrap().lng,[(n=L.latLng(77,n).wrap().lng).toFixed(5),e.getNorth().toFixed(5),i.toFixed(5),e.getSouth().toFixed(5)].join(",")}(t)):n(2,i="")}function a(t){let e=t.wrapLatLng(t.getCenter());e.lat.toFixed(5),e.lng.toFixed(5)}return Tt.subscribe((t=>{t&&(t.on("move",(function(){r(t),a(t)})),t.on("load",(function(){r(t),a(t)})))})),t.$$set=t=>{"bStructuredSearch"in t&&n(0,o=t.bStructuredSearch),"api_request_params"in t&&n(1,s=t.api_request_params)},[o,s,i,function(){let t=h(Tt);t&&r(t)}]}class Ce extends lt{constructor(t){super(),at(this,t,ke,Le,s,{bStructuredSearch:0,api_request_params:1})}}function Ee(t){let e,n,i,o;const s=t[6].default,r=d(s,t,t[5],null);return{c(){e=w("a"),r&&r.c(),C(e,"href",t[1]),C(e,"class",t[0])},m(s,a){v(s,e,a),r&&r.m(e,null),n=!0,i||(o=P(e,"click",k(M(t[2]))),i=!0)},p(t,[i]){r&&r.p&&(!n||32&i)&&f(r,s,t,t[5],n?m(s,t[5],i,null):_(t[5]),null),(!n||2&i)&&C(e,"href",t[1]),(!n||1&i)&&C(e,"class",t[0])},i(t){n||(Q(r,t),n=!0)},o(t){tt(r,t),n=!1},d(t){t&&y(e),r&&r.d(t),i=!1,o()}}}function Ae(t,e,n){let{$$slots:i={},$$scope:o}=e,{extra_classes:s=""}=e,{feature:r=null}=e,a=new URLSearchParams,l="details.html";return t.$$set=t=>{"extra_classes"in t&&n(0,s=t.extra_classes),"feature"in t&&n(3,r=t.feature),"$$scope"in t&&n(5,o=t.$$scope)},t.$$.update=()=>{if(8&t.$$.dirty){let t=new URLSearchParams;null!==r&&(r.osm_type?(1===r.osm_type.length?t.set("osmtype",r.osm_type):t.set("osmtype","node"===(e=r.osm_type)?"N":"way"===e?"W":"relation"===e?"R":""),t.set("osmid",r.osm_id),r.class?t.set("class",r.class):r.category&&t.set("class",r.category)):r.place_id&&t.set("place_id",r.place_id)),n(4,a=t)}var e;if(16&t.$$.dirty){let t=a.toString();n(1,l="details.html"+(t?"?":"")+t)}},[s,l,function(){St("details",a)},r,a,o,i]}class Se extends lt{constructor(t){super(),at(this,t,Ae,Ee,s,{extra_classes:0,feature:3})}}function Oe(e){let n;return{c(){n=w("div"),C(n,"id","welcome")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&y(n)}}}function ze(t){return N((()=>{Dt("theme/welcome.html",document.getElementById("welcome"))})),[]}class Ie extends lt{constructor(t){super(),at(this,t,ze,Oe,s,{})}}function Ne(t){let e,n;return{c(){e=w("img"),C(e,"class","mapicon svelte-180cawe"),l(e.src,n=t[1])||C(e,"src",n),C(e,"alt",t[2])},m(t,n){v(t,e,n)},p(t,i){2&i&&!l(e.src,n=t[1])&&C(e,"src",n),4&i&&C(e,"alt",t[2])},d(t){t&&y(e)}}}function Be(e){let n,i=e[0]&&Ne(e);return{c(){i&&i.c(),n=T()},m(t,e){i&&i.m(t,e),v(t,n,e)},p(t,[e]){t[0]?i?i.p(t,e):(i=Ne(t),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},i:t,o:t,d(t){t&&y(n),i&&i.d(t)}}}function De(t,e,n){let i,o,s,{aPlace:r}=e;return t.$$set=t=>{"aPlace"in t&&n(3,r=t.aPlace)},t.$$.update=()=>{var e,a;8&t.$$.dirty&&n(0,(e=r.category,a=r.type,i={"boundary:administrative":"poi_boundary_administrative","place:city":"poi_place_city","place:town":"poi_place_town","place:village":"poi_place_village","place:hamlet":"poi_place_village","place:suburb":"poi_place_village","place:locality":"poi_place_village","place:airport":"transport_airport2","aeroway:aerodrome":"transport_airport2","railway:station":"transport_train_station2","amenity:place_of_worship":"place_of_worship_unknown3","amenity:pub":"food_pub","amenity:bar":"food_bar","amenity:university":"education_university","tourism:museum":"tourist_museum","amenity:arts_centre":"tourist_art_gallery2","tourism:zoo":"tourist_zoo","tourism:theme_park":"poi_point_of_interest","tourism:attraction":"poi_point_of_interest","leisure:golf_course":"sport_golf","historic:castle":"tourist_castle","amenity:hospital":"health_hospital","amenity:school":"education_school","amenity:theatre":"tourist_theatre","amenity:library":"amenity_library","amenity:fire_station":"amenity_firestation3","amenity:police":"amenity_police2","amenity:bank":"money_bank2","amenity:post_office":"amenity_post_office","tourism:hotel":"accommodation_hotel2","amenity:cinema":"tourist_cinema","tourism:artwork":"tourist_art_gallery2","historic:archaeological_site":"tourist_archaeological2","amenity:doctors":"health_doctors","leisure:sports_centre":"sport_leisure_centre","leisure:swimming_pool":"sport_swimming_outdoor","shop:supermarket":"shopping_supermarket","shop:convenience":"shopping_convenience","amenity:restaurant":"food_restaurant","amenity:fast_food":"food_fastfood","amenity:cafe":"food_cafe","tourism:guest_house":"accommodation_bed_and_breakfast","amenity:pharmacy":"health_pharmacy_dispensing","amenity:fuel":"transport_fuel","natural:peak":"poi_peak","natural:wood":"landuse_coniferous_and_deciduous","shop:bicycle":"shopping_bicycle","shop:clothes":"shopping_clothes","shop:hairdresser":"shopping_hairdresser","shop:doityourself":"shopping_diy","shop:estate_agent":"shopping_estateagent2","shop:car":"shopping_car","shop:garden_centre":"shopping_garden_centre","shop:car_repair":"shopping_car_repair","shop:bakery":"shopping_bakery","shop:butcher":"shopping_butcher","shop:apparel":"shopping_clothes","shop:laundry":"shopping_laundrette","shop:beverages":"shopping_alcohol","shop:alcohol":"shopping_alcohol","shop:optician":"health_opticians","shop:chemist":"health_pharmacy","shop:gallery":"tourist_art_gallery2","shop:jewelry":"shopping_jewelry","tourism:information":"amenity_information","historic:ruins":"tourist_ruin","amenity:college":"education_school","historic:monument":"tourist_monument","historic:memorial":"tourist_monument","historic:mine":"poi_mine","tourism:caravan_site":"accommodation_caravan_park","amenity:bus_station":"transport_bus_station","amenity:atm":"money_atm2","tourism:viewpoint":"tourist_view_point","tourism:guesthouse":"accommodation_bed_and_breakfast","railway:tram":"transport_tram_stop","amenity:courthouse":"amenity_court","amenity:recycling":"amenity_recycling","amenity:dentist":"health_dentist","natural:beach":"tourist_beach","railway:tram_stop":"transport_tram_stop","amenity:prison":"amenity_prison","highway:bus_stop":"transport_bus_stop2"}[e+":"+a])),8&t.$$.dirty&&n(2,o="icon for "+r.category+" "+r.type),1&t.$$.dirty&&n(1,s=Nominatim_Config.Images_Base_Url+i+".p.20.png")},[i,s,o,r]}class Ze extends lt{constructor(t){super(),at(this,t,De,Be,s,{aPlace:3})}}function je(t,e,n){const i=t.slice();return i[6]=e[n],i[8]=n,i}function Re(e){let n,i;return n=new Ie({}),{c(){it(n.$$.fragment)},m(t,e){ot(n,t,e),i=!0},p:t,i(t){i||(Q(n.$$.fragment,t),i=!0)},o(t){tt(n.$$.fragment,t),i=!1},d(t){st(n,t)}}}function He(e){let n;function i(t,e){return t[0]?qe:We}let o=i(e),s=o(e);return{c(){s.c(),n=T()},m(t,e){s.m(t,e),v(t,n,e)},p(t,e){o!==(o=i(t))&&(s.d(1),s=o(t),s&&(s.c(),s.m(n.parentNode,n)))},i:t,o:t,d(t){t&&y(n),s.d(t)}}}function Fe(t){let e,n,i,o=et(t[1]),s=[];for(let e=0;e<o.length;e+=1)s[e]=Ve(je(t,o,e));const r=t=>tt(s[t],1,1,(()=>{s[t]=null}));let a=t[3]&&!t[0]&&Ke(t);return{c(){e=w("div");for(let t=0;t<s.length;t+=1)s[t].c();n=$(),a&&a.c(),C(e,"id","searchresults"),C(e,"role","list")},m(t,o){v(t,e,o);for(let t=0;t<s.length;t+=1)s[t]&&s[t].m(e,null);g(e,n),a&&a.m(e,null),i=!0},p(t,i){if(22&i){let a;for(o=et(t[1]),a=0;a<o.length;a+=1){const r=je(t,o,a);s[a]?(s[a].p(r,i),Q(s[a],1)):(s[a]=Ve(r),s[a].c(),Q(s[a],1),s[a].m(e,n))}for(X(),a=o.length;a<s.length;a+=1)r(a);J()}t[3]&&!t[0]?a?a.p(t,i):(a=Ke(t),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i(t){if(!i){for(let t=0;t<o.length;t+=1)Q(s[t]);i=!0}},o(t){s=s.filter(Boolean);for(let t=0;t<s.length;t+=1)tt(s[t]);i=!1},d(t){t&&y(e),b(s,t),a&&a.d()}}}function We(t){let e;return{c(){e=w("div"),e.textContent="No search results found",C(e,"class","noresults svelte-358hab")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function qe(t){let e;return{c(){e=w("div"),e.textContent="Search for coordinates or click anywhere on the map.",C(e,"id","intro"),C(e,"class","sidebar")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function Ue(t){let e;return{c(){e=x("details")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function Ve(t){let e,n,o,s,r,a,l,c,h,u,d,p,m,f,_,b,L,T,M,A=t[6].display_name+"",S=_t(t[6])+"",z=t[6].lat+"",I=t[6].lon+"";return o=new Ze({props:{aPlace:t[6]}}),b=new Se({props:{extra_classes:"btn btn-outline-secondary btn-sm",feature:t[6],$$slots:{default:[Ue]},$$scope:{ctx:t}}}),{c(){var i,g,v,y;e=w("div"),n=w("div"),it(o.$$.fragment),s=$(),r=w("span"),a=x(A),l=$(),c=w("span"),h=x(S),u=$(),d=w("p"),p=x(z),m=x(","),f=x(I),_=$(),it(b.$$.fragment),i=n,g="float",null==(v="right")?i.style.removeProperty(g):i.style.setProperty(g,v,y?"important":""),C(r,"class","name"),C(c,"class","type svelte-358hab"),C(d,"class","coords svelte-358hab"),C(e,"class","result svelte-358hab"),C(e,"role","listitem"),C(e,"data-position",t[8]),O(e,"highlight",t[8]===t[2])},m(i,y){v(i,e,y),g(e,n),ot(o,n,null),g(e,s),g(e,r),g(r,a),g(e,l),g(e,c),g(c,h),g(e,u),g(e,d),g(d,p),g(d,m),g(d,f),g(e,_),ot(b,e,null),L=!0,T||(M=[P(e,"click",k(t[4])),P(e,"keypress",k(t[4]))],T=!0)},p(t,n){const i={};2&n&&(i.aPlace=t[6]),o.$set(i),(!L||2&n)&&A!==(A=t[6].display_name+"")&&E(a,A),(!L||2&n)&&S!==(S=_t(t[6])+"")&&E(h,S),(!L||2&n)&&z!==(z=t[6].lat+"")&&E(p,z),(!L||2&n)&&I!==(I=t[6].lon+"")&&E(f,I);const s={};2&n&&(s.feature=t[6]),512&n&&(s.$$scope={dirty:n,ctx:t}),b.$set(s),(!L||4&n)&&O(e,"highlight",t[8]===t[2])},i(t){L||(Q(o.$$.fragment,t),Q(b.$$.fragment,t),L=!0)},o(t){tt(o.$$.fragment,t),tt(b.$$.fragment,t),L=!1},d(t){t&&y(e),st(o),st(b),T=!1,i(M)}}}function Ke(t){let e,n,i;return{c(){e=w("div"),n=w("a"),i=x("Search for more results"),C(n,"class","btn btn-primary"),C(n,"href",t[3]),C(e,"class","more svelte-358hab")},m(t,o){v(t,e,o),g(e,n),g(n,i)},p(t,e){8&e&&C(n,"href",t[3])},d(t){t&&y(e)}}}function Ge(t){let e,n,i,o;const s=[Fe,He,Re],r=[];function a(t,e){return t[1]&&t[1].length>0?0:t[1]?1:2}return e=a(t),n=r[e]=s[e](t),{c(){n.c(),i=T()},m(t,n){r[e].m(t,n),v(t,i,n),o=!0},p(t,[o]){let l=e;e=a(t),e===l?r[e].p(t,o):(X(),tt(r[l],1,1,(()=>{r[l]=null})),J(),n=r[e],n?n.p(t,o):(n=r[e]=s[e](t),n.c()),Q(n,1),n.m(i.parentNode,i))},i(t){o||(Q(n),o=!0)},o(t){tt(n),o=!1},d(t){t&&y(i),r[e].d(t)}}}function Ye(t,e,n){let i,o,s,{reverse_search:r=!1}=e,{current_result:a=null}=e;return Pt.subscribe((t=>{if(!t)return;n(1,i=t),n(2,o=0),n(5,a=i[0]);let e=new URLSearchParams(window.location.search),r=t;var l=[];e.has("exclude_place_ids")&&(l=e.get("exclude_place_ids").split(","));for(var c=0;c<r.length;c+=1)l.push(r[c].place_id);var h=new URLSearchParams(window.location.search);h.set("exclude_place_ids",l.join(",")),n(3,s="?"+h.toString())})),t.$$set=t=>{"reverse_search"in t&&n(0,r=t.reverse_search),"current_result"in t&&n(5,a=t.current_result)},[r,i,o,s,function(t){let e=t.target;e.className.match("result")||(e=e.parentElement);let s=Number(e.dataset.position);n(5,a=i[s]),n(2,o=s)},a]}class Xe extends lt{constructor(t){super(),at(this,t,Ye,Ge,s,{reverse_search:0,current_result:5})}}var Je,Qe={exports:{}};
+/* @preserve
+ * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
+ * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
+ */function tn(){return Je||(Je=1,function(t){var e="1.9.4";function n(t){var e,n,i,o;for(n=1,i=arguments.length;n<i;n++)for(e in o=arguments[n])t[e]=o[e];return t}var i=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function o(t,e){var n=Array.prototype.slice;if(t.bind)return t.bind.apply(t,n.call(arguments,1));var i=n.call(arguments,2);return function(){return t.apply(e,i.length?i.concat(n.call(arguments)):arguments)}}var s=0;function r(t){return"_leaflet_id"in t||(t._leaflet_id=++s),t._leaflet_id}function a(t,e,n){var i,o,s,r;return r=function(){i=!1,o&&(s.apply(n,o),o=!1)},s=function(){i?o=arguments:(t.apply(n,arguments),setTimeout(r,e),i=!0)},s}function l(t,e,n){var i=e[1],o=e[0],s=i-o;return t===i&&n?t:((t-o)%s+s)%s+o}function c(){return!1}function h(t,e){if(!1===e)return t;var n=Math.pow(10,void 0===e?6:e);return Math.round(t*n)/n}function u(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function d(t){return u(t).split(/\s+/)}function p(t,e){for(var n in Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?i(t.options):{}),e)t.options[n]=e[n];return t.options}function m(t,e,n){var i=[];for(var o in t)i.push(encodeURIComponent(n?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(e&&-1!==e.indexOf("?")?"&":"?")+i.join("&")}var f=/\{ *([\w_ -]+) *\}/g;function _(t,e){return t.replace(f,(function(t,n){var i=e[n];if(void 0===i)throw new Error("No value provided for variable "+t);return"function"==typeof i&&(i=i(e)),i}))}var g=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function v(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}var y="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function b(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var w=0;function x(t){var e=+new Date,n=Math.max(0,16-(e-w));return w=e+n,window.setTimeout(t,n)}var $=window.requestAnimationFrame||b("RequestAnimationFrame")||x,T=window.cancelAnimationFrame||b("CancelAnimationFrame")||b("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function P(t,e,n){if(!n||$!==x)return $.call(window,o(t,e));t.call(e)}function M(t){t&&T.call(window,t)}var k={__proto__:null,extend:n,create:i,bind:o,get lastId(){return s},stamp:r,throttle:a,wrapNum:l,falseFn:c,formatNum:h,trim:u,splitWords:d,setOptions:p,getParamString:m,template:_,isArray:g,indexOf:v,emptyImageUrl:y,requestFn:$,cancelFn:T,requestAnimFrame:P,cancelAnimFrame:M};function C(){}function E(t){if("undefined"!=typeof L&&L&&L.Mixin){t=g(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}C.extend=function(t){var e=function(){p(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},o=e.__super__=this.prototype,s=i(o);for(var r in s.constructor=e,e.prototype=s,this)Object.prototype.hasOwnProperty.call(this,r)&&"prototype"!==r&&"__super__"!==r&&(e[r]=this[r]);return t.statics&&n(e,t.statics),t.includes&&(E(t.includes),n.apply(null,[s].concat(t.includes))),n(s,t),delete s.statics,delete s.includes,s.options&&(s.options=o.options?i(o.options):{},n(s.options,t.options)),s._initHooks=[],s.callInitHooks=function(){if(!this._initHooksCalled){o.callInitHooks&&o.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=s._initHooks.length;t<e;t++)s._initHooks[t].call(this)}},e},C.include=function(t){var e=this.prototype.options;return n(this.prototype,t),t.options&&(this.prototype.options=e,this.mergeOptions(t.options)),this},C.mergeOptions=function(t){return n(this.prototype.options,t),this},C.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),n="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n),this};var A={on:function(t,e,n){if("object"==typeof t)for(var i in t)this._on(i,t[i],e);else for(var o=0,s=(t=d(t)).length;o<s;o++)this._on(t[o],e,n);return this},off:function(t,e,n){if(arguments.length)if("object"==typeof t)for(var i in t)this._off(i,t[i],e);else{t=d(t);for(var o=1===arguments.length,s=0,r=t.length;s<r;s++)o?this._off(t[s]):this._off(t[s],e,n)}else delete this._events;return this},_on:function(t,e,n,i){if("function"==typeof e){if(!1===this._listens(t,e,n)){n===this&&(n=void 0);var o={fn:e,ctx:n};i&&(o.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(o)}}else console.warn("wrong listener type: "+typeof e)},_off:function(t,e,n){var i,o,s;if(this._events&&(i=this._events[t]))if(1!==arguments.length)if("function"==typeof e){var r=this._listens(t,e,n);if(!1!==r){var a=i[r];this._firingCount&&(a.fn=c,this._events[t]=i=i.slice()),i.splice(r,1)}}else console.warn("wrong listener type: "+typeof e);else{if(this._firingCount)for(o=0,s=i.length;o<s;o++)i[o].fn=c;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var o=n({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var s=this._events[t];if(s){this._firingCount=this._firingCount+1||1;for(var r=0,a=s.length;r<a;r++){var l=s[r],c=l.fn;l.once&&this.off(t,c,l.ctx),c.call(l.ctx||this,o)}this._firingCount--}}return i&&this._propagateEvent(o),this},listens:function(t,e,n,i){"string"!=typeof t&&console.warn('"string" type argument expected');var o=e;"function"!=typeof e&&(i=!!e,o=void 0,n=void 0);var s=this._events&&this._events[t];if(s&&s.length&&!1!==this._listens(t,o,n))return!0;if(i)for(var r in this._eventParents)if(this._eventParents[r].listens(t,e,n,i))return!0;return!1},_listens:function(t,e,n){if(!this._events)return!1;var i=this._events[t]||[];if(!e)return!!i.length;n===this&&(n=void 0);for(var o=0,s=i.length;o<s;o++)if(i[o].fn===e&&i[o].ctx===n)return o;return!1},once:function(t,e,n){if("object"==typeof t)for(var i in t)this._on(i,t[i],e,!0);else for(var o=0,s=(t=d(t)).length;o<s;o++)this._on(t[o],e,n,!0);return this},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[r(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[r(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,n({layer:t.target,propagatedFrom:t.target},t),!0)}};A.addEventListener=A.on,A.removeEventListener=A.clearAllEventListeners=A.off,A.addOneTimeEventListener=A.once,A.fireEvent=A.fire,A.hasEventListeners=A.listens;var S=C.extend(A);function O(t,e,n){this.x=n?Math.round(t):t,this.y=n?Math.round(e):e}var z=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function I(t,e,n){return t instanceof O?t:g(t)?new O(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new O(t.x,t.y):new O(t,e,n)}function N(t,e){if(t)for(var n=e?[t,e]:t,i=0,o=n.length;i<o;i++)this.extend(n[i])}function B(t,e){return!t||t instanceof N?t:new N(t,e)}function D(t,e){if(t)for(var n=e?[t,e]:t,i=0,o=n.length;i<o;i++)this.extend(n[i])}function Z(t,e){return t instanceof D?t:new D(t,e)}function j(t,e,n){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==n&&(this.alt=+n)}function R(t,e,n){return t instanceof j?t:g(t)&&"object"!=typeof t[0]?3===t.length?new j(t[0],t[1],t[2]):2===t.length?new j(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new j(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new j(t,e,n)}O.prototype={clone:function(){return new O(this.x,this.y)},add:function(t){return this.clone()._add(I(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(I(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new O(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new O(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=z(this.x),this.y=z(this.y),this},distanceTo:function(t){var e=(t=I(t)).x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)},equals:function(t){return(t=I(t)).x===this.x&&t.y===this.y},contains:function(t){return t=I(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+h(this.x)+", "+h(this.y)+")"}},N.prototype={extend:function(t){var e,n;if(!t)return this;if(t instanceof O||"number"==typeof t[0]||"x"in t)e=n=I(t);else if(e=(t=B(t)).min,n=t.max,!e||!n)return this;return this.min||this.max?(this.min.x=Math.min(e.x,this.min.x),this.max.x=Math.max(n.x,this.max.x),this.min.y=Math.min(e.y,this.min.y),this.max.y=Math.max(n.y,this.max.y)):(this.min=e.clone(),this.max=n.clone()),this},getCenter:function(t){return I((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return I(this.min.x,this.max.y)},getTopRight:function(){return I(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,n;return(t="number"==typeof t[0]||t instanceof O?I(t):B(t))instanceof N?(e=t.min,n=t.max):e=n=t,e.x>=this.min.x&&n.x<=this.max.x&&e.y>=this.min.y&&n.y<=this.max.y},intersects:function(t){t=B(t);var e=this.min,n=this.max,i=t.min,o=t.max,s=o.x>=e.x&&i.x<=n.x,r=o.y>=e.y&&i.y<=n.y;return s&&r},overlaps:function(t){t=B(t);var e=this.min,n=this.max,i=t.min,o=t.max,s=o.x>e.x&&i.x<n.x,r=o.y>e.y&&i.y<n.y;return s&&r},isValid:function(){return!(!this.min||!this.max)},pad:function(t){var e=this.min,n=this.max,i=Math.abs(e.x-n.x)*t,o=Math.abs(e.y-n.y)*t;return B(I(e.x-i,e.y-o),I(n.x+i,n.y+o))},equals:function(t){return!!t&&(t=B(t),this.min.equals(t.getTopLeft())&&this.max.equals(t.getBottomRight()))}},D.prototype={extend:function(t){var e,n,i=this._southWest,o=this._northEast;if(t instanceof j)e=t,n=t;else{if(!(t instanceof D))return t?this.extend(R(t)||Z(t)):this;if(e=t._southWest,n=t._northEast,!e||!n)return this}return i||o?(i.lat=Math.min(e.lat,i.lat),i.lng=Math.min(e.lng,i.lng),o.lat=Math.max(n.lat,o.lat),o.lng=Math.max(n.lng,o.lng)):(this._southWest=new j(e.lat,e.lng),this._northEast=new j(n.lat,n.lng)),this},pad:function(t){var e=this._southWest,n=this._northEast,i=Math.abs(e.lat-n.lat)*t,o=Math.abs(e.lng-n.lng)*t;return new D(new j(e.lat-i,e.lng-o),new j(n.lat+i,n.lng+o))},getCenter:function(){return new j((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new j(this.getNorth(),this.getWest())},getSouthEast:function(){return new j(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof j||"lat"in t?R(t):Z(t);var e,n,i=this._southWest,o=this._northEast;return t instanceof D?(e=t.getSouthWest(),n=t.getNorthEast()):e=n=t,e.lat>=i.lat&&n.lat<=o.lat&&e.lng>=i.lng&&n.lng<=o.lng},intersects:function(t){t=Z(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=e.lat&&i.lat<=n.lat,r=o.lng>=e.lng&&i.lng<=n.lng;return s&&r},overlaps:function(t){t=Z(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>e.lat&&i.lat<n.lat,r=o.lng>e.lng&&i.lng<n.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=Z(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},j.prototype={equals:function(t,e){return!!t&&(t=R(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+h(this.lat,t)+", "+h(this.lng,t)+")"},distanceTo:function(t){return W.distance(this,R(t))},wrap:function(){return W.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,n=e/Math.cos(Math.PI/180*this.lat);return Z([this.lat-e,this.lng-n],[this.lat+e,this.lng+n])},clone:function(){return new j(this.lat,this.lng,this.alt)}};var H,F={latLngToPoint:function(t,e){var n=this.projection.project(t),i=this.scale(e);return this.transformation._transform(n,i)},pointToLatLng:function(t,e){var n=this.scale(e),i=this.transformation.untransform(t,n);return this.projection.unproject(i)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,n=this.scale(t);return new N(this.transformation.transform(e.min,n),this.transformation.transform(e.max,n))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?l(t.lng,this.wrapLng,!0):t.lng;return new j(this.wrapLat?l(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),n=this.wrapLatLng(e),i=e.lat-n.lat,o=e.lng-n.lng;if(0===i&&0===o)return t;var s=t.getSouthWest(),r=t.getNorthEast();return new D(new j(s.lat-i,s.lng-o),new j(r.lat-i,r.lng-o))}},W=n({},F,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var n=Math.PI/180,i=t.lat*n,o=e.lat*n,s=Math.sin((e.lat-t.lat)*n/2),r=Math.sin((e.lng-t.lng)*n/2),a=s*s+Math.cos(i)*Math.cos(o)*r*r,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),q=6378137,U={R:q,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,n=this.MAX_LATITUDE,i=Math.max(Math.min(n,t.lat),-n),o=Math.sin(i*e);return new O(this.R*t.lng*e,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var e=180/Math.PI;return new j((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:(H=q*Math.PI,new N([-H,-H],[H,H]))};function V(t,e,n,i){if(g(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=n,this._d=i}function K(t,e,n,i){return new V(t,e,n,i)}V.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new O((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var G=n({},W,{code:"EPSG:3857",projection:U,transformation:function(){var t=.5/(Math.PI*U.R);return K(t,.5,-t,.5)}()}),Y=n({},G,{code:"EPSG:900913"});function X(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function J(t,e){var n,i,o,s,r,a,l="";for(n=0,o=t.length;n<o;n++){for(i=0,s=(r=t[n]).length;i<s;i++)l+=(i?"L":"M")+(a=r[i]).x+" "+a.y;l+=e?Dt.svg?"z":"x":""}return l||"M0 0"}var Q,tt=document.documentElement.style,et="ActiveXObject"in window,nt=et&&!document.addEventListener,it="msLaunchUri"in navigator&&!("documentMode"in document),ot=Bt("webkit"),st=Bt("android"),rt=Bt("android 2")||Bt("android 3"),at=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),lt=st&&Bt("Google")&&at<537&&!("AudioNode"in window),ct=!!window.opera,ht=!it&&Bt("chrome"),ut=Bt("gecko")&&!ot&&!ct&&!et,dt=!ht&&Bt("safari"),pt=Bt("phantom"),mt="OTransition"in tt,ft=0===navigator.platform.indexOf("Win"),_t=et&&"transition"in tt,gt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!rt,vt="MozPerspective"in tt,yt=!window.L_DISABLE_3D&&(_t||gt||vt)&&!mt&&!pt,bt="undefined"!=typeof orientation||Bt("mobile"),wt=bt&&ot,xt=bt&>,$t=!window.PointerEvent&&window.MSPointerEvent,Lt=!(!window.PointerEvent&&!$t),Tt="ontouchstart"in window||!!window.TouchEvent,Pt=!window.L_NO_TOUCH&&(Tt||Lt),Mt=bt&&ct,kt=bt&&ut,Ct=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Et=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",c,e),window.removeEventListener("testPassiveEventSupport",c,e)}catch(t){}return t}(),At=!!document.createElement("canvas").getContext,St=!(!document.createElementNS||!X("svg").createSVGRect),Ot=!!St&&((Q=document.createElement("div")).innerHTML="<svg/>","http://www.w3.org/2000/svg"===(Q.firstChild&&Q.firstChild.namespaceURI)),zt=!St&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}(),It=0===navigator.platform.indexOf("Mac"),Nt=0===navigator.platform.indexOf("Linux");function Bt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var Dt={ie:et,ielt9:nt,edge:it,webkit:ot,android:st,android23:rt,androidStock:lt,opera:ct,chrome:ht,gecko:ut,safari:dt,phantom:pt,opera12:mt,win:ft,ie3d:_t,webkit3d:gt,gecko3d:vt,any3d:yt,mobile:bt,mobileWebkit:wt,mobileWebkit3d:xt,msPointer:$t,pointer:Lt,touch:Pt,touchNative:Tt,mobileOpera:Mt,mobileGecko:kt,retina:Ct,passiveEvents:Et,canvas:At,svg:St,vml:zt,inlineSvg:Ot,mac:It,linux:Nt},Zt=Dt.msPointer?"MSPointerDown":"pointerdown",jt=Dt.msPointer?"MSPointerMove":"pointermove",Rt=Dt.msPointer?"MSPointerUp":"pointerup",Ht=Dt.msPointer?"MSPointerCancel":"pointercancel",Ft={touchstart:Zt,touchmove:jt,touchend:Rt,touchcancel:Ht},Wt={touchstart:te,touchmove:Qt,touchend:Qt,touchcancel:Qt},qt={},Ut=!1;function Vt(t,e,n){return"touchstart"===e&&Jt(),Wt[e]?(n=Wt[e].bind(this,n),t.addEventListener(Ft[e],n,!1),n):(console.warn("wrong event specified:",e),c)}function Kt(t,e,n){Ft[e]?t.removeEventListener(Ft[e],n,!1):console.warn("wrong event specified:",e)}function Gt(t){qt[t.pointerId]=t}function Yt(t){qt[t.pointerId]&&(qt[t.pointerId]=t)}function Xt(t){delete qt[t.pointerId]}function Jt(){Ut||(document.addEventListener(Zt,Gt,!0),document.addEventListener(jt,Yt,!0),document.addEventListener(Rt,Xt,!0),document.addEventListener(Ht,Xt,!0),Ut=!0)}function Qt(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){for(var n in e.touches=[],qt)e.touches.push(qt[n]);e.changedTouches=[e],t(e)}}function te(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&Ge(e),Qt(t,e)}function ee(t){var e,n,i={};for(n in t)e=t[n],i[n]=e&&e.bind?e.bind(t):e;return t=i,i.type="dblclick",i.detail=2,i.isTrusted=!1,i._simulated=!0,i}var ne=200;function ie(t,e){t.addEventListener("dblclick",e);var n,i=0;function o(t){if(1===t.detail){if("mouse"!==t.pointerType&&(!t.sourceCapabilities||t.sourceCapabilities.firesTouchEvents)){var o=Xe(t);if(!o.some((function(t){return t instanceof HTMLLabelElement&&t.attributes.for}))||o.some((function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement}))){var s=Date.now();s-i<=ne?2==++n&&e(ee(t)):n=1,i=s}}}else n=t.detail}return t.addEventListener("click",o),{dblclick:e,simDblclick:o}}function oe(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}var se,re,ae,le,ce,he=Me(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ue=Me(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),de="webkitTransition"===ue||"OTransition"===ue?ue+"End":"transitionend";function pe(t){return"string"==typeof t?document.getElementById(t):t}function me(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||"auto"===n)&&document.defaultView){var i=document.defaultView.getComputedStyle(t,null);n=i?i[e]:null}return"auto"===n?null:n}function fe(t,e,n){var i=document.createElement(t);return i.className=e||"",n&&n.appendChild(i),i}function _e(t){var e=t.parentNode;e&&e.removeChild(t)}function ge(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function ve(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ye(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function be(t,e){if(void 0!==t.classList)return t.classList.contains(e);var n=Le(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)}function we(t,e){if(void 0!==t.classList)for(var n=d(e),i=0,o=n.length;i<o;i++)t.classList.add(n[i]);else if(!be(t,e)){var s=Le(t);$e(t,(s?s+" ":"")+e)}}function xe(t,e){void 0!==t.classList?t.classList.remove(e):$e(t,u((" "+Le(t)+" ").replace(" "+e+" "," ")))}function $e(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function Le(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function Te(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&Pe(t,e)}function Pe(t,e){var n=!1,i="DXImageTransform.Microsoft.Alpha";try{n=t.filters.item(i)}catch(t){if(1===e)return}e=Math.round(100*e),n?(n.Enabled=100!==e,n.Opacity=e):t.style.filter+=" progid:"+i+"(opacity="+e+")"}function Me(t){for(var e=document.documentElement.style,n=0;n<t.length;n++)if(t[n]in e)return t[n];return!1}function ke(t,e,n){var i=e||new O(0,0);t.style[he]=(Dt.ie3d?"translate("+i.x+"px,"+i.y+"px)":"translate3d("+i.x+"px,"+i.y+"px,0)")+(n?" scale("+n+")":"")}function Ce(t,e){t._leaflet_pos=e,Dt.any3d?ke(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Ee(t){return t._leaflet_pos||new O(0,0)}if("onselectstart"in document)se=function(){Ze(window,"selectstart",Ge)},re=function(){Re(window,"selectstart",Ge)};else{var Ae=Me(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);se=function(){if(Ae){var t=document.documentElement.style;ae=t[Ae],t[Ae]="none"}},re=function(){Ae&&(document.documentElement.style[Ae]=ae,ae=void 0)}}function Se(){Ze(window,"dragstart",Ge)}function Oe(){Re(window,"dragstart",Ge)}function ze(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(Ie(),le=t,ce=t.style.outlineStyle,t.style.outlineStyle="none",Ze(window,"keydown",Ie))}function Ie(){le&&(le.style.outlineStyle=ce,le=void 0,ce=void 0,Re(window,"keydown",Ie))}function Ne(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Be(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var De={__proto__:null,TRANSFORM:he,TRANSITION:ue,TRANSITION_END:de,get:pe,getStyle:me,create:fe,remove:_e,empty:ge,toFront:ve,toBack:ye,hasClass:be,addClass:we,removeClass:xe,setClass:$e,getClass:Le,setOpacity:Te,testProp:Me,setTransform:ke,setPosition:Ce,getPosition:Ee,get disableTextSelection(){return se},get enableTextSelection(){return re},disableImageDrag:Se,enableImageDrag:Oe,preventOutline:ze,restoreOutline:Ie,getSizedParentNode:Ne,getScale:Be};function Ze(t,e,n,i){if(e&&"object"==typeof e)for(var o in e)We(t,o,e[o],n);else for(var s=0,r=(e=d(e)).length;s<r;s++)We(t,e[s],n,i);return this}var je="_leaflet_events";function Re(t,e,n,i){if(1===arguments.length)He(t),delete t[je];else if(e&&"object"==typeof e)for(var o in e)qe(t,o,e[o],n);else if(e=d(e),2===arguments.length)He(t,(function(t){return-1!==v(e,t)}));else for(var s=0,r=e.length;s<r;s++)qe(t,e[s],n,i);return this}function He(t,e){for(var n in t[je]){var i=n.split(/\d/)[0];e&&!e(i)||qe(t,i,null,null,n)}}var Fe={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function We(t,e,n,i){var o=e+r(n)+(i?"_"+r(i):"");if(t[je]&&t[je][o])return this;var s=function(e){return n.call(i||t,e||window.event)},a=s;!Dt.touchNative&&Dt.pointer&&0===e.indexOf("touch")?s=Vt(t,e,s):Dt.touch&&"dblclick"===e?s=ie(t,s):"addEventListener"in t?"touchstart"===e||"touchmove"===e||"wheel"===e||"mousewheel"===e?t.addEventListener(Fe[e]||e,s,!!Dt.passiveEvents&&{passive:!1}):"mouseenter"===e||"mouseleave"===e?(s=function(e){e=e||window.event,en(t,e)&&a(e)},t.addEventListener(Fe[e],s,!1)):t.addEventListener(e,a,!1):t.attachEvent("on"+e,s),t[je]=t[je]||{},t[je][o]=s}function qe(t,e,n,i,o){o=o||e+r(n)+(i?"_"+r(i):"");var s=t[je]&&t[je][o];if(!s)return this;!Dt.touchNative&&Dt.pointer&&0===e.indexOf("touch")?Kt(t,e,s):Dt.touch&&"dblclick"===e?oe(t,s):"removeEventListener"in t?t.removeEventListener(Fe[e]||e,s,!1):t.detachEvent("on"+e,s),t[je][o]=null}function Ue(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function Ve(t){return We(t,"wheel",Ue),this}function Ke(t){return Ze(t,"mousedown touchstart dblclick contextmenu",Ue),t._leaflet_disable_click=!0,this}function Ge(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Ye(t){return Ge(t),Ue(t),this}function Xe(t){if(t.composedPath)return t.composedPath();for(var e=[],n=t.target;n;)e.push(n),n=n.parentNode;return e}function Je(t,e){if(!e)return new O(t.clientX,t.clientY);var n=Be(e),i=n.boundingClientRect;return new O((t.clientX-i.left)/n.x-e.clientLeft,(t.clientY-i.top)/n.y-e.clientTop)}var Qe=Dt.linux&&Dt.chrome?window.devicePixelRatio:Dt.mac?3*window.devicePixelRatio:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function tn(t){return Dt.edge?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/Qe:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}function en(t,e){var n=e.relatedTarget;if(!n)return!0;try{for(;n&&n!==t;)n=n.parentNode}catch(t){return!1}return n!==t}var nn={__proto__:null,on:Ze,off:Re,stopPropagation:Ue,disableScrollPropagation:Ve,disableClickPropagation:Ke,preventDefault:Ge,stop:Ye,getPropagationPath:Xe,getMousePosition:Je,getWheelDelta:tn,isExternalTarget:en,addListener:Ze,removeListener:Re},on=S.extend({run:function(t,e,n,i){this.stop(),this._el=t,this._inProgress=!0,this._duration=n||.25,this._easeOutPower=1/Math.max(i||.5,.2),this._startPos=Ee(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=P(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,n=1e3*this._duration;e<n?this._runFrame(this._easeOut(e/n),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var n=this._startPos.add(this._offset.multiplyBy(t));e&&n._round(),Ce(this._el,n),this.fire("step")},_complete:function(){M(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),sn=S.extend({options:{crs:G,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=p(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=o(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(R(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ue&&Dt.any3d&&!Dt.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Ze(this._proxy,de,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(R(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=n({animate:i.animate},i.zoom),i.pan=n({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e,i.pan&&i.pan.noMoveStart),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(Dt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(Dt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,n){var i=this.getZoomScale(e),o=this.getSize().divideBy(2),s=(t instanceof O?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/i),r=this.containerPointToLatLng(o.add(s));return this.setView(r,e,{zoom:n})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():Z(t);var n=I(e.paddingTopLeft||e.padding||[0,0]),i=I(e.paddingBottomRight||e.padding||[0,0]),o=this.getBoundsZoom(t,!1,n.add(i));if((o="number"==typeof e.maxZoom?Math.min(e.maxZoom,o):o)===1/0)return{center:t.getCenter(),zoom:o};var s=i.subtract(n).divideBy(2),r=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o);return{center:this.unproject(r.add(a).divideBy(2).add(s),o),zoom:o}},fitBounds:function(t,e){if(!(t=Z(t)).isValid())throw new Error("Bounds are not valid.");var n=this._getBoundsCenterZoom(t,e);return this.setView(n.center,n.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=I(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new on,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){we(this._mapPane,"leaflet-pan-anim");var n=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,n,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,n){if(!1===(n=n||{}).animate||!Dt.any3d)return this.setView(t,e,n);this._stop();var i=this.project(this.getCenter()),o=this.project(t),s=this.getSize(),r=this._zoom;t=R(t),e=void 0===e?r:e;var a=Math.max(s.x,s.y),l=a*this.getZoomScale(r,e),c=o.distanceTo(i)||1,h=1.42,u=h*h;function d(t){var e=(l*l-a*a+(t?-1:1)*u*u*c*c)/(2*(t?l:a)*u*c),n=Math.sqrt(e*e+1)-e;return n<1e-9?-18:Math.log(n)}function p(t){return(Math.exp(t)-Math.exp(-t))/2}function m(t){return(Math.exp(t)+Math.exp(-t))/2}function f(t){return p(t)/m(t)}var _=d(0);function g(t){return a*(m(_)/m(_+h*t))}function v(t){return a*(m(_)*f(_+h*t)-p(_))/u}function y(t){return 1-Math.pow(1-t,1.5)}var b=Date.now(),w=(d(1)-_)/h,x=n.duration?1e3*n.duration:1e3*w*.8;function $(){var n=(Date.now()-b)/x,s=y(n)*w;n<=1?(this._flyToFrame=P($,this),this._move(this.unproject(i.add(o.subtract(i).multiplyBy(v(s)/c)),r),this.getScaleZoom(a/g(s),r),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,n.noMoveStart),$.call(this),this},flyToBounds:function(t,e){var n=this._getBoundsCenterZoom(t,e);return this.flyTo(n.center,n.zoom,e)},setMaxBounds:function(t){return t=Z(t),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),t.isValid()?(this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var n=this.getCenter(),i=this._limitCenter(n,this._zoom,Z(t));return n.equals(i)||this.panTo(i,e),this._enforcingBounds=!1,this},panInside:function(t,e){var n=I((e=e||{}).paddingTopLeft||e.padding||[0,0]),i=I(e.paddingBottomRight||e.padding||[0,0]),o=this.project(this.getCenter()),s=this.project(t),r=this.getPixelBounds(),a=B([r.min.add(n),r.max.subtract(i)]),l=a.getSize();if(!a.contains(s)){this._enforcingBounds=!0;var c=s.subtract(a.getCenter()),h=a.extend(s).getSize().subtract(l);o.x+=c.x<0?-h.x:h.x,o.y+=c.y<0?-h.y:h.y,this.panTo(this.unproject(o),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=n({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),s=e.divideBy(2).round(),r=i.divideBy(2).round(),a=s.subtract(r);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=n({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=o(this._handleGeolocationResponse,this),i=o(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){if(this._container._leaflet_id){var e=t.code,n=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+n+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e=new j(t.coords.latitude,t.coords.longitude),n=e.toBounds(2*t.coords.accuracy),i=this._locateOptions;if(i.setView){var o=this.getBoundsZoom(n);this.setView(e,i.maxZoom?Math.min(o,i.maxZoom):o)}var s={latlng:e,bounds:n,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)}},addHandler:function(t,e){if(!e)return this;var n=this[t]=new e(this);return this._handlers.push(n),this.options[t]&&n.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),_e(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(M(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)_e(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var n=fe("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=n),n},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new D(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,n){t=Z(t),n=I(n||[0,0]);var i=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(n),c=B(this.project(a,i),this.project(r,i)).getSize(),h=Dt.any3d?this.options.zoomSnap:1,u=l.x/c.x,d=l.y/c.y,p=e?Math.max(u,d):Math.min(u,d);return i=this.getScaleZoom(p,i),h&&(i=Math.round(i/(h/100))*(h/100),i=e?Math.ceil(i/h)*h:Math.floor(i/h)*h),Math.max(o,Math.min(s,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var n=this._getTopLeftPoint(t,e);return new N(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,n.scale(t)/n.scale(e)},getScaleZoom:function(t,e){var n=this.options.crs;e=void 0===e?this._zoom:e;var i=n.zoom(t*n.scale(e));return isNaN(i)?1/0:i},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(R(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(I(t),e)},layerPointToLatLng:function(t){var e=I(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(R(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(R(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(Z(t))},distance:function(t,e){return this.options.crs.distance(R(t),R(e))},containerPointToLayerPoint:function(t){return I(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return I(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(I(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(R(t)))},mouseEventToContainerPoint:function(t){return Je(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=pe(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");Ze(e,"scroll",this._onScroll,this),this._containerId=r(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&Dt.any3d,we(t,"leaflet-container"+(Dt.touch?" leaflet-touch":"")+(Dt.retina?" leaflet-retina":"")+(Dt.ielt9?" leaflet-oldie":"")+(Dt.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=me(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Ce(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(we(t.markerPane,"leaflet-zoom-hide"),we(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,n){Ce(this._mapPane,new O(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var o=this._zoom!==e;this._moveStart(o,n)._move(t,e)._moveEnd(o),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,n,i){void 0===e&&(e=this._zoom);var o=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),i?n&&n.pinch&&this.fire("zoom",n):((o||n&&n.pinch)&&this.fire("zoom",n),this.fire("move",n)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return M(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Ce(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[r(this._container)]=this;var e=t?Re:Ze;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),Dt.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){M(this._resizeRequest),this._resizeRequest=P((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var n,i=[],o="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,a=!1;s;){if((n=this._targets[r(s)])&&("click"===e||"preclick"===e)&&this._draggableMoved(n)){a=!0;break}if(n&&n.listens(e,!0)){if(o&&!en(s,t))break;if(i.push(n),o)break}if(s===this._container)break;s=s.parentNode}return i.length||a||o||!this.listens(e,!0)||(i=[this]),i},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e=t.target||t.srcElement;if(!(!this._loaded||e._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(e))){var n=t.type;"mousedown"===n&&ze(e),this._fireDOMEvent(t,n)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var o=n({},t);o.type="preclick",this._fireDOMEvent(o,o.type,i)}var s=this._findEventTargets(t,e);if(i){for(var r=[],a=0;a<i.length;a++)i[a].listens(e,!0)&&r.push(i[a]);s=r.concat(s)}if(s.length){"contextmenu"===e&&Ge(t);var l=s[0],c={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var h=l.getLatLng&&(!l._radius||l._radius<=10);c.containerPoint=h?this.latLngToContainerPoint(l.getLatLng()):this.mouseEventToContainerPoint(t),c.layerPoint=this.containerPointToLayerPoint(c.containerPoint),c.latlng=h?l.getLatLng():this.layerPointToLatLng(c.layerPoint)}for(a=0;a<s.length;a++)if(s[a].fire(e,c,!0),c.originalEvent._stopped||!1===s[a].options.bubblingMouseEvents&&-1!==v(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return Ee(this._mapPane)||new O(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var n=this.getSize()._divideBy(2);return this.project(t,e)._subtract(n)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,n){var i=this._getNewPixelOrigin(n,e);return this.project(t,e)._subtract(i)},_latLngBoundsToNewLayerBounds:function(t,e,n){var i=this._getNewPixelOrigin(n,e);return B([this.project(t.getSouthWest(),e)._subtract(i),this.project(t.getNorthWest(),e)._subtract(i),this.project(t.getSouthEast(),e)._subtract(i),this.project(t.getNorthEast(),e)._subtract(i)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,n){if(!n)return t;var i=this.project(t,e),o=this.getSize().divideBy(2),s=new N(i.subtract(o),i.add(o)),r=this._getBoundsOffset(s,n,e);return Math.abs(r.x)<=1&&Math.abs(r.y)<=1?t:this.unproject(i.add(r),e)},_limitOffset:function(t,e){if(!e)return t;var n=this.getPixelBounds(),i=new N(n.min.add(t),n.max.add(t));return t.add(this._getBoundsOffset(i,e))},_getBoundsOffset:function(t,e,n){var i=B(this.project(e.getNorthEast(),n),this.project(e.getSouthWest(),n)),o=i.min.subtract(t.min),s=i.max.subtract(t.max);return new O(this._rebound(o.x,-s.x),this._rebound(o.y,-s.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),n=this.getMaxZoom(),i=Dt.any3d?this.options.zoomSnap:1;return i&&(t=Math.round(t/i)*i),Math.max(e,Math.min(n,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){xe(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var n=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(n)||(this.panBy(n,e),0))},_createAnimProxy:function(){var t=this._proxy=fe("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=he,n=this._proxy.style[e];ke(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),n===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){_e(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),e=this.getZoom();ke(this._proxy,this.project(t,e),this.getZoomScale(e,1))},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,n){if(this._animatingZoom)return!0;if(n=n||{},!this._zoomAnimated||!1===n.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/i);return!(!0!==n.animate&&!this.getSize().contains(o)||(P((function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,we(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:i}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&xe(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function rn(t,e){return new sn(t,e)}var an=C.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),n=this.getPosition(),i=t._controlCorners[n];return we(e,"leaflet-control"),-1!==n.indexOf("bottom")?i.insertBefore(e,i.firstChild):i.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(_e(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),ln=function(t){return new an(t)};sn.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",n=this._controlContainer=fe("div",e+"control-container",this._container);function i(i,o){var s=e+i+" "+e+o;t[i+o]=fe("div",s,n)}i("top","left"),i("top","right"),i("bottom","left"),i("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)_e(this._controlCorners[t]);_e(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var cn=an.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,n,i){return n<i?-1:i<n?1:0}},initialize:function(t,e,n){for(var i in p(this,n),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1,t)this._addLayer(t[i],i);for(i in e)this._addLayer(e[i],i,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return an.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(r(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){we(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(we(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):xe(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return xe(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=fe("div",t),n=this.options.collapsed;e.setAttribute("aria-haspopup",!0),Ke(e),Ve(e);var i=this._section=fe("section",t+"-list");n&&(this._map.on("click",this.collapse,this),Ze(e,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var o=this._layersLink=fe("a",t+"-toggle",e);o.href="#",o.title="Layers",o.setAttribute("role","button"),Ze(o,{keydown:function(t){13===t.keyCode&&this._expandSafely()},click:function(t){Ge(t),this._expandSafely()}},this),n||this.expand(),this._baseLayersList=fe("div",t+"-base",i),this._separator=fe("div",t+"-separator",i),this._overlaysList=fe("div",t+"-overlays",i),e.appendChild(i)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&r(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,n){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:n}),this.options.sortLayers&&this._layers.sort(o((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;ge(this._baseLayersList),ge(this._overlaysList),this._layerControlInputs=[];var t,e,n,i,o=0;for(n=0;n<this._layers.length;n++)i=this._layers[n],this._addItem(i),e=e||i.overlay,t=t||!i.overlay,o+=i.overlay?0:1;return this.options.hideSingleBase&&(t=t&&o>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(r(t.target)),n=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;n&&this._map.fire(n,e)},_createRadioElement:function(t,e){var n='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",i=document.createElement("div");return i.innerHTML=n,i.firstChild},_addItem:function(t){var e,n=document.createElement("label"),i=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=i):e=this._createRadioElement("leaflet-base-layers_"+r(this),i),this._layerControlInputs.push(e),e.layerId=r(t.layer),Ze(e,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("span");return n.appendChild(s),s.appendChild(e),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var t,e,n=this._layerControlInputs,i=[],o=[];this._handlingClick=!0;for(var s=n.length-1;s>=0;s--)t=n[s],e=this._getLayer(t.layerId).layer,t.checked?i.push(e):t.checked||o.push(e);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])&&this._map.removeLayer(o[s]);for(s=0;s<i.length;s++)this._map.hasLayer(i[s])||this._map.addLayer(i[s]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var t,e,n=this._layerControlInputs,i=this._map.getZoom(),o=n.length-1;o>=0;o--)t=n[o],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&i<e.options.minZoom||void 0!==e.options.maxZoom&&i>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,Ze(t,"click",Ge),this.expand();var e=this;setTimeout((function(){Re(t,"click",Ge),e._preventClick=!1}))}}),hn=function(t,e,n){return new cn(t,e,n)},un=an.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",n=fe("div",e+" leaflet-bar"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,e+"-in",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,e+"-out",n,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),n},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,n,i,o){var s=fe("a",n,i);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),Ke(s),Ze(s,"click",Ye),Ze(s,"click",o,this),Ze(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";xe(this._zoomInButton,e),xe(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(we(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(we(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}});sn.mergeOptions({zoomControl:!0}),sn.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new un,this.addControl(this.zoomControl))}));var dn=function(t){return new un(t)},pn=an.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",n=fe("div",e),i=this.options;return this._addScales(i,e+"-line",n),t.on(i.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),n},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,n){t.metric&&(this._mScale=fe("div",e,n)),t.imperial&&(this._iScale=fe("div",e,n))},_update:function(){var t=this._map,e=t.getSize().y/2,n=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(n)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),n=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,n,e/t)},_updateImperial:function(t){var e,n,i,o=3.2808399*t;o>5280?(e=o/5280,n=this._getRoundNum(e),this._updateScale(this._iScale,n+" mi",n/e)):(i=this._getRoundNum(o),this._updateScale(this._iScale,i+" ft",i/o))},_updateScale:function(t,e,n){t.style.width=Math.round(this.options.maxWidth*n)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),n=t/e;return e*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1)}}),mn=function(t){return new pn(t)},fn='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',_n=an.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(Dt.inlineSvg?fn+" ":"")+"Leaflet</a>"},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=fe("div","leaflet-control-attribution"),Ke(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",(function(){this.removeAttribution(t.layer.getAttribution())}),this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var n=[];this.options.prefix&&n.push(this.options.prefix),t.length&&n.push(t.join(", ")),this._container.innerHTML=n.join(' <span aria-hidden="true">|</span> ')}}});sn.mergeOptions({attributionControl:!0}),sn.addInitHook((function(){this.options.attributionControl&&(new _n).addTo(this)}));var gn=function(t){return new _n(t)};an.Layers=cn,an.Zoom=un,an.Scale=pn,an.Attribution=_n,ln.layers=hn,ln.zoom=dn,ln.scale=mn,ln.attribution=gn;var vn=C.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});vn.addTo=function(t,e){return t.addHandler(e,this),this};var yn={Events:A},bn=Dt.touch?"touchstart mousedown":"mousedown",wn=S.extend({options:{clickTolerance:3},initialize:function(t,e,n,i){p(this,i),this._element=t,this._dragStartTarget=e||t,this._preventOutline=n},enable:function(){this._enabled||(Ze(this._dragStartTarget,bn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(wn._dragging===this&&this.finishDrag(!0),Re(this._dragStartTarget,bn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!be(this._element,"leaflet-zoom-anim")))if(t.touches&&1!==t.touches.length)wn._dragging===this&&this.finishDrag();else if(!(wn._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(wn._dragging=this,this._preventOutline&&ze(this._element),Se(),se(),this._moving))){this.fire("down");var e=t.touches?t.touches[0]:t,n=Ne(this._element);this._startPoint=new O(e.clientX,e.clientY),this._startPos=Ee(this._element),this._parentScale=Be(n);var i="mousedown"===t.type;Ze(document,i?"mousemove":"touchmove",this._onMove,this),Ze(document,i?"mouseup":"touchend touchcancel",this._onUp,this)}},_onMove:function(t){if(this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,n=new O(e.clientX,e.clientY)._subtract(this._startPoint);(n.x||n.y)&&(Math.abs(n.x)+Math.abs(n.y)<this.options.clickTolerance||(n.x/=this._parentScale.x,n.y/=this._parentScale.y,Ge(t),this._moved||(this.fire("dragstart"),this._moved=!0,we(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),we(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(n),this._moving=!0,this._lastEvent=t,this._updatePosition()))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Ce(this._element,this._newPos),this.fire("drag",t)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(t){xe(document.body,"leaflet-dragging"),this._lastTarget&&(xe(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Re(document,"mousemove touchmove",this._onMove,this),Re(document,"mouseup touchend touchcancel",this._onUp,this),Oe(),re();var e=this._moved&&this._moving;this._moving=!1,wn._dragging=!1,e&&this.fire("dragend",{noInertia:t,distance:this._newPos.distanceTo(this._startPos)})}});function xn(t,e,n){var i,o,s,r,a,l,c,h,u,d=[1,4,2,8];for(o=0,c=t.length;o<c;o++)t[o]._code=In(t[o],e);for(r=0;r<4;r++){for(h=d[r],i=[],o=0,s=(c=t.length)-1;o<c;s=o++)a=t[o],l=t[s],a._code&h?l._code&h||((u=zn(l,a,h,e,n))._code=In(u,e),i.push(u)):(l._code&h&&((u=zn(l,a,h,e,n))._code=In(u,e),i.push(u)),i.push(a));t=i}return t}function $n(t,e){var n,i,o,s,r,a,l,c,h;if(!t||0===t.length)throw new Error("latlngs not passed");Dn(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var u=R([0,0]),d=Z(t);d.getNorthWest().distanceTo(d.getSouthWest())*d.getNorthEast().distanceTo(d.getNorthWest())<1700&&(u=Ln(t));var p=t.length,m=[];for(n=0;n<p;n++){var f=R(t[n]);m.push(e.project(R([f.lat-u.lat,f.lng-u.lng])))}for(a=l=c=0,n=0,i=p-1;n<p;i=n++)o=m[n],s=m[i],r=o.y*s.x-s.y*o.x,l+=(o.x+s.x)*r,c+=(o.y+s.y)*r,a+=3*r;h=0===a?m[0]:[l/a,c/a];var _=e.unproject(I(h));return R([_.lat+u.lat,_.lng+u.lng])}function Ln(t){for(var e=0,n=0,i=0,o=0;o<t.length;o++){var s=R(t[o]);e+=s.lat,n+=s.lng,i++}return R([e/i,n/i])}var Tn,Pn={__proto__:null,clipPolygon:xn,polygonCenter:$n,centroid:Ln};function Mn(t,e){if(!e||!t.length)return t.slice();var n=e*e;return t=En(t=Sn(t,n),n)}function kn(t,e,n){return Math.sqrt(Bn(t,e,n,!0))}function Cn(t,e,n){return Bn(t,e,n)}function En(t,e){var n=t.length,i=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(n);i[0]=i[n-1]=1,An(t,i,e,0,n-1);var o,s=[];for(o=0;o<n;o++)i[o]&&s.push(t[o]);return s}function An(t,e,n,i,o){var s,r,a,l=0;for(r=i+1;r<=o-1;r++)(a=Bn(t[r],t[i],t[o],!0))>l&&(s=r,l=a);l>n&&(e[s]=1,An(t,e,n,i,s),An(t,e,n,s,o))}function Sn(t,e){for(var n=[t[0]],i=1,o=0,s=t.length;i<s;i++)Nn(t[i],t[o])>e&&(n.push(t[i]),o=i);return o<s-1&&n.push(t[s-1]),n}function On(t,e,n,i,o){var s,r,a,l=i?Tn:In(t,n),c=In(e,n);for(Tn=c;;){if(!(l|c))return[t,e];if(l&c)return!1;a=In(r=zn(t,e,s=l||c,n,o),n),s===l?(t=r,l=a):(e=r,c=a)}}function zn(t,e,n,i,o){var s,r,a=e.x-t.x,l=e.y-t.y,c=i.min,h=i.max;return 8&n?(s=t.x+a*(h.y-t.y)/l,r=h.y):4&n?(s=t.x+a*(c.y-t.y)/l,r=c.y):2&n?(s=h.x,r=t.y+l*(h.x-t.x)/a):1&n&&(s=c.x,r=t.y+l*(c.x-t.x)/a),new O(s,r,o)}function In(t,e){var n=0;return t.x<e.min.x?n|=1:t.x>e.max.x&&(n|=2),t.y<e.min.y?n|=4:t.y>e.max.y&&(n|=8),n}function Nn(t,e){var n=e.x-t.x,i=e.y-t.y;return n*n+i*i}function Bn(t,e,n,i){var o,s=e.x,r=e.y,a=n.x-s,l=n.y-r,c=a*a+l*l;return c>0&&((o=((t.x-s)*a+(t.y-r)*l)/c)>1?(s=n.x,r=n.y):o>0&&(s+=a*o,r+=l*o)),a=t.x-s,l=t.y-r,i?a*a+l*l:new O(s,r)}function Dn(t){return!g(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Zn(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Dn(t)}function jn(t,e){var n,i,o,s,r,a,l,c;if(!t||0===t.length)throw new Error("latlngs not passed");Dn(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var h=R([0,0]),u=Z(t);u.getNorthWest().distanceTo(u.getSouthWest())*u.getNorthEast().distanceTo(u.getNorthWest())<1700&&(h=Ln(t));var d=t.length,p=[];for(n=0;n<d;n++){var m=R(t[n]);p.push(e.project(R([m.lat-h.lat,m.lng-h.lng])))}for(n=0,i=0;n<d-1;n++)i+=p[n].distanceTo(p[n+1])/2;if(0===i)c=p[0];else for(n=0,s=0;n<d-1;n++)if(r=p[n],a=p[n+1],(s+=o=r.distanceTo(a))>i){l=(s-i)/o,c=[a.x-l*(a.x-r.x),a.y-l*(a.y-r.y)];break}var f=e.unproject(I(c));return R([f.lat+h.lat,f.lng+h.lng])}var Rn={__proto__:null,simplify:Mn,pointToSegmentDistance:kn,closestPointOnSegment:Cn,clipSegment:On,_getEdgeIntersection:zn,_getBitCode:In,_sqClosestPointOnSegment:Bn,isFlat:Dn,_flat:Zn,polylineCenter:jn},Hn={project:function(t){return new O(t.lng,t.lat)},unproject:function(t){return new j(t.y,t.x)},bounds:new N([-180,-90],[180,90])},Fn={R:6378137,R_MINOR:6356752.314245179,bounds:new N([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,n=this.R,i=t.lat*e,o=this.R_MINOR/n,s=Math.sqrt(1-o*o),r=s*Math.sin(i),a=Math.tan(Math.PI/4-i/2)/Math.pow((1-r)/(1+r),s/2);return i=-n*Math.log(Math.max(a,1e-10)),new O(t.lng*e*n,i)},unproject:function(t){for(var e,n=180/Math.PI,i=this.R,o=this.R_MINOR/i,s=Math.sqrt(1-o*o),r=Math.exp(-t.y/i),a=Math.PI/2-2*Math.atan(r),l=0,c=.1;l<15&&Math.abs(c)>1e-7;l++)e=s*Math.sin(a),e=Math.pow((1-e)/(1+e),s/2),a+=c=Math.PI/2-2*Math.atan(r*e)-a;return new j(a*n,t.x*n/i)}},Wn={__proto__:null,LonLat:Hn,Mercator:Fn,SphericalMercator:U},qn=n({},W,{code:"EPSG:3395",projection:Fn,transformation:function(){var t=.5/(Math.PI*Fn.R);return K(t,.5,-t,.5)}()}),Un=n({},W,{code:"EPSG:4326",projection:Hn,transformation:K(1/180,1,-1/180,.5)}),Vn=n({},F,{projection:Hn,transformation:K(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var n=e.lng-t.lng,i=e.lat-t.lat;return Math.sqrt(n*n+i*i)},infinite:!0});F.Earth=W,F.EPSG3395=qn,F.EPSG3857=G,F.EPSG900913=Y,F.EPSG4326=Un,F.Simple=Vn;var Kn=S.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[r(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[r(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var n=this.getEvents();e.on(n,this),this.once("remove",(function(){e.off(n,this)}),this)}this.onAdd(e),this.fire("add"),e.fire("layeradd",{layer:this})}}});sn.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=r(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=r(t);return this._layers[e]?(this._loaded&&t.onRemove(this),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return r(t)in this._layers},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},_addLayers:function(t){for(var e=0,n=(t=t?g(t)?t:[t]:[]).length;e<n;e++)this.addLayer(t[e])},_addZoomLimit:function(t){isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[r(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=r(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,n=this._getZoomSpan();for(var i in this._zoomBoundLayers){var o=this._zoomBoundLayers[i].options;t=void 0===o.minZoom?t:Math.min(t,o.minZoom),e=void 0===o.maxZoom?e:Math.max(e,o.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,n!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Gn=Kn.extend({initialize:function(t,e){var n,i;if(p(this,e),this._layers={},t)for(n=0,i=t.length;n<i;n++)this.addLayer(t[n])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return("number"==typeof t?t:this.getLayerId(t))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,n,i=Array.prototype.slice.call(arguments,1);for(e in this._layers)(n=this._layers[e])[t]&&n[t].apply(n,i);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return r(t)}}),Yn=function(t,e){return new Gn(t,e)},Xn=Gn.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Gn.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Gn.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new D;for(var e in this._layers){var n=this._layers[e];t.extend(n.getBounds?n.getBounds():n.getLatLng())}return t}}),Jn=function(t,e){return new Xn(t,e)},Qn=C.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(t){p(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var n=this._getIconUrl(t);if(!n){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var i=this._createImg(n,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(i,t),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i},_setIconStyles:function(t,e){var n=this.options,i=n[e+"Size"];"number"==typeof i&&(i=[i,i]);var o=I(i),s=I("shadow"===e&&n.shadowAnchor||n.iconAnchor||o&&o.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(n.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),o&&(t.style.width=o.x+"px",t.style.height=o.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return Dt.retina&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function ti(t){return new Qn(t)}var ei=Qn.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return"string"!=typeof ei.imagePath&&(ei.imagePath=this._detectIconPath()),(this.options.imagePath||ei.imagePath)+Qn.prototype._getIconUrl.call(this,t)},_stripUrl:function(t){var e=function(t,e,n){var i=e.exec(t);return i&&i[n]};return(t=e(t,/^url\((['"])?(.+)\1\)$/,2))&&e(t,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var t=fe("div","leaflet-default-icon-path",document.body),e=me(t,"background-image")||me(t,"backgroundImage");if(document.body.removeChild(t),e=this._stripUrl(e))return e;var n=document.querySelector('link[href$="leaflet.css"]');return n?n.href.substring(0,n.href.length-11-1):""}}),ni=vn.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new wn(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),we(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&xe(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,n=e._map,i=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,s=Ee(e._icon),r=n.getPixelBounds(),a=n.getPixelOrigin(),l=B(r.min._subtract(a).add(o),r.max._subtract(a).subtract(o));if(!l.contains(s)){var c=I((Math.max(l.max.x,s.x)-l.max.x)/(r.max.x-l.max.x)-(Math.min(l.min.x,s.x)-l.min.x)/(r.min.x-l.min.x),(Math.max(l.max.y,s.y)-l.max.y)/(r.max.y-l.max.y)-(Math.min(l.min.y,s.y)-l.min.y)/(r.min.y-l.min.y)).multiplyBy(i);n.panBy(c,{animate:!1}),this._draggable._newPos._add(c),this._draggable._startPos._add(c),Ce(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=P(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(M(this._panRequest),this._panRequest=P(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,n=e._shadow,i=Ee(e._icon),o=e._map.layerPointToLatLng(i);n&&Ce(n,i),e._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){M(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),ii=Kn.extend({options:{icon:new ei,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){p(this,e),this._latlng=R(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=R(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),n=t.icon.createIcon(this._icon),i=!1;n!==this._icon&&(this._icon&&this._removeIcon(),i=!0,t.title&&(n.title=t.title),"IMG"===n.tagName&&(n.alt=t.alt||"")),we(n,e),t.keyboard&&(n.tabIndex="0",n.setAttribute("role","button")),this._icon=n,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Ze(n,"focus",this._panOnFocus,this);var o=t.icon.createShadow(this._shadow),s=!1;o!==this._shadow&&(this._removeShadow(),s=!0),o&&(we(o,e),o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),i&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Re(this._icon,"focus",this._panOnFocus,this),_e(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&_e(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&Ce(this._icon,t),this._shadow&&Ce(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon&&(this._icon.style.zIndex=this._zIndex+t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(we(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),ni)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new ni(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&Te(this._icon,t),this._shadow&&Te(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var t=this._map;if(t){var e=this.options.icon.options,n=e.iconSize?I(e.iconSize):I(0,0),i=e.iconAnchor?I(e.iconAnchor):I(0,0);t.panInside(this._latlng,{paddingTopLeft:i,paddingBottomRight:n.subtract(i)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function oi(t,e){return new ii(t,e)}var si=Kn.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return p(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&Object.prototype.hasOwnProperty.call(t,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),ri=si.extend({options:{fill:!0,radius:10},initialize:function(t,e){p(this,e),this._latlng=R(t),this._radius=this.options.radius},setLatLng:function(t){var e=this._latlng;return this._latlng=R(t),this.redraw(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return si.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,n=this._clickTolerance(),i=[t+n,e+n];this._pxBounds=new N(this._point.subtract(i),this._point.add(i))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function ai(t,e){return new ri(t,e)}var li=ri.extend({initialize:function(t,e,i){if("number"==typeof e&&(e=n({},i,{radius:e})),p(this,e),this._latlng=R(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new D(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:si.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,n=this._map,i=n.options.crs;if(i.distance===W.distance){var o=Math.PI/180,s=this._mRadius/W.R/o,r=n.project([e+s,t]),a=n.project([e-s,t]),l=r.add(a).divideBy(2),c=n.unproject(l).lat,h=Math.acos((Math.cos(s*o)-Math.sin(e*o)*Math.sin(c*o))/(Math.cos(e*o)*Math.cos(c*o)))/o;(isNaN(h)||0===h)&&(h=s/Math.cos(Math.PI/180*e)),this._point=l.subtract(n.getPixelOrigin()),this._radius=isNaN(h)?0:l.x-n.project([c,t-h]).x,this._radiusY=l.y-r.y}else{var u=i.unproject(i.project(this._latlng).subtract([this._mRadius,0]));this._point=n.latLngToLayerPoint(this._latlng),this._radius=this._point.x-n.latLngToLayerPoint(u).x}this._updateBounds()}});function ci(t,e,n){return new li(t,e,n)}var hi=si.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){p(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,n,i=1/0,o=null,s=Bn,r=0,a=this._parts.length;r<a;r++)for(var l=this._parts[r],c=1,h=l.length;c<h;c++){var u=s(t,e=l[c-1],n=l[c],!0);u<i&&(i=u,o=s(t,e,n))}return o&&(o.distance=Math.sqrt(i)),o},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return jn(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=R(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new D,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Dn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],n=Dn(t),i=0,o=t.length;i<o;i++)n?(e[i]=R(t[i]),this._bounds.extend(e[i])):e[i]=this._convertLatLngs(t[i]);return e},_project:function(){var t=new N;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new O(t,t);this._rawPxBounds&&(this._pxBounds=new N([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)]))},_projectLatlngs:function(t,e,n){var i,o,s=t[0]instanceof j,r=t.length;if(s){for(o=[],i=0;i<r;i++)o[i]=this._map.latLngToLayerPoint(t[i]),n.extend(o[i]);e.push(o)}else for(i=0;i<r;i++)this._projectLatlngs(t[i],e,n)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,n,i,o,s,r,a,l=this._parts;for(e=0,i=0,o=this._rings.length;e<o;e++)for(n=0,s=(a=this._rings[e]).length;n<s-1;n++)(r=On(a[n],a[n+1],t,n,!0))&&(l[i]=l[i]||[],l[i].push(r[0]),r[1]===a[n+1]&&n!==s-2||(l[i].push(r[1]),i++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,n=0,i=t.length;n<i;n++)t[n]=Mn(t[n],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var n,i,o,s,r,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(n=0,s=this._parts.length;n<s;n++)for(i=0,o=(r=(a=this._parts[n]).length)-1;i<r;o=i++)if((e||0!==i)&&kn(t,a[o],a[i])<=l)return!0;return!1}});function ui(t,e){return new hi(t,e)}hi._flat=Zn;var di=hi.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return $n(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(t){var e=hi.prototype._convertLatLngs.call(this,t),n=e.length;return n>=2&&e[0]instanceof j&&e[0].equals(e[n-1])&&e.pop(),e},_setLatLngs:function(t){hi.prototype._setLatLngs.call(this,t),Dn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Dn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,n=new O(e,e);if(t=new N(t.min.subtract(n),t.max.add(n)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var i,o=0,s=this._rings.length;o<s;o++)(i=xn(this._rings[o],t,!0)).length&&this._parts.push(i)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,n,i,o,s,r,a,l,c=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(s=0,r=(l=(e=this._parts[o]).length)-1;s<l;r=s++)n=e[s],i=e[r],n.y>t.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(c=!c);return c||hi.prototype._containsPoint.call(this,t,!0)}});function pi(t,e){return new di(t,e)}var mi=Xn.extend({initialize:function(t,e){p(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,n,i,o=g(t)?t:t.features;if(o){for(e=0,n=o.length;e<n;e++)((i=o[e]).geometries||i.geometry||i.features||i.coordinates)&&this.addData(i);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=fi(t,s);return r?(r.feature=xi(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return void 0===t?this.eachLayer(this.resetStyle,this):(t.options=n({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this)},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"==typeof e&&(e=e(t.feature)),t.setStyle(e))}});function fi(t,e){var n,i,o,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,l=[],c=e&&e.pointToLayer,h=e&&e.coordsToLatLng||gi;if(!a&&!r)return null;switch(r.type){case"Point":return _i(c,t,n=h(a),e);case"MultiPoint":for(o=0,s=a.length;o<s;o++)n=h(a[o]),l.push(_i(c,t,n,e));return new Xn(l);case"LineString":case"MultiLineString":return i=vi(a,"LineString"===r.type?0:1,h),new hi(i,e);case"Polygon":case"MultiPolygon":return i=vi(a,"Polygon"===r.type?1:2,h),new di(i,e);case"GeometryCollection":for(o=0,s=r.geometries.length;o<s;o++){var u=fi({geometry:r.geometries[o],type:"Feature",properties:t.properties},e);u&&l.push(u)}return new Xn(l);case"FeatureCollection":for(o=0,s=r.features.length;o<s;o++){var d=fi(r.features[o],e);d&&l.push(d)}return new Xn(l);default:throw new Error("Invalid GeoJSON object.")}}function _i(t,e,n,i){return t?t(e,n):new ii(n,i&&i.markersInheritOptions&&i)}function gi(t){return new j(t[1],t[0],t[2])}function vi(t,e,n){for(var i,o=[],s=0,r=t.length;s<r;s++)i=e?vi(t[s],e-1,n):(n||gi)(t[s]),o.push(i);return o}function yi(t,e){return void 0!==(t=R(t)).alt?[h(t.lng,e),h(t.lat,e),h(t.alt,e)]:[h(t.lng,e),h(t.lat,e)]}function bi(t,e,n,i){for(var o=[],s=0,r=t.length;s<r;s++)o.push(e?bi(t[s],Dn(t[s])?0:e-1,n,i):yi(t[s],i));return!e&&n&&o.length>0&&o.push(o[0].slice()),o}function wi(t,e){return t.feature?n({},t.feature,{geometry:e}):xi(e)}function xi(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var $i={toGeoJSON:function(t){return wi(this,{type:"Point",coordinates:yi(this.getLatLng(),t)})}};function Li(t,e){return new mi(t,e)}ii.include($i),li.include($i),ri.include($i),hi.include({toGeoJSON:function(t){var e=!Dn(this._latlngs);return wi(this,{type:(e?"Multi":"")+"LineString",coordinates:bi(this._latlngs,e?1:0,!1,t)})}}),di.include({toGeoJSON:function(t){var e=!Dn(this._latlngs),n=e&&!Dn(this._latlngs[0]),i=bi(this._latlngs,n?2:e?1:0,!0,t);return e||(i=[i]),wi(this,{type:(n?"Multi":"")+"Polygon",coordinates:i})}}),Gn.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(n){e.push(n.toGeoJSON(t).geometry.coordinates)})),wi(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var n="GeometryCollection"===e,i=[];return this.eachLayer((function(e){if(e.toGeoJSON){var o=e.toGeoJSON(t);if(n)i.push(o.geometry);else{var s=xi(o);"FeatureCollection"===s.type?i.push.apply(i,s.features):i.push(s)}}})),n?wi(this,{geometries:i,type:"GeometryCollection"}):{type:"FeatureCollection",features:i}}});var Ti=Li,Pi=Kn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,n){this._url=t,this._bounds=Z(e),p(this,n)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(we(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){_e(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&ve(this._image),this},bringToBack:function(){return this._map&&ye(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=Z(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:fe("img");we(e,"leaflet-image-layer"),this._zoomAnimated&&we(e,"leaflet-zoom-animated"),this.options.className&&we(e,this.options.className),e.onselectstart=c,e.onmousemove=c,e.onload=o(this.fire,this,"load"),e.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;ke(this._image,n,e)},_reset:function(){var t=this._image,e=new N(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),n=e.getSize();Ce(t,e.min),t.style.width=n.x+"px",t.style.height=n.y+"px"},_updateOpacity:function(){Te(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)},getCenter:function(){return this._bounds.getCenter()}}),Mi=function(t,e,n){return new Pi(t,e,n)},ki=Pi.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:fe("video");if(we(e,"leaflet-image-layer"),this._zoomAnimated&&we(e,"leaflet-zoom-animated"),this.options.className&&we(e,this.options.className),e.onselectstart=c,e.onmousemove=c,e.onloadeddata=o(this.fire,this,"load"),t){for(var n=e.getElementsByTagName("source"),i=[],s=0;s<n.length;s++)i.push(n[s].src);this._url=n.length>0?i:[e.src]}else{g(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(e.style,"objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop,e.muted=!!this.options.muted,e.playsInline=!!this.options.playsInline;for(var r=0;r<this._url.length;r++){var a=fe("source");a.src=this._url[r],e.appendChild(a)}}}});function Ci(t,e,n){return new ki(t,e,n)}var Ei=Pi.extend({_initImage:function(){var t=this._image=this._url;we(t,"leaflet-image-layer"),this._zoomAnimated&&we(t,"leaflet-zoom-animated"),this.options.className&&we(t,this.options.className),t.onselectstart=c,t.onmousemove=c}});function Ai(t,e,n){return new Ei(t,e,n)}var Si=Kn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(t,e){t&&(t instanceof j||g(t))?(this._latlng=R(t),p(this,e)):(p(this,t),this._source=e),this.options.content&&(this._content=this.options.content)},openOn:function(t){return(t=arguments.length?t:this._source._map).hasLayer(this)||t.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(t){return this._map?this.close():(arguments.length?this._source=t:t=this._source,this._prepareOpen(),this.openOn(t._map)),this},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&Te(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&Te(this._container,1),this.bringToFront(),this.options.interactive&&(we(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(t){t._fadeAnimated?(Te(this._container,0),this._removeTimeout=setTimeout(o(_e,void 0,this._container),200)):_e(this._container),this.options.interactive&&(xe(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=R(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&ve(this._container),this},bringToBack:function(){return this._map&&ye(this._container),this},_prepareOpen:function(t){var e=this._source;if(!e._map)return!1;if(e instanceof Xn){e=null;var n=this._source._layers;for(var i in n)if(n[i]._map){e=n[i];break}if(!e)return!1;this._source=e}if(!t)if(e.getCenter)t=e.getCenter();else if(e.getLatLng)t=e.getLatLng();else{if(!e.getBounds)throw new Error("Unable to get source layer LatLng.");t=e.getBounds().getCenter()}return this.setLatLng(t),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=I(this.options.offset),n=this._getAnchor();this._zoomAnimated?Ce(this._container,t.add(n)):e=e.add(t).add(n);var i=this._containerBottom=-e.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=i+"px",this._container.style.left=o+"px"}},_getAnchor:function(){return[0,0]}});sn.include({_initOverlay:function(t,e,n,i){var o=e;return o instanceof t||(o=new t(i).setContent(e)),n&&o.setLatLng(n),o}}),Kn.include({_initOverlay:function(t,e,n,i){var o=n;return o instanceof t?(p(o,i),o._source=this):(o=e&&!i?e:new t(i,this)).setContent(n),o}});var Oi=Si.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return!(t=arguments.length?t:this._source._map).hasLayer(this)&&t._popup&&t._popup.options.autoClose&&t.removeLayer(t._popup),t._popup=this,Si.prototype.openOn.call(this,t)},onAdd:function(t){Si.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof si||this._source.on("preclick",Ue))},onRemove:function(t){Si.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof si||this._source.off("preclick",Ue))},getEvents:function(){var t=Si.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this.close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_initLayout:function(){var t="leaflet-popup",e=this._container=fe("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),n=this._wrapper=fe("div",t+"-content-wrapper",e);if(this._contentNode=fe("div",t+"-content",n),Ke(e),Ve(this._contentNode),Ze(e,"contextmenu",Ue),this._tipContainer=fe("div",t+"-tip-container",e),this._tip=fe("div",t+"-tip",this._tipContainer),this.options.closeButton){var i=this._closeButton=fe("a",t+"-close-button",e);i.setAttribute("role","button"),i.setAttribute("aria-label","Close popup"),i.href="#close",i.innerHTML='<span aria-hidden="true">×</span>',Ze(i,"click",(function(t){Ge(t),this.close()}),this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var n=t.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),e.width=n+1+"px",e.whiteSpace="",e.height="";var i=t.offsetHeight,o=this.options.maxHeight,s="leaflet-popup-scrolled";o&&i>o?(e.height=o+"px",we(t,s)):xe(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),n=this._getAnchor();Ce(this._container,e.add(n))},_adjustPan:function(){if(this.options.autoPan)if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning)this._autopanning=!1;else{var t=this._map,e=parseInt(me(this._container,"marginBottom"),10)||0,n=this._container.offsetHeight+e,i=this._containerWidth,o=new O(this._containerLeft,-n-this._containerBottom);o._add(Ee(this._container));var s=t.layerPointToContainerPoint(o),r=I(this.options.autoPanPadding),a=I(this.options.autoPanPaddingTopLeft||r),l=I(this.options.autoPanPaddingBottomRight||r),c=t.getSize(),h=0,u=0;s.x+i+l.x>c.x&&(h=s.x+i-c.x+l.x),s.x-h-a.x<0&&(h=s.x-a.x),s.y+n+l.y>c.y&&(u=s.y+n-c.y+l.y),s.y-u-a.y<0&&(u=s.y-a.y),(h||u)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([h,u]))}},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),zi=function(t,e){return new Oi(t,e)};sn.mergeOptions({closePopupOnClick:!0}),sn.include({openPopup:function(t,e,n){return this._initOverlay(Oi,t,e,n).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),Kn.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Oi,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof Xn||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(this._popup&&this._map){Ye(t);var e=t.layer||t.target;this._popup._source!==e||e instanceof si?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Ii=Si.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Si.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Si.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Si.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=fe("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+r(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,n,i=this._map,o=this._container,s=i.latLngToContainerPoint(i.getCenter()),r=i.layerPointToContainerPoint(t),a=this.options.direction,l=o.offsetWidth,c=o.offsetHeight,h=I(this.options.offset),u=this._getAnchor();"top"===a?(e=l/2,n=c):"bottom"===a?(e=l/2,n=0):"center"===a?(e=l/2,n=c/2):"right"===a?(e=0,n=c/2):"left"===a?(e=l,n=c/2):r.x<s.x?(a="right",e=0,n=c/2):(a="left",e=l+2*(h.x+u.x),n=c/2),t=t.subtract(I(e,n,!0)).add(h).add(u),xe(o,"leaflet-tooltip-right"),xe(o,"leaflet-tooltip-left"),xe(o,"leaflet-tooltip-top"),xe(o,"leaflet-tooltip-bottom"),we(o,"leaflet-tooltip-"+a),Ce(o,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&Te(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return I(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Ni=function(t,e){return new Ii(t,e)};sn.include({openTooltip:function(t,e,n){return this._initOverlay(Ii,t,e,n).openOn(this),this},closeTooltip:function(t){return t.close(),this}}),Kn.include({bindTooltip:function(t,e){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Ii,this._tooltip,t,e),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",n={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?n.add=this._openTooltip:(n.mouseover=this._openTooltip,n.mouseout=this.closeTooltip,n.click=this._openTooltip,this._map?this._addFocusListeners():n.add=this._addFocusListeners),this._tooltip.options.sticky&&(n.mousemove=this._moveTooltip),this[e](n),this._tooltipHandlersAdded=!t}},openTooltip:function(t){return this._tooltip&&(this instanceof Xn||(this._tooltip._source=this),this._tooltip._prepareOpen(t)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(t){var e="function"==typeof t.getElement&&t.getElement();e&&(Ze(e,"focus",(function(){this._tooltip._source=t,this.openTooltip()}),this),Ze(e,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(t){var e="function"==typeof t.getElement&&t.getElement();e&&e.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(t){if(this._tooltip&&this._map)if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var e=this;this._map.once("moveend",(function(){e._openOnceFlag=!1,e._openTooltip(t)}))}else this._tooltip._source=t.layer||t.target,this.openTooltip(this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,n,i=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),n=this._map.containerPointToLayerPoint(e),i=this._map.layerPointToLatLng(n)),this._tooltip.setLatLng(i)}});var Bi=Qn.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),n=this.options;if(n.html instanceof Element?(ge(e),e.appendChild(n.html)):e.innerHTML=!1!==n.html?n.html:"",n.bgPos){var i=I(n.bgPos);e.style.backgroundPosition=-i.x+"px "+-i.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function Di(t){return new Bi(t)}Qn.Default=ei;var Zi=Kn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:Dt.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){p(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),_e(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(ve(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(ye(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var t=this._clampZoom(this._map.getZoom());t!==this._tileZoom&&(this._tileZoom=t,this._updateLevels()),this._update()}return this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=a(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof O?t:new O(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,n=this.getPane().children,i=-t(-1/0,1/0),o=0,s=n.length;o<s;o++)e=n[o].style.zIndex,n[o]!==this._container&&e&&(i=t(i,+e));isFinite(i)&&(this.options.zIndex=i+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Dt.ielt9){Te(this._container,this.options.opacity);var t=+new Date,e=!1,n=!1;for(var i in this._tiles){var o=this._tiles[i];if(o.current&&o.loaded){var s=Math.min(1,(t-o.loaded)/200);Te(o.el,s),s<1?e=!0:(o.active?n=!0:this._onOpaqueTile(o),o.active=!0)}}n&&!this._noPrune&&this._pruneTiles(),e&&(M(this._fadeFrame),this._fadeFrame=P(this._updateOpacity,this))}},_onOpaqueTile:c,_initContainer:function(){this._container||(this._container=fe("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var n in this._levels)n=Number(n),this._levels[n].el.children.length||n===t?(this._levels[n].el.style.zIndex=e-Math.abs(t-n),this._onUpdateLevel(n)):(_e(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);var i=this._levels[t],o=this._map;return i||((i=this._levels[t]={}).el=fe("div","leaflet-tile-container leaflet-zoom-animated",this._container),i.el.style.zIndex=e,i.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),i.zoom=t,this._setZoomTransform(i,o.getCenter(),o.getZoom()),c(i.el.offsetWidth),this._onCreateLevel(i)),this._level=i,i}},_onUpdateLevel:c,_onRemoveLevel:c,_onCreateLevel:c,_pruneTiles:function(){if(this._map){var t,e,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var i=e.coords;this._retainParent(i.x,i.y,i.z,i.z-5)||this._retainChildren(i.x,i.y,i.z,i.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)_e(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,n,i){var o=Math.floor(t/2),s=Math.floor(e/2),r=n-1,a=new O(+o,+s);a.z=+r;var l=this._tileCoordsToKey(a),c=this._tiles[l];return c&&c.active?(c.retain=!0,!0):(c&&c.loaded&&(c.retain=!0),r>i&&this._retainParent(o,s,r,i))},_retainChildren:function(t,e,n,i){for(var o=2*t;o<2*t+2;o++)for(var s=2*e;s<2*e+2;s++){var r=new O(o,s);r.z=n+1;var a=this._tileCoordsToKey(r),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),n+1<i&&this._retainChildren(o,s,n+1,i))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,n,i){var o=Math.round(e);o=void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom?void 0:this._clampZoom(o);var s=this.options.updateWhenZooming&&o!==this._tileZoom;i&&!s||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),n||this._pruneTiles(),this._noPrune=!!n),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var n in this._levels)this._setZoomTransform(this._levels[n],t,e)},_setZoomTransform:function(t,e,n){var i=this._map.getZoomScale(n,t.zoom),o=t.origin.multiplyBy(i).subtract(this._map._getNewPixelOrigin(e,n)).round();Dt.any3d?ke(t.el,o,i):Ce(t.el,o)},_resetGrid:function(){var t=this._map,e=t.options.crs,n=this._tileSize=this.getTileSize(),i=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],i).x/n.x),Math.ceil(t.project([0,e.wrapLng[1]],i).x/n.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],i).y/n.x),Math.ceil(t.project([e.wrapLat[1],0],i).y/n.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,n=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),i=e.getZoomScale(n,this._tileZoom),o=e.project(t,this._tileZoom).floor(),s=e.getSize().divideBy(2*i);return new N(o.subtract(s),o.add(s))},_update:function(t){var e=this._map;if(e){var n=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var i=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(i),s=o.getCenter(),r=[],a=this.options.keepBuffer,l=new N(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var c in this._tiles){var h=this._tiles[c].coords;h.z===this._tileZoom&&l.contains(new O(h.x,h.y))||(this._tiles[c].current=!1)}if(Math.abs(n-this._tileZoom)>1)this._setView(t,n);else{for(var u=o.min.y;u<=o.max.y;u++)for(var d=o.min.x;d<=o.max.x;d++){var p=new O(d,u);if(p.z=this._tileZoom,this._isValidTile(p)){var m=this._tiles[this._tileCoordsToKey(p)];m?m.current=!0:r.push(p)}}if(r.sort((function(t,e){return t.distanceTo(s)-e.distanceTo(s)})),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var f=document.createDocumentFragment();for(d=0;d<r.length;d++)this._addTile(r[d],f);this._level.el.appendChild(f)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var n=this._globalTileRange;if(!e.wrapLng&&(t.x<n.min.x||t.x>n.max.x)||!e.wrapLat&&(t.y<n.min.y||t.y>n.max.y))return!1}if(!this.options.bounds)return!0;var i=this._tileCoordsToBounds(t);return Z(this.options.bounds).overlaps(i)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,n=this.getTileSize(),i=t.scaleBy(n),o=i.add(n);return[e.unproject(i,t.z),e.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),n=new D(e[0],e[1]);return this.options.noWrap||(n=this._map.wrapLatLngBounds(n)),n},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),n=new O(+e[0],+e[1]);return n.z=+e[2],n},_removeTile:function(t){var e=this._tiles[t];e&&(_e(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){we(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=c,t.onmousemove=c,Dt.ielt9&&this.options.opacity<1&&Te(t,this.options.opacity)},_addTile:function(t,e){var n=this._getTilePos(t),i=this._tileCoordsToKey(t),s=this.createTile(this._wrapCoords(t),o(this._tileReady,this,t));this._initTile(s),this.createTile.length<2&&P(o(this._tileReady,this,t,null,s)),Ce(s,n),this._tiles[i]={el:s,coords:t,current:!0},e.appendChild(s),this.fire("tileloadstart",{tile:s,coords:t})},_tileReady:function(t,e,n){e&&this.fire("tileerror",{error:e,tile:n,coords:t});var i=this._tileCoordsToKey(t);(n=this._tiles[i])&&(n.loaded=+new Date,this._map._fadeAnimated?(Te(n.el,0),M(this._fadeFrame),this._fadeFrame=P(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),e||(we(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Dt.ielt9||!this._map._fadeAnimated?P(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new O(this._wrapX?l(t.x,this._wrapX):t.x,this._wrapY?l(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new N(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function ji(t){return new Zi(t)}var Ri=Zi.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,(e=p(this,e)).detectRetina&&Dt.retina&&e.maxZoom>0?(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom=Math.min(e.maxZoom,e.minZoom+1)):(e.zoomOffset++,e.maxZoom=Math.max(e.minZoom,e.maxZoom-1)),e.minZoom=Math.max(0,e.minZoom)):e.zoomReverse?e.minZoom=Math.min(e.maxZoom,e.minZoom):e.maxZoom=Math.max(e.minZoom,e.maxZoom),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var n=document.createElement("img");return Ze(n,"load",o(this._tileOnLoad,this,e,n)),Ze(n,"error",o(this._tileOnError,this,e,n)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),"string"==typeof this.options.referrerPolicy&&(n.referrerPolicy=this.options.referrerPolicy),n.alt="",n.src=this.getTileUrl(t),n},getTileUrl:function(t){var e={r:Dt.retina?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return _(this._url,n(e,this.options))},_tileOnLoad:function(t,e){Dt.ielt9?setTimeout(o(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,n){var i=this.options.errorTileUrl;i&&e.getAttribute("src")!==i&&(e.src=i),t(n,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)if(this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=c,e.onerror=c,!e.complete)){e.src=y;var n=this._tiles[t].coords;_e(e),delete this._tiles[t],this.fire("tileabort",{tile:e,coords:n})}},_removeTile:function(t){var e=this._tiles[t];if(e)return e.el.setAttribute("src",y),Zi.prototype._removeTile.call(this,t)},_tileReady:function(t,e,n){if(this._map&&(!n||n.getAttribute("src")!==y))return Zi.prototype._tileReady.call(this,t,e,n)}});function Hi(t,e){return new Ri(t,e)}var Fi=Ri.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=n({},this.defaultWmsParams);for(var o in e)o in this.options||(i[o]=e[o]);var s=(e=p(this,e)).detectRetina&&Dt.retina?2:1,r=this.getTileSize();i.width=r.x*s,i.height=r.y*s,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,Ri.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),n=this._crs,i=B(n.project(e[0]),n.project(e[1])),o=i.min,s=i.max,r=(this._wmsVersion>=1.3&&this._crs===Un?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),a=Ri.prototype.getTileUrl.call(this,t);return a+m(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return n(this.wmsParams,t),e||this.redraw(),this}});function Wi(t,e){return new Fi(t,e)}Ri.WMS=Fi,Hi.wms=Wi;var qi=Kn.extend({options:{padding:.1},initialize:function(t){p(this,t),r(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),we(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var n=this._map.getZoomScale(e,this._zoom),i=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,e),s=i.multiplyBy(-n).add(o).subtract(this._map._getNewPixelOrigin(t,e));Dt.any3d?ke(this._container,s,n):Ce(this._container,s)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),n=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new N(n,n.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Ui=qi.extend({options:{tolerance:0},getEvents:function(){var t=qi.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){qi.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");Ze(t,"mousemove",this._onMouseMove,this),Ze(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ze(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){M(this._redrawRequest),delete this._ctx,_e(this._container),Re(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){qi.prototype._update.call(this);var t=this._bounds,e=this._container,n=t.getSize(),i=Dt.retina?2:1;Ce(e,t.min),e.width=i*n.x,e.height=i*n.y,e.style.width=n.x+"px",e.style.height=n.y+"px",Dt.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){qi.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[r(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,n=e.next,i=e.prev;n?n.prev=i:this._drawLast=i,i?i.next=n:this._drawFirst=n,delete t._order,delete this._layers[r(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,n,i=t.options.dashArray.split(/[, ]+/),o=[];for(n=0;n<i.length;n++){if(e=Number(i[n]),isNaN(e))return;o.push(e)}t.options._dashArray=o}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||P(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new N,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var n=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,n.x,n.y),this._ctx.clip()}this._drawing=!0;for(var i=this._drawFirst;i;i=i.next)t=i.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var n,i,o,s,r=t._parts,a=r.length,l=this._ctx;if(a){for(l.beginPath(),n=0;n<a;n++){for(i=0,o=r[n].length;i<o;i++)s=r[n][i],l[i?"lineTo":"moveTo"](s.x,s.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,n=this._ctx,i=Math.max(Math.round(t._radius),1),o=(Math.max(Math.round(t._radiusY),1)||i)/i;1!==o&&(n.save(),n.scale(1,o)),n.beginPath(),n.arc(e.x,e.y/o,i,0,2*Math.PI,!1),1!==o&&n.restore(),this._fillStroke(n,t)}},_fillStroke:function(t,e){var n=e.options;n.fill&&(t.globalAlpha=n.fillOpacity,t.fillStyle=n.fillColor||n.color,t.fill(n.fillRule||"evenodd")),n.stroke&&0!==n.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=n.opacity,t.lineWidth=n.weight,t.strokeStyle=n.color,t.lineCap=n.lineCap,t.lineJoin=n.lineJoin,t.stroke())},_onClick:function(t){for(var e,n,i=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)(e=o.layer).options.interactive&&e._containsPoint(i)&&("click"!==t.type&&"preclick"!==t.type||!this._map._draggableMoved(e))&&(n=e);this._fireEvent(!!n&&[n],t)},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(xe(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,e){if(!this._mouseHoverThrottled){for(var n,i,s=this._drawFirst;s;s=s.next)(n=s.layer).options.interactive&&n._containsPoint(e)&&(i=n);i!==this._hoveredLayer&&(this._handleMouseOut(t),i&&(we(this._container,"leaflet-interactive"),this._fireEvent([i],t,"mouseover"),this._hoveredLayer=i)),this._fireEvent(!!this._hoveredLayer&&[this._hoveredLayer],t),this._mouseHoverThrottled=!0,setTimeout(o((function(){this._mouseHoverThrottled=!1}),this),32)}},_fireEvent:function(t,e,n){this._map._fireDOMEvent(e,n||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;n&&(n.prev=i,i?i.next=n:n&&(this._drawFirst=n),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;i&&(i.next=n,n?n.prev=i:i&&(this._drawLast=i),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function Vi(t){return Dt.canvas?new Ui(t):null}var Ki=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Gi={_initContainer:function(){this._container=fe("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(qi.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Ki("shape");we(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Ki("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[r(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;_e(e),t.removeInteractiveTarget(e),delete this._layers[r(t)]},_updateStyle:function(t){var e=t._stroke,n=t._fill,i=t.options,o=t._container;o.stroked=!!i.stroke,o.filled=!!i.fill,i.stroke?(e||(e=t._stroke=Ki("stroke")),o.appendChild(e),e.weight=i.weight+"px",e.color=i.color,e.opacity=i.opacity,i.dashArray?e.dashStyle=g(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=i.lineCap.replace("butt","flat"),e.joinstyle=i.lineJoin):e&&(o.removeChild(e),t._stroke=null),i.fill?(n||(n=t._fill=Ki("fill")),o.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(o.removeChild(n),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),n=Math.round(t._radius),i=Math.round(t._radiusY||n);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+n+","+i+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){ve(t._container)},_bringToBack:function(t){ye(t._container)}},Yi=Dt.vml?Ki:X,Xi=qi.extend({_initContainer:function(){this._container=Yi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Yi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){_e(this._container),Re(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!this._map._animatingZoom||!this._bounds){qi.prototype._update.call(this);var t=this._bounds,e=t.getSize(),n=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,n.setAttribute("width",e.x),n.setAttribute("height",e.y)),Ce(n,t.min),n.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Yi("path");t.options.className&&we(e,t.options.className),t.options.interactive&&we(e,"leaflet-interactive"),this._updateStyle(t),this._layers[r(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){_e(t._path),t.removeInteractiveTarget(t._path),delete this._layers[r(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,n=t.options;e&&(n.stroke?(e.setAttribute("stroke",n.color),e.setAttribute("stroke-opacity",n.opacity),e.setAttribute("stroke-width",n.weight),e.setAttribute("stroke-linecap",n.lineCap),e.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?e.setAttribute("stroke-dasharray",n.dashArray):e.removeAttribute("stroke-dasharray"),n.dashOffset?e.setAttribute("stroke-dashoffset",n.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),n.fill?(e.setAttribute("fill",n.fillColor||n.color),e.setAttribute("fill-opacity",n.fillOpacity),e.setAttribute("fill-rule",n.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,J(t._parts,e))},_updateCircle:function(t){var e=t._point,n=Math.max(Math.round(t._radius),1),i="a"+n+","+(Math.max(Math.round(t._radiusY),1)||n)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(e.x-n)+","+e.y+i+2*n+",0 "+i+2*-n+",0 ";this._setPath(t,o)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){ve(t._path)},_bringToBack:function(t){ye(t._path)}});function Ji(t){return Dt.svg||Dt.vml?new Xi(t):null}Dt.vml&&Xi.include(Gi),sn.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&Vi(t)||Ji(t)}});var Qi=di.extend({initialize:function(t,e){di.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=Z(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function to(t,e){return new Qi(t,e)}Xi.create=Yi,Xi.pointsToPath=J,mi.geometryToLayer=fi,mi.coordsToLatLng=gi,mi.coordsToLatLngs=vi,mi.latLngToCoords=yi,mi.latLngsToCoords=bi,mi.getFeature=wi,mi.asFeature=xi,sn.mergeOptions({boxZoom:!0});var eo=vn.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Ze(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Re(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){_e(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),se(),Se(),this._startPoint=this._map.mouseEventToContainerPoint(t),Ze(document,{contextmenu:Ye,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=fe("div","leaflet-zoom-box",this._container),we(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new N(this._point,this._startPoint),n=e.getSize();Ce(this._box,e.min),this._box.style.width=n.x+"px",this._box.style.height=n.y+"px"},_finish:function(){this._moved&&(_e(this._box),xe(this._container,"leaflet-crosshair")),re(),Oe(),Re(document,{contextmenu:Ye,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var e=new D(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});sn.addInitHook("addHandler","boxZoom",eo),sn.mergeOptions({doubleClickZoom:!0});var no=vn.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,n=e.getZoom(),i=e.options.zoomDelta,o=t.originalEvent.shiftKey?n-i:n+i;"center"===e.options.doubleClickZoom?e.setZoom(o):e.setZoomAround(t.containerPoint,o)}});sn.addInitHook("addHandler","doubleClickZoom",no),sn.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var io=vn.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new wn(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}we(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){xe(this._map._container,"leaflet-grab"),xe(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=Z(this._map.options.maxBounds);this._offsetLimit=B(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(n),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),n=this._initialWorldOffset,i=this._draggable._newPos.x,o=(i-e+n)%t+e-n,s=(i+e+n)%t-e-n,r=Math.abs(o+n)<Math.abs(s+n)?o:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var e=this._map,n=e.options,i=!n.inertia||t.noInertia||this._times.length<2;if(e.fire("dragend",t),i)e.fire("moveend");else{this._prunePositions(+new Date);var o=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,r=n.easeLinearity,a=o.multiplyBy(r/s),l=a.distanceTo([0,0]),c=Math.min(n.inertiaMaxSpeed,l),h=a.multiplyBy(c/l),u=c/(n.inertiaDeceleration*r),d=h.multiplyBy(-u/2).round();d.x||d.y?(d=e._limitOffset(d,e.options.maxBounds),P((function(){e.panBy(d,{duration:u,easeLinearity:r,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});sn.addInitHook("addHandler","dragging",io),sn.mergeOptions({keyboard:!0,keyboardPanDelta:80});var oo=vn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),Ze(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Re(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,n=t.scrollTop||e.scrollTop,i=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(i,n)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,n,i=this._panKeys={},o=this.keyCodes;for(e=0,n=o.left.length;e<n;e++)i[o.left[e]]=[-1*t,0];for(e=0,n=o.right.length;e<n;e++)i[o.right[e]]=[t,0];for(e=0,n=o.down.length;e<n;e++)i[o.down[e]]=[0,t];for(e=0,n=o.up.length;e<n;e++)i[o.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,n,i=this._zoomKeys={},o=this.keyCodes;for(e=0,n=o.zoomIn.length;e<n;e++)i[o.zoomIn[e]]=t;for(e=0,n=o.zoomOut.length;e<n;e++)i[o.zoomOut[e]]=-t},_addHooks:function(){Ze(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Re(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,n=t.keyCode,i=this._map;if(n in this._panKeys){if(!i._panAnim||!i._panAnim._inProgress)if(e=this._panKeys[n],t.shiftKey&&(e=I(e).multiplyBy(3)),i.options.maxBounds&&(e=i._limitOffset(I(e),i.options.maxBounds)),i.options.worldCopyJump){var o=i.wrapLatLng(i.unproject(i.project(i.getCenter()).add(e)));i.panTo(o)}else i.panBy(e)}else if(n in this._zoomKeys)i.setZoom(i.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!i._popup||!i._popup.options.closeOnEscapeKey)return;i.closePopup()}Ye(t)}}});sn.addInitHook("addHandler","keyboard",oo),sn.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var so=vn.extend({addHooks:function(){Ze(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Re(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=tn(t),n=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var i=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(o(this._performZoom,this),i),Ye(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),n=this._map.options.zoomSnap||0;t._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(i))))/Math.LN2,s=n?Math.ceil(o/n)*n:o,r=t._limitZoom(e+(this._delta>0?s:-s))-e;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(e+r):t.setZoomAround(this._lastMousePos,e+r))}});sn.addInitHook("addHandler","scrollWheelZoom",so);var ro=600;sn.mergeOptions({tapHold:Dt.touchNative&&Dt.safari&&Dt.mobile,tapTolerance:15});var ao=vn.extend({addHooks:function(){Ze(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Re(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),1===t.touches.length){var e=t.touches[0];this._startPos=this._newPos=new O(e.clientX,e.clientY),this._holdTimeout=setTimeout(o((function(){this._cancel(),this._isTapValid()&&(Ze(document,"touchend",Ge),Ze(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",e))}),this),ro),Ze(document,"touchend touchcancel contextmenu",this._cancel,this),Ze(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){Re(document,"touchend",Ge),Re(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),Re(document,"touchend touchcancel contextmenu",this._cancel,this),Re(document,"touchmove",this._onMove,this)},_onMove:function(t){var e=t.touches[0];this._newPos=new O(e.clientX,e.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,e){var n=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY});n._simulated=!0,e.target.dispatchEvent(n)}});sn.addInitHook("addHandler","tapHold",ao),sn.mergeOptions({touchZoom:Dt.touch,bounceAtZoomLimits:!0});var lo=vn.extend({addHooks:function(){we(this._map._container,"leaflet-touch-zoom"),Ze(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){xe(this._map._container,"leaflet-touch-zoom"),Re(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(n.add(i)._divideBy(2))),this._startDist=n.distanceTo(i),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),Ze(document,"touchmove",this._onTouchMove,this),Ze(document,"touchend touchcancel",this._onTouchEnd,this),Ge(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]),s=n.distanceTo(i)/this._startDist;if(this._zoom=e.getScaleZoom(s,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&s<1||this._zoom>e.getMaxZoom()&&s>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===s)return}else{var r=n._add(i)._divideBy(2)._subtract(this._centerPoint);if(1===s&&0===r.x&&0===r.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),M(this._animRequest);var a=o(e._move,e,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=P(a,this,!0),Ge(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,M(this._animRequest),Re(document,"touchmove",this._onTouchMove,this),Re(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});sn.addInitHook("addHandler","touchZoom",lo),sn.BoxZoom=eo,sn.DoubleClickZoom=no,sn.Drag=io,sn.Keyboard=oo,sn.ScrollWheelZoom=so,sn.TapHold=ao,sn.TouchZoom=lo,t.Bounds=N,t.Browser=Dt,t.CRS=F,t.Canvas=Ui,t.Circle=li,t.CircleMarker=ri,t.Class=C,t.Control=an,t.DivIcon=Bi,t.DivOverlay=Si,t.DomEvent=nn,t.DomUtil=De,t.Draggable=wn,t.Evented=S,t.FeatureGroup=Xn,t.GeoJSON=mi,t.GridLayer=Zi,t.Handler=vn,t.Icon=Qn,t.ImageOverlay=Pi,t.LatLng=j,t.LatLngBounds=D,t.Layer=Kn,t.LayerGroup=Gn,t.LineUtil=Rn,t.Map=sn,t.Marker=ii,t.Mixin=yn,t.Path=si,t.Point=O,t.PolyUtil=Pn,t.Polygon=di,t.Polyline=hi,t.Popup=Oi,t.PosAnimation=on,t.Projection=Wn,t.Rectangle=Qi,t.Renderer=qi,t.SVG=Xi,t.SVGOverlay=Ei,t.TileLayer=Ri,t.Tooltip=Ii,t.Transformation=V,t.Util=k,t.VideoOverlay=ki,t.bind=o,t.bounds=B,t.canvas=Vi,t.circle=ci,t.circleMarker=ai,t.control=ln,t.divIcon=Di,t.extend=n,t.featureGroup=Jn,t.geoJSON=Li,t.geoJson=Ti,t.gridLayer=ji,t.icon=ti,t.imageOverlay=Mi,t.latLng=R,t.latLngBounds=Z,t.layerGroup=Yn,t.map=rn,t.marker=oi,t.point=I,t.polygon=pi,t.polyline=ui,t.popup=zi,t.rectangle=to,t.setOptions=p,t.stamp=r,t.svg=Ji,t.svgOverlay=Ai,t.tileLayer=Hi,t.tooltip=Ni,t.transformation=K,t.version=e,t.videoOverlay=Ci;var co=window.L;t.noConflict=function(){return window.L=co,this},window.L=t}(Qe.exports)),Qe.exports}var en=tn();function nn(e){let n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,b,L,T,M,k,A,S,O,z,I,N,B,D;return{c(){n=w("div"),i=w("div"),o=x("map center: "),s=x(e[0]),r=$(),a=w("a"),l=x("view on osm.org"),c=$(),h=w("br"),u=x("\n map zoom: "),d=x(e[1]),p=$(),m=w("br"),f=x("\n viewbox: "),_=x(e[2]),b=$(),L=w("br"),T=x("\n last click: "),M=x(e[4]),k=$(),A=w("br"),S=x("\n mouse position: "),O=x(e[5]),z=$(),I=w("div"),N=w("a"),N.textContent="hide",C(a,"target","_blank"),C(a,"rel","noreferrer"),C(a,"href",e[3]),C(i,"id","map-position-inner"),C(N,"href","#hide"),C(I,"id","map-position-close"),C(I,"class","svelte-1k961ph"),C(n,"id","map-position"),C(n,"class","svelte-1k961ph")},m(t,e){v(t,n,e),g(n,i),g(i,o),g(i,s),g(i,r),g(i,a),g(a,l),g(i,c),g(i,h),g(i,u),g(i,d),g(i,p),g(i,m),g(i,f),g(i,_),g(i,b),g(i,L),g(i,T),g(i,M),g(i,k),g(i,A),g(i,S),g(i,O),g(n,z),g(n,I),g(I,N),B||(D=P(N,"click",on),B=!0)},p(t,[e]){1&e&&E(s,t[0]),8&e&&C(a,"href",t[3]),2&e&&E(d,t[1]),4&e&&E(_,t[2]),16&e&&E(M,t[4]),32&e&&E(O,t[5])},i:t,o:t,d(t){t&&y(n),B=!1,D()}}}function on(){document.getElementById("map-position").style.display="none",document.getElementById("show-map-position").style.display="block"}function sn(t,e,n){let i,o,s,r,a,l,c;function h(t,e){n(0,o=t.getCenter().lat.toFixed(5)+","+t.getCenter().lng.toFixed(5)),n(3,a=function(t){return"https://openstreetmap.org/#map="+t.getZoom()+"/"+t.getCenter().lat.toFixed(5)+"/"+t.getCenter().lng.toFixed(5)}(t)),n(1,s=t.getZoom()),n(2,r=function(t){var e=t.getBounds(),n=e.getWest(),i=e.getEast();return i-n>=360&&(n=t.getCenter().lng-179.999,i=t.getCenter().lng+179.999),i=L.latLng(77,i).wrap().lng,[(n=L.latLng(77,n).wrap().lng).toFixed(5),e.getNorth().toFixed(5),i.toFixed(5),e.getSouth().toFixed(5)].join(",")}(t)),n(5,c="-"),e&&n(5,c=[e.lat.toFixed(5),e.lng.toFixed(5)].join(",")),i&&n(4,l=[i.lat.toFixed(5),i.lng.toFixed(5)].join(","))}return Tt.subscribe((t=>{t&&(t.on("move",(function(){h(t)})),t.on("mousemove",(function(e){h(t,e.latlng)})),t.on("click",(function(e){i=e.latlng,h(t)})),t.on("load",(function(){h(t)})))})),[o,s,r,a,l,c]}!function(t,e){!function(e,n){t.exports=e(tn()),void 0!==n&&n.L&&(n.L.Control.MiniMap=e(L),n.L.control.minimap=function(t,e){return new n.L.Control.MiniMap(t,e)})}((function(t){var e=t.Control.extend({includes:t.Evented?t.Evented.prototype:t.Mixin.Events,options:{position:"bottomright",toggleDisplay:!1,zoomLevelOffset:-5,zoomLevelFixed:!1,centerFixed:!1,zoomAnimation:!1,autoToggleDisplay:!1,minimized:!1,width:150,height:150,collapsedWidth:19,collapsedHeight:19,aimingRectOptions:{color:"#ff7800",weight:1,clickable:!1},shadowRectOptions:{color:"#000000",weight:1,clickable:!1,opacity:0,fillOpacity:0},strings:{hideText:"Hide MiniMap",showText:"Show MiniMap"},mapOptions:{}},initialize:function(e,n){t.Util.setOptions(this,n),this.options.aimingRectOptions.clickable=!1,this.options.shadowRectOptions.clickable=!1,this._layer=e},onAdd:function(e){this._mainMap=e,this._container=t.DomUtil.create("div","leaflet-control-minimap"),this._container.style.width=this.options.width+"px",this._container.style.height=this.options.height+"px",t.DomEvent.disableClickPropagation(this._container),t.DomEvent.on(this._container,"mousewheel",t.DomEvent.stopPropagation);var n={attributionControl:!1,dragging:!this.options.centerFixed,zoomControl:!1,zoomAnimation:this.options.zoomAnimation,autoToggleDisplay:this.options.autoToggleDisplay,touchZoom:this.options.centerFixed?"center":!this._isZoomLevelFixed(),scrollWheelZoom:this.options.centerFixed?"center":!this._isZoomLevelFixed(),doubleClickZoom:this.options.centerFixed?"center":!this._isZoomLevelFixed(),boxZoom:!this._isZoomLevelFixed(),crs:e.options.crs};return n=t.Util.extend(this.options.mapOptions,n),this._miniMap=new t.Map(this._container,n),this._miniMap.addLayer(this._layer),this._mainMapMoving=!1,this._miniMapMoving=!1,this._userToggledDisplay=!1,this._minimized=!1,this.options.toggleDisplay&&this._addToggleButton(),this._miniMap.whenReady(t.Util.bind((function(){this._aimingRect=t.rectangle(this._mainMap.getBounds(),this.options.aimingRectOptions).addTo(this._miniMap),this._shadowRect=t.rectangle(this._mainMap.getBounds(),this.options.shadowRectOptions).addTo(this._miniMap),this._mainMap.on("moveend",this._onMainMapMoved,this),this._mainMap.on("move",this._onMainMapMoving,this),this._miniMap.on("movestart",this._onMiniMapMoveStarted,this),this._miniMap.on("move",this._onMiniMapMoving,this),this._miniMap.on("moveend",this._onMiniMapMoved,this)}),this)),this._container},addTo:function(e){t.Control.prototype.addTo.call(this,e);var n=this.options.centerFixed||this._mainMap.getCenter();return this._miniMap.setView(n,this._decideZoom(!0)),this._setDisplay(this.options.minimized),this},onRemove:function(t){this._mainMap.off("moveend",this._onMainMapMoved,this),this._mainMap.off("move",this._onMainMapMoving,this),this._miniMap.off("moveend",this._onMiniMapMoved,this),this._miniMap.removeLayer(this._layer)},changeLayer:function(t){this._miniMap.removeLayer(this._layer),this._layer=t,this._miniMap.addLayer(this._layer)},_addToggleButton:function(){this._toggleDisplayButton=this.options.toggleDisplay?this._createButton("",this._toggleButtonInitialTitleText(),"leaflet-control-minimap-toggle-display leaflet-control-minimap-toggle-display-"+this.options.position,this._container,this._toggleDisplayButtonClicked,this):void 0,this._toggleDisplayButton.style.width=this.options.collapsedWidth+"px",this._toggleDisplayButton.style.height=this.options.collapsedHeight+"px"},_toggleButtonInitialTitleText:function(){return this.options.minimized?this.options.strings.showText:this.options.strings.hideText},_createButton:function(e,n,i,o,s,r){var a=t.DomUtil.create("a",i,o);a.innerHTML=e,a.href="#",a.title=n;var l=t.DomEvent.stopPropagation;return t.DomEvent.on(a,"click",l).on(a,"mousedown",l).on(a,"dblclick",l).on(a,"click",t.DomEvent.preventDefault).on(a,"click",s,r),a},_toggleDisplayButtonClicked:function(){this._userToggledDisplay=!0,this._minimized?this._restore():this._minimize()},_setDisplay:function(t){t!==this._minimized&&(this._minimized?this._restore():this._minimize())},_minimize:function(){this.options.toggleDisplay?(this._container.style.width=this.options.collapsedWidth+"px",this._container.style.height=this.options.collapsedHeight+"px",this._toggleDisplayButton.className+=" minimized-"+this.options.position,this._toggleDisplayButton.title=this.options.strings.showText):this._container.style.display="none",this._minimized=!0,this._onToggle()},_restore:function(){this.options.toggleDisplay?(this._container.style.width=this.options.width+"px",this._container.style.height=this.options.height+"px",this._toggleDisplayButton.className=this._toggleDisplayButton.className.replace("minimized-"+this.options.position,""),this._toggleDisplayButton.title=this.options.strings.hideText):this._container.style.display="block",this._minimized=!1,this._onToggle()},_onMainMapMoved:function(t){if(this._miniMapMoving)this._miniMapMoving=!1;else{var e=this.options.centerFixed||this._mainMap.getCenter();this._mainMapMoving=!0,this._miniMap.setView(e,this._decideZoom(!0)),this._setDisplay(this._decideMinimized())}this._aimingRect.setBounds(this._mainMap.getBounds())},_onMainMapMoving:function(t){this._aimingRect.setBounds(this._mainMap.getBounds())},_onMiniMapMoveStarted:function(t){if(!this.options.centerFixed){var e=this._aimingRect.getBounds(),n=this._miniMap.latLngToContainerPoint(e.getSouthWest()),i=this._miniMap.latLngToContainerPoint(e.getNorthEast());this._lastAimingRectPosition={sw:n,ne:i}}},_onMiniMapMoving:function(e){this.options.centerFixed||!this._mainMapMoving&&this._lastAimingRectPosition&&(this._shadowRect.setBounds(new t.LatLngBounds(this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.sw),this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.ne))),this._shadowRect.setStyle({opacity:1,fillOpacity:.3}))},_onMiniMapMoved:function(t){this._mainMapMoving?this._mainMapMoving=!1:(this._miniMapMoving=!0,this._mainMap.setView(this._miniMap.getCenter(),this._decideZoom(!1)),this._shadowRect.setStyle({opacity:0,fillOpacity:0}))},_isZoomLevelFixed:function(){var t=this.options.zoomLevelFixed;return this._isDefined(t)&&this._isInteger(t)},_decideZoom:function(t){if(this._isZoomLevelFixed())return t?this.options.zoomLevelFixed:this._mainMap.getZoom();if(t)return this._mainMap.getZoom()+this.options.zoomLevelOffset;var e,n=this._miniMap.getZoom()-this._mainMap.getZoom(),i=this._miniMap.getZoom()-this.options.zoomLevelOffset;return n>this.options.zoomLevelOffset&&this._mainMap.getZoom()<this._miniMap.getMinZoom()-this.options.zoomLevelOffset?this._miniMap.getZoom()>this._lastMiniMapZoom?(e=this._mainMap.getZoom()+1,this._miniMap.setZoom(this._miniMap.getZoom()-1)):e=this._mainMap.getZoom():e=i,this._lastMiniMapZoom=this._miniMap.getZoom(),e},_decideMinimized:function(){return this._userToggledDisplay?this._minimized:this.options.autoToggleDisplay?!!this._mainMap.getBounds().contains(this._miniMap.getBounds()):this._minimized},_isInteger:function(t){return"number"==typeof t},_isDefined:function(t){return void 0!==t},_onToggle:function(){t.Util.requestAnimFrame((function(){t.DomEvent.on(this._container,"transitionend",this._fireToggleEvents,this),t.Browser.any3d||t.Util.requestAnimFrame(this._fireToggleEvents,this)}),this)},_fireToggleEvents:function(){t.DomEvent.off(this._container,"transitionend",this._fireToggleEvents,this);var e={minimized:this._minimized};this.fire(this._minimized?"minimize":"restore",e),this.fire("toggle",e)}});return t.Map.mergeOptions({miniMapControl:!1}),t.Map.addInitHook((function(){this.options.miniMapControl&&(this.miniMapControl=(new e).addTo(this))})),e}),window)}({exports:{}});class rn extends lt{constructor(t){super(),at(this,t,sn,nn,s,{})}}function an(e){let n,s,r,a,l,c,h,u;return n=new rn({}),{c(){it(n.$$.fragment),s=$(),r=w("div"),a=$(),l=w("button"),l.textContent="show map bounds",C(r,"id","map"),C(r,"class","svelte-1vbvdrk"),C(l,"id","show-map-position"),C(l,"class","leaflet-bar btn btn-sm btn-outline-secondary svelte-1vbvdrk")},m(i,d){var p;ot(n,i,d),v(i,s,d),v(i,r,d),v(i,a,d),v(i,l,d),c=!0,h||(u=[(p=e[0].call(null,r),p&&o(p.destroy)?p.destroy:t),P(l,"click",k(ln))],h=!0)},p:t,i(t){c||(Q(n.$$.fragment,t),c=!0)},o(t){tt(n.$$.fragment,t),c=!1},d(t){t&&(y(s),y(r),y(a),y(l)),st(n,t),h=!1,i(u)}}}function ln(t){t.target.style.display="none",document.getElementById("map-position").style.display="block"}function cn(t,e,n){let{display_minimap:i=!1}=e,{current_result:o=null}=e,{position_marker:s=null}=e,r=[];function a(t){let e=h(Tt);if(!e)return;if(function(){let t=h(Tt);t&&r.forEach((function(e){t.removeLayer(e)}))}(),s){let t=en.circleMarker(s,{radius:5,weight:2,fillColor:"#ff7800",color:"red",opacity:.75,zIndexOffset:100,clickable:!1});t.bindTooltip(`Search (${s[0]},${s[1]})`).openTooltip(),t.addTo(e),r.push(t)}var n=new URLSearchParams(window.location.search).get("viewbox");if(n){let t=n.split(","),i=en.latLngBounds([t[1],t[0]],[t[3],t[2]]),o=en.rectangle(i,{color:"#69d53e",weight:3,dashArray:"5 5",opacity:.8,fill:!1,interactive:!1});e.addLayer(o),r.push(o)}if(!t)return;let i=t.centroid?t.centroid.coordinates[1]:t.lat,o=t.centroid?t.centroid.coordinates[0]:t.lon,a=t.geometry||t.geojson;if(i&&o){let t=en.circleMarker([i,o],{radius:10,weight:2,fillColor:"#ff7800",color:"blue",opacity:.75});s&&t.bindTooltip("Result").openTooltip(),e.addLayer(t),r.push(t)}if(a){var l=en.geoJson({type:"FeatureCollection",features:[{type:"Feature",geometry:a,properties:{}}]},{style:()=>({interactive:!1,color:"blue"})});e.addLayer(l),r.push(l),e.fitBounds(l.getBounds())}else i&&o&&s?e.fitBounds([[i,o],s],{padding:[50,50]}):i&&o&&e.setView([i,o],10)}return t.$$set=t=>{"display_minimap"in t&&n(1,i=t.display_minimap),"current_result"in t&&n(2,o=t.current_result),"position_marker"in t&&n(3,s=t.position_marker)},t.$$.update=()=>{4&t.$$.dirty&&a(o)},[function(t){let e=function(t){const e=Nominatim_Config.Map_Tile_Attribution;let n=new en.map(t,{attributionControl:!1,scrollWheelZoom:!0,touchZoom:!1,center:[Nominatim_Config.Map_Default_Lat,Nominatim_Config.Map_Default_Lon],zoom:Nominatim_Config.Map_Default_Zoom});if(void 0!==Nominatim_Config.Map_Default_Bounds&&Nominatim_Config.Map_Default_Bounds&&n.fitBounds(Nominatim_Config.Map_Default_Bounds),e&&e.length&&en.control.attribution({prefix:'<a href="https://leafletjs.com/">Leaflet</a>'}).addTo(n),en.tileLayer(Nominatim_Config.Map_Tile_URL,{attribution:e}).addTo(n),i){let t=new en.TileLayer(Nominatim_Config.Map_Tile_URL,{minZoom:0,maxZoom:13,attribution:e});new en.Control.MiniMap(t,{toggleDisplay:!0}).addTo(n)}const o=en.Control.extend({options:{position:"topright"},onAdd:()=>document.getElementById("show-map-position")});return n.addControl(new o),n}(t);return Tt.set(e),a(o),{destroy:()=>{Tt.set(null),e.remove()}}},i,o,s]}let hn=class extends lt{constructor(t){super(),at(this,t,cn,an,s,{display_minimap:1,current_result:2,position_marker:3})}};function un(t){let e,n;return e=new Ce({props:{api_request_params:t[0],bStructuredSearch:t[2]}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.api_request_params=t[0]),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function dn(t){let e,n,i,o,s,r,a,l,c,h;function u(e){t[4](e)}e=new ve({props:{$$slots:{default:[un]},$$scope:{ctx:t}}});let d={reverse_search:!1};return void 0!==t[1]&&(d.current_result=t[1]),s=new Xe({props:d}),D.push((()=>nt(s,"current_result",u))),c=new hn({props:{current_result:t[1],display_minimap:!0}}),{c(){it(e.$$.fragment),n=$(),i=w("div"),o=w("div"),it(s.$$.fragment),a=$(),l=w("div"),it(c.$$.fragment),C(o,"class","sidebar svelte-1d53ob0"),C(l,"id","map-wrapper"),C(l,"class","svelte-1d53ob0"),C(i,"id","content"),C(i,"class","svelte-1d53ob0")},m(t,r){ot(e,t,r),v(t,n,r),v(t,i,r),g(i,o),ot(s,o,null),g(i,a),g(i,l),ot(c,l,null),h=!0},p(t,[n]){const i={};65&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};!r&&2&n&&(r=!0,o.current_result=t[1],W((()=>r=!1))),s.$set(o);const a={};2&n&&(a.current_result=t[1]),c.$set(a)},i(t){h||(Q(e.$$.fragment,t),Q(s.$$.fragment,t),Q(c.$$.fragment,t),h=!0)},o(t){tt(e.$$.fragment,t),tt(s.$$.fragment,t),tt(c.$$.fragment,t),h=!1},d(t){t&&(y(n),y(i)),st(e,t),st(s),st(c)}}}function pn(t,e,n){let i,o,s;return u(t,Ct,(t=>n(3,i=t))),t.$$.update=()=>{if(8&t.$$.dirty){let t=i;"search"===t.tab&&function(t){jt(),n(0,o={q:t.get("q"),street:t.get("street"),city:t.get("city"),county:t.get("county"),state:t.get("state"),country:t.get("country"),postalcode:t.get("postalcode"),polygon_geojson:Nominatim_Config.Search_AreaPolygons?1:0,viewbox:t.get("viewbox"),bounded:t.get("bounded"),dedupe:t.has("dedupe")&&"1"!==t.get("dedupe")?0:1,"accept-language":t.get("accept-language"),countrycodes:t.get("countrycodes"),limit:t.get("limit"),polygon_threshold:t.get("polygon_threshold"),exclude_place_ids:t.get("exclude_place_ids"),format:"jsonv2"});let e=o.street||o.city||o.county||o.state||o.country||o.postalcode;o.q||e?Nt("search",o,(function(t){Pt.set(t),e?(jt("Result for "+[o.street,o.city,o.county,o.state,o.country,o.postalcode].filter((t=>t&&t.length>1)).join(", ")),document.querySelector(".nav-tabs a[href='#structured']").click(),document.querySelector("input[name=street]").focus()):(jt("Result for "+o.q),document.querySelector("input[name=q]").focus())})):Pt.set(void 0)}(t.params)}},[o,s,undefined,i,function(t){s=t,n(1,s)}]}class mn extends lt{constructor(t){super(),at(this,t,pn,dn,s,{})}}function fn(t,e,n){const i=t.slice();return i[9]=e[n],i[11]=n,i}function _n(e){let n;return{c(){n=w("option"),n.textContent=`${e[11]} - ${e[9]}`,n.__value=e[11],A(n,n.__value)},m(t,e){v(t,n,e)},p:t,d(t){t&&y(n)}}}function gn(t){let e,n,o,s,r,a,l,c,h,u,d,p,m,f,_,x,L,T,E,O,z,I,N,B,D,Z=et(["Continent / Sea","","","Country","","State","Region","","County","","City","","Town / Borough","Village / Suburb","Neighbourhood","Locality","Major Street","Minor Street","Building"]),j=[];for(let e=0;e<Z.length;e+=1)j[e]=_n(fn(t,Z,e));return{c(){e=w("div"),e.innerHTML='<label for="reverse-lat" class="svelte-1s4hp9x">lat</label>',n=$(),o=w("div"),s=w("input"),r=$(),a=w("div"),l=w("button"),l.textContent="<>",c=$(),h=w("div"),h.innerHTML='<label for="reverse-lon" class="svelte-1s4hp9x">lon</label>',u=$(),d=w("div"),p=w("input"),m=$(),f=w("div"),f.innerHTML='<label for="reverse-zoom" class="svelte-1s4hp9x">max zoom</label>',_=$(),x=w("div"),L=w("select"),T=w("option"),T.textContent="---";for(let t=0;t<j.length;t+=1)j[t].c();E=$(),O=w("input"),I=$(),N=w("div"),N.innerHTML='<button type="submit" class="btn btn-primary btn-sm mx-1">Search</button>',C(e,"class","col-auto"),C(s,"id","reverse-lat"),C(s,"name","lat"),C(s,"type","text"),C(s,"class","form-control form-control-sm d-inline svelte-1s4hp9x"),C(s,"placeholder","latitude"),C(s,"pattern","^-?\\d+(\\.\\d+)?$"),C(o,"class","col-auto"),C(l,"id","switch-coords"),C(l,"class","btn btn-outline-secondary btn-sm svelte-1s4hp9x"),C(l,"title","switch lat and lon"),C(a,"class","col-auto"),C(h,"class","col-auto"),C(p,"id","reverse-lon"),C(p,"name","lon"),C(p,"type","text"),C(p,"class","form-control form-control-sm svelte-1s4hp9x"),C(p,"placeholder","longitude"),C(p,"pattern","^-?\\d+(\\.\\d+)?$"),C(d,"class","col-auto"),C(f,"class","col-auto"),T.__value="",A(T,T.__value),C(L,"id","reverse-zoom"),C(L,"name","zoom"),C(L,"class","form-select form-select-sm svelte-1s4hp9x"),void 0===t[2]&&F((()=>t[8].call(L))),C(x,"class","col-auto"),C(O,"type","hidden"),C(O,"name","layer"),O.value=z=t[3].layer||"",C(N,"class","col-auto")},m(i,y){v(i,e,y),v(i,n,y),v(i,o,y),g(o,s),A(s,t[0]),v(i,r,y),v(i,a,y),g(a,l),v(i,c,y),v(i,h,y),v(i,u,y),v(i,d,y),g(d,p),A(p,t[1]),v(i,m,y),v(i,f,y),v(i,_,y),v(i,x,y),g(x,L),g(L,T);for(let t=0;t<j.length;t+=1)j[t]&&j[t].m(L,null);S(L,t[2],!0),v(i,E,y),v(i,O,y),v(i,I,y),v(i,N,y),B||(D=[P(s,"input",t[5]),P(s,"change",yn),P(l,"click",k(M(t[6]))),P(p,"input",t[7]),P(L,"change",t[8])],B=!0)},p(t,e){1&e&&s.value!==t[0]&&A(s,t[0]),2&e&&p.value!==t[1]&&A(p,t[1]),4&e&&S(L,t[2]),8&e&&z!==(z=t[3].layer||"")&&(O.value=z)},d(t){t&&(y(e),y(n),y(o),y(r),y(a),y(c),y(h),y(u),y(d),y(m),y(f),y(_),y(x),y(E),y(O),y(I),y(N)),b(j,t),B=!1,i(D)}}}function vn(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m;return e=new we({props:{page:"reverse",$$slots:{default:[gn]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment),n=$(),i=w("details"),o=w("summary"),o.innerHTML="<small>Advanced options</small>",s=$(),r=w("ul"),a=w("li"),l=w("label"),l.textContent="Layer",c=$(),h=w("input"),C(l,"for","option_layer"),C(l,"class","svelte-1s4hp9x"),C(h,"id","option_layer"),C(h,"name","layer"),C(h,"placeholder","e.g. address,poi,railway,natural,manmade"),h.value=u=t[3].layer||"",C(h,"data-api-param","layer"),C(h,"class","form-control form-control-sm d-inline w-auto api-param-setting"),C(a,"class","svelte-1s4hp9x"),C(r,"class","svelte-1s4hp9x"),C(i,"id","searchAdvancedOptions"),C(i,"class","mt-2 svelte-1s4hp9x")},m(t,u){ot(e,t,u),v(t,n,u),v(t,i,u),g(i,o),g(i,s),g(i,r),g(r,a),g(a,l),g(a,c),g(a,h),d=!0,p||(m=P(h,"change",bn),p=!0)},p(t,[n]){const i={};4111&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i),(!d||8&n&&u!==(u=t[3].layer||"")&&h.value!==u)&&(h.value=u)},i(t){d||(Q(e.$$.fragment,t),d=!0)},o(t){tt(e.$$.fragment,t),d=!1},d(t){t&&(y(n),y(i)),st(e,t),p=!1,m()}}}function yn(t){var e=t.target.value.split(/,|%2C/);2===e.length&&(document.querySelector("input[name=lat]").value=L.Util.trim(e[0]),document.querySelector("input[name=lon]").value=L.Util.trim(e[1]))}function bn(t){document.querySelector("input[name="+t.target.dataset.apiParam+"]").value=t.target.value}function wn(t,e,n){let{lat:i=""}=e,{lon:o=""}=e,{zoom:s=""}=e,{api_request_params:r={}}=e;function a(t,e,n){if(null===t||null===e)return;let i=new URLSearchParams;i.set("lat",t),i.set("lon",e),i.set("zoom",n||s),St("reverse",i)}Tt.subscribe((t=>{t&&t.on("click",(t=>{let e=t.latlng.wrap();a(e.lat.toFixed(5),e.lng.toFixed(5))}))}));return t.$$set=t=>{"lat"in t&&n(0,i=t.lat),"lon"in t&&n(1,o=t.lon),"zoom"in t&&n(2,s=t.zoom),"api_request_params"in t&&n(3,r=t.api_request_params)},[i,o,s,r,a,function(){i=this.value,n(0,i)},()=>a(o,i),function(){o=this.value,n(1,o)},function(){s=function(t){const e=t.querySelector(":checked");return e&&e.__value}(this),n(2,s)}]}class xn extends lt{constructor(t){super(),at(this,t,wn,vn,s,{lat:0,lon:1,zoom:2,api_request_params:3})}}function $n(t){let e,n;return e=new xn({props:{lat:t[0].lat,lon:t[0].lon,zoom:t[0].zoom,api_request_params:t[0]}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.lat=t[0].lat),1&n&&(i.lon=t[0].lon),1&n&&(i.zoom=t[0].zoom),1&n&&(i.api_request_params=t[0]),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function Ln(t){let e,n,i,o,s,r,a,l,c,h;function u(e){t[4](e)}e=new ve({props:{$$slots:{default:[$n]},$$scope:{ctx:t}}});let d={reverse_search:!0};return void 0!==t[1]&&(d.current_result=t[1]),s=new Xe({props:d}),D.push((()=>nt(s,"current_result",u))),c=new hn({props:{current_result:t[1],position_marker:t[2],display_minimap:!0}}),{c(){it(e.$$.fragment),n=$(),i=w("div"),o=w("div"),it(s.$$.fragment),a=$(),l=w("div"),it(c.$$.fragment),C(o,"class","sidebar svelte-1d53ob0"),C(l,"id","map-wrapper"),C(l,"class","svelte-1d53ob0"),C(i,"id","content"),C(i,"class","svelte-1d53ob0")},m(t,r){ot(e,t,r),v(t,n,r),v(t,i,r),g(i,o),ot(s,o,null),g(i,a),g(i,l),ot(c,l,null),h=!0},p(t,[n]){const i={};65&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};!r&&2&n&&(r=!0,o.current_result=t[1],W((()=>r=!1))),s.$set(o);const a={};2&n&&(a.current_result=t[1]),4&n&&(a.position_marker=t[2]),c.$set(a)},i(t){h||(Q(e.$$.fragment,t),Q(s.$$.fragment,t),Q(c.$$.fragment,t),h=!0)},o(t){tt(e.$$.fragment,t),tt(s.$$.fragment,t),tt(c.$$.fragment,t),h=!1},d(t){t&&(y(n),y(i)),st(e,t),st(s),st(c)}}}function Tn(t,e,n){let i,o,s,r;return u(t,Ct,(t=>n(3,i=t))),t.$$.update=()=>{if(8&t.$$.dirty){let t=i;"reverse"===t.tab&&(e=t.params,jt(),n(0,o={lat:e.get("lat"),lon:e.get("lon"),zoom:e.get("zoom")>1?Number(e.get("zoom")):Number(Nominatim_Config.Reverse_Default_Search_Zoom),layer:e.get("layer"),format:"jsonv2"}),o.lat||o.lat?Nt("reverse",o,(function(t){n(2,r=[o.lat,o.lon]),t&&!t.error?Pt.set([t]):Pt.set([]),jt("Reverse result for "+o.lat+","+o.lon),document.querySelector("input[name=lat]").focus()})):Pt.set(void 0))}var e},[o,s,r,i,function(t){s=t,n(1,s)}]}class Pn extends lt{constructor(t){super(),at(this,t,Tn,Ln,s,{})}}function Mn(e){let n,i,o,s,r,a,l,c,h,u,d;return{c(){n=w("form"),i=w("div"),o=w("div"),s=w("input"),a=$(),l=w("div"),l.innerHTML='<button type="submit" class="btn btn-primary btn-sm">Show</button>',c=$(),h=w("small"),h.innerHTML='OSM type+id (<em class="svelte-1kvo9ki">N123</em>,\n <em class="svelte-1kvo9ki">n123</em>,\n <em class="svelte-1kvo9ki">W123</em>,\n <em class="svelte-1kvo9ki">w123</em>,\n <em class="svelte-1kvo9ki">R123</em>,\n <em class="svelte-1kvo9ki">r123</em>),\n Place id (<em class="svelte-1kvo9ki">1234</em>) or\n URL (<em class="svelte-1kvo9ki">https://openstreetmap.org/way/123</em>)',C(s,"type","edit"),C(s,"class","form-control form-control-sm me-1 svelte-1kvo9ki"),C(s,"pattern","^[1-9][0-9]*$|^[NWRnwr]-?[1-9][0-9]*$|.*openstreetmap.*"),s.value=r=(e[0].osmtype||"")+(e[0].osmid||"")+(e[0].place_id||""),C(o,"class","col-auto"),C(l,"class","col-auto"),C(i,"class","row g-1"),C(n,"class","form-inline svelte-1kvo9ki"),C(n,"action","details.html"),C(h,"class","form-text text-muted svelte-1kvo9ki")},m(t,r){v(t,n,r),g(n,i),g(i,o),g(o,s),g(i,a),g(i,l),v(t,c,r),v(t,h,r),u||(d=P(n,"submit",M(e[1])),u=!0)},p(t,[e]){1&e&&r!==(r=(t[0].osmtype||"")+(t[0].osmid||"")+(t[0].place_id||""))&&s.value!==r&&(s.value=r)},i:t,o:t,d(t){t&&(y(n),y(c),y(h)),u=!1,d()}}}function kn(t,e,n){let{api_request_params:i={}}=e;return t.$$set=t=>{"api_request_params"in t&&n(0,i=t.api_request_params)},[i,function(t){let e=t.target.querySelector("input[type=edit]").value.trim(),n=e.match(/^\s*([NWR])(-?\d+)\s*$/i)||e.match(/\/(relation|way|node)\/(-?\d+)\s*$/);var i=new URLSearchParams;if(n)i.set("osmtype",n[1].charAt(0).toUpperCase()),i.set("osmid",n[2]);else{if(!e.match(/^\d+$/))return void alert("invalid input");i.set("place_id",e)}St("details",i)}]}class Cn extends lt{constructor(t){super(),at(this,t,kn,Mn,s,{api_request_params:0})}}function En(e){let n;return{c(){n=w("span"),n.textContent="No Name",C(n,"class","noname")},m(t,e){v(t,n,e)},p:t,d(t){t&&y(n)}}}function An(t){let e,n=t[0].localname+"";return{c(){e=x(n)},m(t,n){v(t,e,n)},p(t,i){1&i&&n!==(n=t[0].localname+"")&&E(e,n)},d(t){t&&y(e)}}}function Sn(t){let e,n;return e=new Ft({props:{page:"search",params_hash:{postalcode:t[0].localname,country:t[3]},$$slots:{default:[In]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};9&n&&(i.params_hash={postalcode:t[0].localname,country:t[3]}),64&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function On(t){let e,n;return e=new Ft({props:{page:"search",params_hash:{country:t[0].localname},$$slots:{default:[Nn]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.params_hash={country:t[0].localname}),64&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function zn(t){let e,n;return e=new Se({props:{feature:t[0],$$slots:{default:[Bn]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.feature=t[0]),64&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function In(t){let e;return{c(){e=x("search by name")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function Nn(t){let e;return{c(){e=x("search by name")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function Bn(t){let e;return{c(){e=x("details")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function Dn(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,b,L,T,P,M,k=wt(t[0])+"",A=ft(t[0])+"",S=t[0].rank_address+"",z=xt(t[0].admin_level)+"",I=$t(t[0].distance,t[1])+"";function N(t,e){return t[0].localname?An:En}let B=N(t),D=B(t);const Z=[zn,On,Sn],j=[];function R(t,e){return 17&e&&(L=null),t[0].osm_id?0:(null==L&&(L=!(t[4]||!t[0].type.match(/^country/))),L?1:t[4]||"postcode"!==t[0].type?-1:2)}return~(T=R(t,-1))&&(P=j[T]=Z[T](t)),{c(){e=w("tr"),n=w("td"),D.c(),i=$(),o=w("td"),s=x(k),r=$(),a=w("td"),l=$(),c=w("td"),h=x(S),u=$(),d=w("td"),p=x(z),m=$(),f=w("td"),_=$(),b=w("td"),P&&P.c(),C(n,"class","name fw-bold svelte-6a43i0"),C(o,"class","svelte-6a43i0"),C(a,"class","svelte-6a43i0"),C(c,"class","svelte-6a43i0"),C(d,"class","svelte-6a43i0"),C(f,"class","svelte-6a43i0"),C(b,"class","svelte-6a43i0"),C(e,"class","svelte-6a43i0"),O(e,"notused",t[2]&&!t[5])},m(t,y){v(t,e,y),g(e,n),D.m(n,null),g(e,i),g(e,o),g(o,s),g(e,r),g(e,a),a.innerHTML=A,g(e,l),g(e,c),g(c,h),g(e,u),g(e,d),g(d,p),g(e,m),g(e,f),f.innerHTML=I,g(e,_),g(e,b),~T&&j[T].m(b,null),M=!0},p(t,[i]){B===(B=N(t))&&D?D.p(t,i):(D.d(1),D=B(t),D&&(D.c(),D.m(n,null))),(!M||1&i)&&k!==(k=wt(t[0])+"")&&E(s,k),(!M||1&i)&&A!==(A=ft(t[0])+"")&&(a.innerHTML=A),(!M||1&i)&&S!==(S=t[0].rank_address+"")&&E(h,S),(!M||1&i)&&z!==(z=xt(t[0].admin_level)+"")&&E(p,z),(!M||3&i)&&I!==(I=$t(t[0].distance,t[1])+"")&&(f.innerHTML=I);let o=T;T=R(t,i),T===o?~T&&j[T].p(t,i):(P&&(X(),tt(j[o],1,1,(()=>{j[o]=null})),J()),~T?(P=j[T],P?P.p(t,i):(P=j[T]=Z[T](t),P.c()),Q(P,1),P.m(b,null)):P=null),(!M||36&i)&&O(e,"notused",t[2]&&!t[5])},i(t){M||(Q(P),M=!0)},o(t){tt(P),M=!1},d(t){t&&y(e),D.d(),~T&&j[T].d()}}}function Zn(t,e,n){let i,o,{addressLine:s}=e,{bDistanceInMeters:r}=e,{bMarkUnusedLines:a=!1}=e,{sCountryCode:l}=e;return t.$$set=t=>{"addressLine"in t&&n(0,s=t.addressLine),"bDistanceInMeters"in t&&n(1,r=t.bDistanceInMeters),"bMarkUnusedLines"in t&&n(2,a=t.bMarkUnusedLines),"sCountryCode"in t&&n(3,l=t.sCountryCode)},t.$$.update=()=>{1&t.$$.dirty&&n(5,i=s.isaddress)},n(4,o=Nominatim_Config.Reverse_Only),[s,r,a,l,o,i]}class jn extends lt{constructor(t){super(),at(this,t,Zn,Dn,s,{addressLine:0,bDistanceInMeters:1,bMarkUnusedLines:2,sCountryCode:3})}}function Rn(e){let n,o,s,r,a,l,c,h,u,d,p,m,f,_,b,L,T;return{c(){n=x("("),o=w("a"),o.textContent="how?",s=x(")\n\n"),r=w("div"),a=w("button"),l=$(),c=w("p"),c.innerHTML='Nightly calculated from nearby places having this postcode.\n <a href="https://nominatim.org/release-docs/latest/admin/Maintenance/#updating-postcodes">Documentation\n </a>.',h=$(),u=w("p"),d=x("You can search for those with an\n "),p=w("a"),m=x("Overpass Turbo query"),f=x("."),_=$(),b=w("p"),b.innerHTML='<a href="https://nominatim.org/2022/06/26/state-of-postcodes.html" target="_blank" rel="noreferrer">How Nominatim uses postcodes</a>.',C(o,"href","#openHint"),C(a,"type","button"),C(a,"class","btn-close float-end m-1"),C(a,"aria-label","Close"),C(p,"href",e[0]),C(p,"target","_blank"),C(p,"rel","noreferrer"),C(r,"id","postcode-hint"),C(r,"class","my-2 p-2 svelte-6dtaih")},m(t,e){v(t,n,e),v(t,o,e),v(t,s,e),v(t,r,e),g(r,a),g(r,l),g(r,c),g(r,h),g(r,u),g(u,d),g(u,p),g(p,m),g(u,f),g(r,_),g(r,b),L||(T=[P(o,"click",k(M(Hn))),P(a,"click",k(Fn))],L=!0)},p:t,i:t,o:t,d(t){t&&(y(n),y(o),y(s),y(r)),L=!1,i(T)}}}function Hn(){document.getElementById("postcode-hint").style.display="block"}function Fn(){document.getElementById("postcode-hint").style.display="none"}function Wn(t,e,n){let{postcode:i}=e,{lat:o}=e,{lon:s}=e,r=`\n // Based on the map bounds, you can zoom out and rerun the query\n\n [timeout:30]; // in seconds\n\n // we define a shortcut\n // https://wiki.openstreetmap.org/wiki/Overpass_turbo/Extended_Overpass_Turbo_Queries\n {{postcode=${i}}}\n\n (\n node["addr:postcode"="{{postcode}}"]({{bbox}});\n way["addr:postcode"="{{postcode}}"]({{bbox}});\n relation["addr:postcode"="{{postcode}}"]({{bbox}});\n\n node["postal_code"="{{postcode}}"]({{bbox}});\n way["postal_code"="{{postcode}}"]({{bbox}});\n relation["postal_code"="{{postcode}}"]({{bbox}});\n );\n\n out body;\n >;\n out skel qt;\n `.replace(/^ {4}/gm,""),a="https://overpass-turbo.eu/?Q="+encodeURIComponent(r)+"&C="+encodeURIComponent([o,s,15].join(";"))+"&R";return t.$$set=t=>{"postcode"in t&&n(1,i=t.postcode),"lat"in t&&n(2,o=t.lat),"lon"in t&&n(3,s=t.lon)},[a,i,o,s]}class qn extends lt{constructor(t){super(),at(this,t,Wn,Rn,s,{postcode:1,lat:2,lon:3})}}function Un(t){let e,n,i,o,s,r;const a=t[2].default,l=d(a,t,t[1],null);return{c(){e=w("tr"),n=w("td"),i=x(t[0]),o=$(),s=w("td"),l&&l.c(),C(n,"class","svelte-1184nr4"),C(s,"class","svelte-1184nr4")},m(t,a){v(t,e,a),g(e,n),g(n,i),g(e,o),g(e,s),l&&l.m(s,null),r=!0},p(t,[e]){(!r||1&e)&&E(i,t[0]),l&&l.p&&(!r||2&e)&&f(l,a,t,t[1],r?m(a,t[1],e,null):_(t[1]),null)},i(t){r||(Q(l,t),r=!0)},o(t){tt(l,t),r=!1},d(t){t&&y(e),l&&l.d(t)}}}function Vn(t,e,n){let{$$slots:i={},$$scope:o}=e,{title:s}=e;return t.$$set=t=>{"title"in t&&n(0,s=t.title),"$$scope"in t&&n(1,o=t.$$scope)},[s,o,i]}class Kn extends lt{constructor(t){super(),at(this,t,Vn,Un,s,{title:0})}}function Gn(t,e,n){const i=t.slice();return i[1]=e[n],i}function Yn(t){let e,n,i,o,s,r,a=t[0][t[1]]+"",l=t[1]+"";return{c(){e=w("div"),n=w("span"),i=x(a),o=x(" ("),s=x(l),r=x(")\n "),C(n,"class","name svelte-ndknvb"),C(e,"class","line")},m(t,a){v(t,e,a),g(e,n),g(n,i),g(e,o),g(e,s),g(e,r)},p(t,e){1&e&&a!==(a=t[0][t[1]]+"")&&E(i,a),1&e&&l!==(l=t[1]+"")&&E(s,l)},d(t){t&&y(e)}}}function Xn(e){let n,i=et(Object.keys(e[0])),o=[];for(let t=0;t<i.length;t+=1)o[t]=Yn(Gn(e,i,t));return{c(){for(let t=0;t<o.length;t+=1)o[t].c();n=T()},m(t,e){for(let n=0;n<o.length;n+=1)o[n]&&o[n].m(t,e);v(t,n,e)},p(t,[e]){if(1&e){let s;for(i=et(Object.keys(t[0])),s=0;s<i.length;s+=1){const r=Gn(t,i,s);o[s]?o[s].p(r,e):(o[s]=Yn(r),o[s].c(),o[s].m(n.parentNode,n))}for(;s<o.length;s+=1)o[s].d(1);o.length=i.length}},i:t,o:t,d(t){t&&y(n),b(o,t)}}}function Jn(t,e,n){let{items:i}=e;return t.$$set=t=>{"items"in t&&n(0,i=t.items)},[i]}class Qn extends lt{constructor(t){super(),at(this,t,Jn,Xn,s,{items:0})}}function ti(t,e,n){const i=t.slice();return i[7]=e[n],i}function ei(t,e,n){const i=t.slice();return i[10]=e[n],i}function ni(t,e,n){const i=t.slice();return i[13]=e[n],i}function ii(t,e,n){const i=t.slice();return i[13]=e[n],i}function oi(t,e,n){const i=t.slice();return i[18]=e[n],i}function si(t,e,n){const i=t.slice();return i[18]=e[n],i}function ri(t){let e,n;return e=new Cn({props:{api_request_params:t[2]}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};4&n&&(i.api_request_params=t[2]),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function ai(e){let n;return{c(){n=x("No such place found.")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&y(n)}}}function li(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,b,L,T,P,M,k,A,S,O,z,I,N,B,D,Z,j,R,H,F,W,q,U,V,K,G,Y,et,nt,rt,at,lt,ct,ht,ut,dt,pt,ft,_t,gt,vt,bt,wt,xt,$t,Lt,Tt,Pt=(t[0].localname||`${mt(t[0].osm_type)} ${t[0].osm_id}`)+"",Mt=yt(t[0]);a=new Se({props:{feature:t[0],$$slots:{default:[ci]},$$scope:{ctx:t}}}),h=new Ze({props:{aPlace:t[0]}}),_=new Kn({props:{title:"Name",$$slots:{default:[di]},$$scope:{ctx:t}}}),L=new Kn({props:{title:"Type",$$slots:{default:[pi]},$$scope:{ctx:t}}}),P=new Kn({props:{title:"Last Updated",$$slots:{default:[mi]},$$scope:{ctx:t}}});let kt=Mt&&fi(t);A=new Kn({props:{title:"Search Rank",$$slots:{default:[gi]},$$scope:{ctx:t}}}),O=new Kn({props:{title:"Address Rank",$$slots:{default:[vi]},$$scope:{ctx:t}}});let Ct=t[0].calculated_importance&&yi(t);N=new Kn({props:{title:"Coverage",$$slots:{default:[xi]},$$scope:{ctx:t}}}),D=new Kn({props:{title:"Centre Point (lat,lon)",$$slots:{default:[$i]},$$scope:{ctx:t}}}),j=new Kn({props:{title:"OSM",$$slots:{default:[Li]},$$scope:{ctx:t}}}),H=new Kn({props:{title:"Place Id",$$slots:{default:[Ti]},$$scope:{ctx:t}}});let Et=t[0].calculated_wikipedia&&Pi(t);q=new Kn({props:{title:"Computed Postcode",$$slots:{default:[Ci]},$$scope:{ctx:t}}}),V=new Kn({props:{title:"Address Tags",$$slots:{default:[Ei]},$$scope:{ctx:t}}}),G=new Kn({props:{title:"Extra Tags",$$slots:{default:[Ai]},$$scope:{ctx:t}}}),rt=new hn({props:{current_result:t[0]}});let At=t[0].address&&Si(t),St=t[0].linked_places&&zi(t),Ot=!t[4]&&Ni(t);const zt=[Vi,Ui],It=[];function Nt(t,e){return t[2].hierarchy?0:1}return $t=Nt(t),Lt=It[$t]=zt[$t](t),{c(){e=w("div"),n=w("div"),i=w("h1"),o=x(Pt),s=$(),r=w("small"),it(a.$$.fragment),l=$(),c=w("div"),it(h.$$.fragment),u=$(),d=w("div"),p=w("div"),m=w("table"),f=w("tbody"),it(_.$$.fragment),b=$(),it(L.$$.fragment),T=$(),it(P.$$.fragment),M=$(),kt&&kt.c(),k=$(),it(A.$$.fragment),S=$(),it(O.$$.fragment),z=$(),Ct&&Ct.c(),I=$(),it(N.$$.fragment),B=$(),it(D.$$.fragment),Z=$(),it(j.$$.fragment),R=$(),it(H.$$.fragment),F=$(),Et&&Et.c(),W=$(),it(q.$$.fragment),U=$(),it(V.$$.fragment),K=$(),it(G.$$.fragment),Y=$(),et=w("div"),nt=w("div"),it(rt.$$.fragment),at=$(),lt=w("div"),ct=w("div"),ht=w("h2"),ht.textContent="Address",ut=$(),dt=w("table"),pt=w("thead"),pt.innerHTML="<tr><th>Local name</th> <th>Type</th> <th>OSM</th> <th>Address rank</th> <th>Admin level</th> <th>Distance</th> <th></th></tr>",ft=$(),_t=w("tbody"),At&&At.c(),gt=$(),St&&St.c(),vt=$(),Ot&&Ot.c(),bt=$(),wt=w("tr"),wt.innerHTML='<td colspan="7" class="svelte-1bl6i9w"><h2 class="svelte-1bl6i9w">Parent Of</h2></td>',xt=$(),Lt.c(),C(r,"class","svelte-1bl6i9w"),C(i,"class","svelte-1bl6i9w"),C(n,"class","col-sm-10"),C(c,"class","col-sm-2 text-end"),C(e,"class","row"),C(m,"id","locationdetails"),C(m,"class","table table-striped table-responsive"),C(p,"class","col-md-6"),C(nt,"id","map-wrapper"),C(nt,"class","svelte-1bl6i9w"),C(et,"class","col-md-6"),C(d,"class","row"),C(ht,"class","svelte-1bl6i9w"),C(wt,"class","all-columns svelte-1bl6i9w"),C(dt,"id","address"),C(dt,"class","table table-striped table-small"),C(ct,"class","col-md-12"),C(lt,"class","row")},m(t,y){v(t,e,y),g(e,n),g(n,i),g(i,o),g(i,s),g(i,r),ot(a,r,null),g(e,l),g(e,c),ot(h,c,null),v(t,u,y),v(t,d,y),g(d,p),g(p,m),g(m,f),ot(_,f,null),g(f,b),ot(L,f,null),g(f,T),ot(P,f,null),g(f,M),kt&&kt.m(f,null),g(f,k),ot(A,f,null),g(f,S),ot(O,f,null),g(f,z),Ct&&Ct.m(f,null),g(f,I),ot(N,f,null),g(f,B),ot(D,f,null),g(f,Z),ot(j,f,null),g(f,R),ot(H,f,null),g(f,F),Et&&Et.m(f,null),g(f,W),ot(q,f,null),g(f,U),ot(V,f,null),g(f,K),ot(G,f,null),g(d,Y),g(d,et),g(et,nt),ot(rt,nt,null),v(t,at,y),v(t,lt,y),g(lt,ct),g(ct,ht),g(ct,ut),g(ct,dt),g(dt,pt),g(dt,ft),g(dt,_t),At&&At.m(_t,null),g(_t,gt),St&&St.m(_t,null),g(_t,vt),Ot&&Ot.m(_t,null),g(_t,bt),g(_t,wt),g(_t,xt),It[$t].m(_t,null),Tt=!0},p(t,e){(!Tt||1&e)&&Pt!==(Pt=(t[0].localname||`${mt(t[0].osm_type)} ${t[0].osm_id}`)+"")&&E(o,Pt);const n={};1&e&&(n.feature=t[0]),8388608&e&&(n.$$scope={dirty:e,ctx:t}),a.$set(n);const i={};1&e&&(i.aPlace=t[0]),h.$set(i);const s={};8388609&e&&(s.$$scope={dirty:e,ctx:t}),_.$set(s);const r={};8388609&e&&(r.$$scope={dirty:e,ctx:t}),L.$set(r);const l={};8388609&e&&(l.$$scope={dirty:e,ctx:t}),P.$set(l),1&e&&(Mt=yt(t[0])),Mt?kt?(kt.p(t,e),1&e&&Q(kt,1)):(kt=fi(t),kt.c(),Q(kt,1),kt.m(f,k)):kt&&(X(),tt(kt,1,1,(()=>{kt=null})),J());const c={};8388609&e&&(c.$$scope={dirty:e,ctx:t}),A.$set(c);const u={};8388609&e&&(u.$$scope={dirty:e,ctx:t}),O.$set(u),t[0].calculated_importance?Ct?(Ct.p(t,e),1&e&&Q(Ct,1)):(Ct=yi(t),Ct.c(),Q(Ct,1),Ct.m(f,I)):Ct&&(X(),tt(Ct,1,1,(()=>{Ct=null})),J());const d={};8388609&e&&(d.$$scope={dirty:e,ctx:t}),N.$set(d);const p={};8388609&e&&(p.$$scope={dirty:e,ctx:t}),D.$set(p);const m={};8388609&e&&(m.$$scope={dirty:e,ctx:t}),j.$set(m);const g={};8388609&e&&(g.$$scope={dirty:e,ctx:t}),H.$set(g),t[0].calculated_wikipedia?Et?(Et.p(t,e),1&e&&Q(Et,1)):(Et=Pi(t),Et.c(),Q(Et,1),Et.m(f,W)):Et&&(X(),tt(Et,1,1,(()=>{Et=null})),J());const v={};8388609&e&&(v.$$scope={dirty:e,ctx:t}),q.$set(v);const y={};8388609&e&&(y.$$scope={dirty:e,ctx:t}),V.$set(y);const b={};8388609&e&&(b.$$scope={dirty:e,ctx:t}),G.$set(b);const w={};1&e&&(w.current_result=t[0]),rt.$set(w),t[0].address?At?(At.p(t,e),1&e&&Q(At,1)):(At=Si(t),At.c(),Q(At,1),At.m(_t,gt)):At&&(X(),tt(At,1,1,(()=>{At=null})),J()),t[0].linked_places?St?(St.p(t,e),1&e&&Q(St,1)):(St=zi(t),St.c(),Q(St,1),St.m(_t,vt)):St&&(X(),tt(St,1,1,(()=>{St=null})),J()),t[4]?Ot&&(Ot.d(1),Ot=null):Ot?Ot.p(t,e):(Ot=Ni(t),Ot.c(),Ot.m(_t,bt));let x=$t;$t=Nt(t),$t===x?It[$t].p(t,e):(X(),tt(It[x],1,1,(()=>{It[x]=null})),J(),Lt=It[$t],Lt?Lt.p(t,e):(Lt=It[$t]=zt[$t](t),Lt.c()),Q(Lt,1),Lt.m(_t,null))},i(t){Tt||(Q(a.$$.fragment,t),Q(h.$$.fragment,t),Q(_.$$.fragment,t),Q(L.$$.fragment,t),Q(P.$$.fragment,t),Q(kt),Q(A.$$.fragment,t),Q(O.$$.fragment,t),Q(Ct),Q(N.$$.fragment,t),Q(D.$$.fragment,t),Q(j.$$.fragment,t),Q(H.$$.fragment,t),Q(Et),Q(q.$$.fragment,t),Q(V.$$.fragment,t),Q(G.$$.fragment,t),Q(rt.$$.fragment,t),Q(At),Q(St),Q(Lt),Tt=!0)},o(t){tt(a.$$.fragment,t),tt(h.$$.fragment,t),tt(_.$$.fragment,t),tt(L.$$.fragment,t),tt(P.$$.fragment,t),tt(kt),tt(A.$$.fragment,t),tt(O.$$.fragment,t),tt(Ct),tt(N.$$.fragment,t),tt(D.$$.fragment,t),tt(j.$$.fragment,t),tt(H.$$.fragment,t),tt(Et),tt(q.$$.fragment,t),tt(V.$$.fragment,t),tt(G.$$.fragment,t),tt(rt.$$.fragment,t),tt(At),tt(St),tt(Lt),Tt=!1},d(t){t&&(y(e),y(u),y(d),y(at),y(lt)),st(a),st(h),st(_),st(L),st(P),kt&&kt.d(),st(A),st(O),Ct&&Ct.d(),st(N),st(D),st(j),st(H),Et&&Et.d(),st(q),st(V),st(G),st(rt),At&&At.d(),St&&St.d(),Ot&&Ot.d(),It[$t].d()}}}function ci(t){let e;return{c(){e=x("link to this page")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function hi(e){let n;return{c(){n=w("span"),n.textContent="No Name",C(n,"class","noname fw-bold")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&y(n)}}}function ui(t){let e,n;return e=new Qn({props:{items:t[0].names}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.items=t[0].names),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function di(t){let e,n,i,o,s;const r=[ui,hi],a=[];function l(t,n){return 1&n&&(e=null),null==e&&(e=!(!t[0].names||"object"!=typeof t[0].names||!Object.keys(t[0].names).length)),e?0:1}return n=l(t,-1),i=a[n]=r[n](t),{c(){i.c(),o=T()},m(t,e){a[n].m(t,e),v(t,o,e),s=!0},p(t,e){let s=n;n=l(t,e),n===s?a[n].p(t,e):(X(),tt(a[s],1,1,(()=>{a[s]=null})),J(),i=a[n],i?i.p(t,e):(i=a[n]=r[n](t),i.c()),Q(i,1),i.m(o.parentNode,o))},i(t){s||(Q(i),s=!0)},o(t){tt(i),s=!1},d(t){t&&y(o),a[n].d(t)}}}function pi(t){let e,n,i,o=t[0].category+"",s=t[0].type+"";return{c(){e=x(o),n=x(":"),i=x(s)},m(t,o){v(t,e,o),v(t,n,o),v(t,i,o)},p(t,n){1&n&&o!==(o=t[0].category+"")&&E(e,o),1&n&&s!==(s=t[0].type+"")&&E(i,s)},d(t){t&&(y(e),y(n),y(i))}}}function mi(t){let e,n=t[0].indexed_date+"";return{c(){e=x(n)},m(t,n){v(t,e,n)},p(t,i){1&i&&n!==(n=t[0].indexed_date+"")&&E(e,n)},d(t){t&&y(e)}}}function fi(t){let e,n;return e=new Kn({props:{title:"Admin Level",$$slots:{default:[_i]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};8388609&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function _i(t){let e,n=t[0].admin_level+"";return{c(){e=x(n)},m(t,n){v(t,e,n)},p(t,i){1&i&&n!==(n=t[0].admin_level+"")&&E(e,n)},d(t){t&&y(e)}}}function gi(t){let e,n=t[0].rank_search+"";return{c(){e=x(n)},m(t,n){v(t,e,n)},p(t,i){1&i&&n!==(n=t[0].rank_search+"")&&E(e,n)},d(t){t&&y(e)}}}function vi(t){let e,n,i,o,s=t[0].rank_address+"",r=bt(t[0].rank_address)+"";return{c(){e=x(s),n=x(" ("),i=x(r),o=x(")")},m(t,s){v(t,e,s),v(t,n,s),v(t,i,s),v(t,o,s)},p(t,n){1&n&&s!==(s=t[0].rank_address+"")&&E(e,s),1&n&&r!==(r=bt(t[0].rank_address)+"")&&E(i,r)},d(t){t&&(y(e),y(n),y(i),y(o))}}}function yi(t){let e,n;return e=new Kn({props:{title:"Importance",$$slots:{default:[wi]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};8388609&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function bi(t){let e;return{c(){e=x("(estimated)")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function wi(t){let e,n,i,o=t[0].calculated_importance+"",s=!t[0].importance&&bi();return{c(){e=x(o),n=$(),s&&s.c(),i=T()},m(t,o){v(t,e,o),v(t,n,o),s&&s.m(t,o),v(t,i,o)},p(t,n){1&n&&o!==(o=t[0].calculated_importance+"")&&E(e,o),t[0].importance?s&&(s.d(1),s=null):s||(s=bi(),s.c(),s.m(i.parentNode,i))},d(t){t&&(y(e),y(n),y(i)),s&&s.d(t)}}}function xi(t){let e,n=vt(t[0])+"";return{c(){e=x(n)},m(t,n){v(t,e,n)},p(t,i){1&i&&n!==(n=vt(t[0])+"")&&E(e,n)},d(t){t&&y(e)}}}function $i(t){let e,n,i,o=t[0].centroid.coordinates[1]+"",s=t[0].centroid.coordinates[0]+"";return{c(){e=x(o),n=x(","),i=x(s)},m(t,o){v(t,e,o),v(t,n,o),v(t,i,o)},p(t,n){1&n&&o!==(o=t[0].centroid.coordinates[1]+"")&&E(e,o),1&n&&s!==(s=t[0].centroid.coordinates[0]+"")&&E(i,s)},d(t){t&&(y(e),y(n),y(i))}}}function Li(t){let e,n,i=ft(t[0])+"";return{c(){e=new z(!1),n=T(),e.a=n},m(t,o){e.m(i,t,o),v(t,n,o)},p(t,n){1&n&&i!==(i=ft(t[0])+"")&&e.p(i)},d(t){t&&(y(n),e.d())}}}function Ti(t){let e,n,i,o,s=t[0].place_id+"";return{c(){e=x(s),n=x("\n ("),i=w("a"),i.textContent="on this server\n ",o=x(")"),C(i,"href","https://nominatim.org/release-docs/develop/api/Output/#place_id-is-not-a-persistent-id")},m(t,s){v(t,e,s),v(t,n,s),v(t,i,s),v(t,o,s)},p(t,n){1&n&&s!==(s=t[0].place_id+"")&&E(e,s)},d(t){t&&(y(e),y(n),y(i),y(o))}}}function Pi(t){let e,n;return e=new Kn({props:{title:"Wikipedia Calculated",$$slots:{default:[Mi]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};8388609&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function Mi(t){let e,n,i=gt(t[0])+"";return{c(){e=new z(!1),n=T(),e.a=n},m(t,o){e.m(i,t,o),v(t,n,o)},p(t,n){1&n&&i!==(i=gt(t[0])+"")&&e.p(i)},d(t){t&&(y(n),e.d())}}}function ki(t){let e,n,i,o,s=t[0].calculated_postcode+"";return i=new qn({props:{postcode:t[0].calculated_postcode,lat:t[0].centroid.coordinates[1],lon:t[0].centroid.coordinates[0]}}),{c(){e=x(s),n=$(),it(i.$$.fragment)},m(t,s){v(t,e,s),v(t,n,s),ot(i,t,s),o=!0},p(t,n){(!o||1&n)&&s!==(s=t[0].calculated_postcode+"")&&E(e,s);const r={};1&n&&(r.postcode=t[0].calculated_postcode),1&n&&(r.lat=t[0].centroid.coordinates[1]),1&n&&(r.lon=t[0].centroid.coordinates[0]),i.$set(r)},i(t){o||(Q(i.$$.fragment,t),o=!0)},o(t){tt(i.$$.fragment,t),o=!1},d(t){t&&(y(e),y(n)),st(i,t)}}}function Ci(t){let e,n,i=t[0].calculated_postcode&&ki(t);return{c(){i&&i.c(),e=T()},m(t,o){i&&i.m(t,o),v(t,e,o),n=!0},p(t,n){t[0].calculated_postcode?i?(i.p(t,n),1&n&&Q(i,1)):(i=ki(t),i.c(),Q(i,1),i.m(e.parentNode,e)):i&&(X(),tt(i,1,1,(()=>{i=null})),J())},i(t){n||(Q(i),n=!0)},o(t){tt(i),n=!1},d(t){t&&y(e),i&&i.d(t)}}}function Ei(t){let e,n;return e=new Qn({props:{items:t[0].addresstags}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.items=t[0].addresstags),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function Ai(t){let e,n;return e=new Qn({props:{items:t[0].extratags}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.items=t[0].extratags),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function Si(t){let e,n,i=et(t[0].address),o=[];for(let e=0;e<i.length;e+=1)o[e]=Oi(si(t,i,e));const s=t=>tt(o[t],1,1,(()=>{o[t]=null}));return{c(){for(let t=0;t<o.length;t+=1)o[t].c();e=T()},m(t,i){for(let e=0;e<o.length;e+=1)o[e]&&o[e].m(t,i);v(t,e,i),n=!0},p(t,n){if(1&n){let r;for(i=et(t[0].address),r=0;r<i.length;r+=1){const s=si(t,i,r);o[r]?(o[r].p(s,n),Q(o[r],1)):(o[r]=Oi(s),o[r].c(),Q(o[r],1),o[r].m(e.parentNode,e))}for(X(),r=i.length;r<o.length;r+=1)s(r);J()}},i(t){if(!n){for(let t=0;t<i.length;t+=1)Q(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)tt(o[t]);n=!1},d(t){t&&y(e),b(o,t)}}}function Oi(t){let e,n;return e=new jn({props:{addressLine:t[18],bMarkUnusedLines:!0,bDistanceInMeters:!1,sCountryCode:to(t[0])}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.addressLine=t[18]),1&n&&(i.sCountryCode=to(t[0])),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function zi(t){let e,n,i,o,s=et(t[0].linked_places),r=[];for(let e=0;e<s.length;e+=1)r[e]=Ii(oi(t,s,e));const a=t=>tt(r[t],1,1,(()=>{r[t]=null}));return{c(){e=w("tr"),e.innerHTML='<td colspan="7" class="svelte-1bl6i9w"><h2 class="svelte-1bl6i9w">Linked Places</h2></td>',n=$();for(let t=0;t<r.length;t+=1)r[t].c();i=T(),C(e,"class","all-columns svelte-1bl6i9w")},m(t,s){v(t,e,s),v(t,n,s);for(let e=0;e<r.length;e+=1)r[e]&&r[e].m(t,s);v(t,i,s),o=!0},p(t,e){if(1&e){let n;for(s=et(t[0].linked_places),n=0;n<s.length;n+=1){const o=oi(t,s,n);r[n]?(r[n].p(o,e),Q(r[n],1)):(r[n]=Ii(o),r[n].c(),Q(r[n],1),r[n].m(i.parentNode,i))}for(X(),n=s.length;n<r.length;n+=1)a(n);J()}},i(t){if(!o){for(let t=0;t<s.length;t+=1)Q(r[t]);o=!0}},o(t){r=r.filter(Boolean);for(let t=0;t<r.length;t+=1)tt(r[t]);o=!1},d(t){t&&(y(e),y(n),y(i)),b(r,t)}}}function Ii(t){let e,n;return e=new jn({props:{addressLine:t[18],bMarkUnusedLines:!0,bDistanceInMeters:!0}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.addressLine=t[18]),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function Ni(t){let e,n,i;function o(t,e){return t[2].keywords?Di:Bi}let s=o(t),r=s(t);return{c(){e=w("tr"),e.innerHTML='<td colspan="7" class="svelte-1bl6i9w"><h2 class="svelte-1bl6i9w">Keywords</h2></td>',n=$(),r.c(),i=T(),C(e,"class","all-columns svelte-1bl6i9w")},m(t,o){v(t,e,o),v(t,n,o),r.m(t,o),v(t,i,o)},p(t,e){s===(s=o(t))&&r?r.p(t,e):(r.d(1),r=s(t),r&&(r.c(),r.m(i.parentNode,i)))},d(t){t&&(y(e),y(n),y(i)),r.d(t)}}}function Bi(t){let e,n,i,o,s;return{c(){e=w("tr"),n=w("td"),i=w("a"),o=x("display keywords"),C(i,"class","btn btn-outline-secondary btn-sm"),C(i,"href",s=t[1]+"&keywords=1")},m(t,s){v(t,e,s),g(e,n),g(n,i),g(i,o)},p(t,e){2&e&&s!==(s=t[1]+"&keywords=1")&&C(i,"href",s)},d(t){t&&y(e)}}}function Di(t){let e,n;function i(t,n){var i;return 1&n&&(e=null),null==e&&(i=t[0],e=!!(i.keywords&&i.keywords.name&&i.keywords.address&&(i.keywords.name.length>0||i.keywords.address.length>0))),e?ji:Zi}let o=i(t,-1),s=o(t);return{c(){s.c(),n=T()},m(t,e){s.m(t,e),v(t,n,e)},p(t,e){o===(o=i(t,e))&&s?s.p(t,e):(s.d(1),s=o(t),s&&(s.c(),s.m(n.parentNode,n)))},d(t){t&&y(n),s.d(t)}}}function Zi(e){let n;return{c(){n=w("tr"),n.innerHTML="<td>Place has no keywords</td>"},m(t,e){v(t,n,e)},p:t,d(t){t&&y(n)}}}function ji(t){let e,n,i,o,s=et(t[0].keywords.name),r=[];for(let e=0;e<s.length;e+=1)r[e]=Hi(ii(t,s,e));let a=t[0].keywords.address&&Fi(t);return{c(){e=w("tr"),e.innerHTML='<td colspan="7" class="svelte-1bl6i9w"><h3 class="svelte-1bl6i9w">Name Keywords</h3></td>',n=$();for(let t=0;t<r.length;t+=1)r[t].c();i=$(),a&&a.c(),o=T(),C(e,"class","all-columns svelte-1bl6i9w")},m(t,s){v(t,e,s),v(t,n,s);for(let e=0;e<r.length;e+=1)r[e]&&r[e].m(t,s);v(t,i,s),a&&a.m(t,s),v(t,o,s)},p(t,e){if(1&e){let n;for(s=et(t[0].keywords.name),n=0;n<s.length;n+=1){const o=ii(t,s,n);r[n]?r[n].p(o,e):(r[n]=Hi(o),r[n].c(),r[n].m(i.parentNode,i))}for(;n<r.length;n+=1)r[n].d(1);r.length=s.length}t[0].keywords.address?a?a.p(t,e):(a=Fi(t),a.c(),a.m(o.parentNode,o)):a&&(a.d(1),a=null)},d(t){t&&(y(e),y(n),y(i),y(o)),b(r,t),a&&a.d(t)}}}function Ri(t){let e,n,i,o=t[13].id+"";return{c(){e=w("td"),n=x("word id: "),i=x(o)},m(t,o){v(t,e,o),g(e,n),g(e,i)},p(t,e){1&e&&o!==(o=t[13].id+"")&&E(i,o)},d(t){t&&y(e)}}}function Hi(t){let e,n,i,o,s=Lt(t[13].token)+"",r=t[13].id&&Ri(t);return{c(){e=w("tr"),n=w("td"),i=x(s),o=$(),r&&r.c()},m(t,s){v(t,e,s),g(e,n),g(n,i),g(e,o),r&&r.m(e,null)},p(t,n){1&n&&s!==(s=Lt(t[13].token)+"")&&E(i,s),t[13].id?r?r.p(t,n):(r=Ri(t),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},d(t){t&&y(e),r&&r.d()}}}function Fi(t){let e,n,i,o=et(t[0].keywords.address),s=[];for(let e=0;e<o.length;e+=1)s[e]=qi(ni(t,o,e));return{c(){e=w("tr"),e.innerHTML='<td colspan="7" class="svelte-1bl6i9w"><h3 class="svelte-1bl6i9w">Address Keywords</h3></td>',n=$();for(let t=0;t<s.length;t+=1)s[t].c();i=T(),C(e,"class","all-columns svelte-1bl6i9w")},m(t,o){v(t,e,o),v(t,n,o);for(let e=0;e<s.length;e+=1)s[e]&&s[e].m(t,o);v(t,i,o)},p(t,e){if(1&e){let n;for(o=et(t[0].keywords.address),n=0;n<o.length;n+=1){const r=ni(t,o,n);s[n]?s[n].p(r,e):(s[n]=qi(r),s[n].c(),s[n].m(i.parentNode,i))}for(;n<s.length;n+=1)s[n].d(1);s.length=o.length}},d(t){t&&(y(e),y(n),y(i)),b(s,t)}}}function Wi(t){let e,n,i,o=t[13].id+"";return{c(){e=w("td"),n=x("word id: "),i=x(o)},m(t,o){v(t,e,o),g(e,n),g(e,i)},p(t,e){1&e&&o!==(o=t[13].id+"")&&E(i,o)},d(t){t&&y(e)}}}function qi(t){let e,n,i,o,s,r=Lt(t[13].token)+"",a=t[13].id&&Wi(t);return{c(){e=w("tr"),n=w("td"),i=x(r),o=$(),a&&a.c(),s=$()},m(t,r){v(t,e,r),g(e,n),g(n,i),g(e,o),a&&a.m(e,null),g(e,s)},p(t,n){1&n&&r!==(r=Lt(t[13].token)+"")&&E(i,r),t[13].id?a?a.p(t,n):(a=Wi(t),a.c(),a.m(e,s)):a&&(a.d(1),a=null)},d(t){t&&y(e),a&&a.d()}}}function Ui(e){let n,i,o,s,r;return{c(){n=w("tr"),i=w("td"),o=w("a"),s=x("display child places"),C(o,"class","btn btn-outline-secondary btn-sm"),C(o,"href",r=e[1]+"&hierarchy=1")},m(t,e){v(t,n,e),g(n,i),g(i,o),g(o,s)},p(t,e){2&e&&r!==(r=t[1]+"&hierarchy=1")&&C(o,"href",r)},i:t,o:t,d(t){t&&y(n)}}}function Vi(t){let e,n,i,o,s;const r=[Gi,Ki],a=[];function l(t,n){return 1&n&&(e=null),null==e&&(e=!(!t[0].hierarchy||"object"!=typeof t[0].hierarchy||!Object.keys(t[0].hierarchy).length)),e?0:1}return n=l(t,-1),i=a[n]=r[n](t),{c(){i.c(),o=T()},m(t,e){a[n].m(t,e),v(t,o,e),s=!0},p(t,e){let s=n;n=l(t,e),n===s?a[n].p(t,e):(X(),tt(a[s],1,1,(()=>{a[s]=null})),J(),i=a[n],i?i.p(t,e):(i=a[n]=r[n](t),i.c()),Q(i,1),i.m(o.parentNode,o))},i(t){s||(Q(i),s=!0)},o(t){tt(i),s=!1},d(t){t&&y(o),a[n].d(t)}}}function Ki(e){let n;return{c(){n=w("tr"),n.innerHTML="<td>Place is not parent of other places</td>"},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&y(n)}}}function Gi(t){let e,n,i,o=Object.keys(t[0].hierarchy)>500,s=et(Object.keys(t[0].hierarchy)),r=[];for(let e=0;e<s.length;e+=1)r[e]=Xi(ti(t,s,e));const a=t=>tt(r[t],1,1,(()=>{r[t]=null}));let l=o&&Ji();return{c(){for(let t=0;t<r.length;t+=1)r[t].c();e=$(),l&&l.c(),n=T()},m(t,o){for(let e=0;e<r.length;e+=1)r[e]&&r[e].m(t,o);v(t,e,o),l&&l.m(t,o),v(t,n,o),i=!0},p(t,i){if(1&i){let n;for(s=et(Object.keys(t[0].hierarchy)),n=0;n<s.length;n+=1){const o=ti(t,s,n);r[n]?(r[n].p(o,i),Q(r[n],1)):(r[n]=Xi(o),r[n].c(),Q(r[n],1),r[n].m(e.parentNode,e))}for(X(),n=s.length;n<r.length;n+=1)a(n);J()}1&i&&(o=Object.keys(t[0].hierarchy)>500),o?l||(l=Ji(),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},i(t){if(!i){for(let t=0;t<s.length;t+=1)Q(r[t]);i=!0}},o(t){r=r.filter(Boolean);for(let t=0;t<r.length;t+=1)tt(r[t]);i=!1},d(t){t&&(y(e),y(n)),b(r,t),l&&l.d(t)}}}function Yi(t){let e,n;return e=new jn({props:{addressLine:t[10],bDistanceInMeters:!0}}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.addressLine=t[10]),e.$set(i)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function Xi(t){let e,n,i,o,s,r,a,l=t[7]+"",c=et(t[0].hierarchy[t[7]]),h=[];for(let e=0;e<c.length;e+=1)h[e]=Yi(ei(t,c,e));const u=t=>tt(h[t],1,1,(()=>{h[t]=null}));return{c(){e=w("tr"),n=w("td"),i=w("h3"),o=x(l),s=$();for(let t=0;t<h.length;t+=1)h[t].c();r=T(),C(i,"class","svelte-1bl6i9w"),C(n,"colspan","7"),C(n,"class","svelte-1bl6i9w"),C(e,"class","all-columns svelte-1bl6i9w")},m(t,l){v(t,e,l),g(e,n),g(n,i),g(i,o),v(t,s,l);for(let e=0;e<h.length;e+=1)h[e]&&h[e].m(t,l);v(t,r,l),a=!0},p(t,e){if((!a||1&e)&&l!==(l=t[7]+"")&&E(o,l),1&e){let n;for(c=et(t[0].hierarchy[t[7]]),n=0;n<c.length;n+=1){const i=ei(t,c,n);h[n]?(h[n].p(i,e),Q(h[n],1)):(h[n]=Yi(i),h[n].c(),Q(h[n],1),h[n].m(r.parentNode,r))}for(X(),n=c.length;n<h.length;n+=1)u(n);J()}},i(t){if(!a){for(let t=0;t<c.length;t+=1)Q(h[t]);a=!0}},o(t){h=h.filter(Boolean);for(let t=0;t<h.length;t+=1)tt(h[t]);a=!1},d(t){t&&(y(e),y(s),y(r)),b(h,t)}}}function Ji(t){let e;return{c(){e=w("p"),e.textContent="There are more child objects which are not shown."},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function Qi(t){let e,n,i,o,s,r;e=new ve({props:{$$slots:{default:[ri]},$$scope:{ctx:t}}});const a=[li,ai],l=[];function c(t,e){return t[0]?0:""!==window.location.search&&t[3]?1:-1}return~(o=c(t))&&(s=l[o]=a[o](t)),{c(){it(e.$$.fragment),n=$(),i=w("div"),s&&s.c(),C(i,"class","container")},m(t,s){ot(e,t,s),v(t,n,s),v(t,i,s),~o&&l[o].m(i,null),r=!0},p(t,[n]){const r={};8388612&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r);let h=o;o=c(t),o===h?~o&&l[o].p(t,n):(s&&(X(),tt(l[h],1,1,(()=>{l[h]=null})),J()),~o?(s=l[o],s?s.p(t,n):(s=l[o]=a[o](t),s.c()),Q(s,1),s.m(i,null)):s=null)},i(t){r||(Q(e.$$.fragment,t),Q(s),r=!0)},o(t){tt(e.$$.fragment,t),tt(s),r=!1},d(t){t&&(y(n),y(i)),st(e,t),~o&&l[o].d()}}}function to(t){let e=t.address.find((t=>"country_code"===t.type));return e?e.localname:null}function eo(t,e,n){let i,o,s,r,a;u(t,Ct,(t=>n(5,o=t)));let l=!1;return t.$$.update=()=>{if(32&t.$$.dirty){let t=o;"details"===t.tab&&(e=t.params,n(2,a={place_id:e.get("place_id"),osmtype:e.get("osmtype"),osmid:e.get("osmid"),class:e.get("class"),keywords:e.get("keywords"),addressdetails:1,hierarchy:"1"===e.get("hierarchy")?1:0,group_hierarchy:1,polygon_geojson:1,format:"json"}),n(3,l=!1),a.place_id||a.osmtype&&a.osmid?(a.place_id?jt("Details for "+a.place_id):jt("Details for "+a.osmtype+a.osmid),Nt("details",a,(function(t){window.scrollTo(0,0),n(3,l=!0),n(0,s=t&&!t.error?t:void 0)}))):n(0,s=void 0),n(1,r=window.location.search))}var e},n(4,i=Nominatim_Config.Reverse_Only),[s,r,a,l,i,o]}class no extends lt{constructor(t){super(),at(this,t,eo,Qi,s,{})}}function io(t,e,n){const i=t.slice();return i[2]=e[n],i}function oo(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,b,L,T,P,M,k,A,S,O,z,I=ft(t[2])+"",N=t[2].class+"",B=t[2].type+"",D=t[2].name+"",Z=(t[2].country_code||"")+"",j=t[2].errormessage+"",R=t[2].updated+"";return{c(){e=w("tr"),n=w("td"),i=$(),o=w("td"),s=x(N),r=$(),a=w("td"),l=x(B),c=$(),h=w("td"),u=x(D),d=$(),p=w("td"),m=x(Z),f=$(),_=w("td"),b=x(j),L=$(),T=w("td"),P=x(R),M=$(),k=w("td"),A=w("a"),S=x("josm"),z=$(),C(A,"href",O="http://localhost:8111/import?url=https://www.openstreetmap.org/api/0.6/"+mt(t[2].osm_type)+"/"+t[2].osm_id+"/full"),C(A,"target","josm")},m(t,y){v(t,e,y),g(e,n),n.innerHTML=I,g(e,i),g(e,o),g(o,s),g(e,r),g(e,a),g(a,l),g(e,c),g(e,h),g(h,u),g(e,d),g(e,p),g(p,m),g(e,f),g(e,_),g(_,b),g(e,L),g(e,T),g(T,P),g(e,M),g(e,k),g(k,A),g(A,S),g(e,z)},p(t,e){1&e&&I!==(I=ft(t[2])+"")&&(n.innerHTML=I),1&e&&N!==(N=t[2].class+"")&&E(s,N),1&e&&B!==(B=t[2].type+"")&&E(l,B),1&e&&D!==(D=t[2].name+"")&&E(u,D),1&e&&Z!==(Z=(t[2].country_code||"")+"")&&E(m,Z),1&e&&j!==(j=t[2].errormessage+"")&&E(b,j),1&e&&R!==(R=t[2].updated+"")&&E(P,R),1&e&&O!==(O="http://localhost:8111/import?url=https://www.openstreetmap.org/api/0.6/"+mt(t[2].osm_type)+"/"+t[2].osm_id+"/full")&&C(A,"href",O)},d(t){t&&y(e)}}}function so(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,L,T=t[0].length+"";e=new ve({});let P=et(t[0]),M=[];for(let e=0;e<P.length;e+=1)M[e]=oo(io(t,P,e));return{c(){it(e.$$.fragment),n=$(),i=w("div"),o=w("div"),s=w("div"),r=w("h1"),r.textContent="Broken polygons",a=$(),l=w("p"),c=x("Total number of broken polygons: "),h=x(T),u=x("."),d=$(),p=w("table"),m=w("thead"),m.innerHTML="<th>OSM object</th> <th>Class</th> <th>Type</th> <th>Name</th> <th>Country Code</th> <th>Error message</th> <th>Updated</th> <th></th>",f=$(),_=w("tbody");for(let t=0;t<M.length;t+=1)M[t].c();C(p,"class","table table-striped table-hover"),C(s,"class","col-sm-12"),C(o,"class","row"),C(i,"class","container")},m(t,y){ot(e,t,y),v(t,n,y),v(t,i,y),g(i,o),g(o,s),g(s,r),g(s,a),g(s,l),g(l,c),g(l,h),g(l,u),g(s,d),g(s,p),g(p,m),g(p,f),g(p,_);for(let t=0;t<M.length;t+=1)M[t]&&M[t].m(_,null);L=!0},p(t,[e]){if((!L||1&e)&&T!==(T=t[0].length+"")&&E(h,T),1&e){let n;for(P=et(t[0]),n=0;n<P.length;n+=1){const i=io(t,P,n);M[n]?M[n].p(i,e):(M[n]=oo(i),M[n].c(),M[n].m(_,null))}for(;n<M.length;n+=1)M[n].d(1);M.length=P.length}},i(t){L||(Q(e.$$.fragment,t),L=!0)},o(t){tt(e.$$.fragment,t),L=!1},d(t){t&&(y(n),y(i)),st(e,t),b(M,t)}}}function ro(t,e,n){let i=[];return N((function(){Nt("polygons",{format:"json"},(function(t){n(0,i=t)})),jt("Broken polygons")})),[i]}class ao extends lt{constructor(t){super(),at(this,t,ro,so,s,{})}}function lo(t,e,n){const i=t.slice();return i[2]=e[n],i}function co(t){let e,n=t[2].place_id+"";return{c(){e=x(n)},m(t,n){v(t,e,n)},p(t,i){1&i&&n!==(n=t[2].place_id+"")&&E(e,n)},d(t){t&&y(e)}}}function ho(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,b,L,T,P=t[2].country_code+"",M=t[2].name+"",k=ft(t[2])+"",C=t[2].class+"",A=t[2].type+"";return i=new Se({props:{feature:t[2],$$slots:{default:[co]},$$scope:{ctx:t}}}),{c(){e=w("tr"),n=w("td"),it(i.$$.fragment),o=$(),s=w("td"),r=x(P),a=$(),l=w("td"),c=x(M),h=$(),u=w("td"),d=$(),p=w("td"),m=x(C),f=$(),_=w("td"),b=x(A),L=$()},m(t,y){v(t,e,y),g(e,n),ot(i,n,null),g(e,o),g(e,s),g(s,r),g(e,a),g(e,l),g(l,c),g(e,h),g(e,u),u.innerHTML=k,g(e,d),g(e,p),g(p,m),g(e,f),g(e,_),g(_,b),g(e,L),T=!0},p(t,e){const n={};1&e&&(n.feature=t[2]),33&e&&(n.$$scope={dirty:e,ctx:t}),i.$set(n),(!T||1&e)&&P!==(P=t[2].country_code+"")&&E(r,P),(!T||1&e)&&M!==(M=t[2].name+"")&&E(c,M),(!T||1&e)&&k!==(k=ft(t[2])+"")&&(u.innerHTML=k),(!T||1&e)&&C!==(C=t[2].class+"")&&E(m,C),(!T||1&e)&&A!==(A=t[2].type+"")&&E(b,A)},i(t){T||(Q(i.$$.fragment,t),T=!0)},o(t){tt(i.$$.fragment,t),T=!1},d(t){t&&y(e),st(i)}}}function uo(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,L=t[0].length+"";e=new ve({});let T=et(t[0]),P=[];for(let e=0;e<T.length;e+=1)P[e]=ho(lo(t,T,e));const M=t=>tt(P[t],1,1,(()=>{P[t]=null}));return{c(){it(e.$$.fragment),n=$(),i=w("div"),o=w("div"),s=w("div"),r=w("h1"),r.textContent="Deletable",a=$(),l=w("p"),c=x(L),h=x(" objects have been deleted in OSM but\n are still in the Nominatim database."),u=$(),d=w("table"),p=w("thead"),p.innerHTML="<th>Place id</th> <th>Country Code</th> <th>Name</th> <th>OSM object</th> <th>Class</th> <th>Type</th>",m=$(),f=w("tbody");for(let t=0;t<P.length;t+=1)P[t].c();C(d,"class","table table-striped table-hover"),C(s,"class","col-sm-12"),C(o,"class","row"),C(i,"class","container")},m(t,y){ot(e,t,y),v(t,n,y),v(t,i,y),g(i,o),g(o,s),g(s,r),g(s,a),g(s,l),g(l,c),g(l,h),g(s,u),g(s,d),g(d,p),g(d,m),g(d,f);for(let t=0;t<P.length;t+=1)P[t]&&P[t].m(f,null);_=!0},p(t,[e]){if((!_||1&e)&&L!==(L=t[0].length+"")&&E(c,L),1&e){let n;for(T=et(t[0]),n=0;n<T.length;n+=1){const i=lo(t,T,n);P[n]?(P[n].p(i,e),Q(P[n],1)):(P[n]=ho(i),P[n].c(),Q(P[n],1),P[n].m(f,null))}for(X(),n=T.length;n<P.length;n+=1)M(n);J()}},i(t){if(!_){Q(e.$$.fragment,t);for(let t=0;t<T.length;t+=1)Q(P[t]);_=!0}},o(t){tt(e.$$.fragment,t),P=P.filter(Boolean);for(let t=0;t<P.length;t+=1)tt(P[t]);_=!1},d(t){t&&(y(n),y(i)),st(e,t),b(P,t)}}}function po(t,e,n){let i=[];return N((function(){Nt("deletable",{format:"json"},(function(t){n(0,i=t)})),jt("Deletable objects")})),[i]}class mo extends lt{constructor(t){super(),at(this,t,po,uo,s,{})}}function fo(t){let e,n,i,o,s,r,a,l,c,h,u,d,p,m,f,_,b,L,T,P,M,k,A,S=t[1].Nominatim_API_Endpoint+"",O=t[0].software_version+"",z=t[0].database_version+"",I=t[0].data_updated+"";return e=new ve({}),{c(){it(e.$$.fragment),n=$(),i=w("div"),o=w("div"),s=w("div"),r=w("h1"),r.textContent="Server status",a=$(),l=w("dl"),c=w("dt"),c.textContent="API Endpoint",h=w("dd"),u=w("a"),d=x(S),p=$(),m=w("dt"),m.textContent="Software version",f=w("dd"),_=x(O),b=w("dt"),b.textContent="Database version",L=w("dd"),T=x(z),P=w("dt"),P.textContent="Data last updated",M=w("dd"),k=x(I),C(u,"href",t[1].Nominatim_API_Endpoint),C(s,"class","col-sm-12"),C(o,"class","row"),C(i,"class","container")},m(t,y){ot(e,t,y),v(t,n,y),v(t,i,y),g(i,o),g(o,s),g(s,r),g(s,a),g(s,l),g(l,c),g(l,h),g(h,u),g(u,d),g(h,p),g(l,m),g(l,f),g(f,_),g(l,b),g(l,L),g(L,T),g(l,P),g(l,M),g(M,k),A=!0},p(t,[e]){(!A||1&e)&&O!==(O=t[0].software_version+"")&&E(_,O),(!A||1&e)&&z!==(z=t[0].database_version+"")&&E(T,z),(!A||1&e)&&I!==(I=t[0].data_updated+"")&&E(k,I)},i(t){A||(Q(e.$$.fragment,t),A=!0)},o(t){tt(e.$$.fragment,t),A=!1},d(t){t&&(y(n),y(i)),st(e,t)}}}function _o(t,e,n){let i={},o=Nominatim_Config;return N((function(){Nt("status",{format:"json"},(function(t){n(0,i=t)})),jt("Server status")})),[i,o]}class go extends lt{constructor(t){super(),at(this,t,_o,fo,s,{})}}function vo(e){let n,i,o,s;return n=new ve({}),{c(){it(n.$$.fragment),i=$(),o=w("div"),C(o,"id","about-help"),C(o,"class","container svelte-1l5yrvt")},m(t,e){ot(n,t,e),v(t,i,e),v(t,o,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){tt(n.$$.fragment,t),s=!1},d(t){t&&(y(i),y(o)),st(n,t)}}}function yo(t){return N((()=>{Dt("theme/about-help.html",document.getElementById("about-help"))})),[]}class bo extends lt{constructor(t){super(),at(this,t,yo,vo,s,{})}}function wo(t){let e,n;return e=new bo({}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function xo(t){let e,n;return e=new go({}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function $o(t){let e,n;return e=new ao({}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function Lo(t){let e,n;return e=new mo({}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function To(t){let e,n;return e=new no({}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function Po(t){let e,n;return e=new Pn({}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function Mo(t){let e,n;return e=new mn({}),{c(){it(e.$$.fragment)},m(t,i){ot(e,t,i),n=!0},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){tt(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function ko(t){let e,n,i,o,s,r,a;const l=[Mo,Po,To,Lo,$o,xo,wo],c=[];function h(t,e){return"search"===t[0]?0:"reverse"===t[0]?1:"details"===t[0]?2:"deletable"===t[0]?3:"polygons"===t[0]?4:"status"===t[0]?5:"about"===t[0]?6:-1}return~(e=h(t))&&(n=c[e]=l[e](t)),o=new zt({}),{c(){n&&n.c(),i=$(),it(o.$$.fragment)},m(n,l){~e&&c[e].m(n,l),v(n,i,l),ot(o,n,l),s=!0,r||(a=P(window,"popstate",t[2]),r=!0)},p(t,[o]){let s=e;e=h(t),e!==s&&(n&&(X(),tt(c[s],1,1,(()=>{c[s]=null})),J()),~e?(n=c[e],n||(n=c[e]=l[e](t),n.c()),Q(n,1),n.m(i.parentNode,i)):n=null)},i(t){s||(Q(n),Q(o.$$.fragment,t),s=!0)},o(t){tt(n),tt(o.$$.fragment,t),s=!1},d(t){t&&y(i),~e&&c[e].d(t),st(o,t),r=!1,a()}}}function Co(t,e,n){let i,o;u(t,Ct,(t=>n(1,o=t))),St();return t.$$.update=()=>{2&t.$$.dirty&&n(0,i=o.tab)},[i,o,()=>St()]}new class extends lt{constructor(t){super(),at(this,t,Co,ko,s,{})}}({target:document.body})}();
//# sourceMappingURL=bundle.js.map