leaflet
Version:
JavaScript library for mobile-friendly interactive maps
5 lines • 145 kB
JavaScript
/* @preserve
* Leaflet 2.0.0-alpha.1, a JS library for interactive maps. https://leafletjs.com
* (c) 2010-2025 Volodymyr Agafonkin, (c) 2010-2011 CloudMade
*/
let lastId=0;function stamp(t){return"_leaflet_id"in t||(t._leaflet_id=++lastId),t._leaflet_id}function throttle(e,i,o){let s,n;function a(){s=!1,n&&(t.apply(o,n),n=!1)}function t(...t){s?n=t:(e.apply(o,t),setTimeout(a,i),s=!0)}return t}function wrapNum(t,e,i){var o=e[1],e=e[0],s=o-e;return t===o&&i?t:((t-e)%s+s)%s+e}function falseFn(){return!1}function formatNum(t,e){return!1===e?t:(e=10**(void 0===e?6:e),Math.round(t*e)/e)}function splitWords(t){return t.trim().split(/\s+/)}function setOptions(t,e){for(var i in Object.hasOwn(t,"options")||(t.options=t.options?Object.create(t.options):{}),e)Object.hasOwn(e,i)&&(t.options[i]=e[i]);return t.options}let templateRe=/\{ *([\w_ -]+) *\}/g;function template(t,o){return t.replace(templateRe,(t,e)=>{let i=o[e];if(void 0===i)throw new Error("No value provided for variable "+t);return i="function"==typeof i?i(o):i})}let emptyImageUrl="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";var Util={__proto__:null,emptyImageUrl:emptyImageUrl,falseFn:falseFn,formatNum:formatNum,get lastId(){return lastId},setOptions:setOptions,splitWords:splitWords,stamp:stamp,template:template,throttle:throttle,wrapNum:wrapNum};class Class{static extend({statics:t,includes:e,...i}){var o=class extends this{},s=(Object.setPrototypeOf(o,this),this.prototype),n=o.prototype;if(t&&Object.assign(o,t),Array.isArray(e))for(var a of e)Object.assign(n,a);else e&&Object.assign(n,e);return Object.assign(n,i),n.options&&(n.options=s.options?Object.create(s.options):{},Object.assign(n.options,i.options)),n._initHooks=[],o}static include(t){var e=this.prototype.options;return Object.assign(this.prototype,t),t.options&&(this.prototype.options=e,this.mergeOptions(t.options)),this}static setDefaultOptions(t){return setOptions(this.prototype,t),this}static mergeOptions(t){return this.prototype.options??={},Object.assign(this.prototype.options,t),this}static addInitHook(t,...e){var i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks??=[],this.prototype._initHooks.push(i),this}constructor(...t){this._initHooksCalled=!1,setOptions(this),this.initialize&&this.initialize(...t),this.callInitHooks()}initialize(){}callInitHooks(){if(!this._initHooksCalled){var e,i=[];let t=this;for(;null!==(t=Object.getPrototypeOf(t));)i.push(t);i.reverse();for(e of i)for(var o of e._initHooks??[])o.call(this);this._initHooksCalled=!0}}}class Evented extends Class{on(t,e,i){if("object"==typeof t)for(var[o,s]of Object.entries(t))this._on(o,s,e);else for(var n of splitWords(t))this._on(n,e,i);return this}off(t,e,i){if(arguments.length)if("object"==typeof t)for(var[o,s]of Object.entries(t))this._off(o,s,e);else{var n,a=1===arguments.length;for(n of splitWords(t))a?this._off(n):this._off(n,e,i)}else delete this._events;return this}_on(t,e,i,o){"function"!=typeof e?console.warn("wrong listener type: "+typeof e):!1===this._listens(t,e,i)&&(e={fn:e,ctx:i=i===this?void 0:i},o&&(e.once=!0),this._events??={},this._events[t]??=[],this._events[t].push(e))}_off(e,i,o){if(this._events){let t=this._events[e];if(t)if(1===arguments.length){if(this._firingCount)for(var s of t)s.fn=falseFn;delete this._events[e]}else"function"!=typeof i?console.warn("wrong listener type: "+typeof i):!1!==(i=this._listens(e,i,o))&&(o=t[i],this._firingCount&&(o.fn=falseFn,this._events[e]=t=t.slice()),t.splice(i,1))}}fire(t,e,i){if(this.listens(t,i)){var o={...e,type:t,target:this,sourceTarget:e?.sourceTarget||this};if(this._events){e=this._events[t];if(e){this._firingCount=this._firingCount+1||1;for(var s of e){var n=s.fn;s.once&&this.off(t,n,s.ctx),n.call(s.ctx||this,o)}this._firingCount--}}i&&this._propagateEvent(o)}return this}listens(t,e,i,o){"string"!=typeof t&&console.warn('"string" type argument expected');let s=e;if("function"!=typeof e&&(o=!!e,i=s=void 0),this._events?.[t]?.length&&!1!==this._listens(t,s,i))return!0;if(o)for(var n of Object.values(this._eventParents??{}))if(n.listens(t,e,i,o))return!0;return!1}_listens(t,e,i){if(!this._events)return!1;t=this._events[t]??[];if(!e)return!!t.length;i===this&&(i=void 0);t=t.findIndex(t=>t.fn===e&&t.ctx===i);return-1!==t&&t}once(t,e,i){if("object"==typeof t)for(var[o,s]of Object.entries(t))this._on(o,s,e,!0);else for(var n of splitWords(t))this._on(n,e,i,!0);return this}addEventParent(t){return this._eventParents??={},this._eventParents[stamp(t)]=t,this}removeEventParent(t){return this._eventParents&&delete this._eventParents[stamp(t)],this}_propagateEvent(t){for(var e of Object.values(this._eventParents??{}))e.fire(t.type,{propagatedFrom:t.target,...t},!0)}}class Point{constructor(t,e,i){if(!Point.validate(t,e))throw new Error(`Invalid Point object: (${t}, ${e})`);let o,s;if(t instanceof Point)return t;s=Array.isArray(t)?(o=t[0],t[1]):"object"==typeof t&&"x"in t&&"y"in t?(o=t.x,t.y):(o=t,e),this.x=i?Math.round(o):o,this.y=i?Math.round(s):s}static validate(t,e){return!!(t instanceof Point||Array.isArray(t))||!!(t&&"object"==typeof t&&"x"in t&&"y"in t)||!(!t&&0!==t||!e&&0!==e)}clone(){var t=new Point(0,0);return t.x=this.x,t.y=this.y,t}add(t){return this.clone()._add(new Point(t))}_add(t){return this.x+=t.x,this.y+=t.y,this}subtract(t){return this.clone()._subtract(new Point(t))}_subtract(t){return this.x-=t.x,this.y-=t.y,this}divideBy(t){return this.clone()._divideBy(t)}_divideBy(t){return this.x/=t,this.y/=t,this}multiplyBy(t){return this.clone()._multiplyBy(t)}_multiplyBy(t){return this.x*=t,this.y*=t,this}scaleBy(t){return new Point(this.x*t.x,this.y*t.y)}unscaleBy(t){return new Point(this.x/t.x,this.y/t.y)}round(){return this.clone()._round()}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}floor(){return this.clone()._floor()}_floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.clone()._ceil()}_ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}trunc(){return this.clone()._trunc()}_trunc(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}distanceTo(t){var e=(t=new Point(t)).x-this.x,t=t.y-this.y;return Math.sqrt(e*e+t*t)}equals(t){return(t=new Point(t)).x===this.x&&t.y===this.y}contains(t){return t=new Point(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)}toString(){return`Point(${formatNum(this.x)}, ${formatNum(this.y)})`}}class Bounds{constructor(t,e){if(t){if(t instanceof Bounds)return t;var i;for(i of e?[t,e]:t)this.extend(i)}}extend(t){let e,i;if(t){if(t instanceof Point||"number"==typeof t[0]||"x"in t)e=i=new Point(t);else if(t=new Bounds(t),e=t.min,i=t.max,!e||!i)return this;this.min||this.max?(this.min.x=Math.min(e.x,this.min.x),this.max.x=Math.max(i.x,this.max.x),this.min.y=Math.min(e.y,this.min.y),this.max.y=Math.max(i.y,this.max.y)):(this.min=e.clone(),this.max=i.clone())}return this}getCenter(t){return new Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)}getBottomLeft(){return new Point(this.min.x,this.max.y)}getTopRight(){return new Point(this.max.x,this.min.y)}getTopLeft(){return this.min}getBottomRight(){return this.max}getSize(){return this.max.subtract(this.min)}contains(t){let e,i;return(t=new("number"==typeof t[0]||t instanceof Point?Point:Bounds)(t))instanceof Bounds?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y}intersects(t){t=new Bounds(t);var e=this.min,i=this.max,o=t.min,t=t.max,s=t.x>=e.x&&o.x<=i.x,e=e.y<=t.y&&o.y<=i.y;return s&&e}overlaps(t){t=new Bounds(t);var e=this.min,i=this.max,o=t.min,t=t.max,s=t.x>e.x&&o.x<i.x,e=e.y<t.y&&o.y<i.y;return s&&e}isValid(){return!(!this.min||!this.max)}pad(t){var e=this.min,i=this.max,o=Math.abs(e.x-i.x)*t,t=Math.abs(e.y-i.y)*t;return new Bounds(new Point(e.x-o,e.y-t),new Point(i.x+o,i.y+t))}equals(t){return!!t&&(t=new Bounds(t),this.min.equals(t.getTopLeft()))&&this.max.equals(t.getBottomRight())}}class LatLngBounds{constructor(t,e){if(t){if(t instanceof LatLngBounds)return t;var i;for(i of e?[t,e]:t)this.extend(i)}}extend(t){var e=this._southWest,i=this._northEast;let o,s;if(t instanceof LatLng)o=t,s=t;else{if(!(t instanceof LatLngBounds))return t?LatLng.validate(t)?this.extend(new LatLng(t)):this.extend(new LatLngBounds(t)):this;if(o=t._southWest,s=t._northEast,!o||!s)return this}return e||i?(e.lat=Math.min(o.lat,e.lat),e.lng=Math.min(o.lng,e.lng),i.lat=Math.max(s.lat,i.lat),i.lng=Math.max(s.lng,i.lng)):(this._southWest=new LatLng(o.lat,o.lng),this._northEast=new LatLng(s.lat,s.lng)),this}pad(t){var e=this._southWest,i=this._northEast,o=Math.abs(e.lat-i.lat)*t,t=Math.abs(e.lng-i.lng)*t;return new LatLngBounds(new LatLng(e.lat-o,e.lng-t),new LatLng(i.lat+o,i.lng+t))}getCenter(){return new LatLng((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)}getSouthWest(){return this._southWest}getNorthEast(){return this._northEast}getNorthWest(){return new LatLng(this.getNorth(),this.getWest())}getSouthEast(){return new LatLng(this.getSouth(),this.getEast())}getWest(){return this._southWest.lng}getSouth(){return this._southWest.lat}getEast(){return this._northEast.lng}getNorth(){return this._northEast.lat}contains(t){t=new(LatLng.validate(t)?LatLng:LatLngBounds)(t);var e=this._southWest,i=this._northEast;let o,s;return t instanceof LatLngBounds?(o=t.getSouthWest(),s=t.getNorthEast()):o=s=t,o.lat>=e.lat&&s.lat<=i.lat&&o.lng>=e.lng&&s.lng<=i.lng}intersects(t){t=new LatLngBounds(t);var e=this._southWest,i=this._northEast,o=t.getSouthWest(),t=t.getNorthEast(),s=t.lat>=e.lat&&o.lat<=i.lat,t=t.lng>=e.lng&&o.lng<=i.lng;return s&&t}overlaps(t){t=new LatLngBounds(t);var e=this._southWest,i=this._northEast,o=t.getSouthWest(),t=t.getNorthEast(),s=t.lat>e.lat&&o.lat<i.lat,t=t.lng>e.lng&&o.lng<i.lng;return s&&t}toBBoxString(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")}equals(t,e){return!!t&&(t=new LatLngBounds(t),this._southWest.equals(t.getSouthWest(),e))&&this._northEast.equals(t.getNorthEast(),e)}isValid(){return!(!this._southWest||!this._northEast)}}class LatLng{constructor(t,e,i){if(!LatLng.validate(t,e,i))throw new Error(`Invalid LatLng object: (${t}, ${e})`);let o,s,n;if(t instanceof LatLng)return t;Array.isArray(t)&&"object"!=typeof t[0]?3===t.length?(o=t[0],s=t[1],n=t[2]):2===t.length&&(o=t[0],s=t[1]):n="object"==typeof t&&"lat"in t?(o=t.lat,s="lng"in t?t.lng:t.lon,t.alt):(o=t,s=e,i),this.lat=+o,this.lng=+s,void 0!==n&&(this.alt=+n)}static validate(t,e,i){return t instanceof LatLng||"object"==typeof t&&"lat"in t||(t&&Array.isArray(t)&&"object"!=typeof t[0]?3===t.length||2===t.length:!(!t&&0!==t||!e&&0!==e))}equals(t,e){return!!t&&(t=new LatLng(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(e??1e-9))}toString(t){return`LatLng(${formatNum(this.lat,t)}, ${formatNum(this.lng,t)})`}distanceTo(t){return Earth.distance(this,new LatLng(t))}wrap(){return Earth.wrapLatLng(this)}toBounds(t){var t=180*t/40075017,e=t/Math.cos(Math.PI/180*this.lat);return new LatLngBounds([this.lat-t,this.lng-e],[this.lat+t,this.lng+e])}clone(){var t=new LatLng(0,0);return t.lat=this.lat,t.lng=this.lng,t.alt=this.alt,t}}class CRS{static projection=void 0;static transformation=void 0;static latLngToPoint(t,e){t=this.projection.project(t),e=this.scale(e);return this.transformation._transform(t,e)}static pointToLatLng(t,e){e=this.scale(e),t=this.transformation.untransform(t,e);return this.projection.unproject(t)}static project(t){return this.projection.project(t)}static unproject(t){return this.projection.unproject(t)}static scale(t){return 256*2**t}static zoom(t){return Math.log(t/256)/Math.LN2}static getProjectedBounds(t){var e,i;return this.infinite?null:(i=this.projection.bounds,t=this.scale(t),e=this.transformation.transform(i.min,t),i=this.transformation.transform(i.max,t),new Bounds(e,i))}static infinite=!1;static wrapLatLng(t){t=new LatLng(t);var e=this.wrapLng?wrapNum(t.lng,this.wrapLng,!0):t.lng,i=this.wrapLat?wrapNum(t.lat,this.wrapLat,!0):t.lat,t=t.alt;return new LatLng(i,e,t)}static wrapLatLngBounds(t){var e=(t=new LatLngBounds(t)).getCenter(),i=this.wrapLatLng(e),o=e.lat-i.lat,e=e.lng-i.lng;return 0==o&&0==e?t:(i=t.getSouthWest(),t=t.getNorthEast(),i=new LatLng(i.lat-o,i.lng-e),o=new LatLng(t.lat-o,t.lng-e),new LatLngBounds(i,o))}}class Earth extends CRS{static wrapLng=[-180,180];static R=6371e3;static distance(t,e){var i=Math.PI/180,o=t.lat*i,s=e.lat*i,n=Math.sin((e.lat-t.lat)*i/2),e=Math.sin((e.lng-t.lng)*i/2),t=n*n+Math.cos(o)*Math.cos(s)*e*e,i=2*Math.atan2(Math.sqrt(t),Math.sqrt(1-t));return this.R*i}}let earthRadius$1=6378137,SphericalMercator={R:earthRadius$1,MAX_LATITUDE:85.0511287798,project(t){t=new LatLng(t);var e=Math.PI/180,i=this.MAX_LATITUDE,i=Math.max(Math.min(i,t.lat),-i),i=Math.sin(i*e);return new Point(this.R*t.lng*e,this.R*Math.log((1+i)/(1-i))/2)},unproject(t){t=new Point(t);var e=180/Math.PI;return new LatLng((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:(()=>{var t=earthRadius$1*Math.PI;return new Bounds([-t,-t],[t,t])})()};class Transformation{constructor(t,e,i,o){Array.isArray(t)?(this._a=t[0],this._b=t[1],this._c=t[2],this._d=t[3]):(this._a=t,this._b=e,this._c=i,this._d=o)}transform(t,e){return this._transform(t.clone(),e)}_transform(t,e){return t.x=(e||=1)*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t}untransform(t,e){return e||=1,new Point((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}}class EPSG3857 extends Earth{static code="EPSG:3857";static projection=SphericalMercator;static transformation=(()=>{var t=.5/(Math.PI*SphericalMercator.R);return new Transformation(t,.5,-t,.5)})()}class EPSG900913 extends EPSG3857{static code="EPSG:900913"}let chrome=userAgentContains("chrome"),safari=!chrome&&userAgentContains("safari"),mobile="undefined"!=typeof orientation||userAgentContains("mobile"),pointer="undefined"!=typeof window&&!!window.PointerEvent,touchNative="undefined"!=typeof window&&("ontouchstart"in window||!!window.TouchEvent),touch=touchNative||pointer,retina="undefined"!=typeof window&&void 0!==window.devicePixelRatio&&1<window.devicePixelRatio,mac="undefined"!=typeof navigator&&void 0!==navigator.platform&&navigator.platform.startsWith("Mac"),linux="undefined"!=typeof navigator&&void 0!==navigator.platform&&navigator.platform.startsWith("Linux");function userAgentContains(t){return"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t)}var Browser={chrome:chrome,safari:safari,mobile:mobile,pointer:pointer,touch:touch,touchNative:touchNative,retina:retina,mac:mac,linux:linux};function makeDblclick(t){let e={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:2,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,button:t.button,buttons:t.buttons,relatedTarget:t.relatedTarget,region:t.region},i;return i=new(t instanceof PointerEvent?(e={...e,pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tangentialPressure:t.tangentialPressure,tiltX:t.tiltX,tiltY:t.tiltY,twist:t.twist,pointerType:t.pointerType,isPrimary:t.isPrimary},PointerEvent):MouseEvent)("dblclick",e)}let delay=200;function addDoubleTapListener(t,e){t.addEventListener("dblclick",e);let i=0,o;function s(t){var e;1!==t.detail?o=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||(e=getPropagationPath(t)).some(t=>t instanceof HTMLLabelElement&&t.attributes.for)&&!e.some(t=>t instanceof HTMLInputElement||t instanceof HTMLSelectElement)||((e=Date.now())-i<=delay?2===++o&&t.target.dispatchEvent(makeDblclick(t)):o=1,i=e)}return t.addEventListener("click",s),{dblclick:e,simDblclick:s}}function removeDoubleTapListener(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}function get(t){return"string"==typeof t?document.getElementById(t):t}function create$1(t,e,i){t=document.createElement(t);return t.className=e??"",i?.appendChild(t),t}function toFront(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function toBack(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function setTransform(t,e,i){e=e??new Point(0,0);t.style.transform=`translate3d(${e.x}px,${e.y}px,0)`+(i?` scale(${i})`:"")}let positions=new WeakMap;function setPosition(t,e){positions.set(t,e),setTransform(t,e)}function getPosition(t){return positions.get(t)??new Point(0,0)}let documentStyle="undefined"==typeof document?{}:document.documentElement.style,userSelectProp=["userSelect","WebkitUserSelect"].find(t=>t in documentStyle),prevUserSelect;function disableTextSelection(){var t=documentStyle[userSelectProp];"none"!==t&&(prevUserSelect=t,documentStyle[userSelectProp]="none")}function enableTextSelection(){void 0!==prevUserSelect&&(documentStyle[userSelectProp]=prevUserSelect,prevUserSelect=void 0)}function disableImageDrag(){on(window,"dragstart",preventDefault)}function enableImageDrag(){off(window,"dragstart",preventDefault)}let _outlineElement,_outlineStyle;function preventOutline(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(restoreOutline(),_outlineElement=t,_outlineStyle=t.style.outlineStyle,t.style.outlineStyle="none",on(window,"keydown",restoreOutline))}function restoreOutline(){_outlineElement&&(_outlineElement.style.outlineStyle=_outlineStyle,_outlineElement=void 0,_outlineStyle=void 0,off(window,"keydown",restoreOutline))}function getSizedParentNode(t){for(;!((t=t.parentNode).offsetWidth&&t.offsetHeight||t===document.body););return t}function getScale(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var DomUtil={__proto__:null,create:create$1,disableImageDrag:disableImageDrag,disableTextSelection:disableTextSelection,enableImageDrag:enableImageDrag,enableTextSelection:enableTextSelection,get:get,getPosition:getPosition,getScale:getScale,getSizedParentNode:getSizedParentNode,preventOutline:preventOutline,restoreOutline:restoreOutline,setPosition:setPosition,setTransform:setTransform,toBack:toBack,toFront:toFront};let activePointers=new Map,initialized=!1;function enablePointerDetection(){initialized||(initialized=!0,document.addEventListener("pointerdown",_onSet,{capture:!0}),document.addEventListener("pointermove",_onUpdate,{capture:!0}),document.addEventListener("pointerup",_onDelete,{capture:!0}),document.addEventListener("pointercancel",_onDelete,{capture:!0}),activePointers=new Map)}function disablePointerDetection(){document.removeEventListener("pointerdown",_onSet,{capture:!0}),document.removeEventListener("pointermove",_onUpdate,{capture:!0}),document.removeEventListener("pointerup",_onDelete,{capture:!0}),document.removeEventListener("pointercancel",_onDelete,{capture:!0}),initialized=!1}function _onSet(t){activePointers.set(t.pointerId,t)}function _onUpdate(t){activePointers.has(t.pointerId)&&activePointers.set(t.pointerId,t)}function _onDelete(t){activePointers.delete(t.pointerId)}function getPointers(){return[...activePointers.values()]}function cleanupPointers(){activePointers.clear()}var DomEvent_PointerEvents={__proto__:null,cleanupPointers:cleanupPointers,disablePointerDetection:disablePointerDetection,enablePointerDetection:enablePointerDetection,getPointers:getPointers};function on(t,e,i,o){if(e&&"object"==typeof e)for(var[s,n]of Object.entries(e))addOne(t,s,n,i);else for(var a of splitWords(e))addOne(t,a,i,o);return this}let eventsKey="_leaflet_events";function off(t,e,i,o){if(1===arguments.length)batchRemove(t),delete t[eventsKey];else if(e&&"object"==typeof e)for(var[s,n]of Object.entries(e))removeOne(t,s,n,i);else if(e=splitWords(e),2===arguments.length)batchRemove(t,t=>e.includes(t));else for(var a of e)removeOne(t,a,i,o);return this}function batchRemove(t,e){for(var i of Object.keys(t[eventsKey]??{})){var o=i.split(/\d/)[0];e&&!e(o)||removeOne(t,o,null,null,i)}}let pointerSubst={pointerenter:"pointerover",pointerleave:"pointerout",wheel:"undefined"!=typeof window&&!("onwheel"in window)&&"mousewheel"};function addOne(e,t,i,o){var s=t+stamp(i)+(o?"_"+stamp(o):"");if(e[eventsKey]&&e[eventsKey][s])return this;let n=function(t){return i.call(o||e,t||window.event)},a=n;Browser.touch&&"dblclick"===t?n=addDoubleTapListener(e,n):"addEventListener"in e?"wheel"===t||"mousewheel"===t?e.addEventListener(pointerSubst[t]||t,n,{passive:!1}):"pointerenter"===t||"pointerleave"===t?(n=function(t){t??=window.event,isExternalTarget(e,t)&&a(t)},e.addEventListener(pointerSubst[t],n,!1)):e.addEventListener(t,a,!1):e.attachEvent("on"+t,n),e[eventsKey]??={},e[eventsKey][s]=n}function removeOne(t,e,i,o,s){s??=e+stamp(i)+(o?"_"+stamp(o):"");i=t[eventsKey]&&t[eventsKey][s];if(!i)return this;Browser.touch&&"dblclick"===e?removeDoubleTapListener(t,i):"removeEventListener"in t?t.removeEventListener(pointerSubst[e]||e,i,!1):t.detachEvent("on"+e,i),t[eventsKey][s]=null}function stopPropagation(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function disableScrollPropagation(t){return addOne(t,"wheel",stopPropagation),this}function disableClickPropagation(t){return on(t,"pointerdown dblclick contextmenu",stopPropagation),t._leaflet_disable_click=!0,this}function preventDefault(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function stop(t){return preventDefault(t),stopPropagation(t),this}function getPropagationPath(t){return t.composedPath()}function getPointerPosition(t,e){var i,o;return e?(o=(i=getScale(e)).boundingClientRect,new Point((t.clientX-o.left)/i.x-e.clientLeft,(t.clientY-o.top)/i.y-e.clientTop)):new Point(t.clientX,t.clientY)}function getWheelPxFactor(){var t=window.devicePixelRatio;return Browser.linux&&Browser.chrome?t:Browser.mac?3*t:0<t?2*t:1}function getWheelDelta(t){return t.deltaY&&0===t.deltaMode?-t.deltaY/getWheelPxFactor():t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:(t.deltaX||t.deltaZ,0)}function isExternalTarget(t,e){let i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}var DomEvent={__proto__:null,PointerEvents:DomEvent_PointerEvents,disableClickPropagation:disableClickPropagation,disableScrollPropagation:disableScrollPropagation,getPointerPosition:getPointerPosition,getPropagationPath:getPropagationPath,getWheelDelta:getWheelDelta,getWheelPxFactor:getWheelPxFactor,isExternalTarget:isExternalTarget,off:off,on:on,preventDefault:preventDefault,stop:stop,stopPropagation:stopPropagation};class PosAnimation extends Evented{run(t,e,i,o){this.stop(),this._el=t,this._inProgress=!0,this._duration=i??.25,this._easeOutPower=1/Math.max(o??.5,.2),this._startPos=getPosition(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()}stop(){this._inProgress&&(this._step(!0),this._complete())}_animate(){this._animId=requestAnimationFrame(this._animate.bind(this)),this._step()}_step(t){var e=+new Date-this._startTime,i=1e3*this._duration;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())}_runFrame(t,e){t=this._startPos.add(this._offset.multiplyBy(t));e&&t._round(),setPosition(this._el,t),this.fire("step")}_complete(){cancelAnimationFrame(this._animId),this._inProgress=!1,this.fire("end")}_easeOut(t){return 1-(1-t)**this._easeOutPower}}let Map$1=class Map extends Evented{static{this.setDefaultOptions({crs:EPSG3857,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(t,e){e=setOptions(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),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(new LatLng(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=this.options.zoomAnimation,this._zoomAnimated&&this._createAnimProxy(),this._addLayers(this.options.layers)}setView(t,e,i){if((e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(new LatLng(t),e,this.options.maxBounds),i??={},this._stop(),this._loaded&&!i.reset&&!0!==i)&&(void 0!==i.animate&&(i.zoom={animate:i.animate,...i.zoom},i.pan={animate:i.animate,duration:i.duration,...i.pan}),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan)))return clearTimeout(this._sizeTimer),this;return this._resetView(t,e,i.pan?.noMoveStart),this}setZoom(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)}zoomIn(t,e){return t??=this.options.zoomDelta,this.setZoom(this._zoom+t,e)}zoomOut(t,e){return t??=this.options.zoomDelta,this.setZoom(this._zoom-t,e)}setZoomAround(t,e,i){var o=this.getZoomScale(e),s=this.getSize().divideBy(2),t=(t instanceof Point?t:this.latLngToContainerPoint(t)).subtract(s).multiplyBy(1-1/o),o=this.containerPointToLatLng(s.add(t));return this.setView(o,e,{zoom:i})}_getBoundsCenterZoom(t,e){e??={},t=t.getBounds?t.getBounds():new LatLngBounds(t);var i=new Point(e.paddingTopLeft||e.padding||[0,0]),o=new Point(e.paddingBottomRight||e.padding||[0,0]),s=this.getBoundsZoom(t,!1,i.add(o));return(s="number"==typeof e.maxZoom?Math.min(e.maxZoom,s):s)===1/0?{center:t.getCenter(),zoom:s}:(e=o.subtract(i).divideBy(2),o=this.project(t.getSouthWest(),s),i=this.project(t.getNorthEast(),s),{center:this.unproject(o.add(i).divideBy(2).add(e),s),zoom:s})}fitBounds(t,e){if((t=new LatLngBounds(t)).isValid())return t=this._getBoundsCenterZoom(t,e),this.setView(t.center,t.zoom,e);throw new Error("Bounds are not valid.")}fitWorld(t){return this.fitBounds([[-90,-180],[90,180]],t)}panTo(t,e){return this.setView(t,this._zoom,{pan:e})}panBy(t,e){var i;return e??={},(t=new Point(t).round()).x||t.y?(!0===e.animate||this.getSize().contains(t)?(this._panAnim||(this._panAnim=new PosAnimation,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate?(this._mapPane.classList.add("leaflet-pan-anim"),i=this._getMapPanePos().subtract(t).round(),this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)):(this._rawPanBy(t),this.fire("move").fire("moveend"))):this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this):this.fire("moveend")}flyTo(i,o,t){if(!1===(t??={}).animate)return this.setView(i,o,t);this._stop();let s=this.project(this.getCenter()),n=this.project(i),e=this.getSize(),a=this._zoom,r=(i=new LatLng(i),o=void 0===o?a:this._limitZoom(o),Math.max(e.x,e.y)),h=r*this.getZoomScale(a,o),l=n.distanceTo(s)||1,d=1.42,p=d*d;function _(t){var e=t?-1:1,t=t?h:r,e=(h*h-r*r+e*p*p*l*l)/(2*t*p*l),t=Math.sqrt(e*e+1)-e;return t<1e-9?-18:Math.log(t)}function c(t){return(Math.exp(t)-Math.exp(-t))/2}function u(t){return(Math.exp(t)+Math.exp(-t))/2}let m=_(0);function g(t){return r*(u(m)*(c(t=m+d*t)/u(t))-c(m))/p}let f=Date.now(),v=(_(1)-m)/d,y=t.duration?1e3*t.duration:1e3*v*.8,L=()=>{var t=(Date.now()-f)/y,e=(1-(1-t)**1.5)*v;t<=1?(this._flyToFrame=requestAnimationFrame(L),this._move(this.unproject(s.add(n.subtract(s).multiplyBy(g(e)/l)),a),this.getScaleZoom(r/(t=e,r*(u(m)/u(m+d*t))),a),{flyTo:!0})):this._move(i,o)._moveEnd(!0)};return this._moveStart(!0,t.noMoveStart),L(),this}flyToBounds(t,e){t=this._getBoundsCenterZoom(t,e);return this.flyTo(t.center,t.zoom,e)}setMaxBounds(t){return t=new LatLngBounds(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(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(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(t,e){this._enforcingBounds=!0;var i=this.getCenter(),t=this._limitCenter(i,this._zoom,new LatLngBounds(t));return i.equals(t)||this.panTo(t,e),this._enforcingBounds=!1,this}panInside(t,e){e??={};var i=new Point(e.paddingTopLeft||e.padding||[0,0]),o=new Point(e.paddingBottomRight||e.padding||[0,0]),s=this.project(this.getCenter()),t=this.project(t),n=this.getPixelBounds(),i=new Bounds([n.min.add(i),n.max.subtract(o)]),n=i.getSize();return i.contains(t)||(this._enforcingBounds=!0,o=t.subtract(i.getCenter()),i=i.extend(t).getSize().subtract(n),s.x+=o.x<0?-i.x:i.x,s.y+=o.y<0?-i.y:i.y,this.panTo(this.unproject(s),e),this._enforcingBounds=!1),this}invalidateSize(t){if(!this._loaded)return this;t={animate:!1,pan:!0,...!0===t?{animate:!0}:t};var e=this.getSize(),i=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),o=e.divideBy(2).round(),s=i.divideBy(2).round(),o=o.subtract(s);return o.x||o.y?(t.animate&&t.pan?this.panBy(o):(t.pan&&this._rawPanBy(o),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(this.fire.bind(this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this}stop(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()}locate(t){var e,i;return t=this._locateOptions={timeout:1e4,watch:!1,...t},"geolocation"in navigator?(e=this._handleGeolocationResponse.bind(this),i=this._handleGeolocationError.bind(this),t.watch?(void 0!==this._locationWatchId&&navigator.geolocation.clearWatch(this._locationWatchId),this._locationWatchId=navigator.geolocation.watchPosition(e,i,t)):navigator.geolocation.getCurrentPosition(e,i,t)):this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this}stopLocate(){return navigator.geolocation?.clearWatch?.(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this}_handleGeolocationError(t){var e;this._container._leaflet_id&&(e=t.code,t=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: ${t}.`}))}_handleGeolocationResponse(t){if(this._container._leaflet_id){var e,i,o=t.coords.latitude,s=t.coords.longitude,o=new LatLng(o,s),s=o.toBounds(2*t.coords.accuracy),n=this._locateOptions,a=(n.setView&&(e=this.getBoundsZoom(s),this.setView(o,n.maxZoom?Math.min(e,n.maxZoom):e)),{latlng:o,bounds:s,timestamp:t.timestamp});for(i in t.coords)"number"==typeof t.coords[i]&&(a[i]=t.coords[i]);this.fire("locationfound",a)}}addHandler(t,e){return e&&(e=this[t]=new e(this),this._handlers.push(e),this.options[t])&&e.enable(),this}remove(){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");delete this._container._leaflet_id,delete this._containerId,void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),this._mapPane.remove(),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(cancelAnimationFrame(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),clearTimeout(this._transitionEndTimer),clearTimeout(this._sizeTimer),this._loaded&&this.fire("unload"),this._destroyAnimProxy();for(var t of Object.values(this._layers))t.remove();for(var e of Object.values(this._panes))e.remove();return this._layers={},this._panes={},delete this._mapPane,delete this._renderer,this}createPane(t,e){e=create$1("div","leaflet-pane"+(t?` leaflet-${t.replace("Pane","")}-pane`:""),e||this._mapPane);return t&&(this._panes[t]=e),e}getCenter(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())}getZoom(){return this._zoom}getBounds(){var t=this.getPixelBounds(),e=this.unproject(t.getBottomLeft()),t=this.unproject(t.getTopRight());return new LatLngBounds(e,t)}getMinZoom(){return this.options.minZoom??this._layersMinZoom??0}getMaxZoom(){return this.options.maxZoom??this._layersMaxZoom??1/0}getBoundsZoom(t,e,i){t=new LatLngBounds(t),i=new Point(i??[0,0]);let o=this.getZoom()??0;var s=this.getMinZoom(),n=this.getMaxZoom(),a=t.getNorthWest(),t=t.getSouthEast(),i=this.getSize().subtract(i),t=new Bounds(this.project(t,o),this.project(a,o)).getSize(),a=this.options.zoomSnap,r=i.x/t.x,i=i.y/t.y,t=e?Math.max(r,i):Math.min(r,i);return o=this.getScaleZoom(t,o),a&&(o=Math.round(o/(a/100))*(a/100),o=e?Math.ceil(o/a)*a:Math.floor(o/a)*a),Math.max(s,Math.min(n,o))}getSize(){return this._size&&!this._sizeChanged||(this._size=new Point(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()}getPixelBounds(t,e){t=this._getTopLeftPoint(t,e);return new Bounds(t,t.add(this.getSize()))}getPixelOrigin(){return this._checkIfLoaded(),this._pixelOrigin}getPixelWorldBounds(t){return this.options.crs.getProjectedBounds(t??this.getZoom())}getPane(t){return"string"==typeof t?this._panes[t]:t}getPanes(){return this._panes}getContainer(){return this._container}getZoomScale(t,e){var i=this.options.crs;return e??=this._zoom,i.scale(t)/i.scale(e)}getScaleZoom(t,e){var i=this.options.crs,t=(e??=this._zoom,i.zoom(t*i.scale(e)));return isNaN(t)?1/0:t}project(t,e){return e??=this._zoom,this.options.crs.latLngToPoint(new LatLng(t),e)}unproject(t,e){return e??=this._zoom,this.options.crs.pointToLatLng(new Point(t),e)}layerPointToLatLng(t){t=new Point(t).add(this.getPixelOrigin());return this.unproject(t)}latLngToLayerPoint(t){return this.project(new LatLng(t))._round()._subtract(this.getPixelOrigin())}wrapLatLng(t){return this.options.crs.wrapLatLng(new LatLng(t))}wrapLatLngBounds(t){return this.options.crs.wrapLatLngBounds(new LatLngBounds(t))}distance(t,e){return this.options.crs.distance(new LatLng(t),new LatLng(e))}containerPointToLayerPoint(t){return new Point(t).subtract(this._getMapPanePos())}layerPointToContainerPoint(t){return new Point(t).add(this._getMapPanePos())}containerPointToLatLng(t){t=this.containerPointToLayerPoint(new Point(t));return this.layerPointToLatLng(t)}latLngToContainerPoint(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(new LatLng(t)))}pointerEventToContainerPoint(t){return getPointerPosition(t,this._container)}pointerEventToLayerPoint(t){return this.containerPointToLayerPoint(this.pointerEventToContainerPoint(t))}pointerEventToLatLng(t){return this.layerPointToLatLng(this.pointerEventToLayerPoint(t))}_initContainer(t){t=this._container=get(t);if(!t)throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");on(t,"scroll",this._onScroll,this),this._containerId=stamp(t),enablePointerDetection()}_initLayout(){var t=this._container,e=(this._fadeAnimated=this.options.fadeAnimation,["leaflet-container","leaflet-touch"]),e=(Browser.retina&&e.push("leaflet-retina"),Browser.safari&&e.push("leaflet-safari"),this._fadeAnimated&&e.push("leaflet-fade-anim"),t.classList.add(...e),getComputedStyle(t)).position;"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()}_initPanes(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),setPosition(this._mapPane,new Point(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(t.markerPane.classList.add("leaflet-zoom-hide"),t.shadowPane.classList.add("leaflet-zoom-hide"))}_resetView(t,e,i){setPosition(this._mapPane,new Point(0,0));var o=!this._loaded,s=(this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset"),this._zoom!==e);this._moveStart(s,i)._move(t,e)._moveEnd(s),this.fire("viewreset"),o&&this.fire("load")}_moveStart(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this}_move(t,e,i,o){void 0===e&&(e=this._zoom);var s=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),o?i?.pinch&&this.fire("zoom",i):((s||i?.pinch)&&this.fire("zoom",i),this.fire("move",i)),this}_moveEnd(t){return t&&this.fire("zoomend"),this.fire("moveend")}_stop(){return cancelAnimationFrame(this._flyToFrame),this._panAnim?.stop(),this}_rawPanBy(t){setPosition(this._mapPane,this._getMapPanePos().subtract(t))}_getZoomSpan(){return this.getMaxZoom()-this.getMinZoom()}_panInsideMaxBounds(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)}_checkIfLoaded(){if(!this._loaded)throw new Error("Set map center and zoom first.")}_initEvents(t){this._targets={},(t?off:on)((this._targets[stamp(this._container)]=this)._container,"click dblclick pointerdown pointerup pointerover pointerout pointermove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&(t?this._resizeObserver.disconnect():(this._resizeObserver||(this._resizeObserver=new ResizeObserver(this._onResize.bind(this))),this._resizeObserver.observe(this._container))),this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)}_onResize(){cancelAnimationFrame(this._resizeRequest),this._resizeRequest=requestAnimationFrame(()=>{this.invalidateSize({debounceMoveend:!0})})}_onScroll(){this._container.scrollTop=0,this._container.scrollLeft=0}_onMoveEnd(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())}_findEventTargets(t,e){let i=[],o,s=t.target||t.srcElement,n=!1;for(var a="pointerout"===e||"pointerover"===e;s;){if((o=this._targets[stamp(s)])&&("click"===e||"preclick"===e)&&this._draggableMoved(o)){n=!0;break}if(o&&o.listens(e,!0)){if(a&&!isExternalTarget(s,t))break;if(i.push(o),a)break}if(s===this._container)break;s=s.parentNode}return i=i.length||n||a||!this.listens(e,!0)?i:[this]}_isClickDisabled(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click||!t.parentNode)return!0;t=t.parentNode}}_handleDOMEvent(t){var e,i=t.target??t.srcElement;!this._loaded||i._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(i)||("pointerdown"===(e=t.type)&&preventOutline(i),this._fireDOMEvent(t,e))}static _pointerEvents=["click","dblclick","pointerover","pointerout","contextmenu"];_fireDOMEvent(t,e,i){"click"===e&&this._fireDOMEvent(t,"preclick",i);let o=this._findEventTargets(t,e);if(i&&(i=i.filter(t=>t.listens(e,!0)),o=i.concat(o)),o.length){"contextmenu"===e&&preventDefault(t);var s,n,i=o[0],a={originalEvent:t};"keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type&&(s=i.getLatLng&&(!i._radius||i._radius<=10),a.containerPoint=s?this.latLngToContainerPoint(i.getLatLng()):this.pointerEventToContainerPoint(t),a.layerPoint=this.containerPointToLayerPoint(a.containerPoint),a.latlng=s?i.getLatLng():this.layerPointToLatLng(a.layerPoint));for(n of o)if(n.fire(e,a,!0),a.originalEvent._stopped||!1===n.options.bubblingPointerEvents&&Map._pointerEvents.includes(e))return}}_draggableMoved(t){return(t=t.dragging?.enabled()?t:this).dragging?.moved()||this.boxZoom?.moved()}_clearHandlers(){for(var t of this._handlers)t.disable()}whenReady(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this}_getMapPanePos(){return getPosition(this._mapPane)}_moved(){var t=this._getMapPanePos();return t&&!t.equals([0,0])}_getTopLeftPoint(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())}_getNewPixelOrigin(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()}_latLngToNewLayerPoint(t,e,i){i=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(i)}_latLngBoundsToNewLayerBounds(t,e,i){i=this._getNewPixelOrigin(i,e);return new Bounds([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(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))}_getCenterOffset(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())}_limitCenter(t,e,i){var o,s;return!i||(o=this.project(t,e),s=this.getSize().divideBy(2),s=new Bounds(o.subtract(s),o.add(s)),s=this._getBoundsOffset(s,i,e),Math.abs(s.x)<=1&&Math.abs(s.y)<=1)?t:this.unproject(o.add(s),e)}_limitOffset(t,e){var i;return e?(i=this.getPixelBounds(),i=new Bounds(i.min.add(t),i.max.add(t)),t.add(this._getBoundsOffset(i,e))):t}_getBoundsOffset(t,e,i){e=new Bounds(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),i=e.min.subtract(t.min),e=e.max.subtract(t.max),t=this._rebound(i.x,-e.x),i=this._rebound(i.y,-e.y);return new Point(t,i)}_rebound(t,e){return 0<t+e?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))}_limitZoom(t){var e=this.getMinZoom(),i=this.getMaxZoom(),o=this.options.zoomSnap;return o&&(t=Math.round(t/o)*o),Math.max(e,Math.min(i,t))}_onPanTransitionStep(){this.fire("move")}_onPanTransitionEnd(){this._mapPane.classList.remove("leaflet-pan-anim"),this.fire("moveend")}_tryAnimatedPan(t,e){t=this._getCenterOffset(t)._trunc();return!(!0!==e?.animate&&!this.getSize().contains(t)||(this.panBy(t,e),0))}_createAnimProxy(){this._proxy=create$1("div","leaflet-proxy leaflet-zoom-animated"),this._panes.mapPane.appendChild(this._proxy),this.on("zoomanim",this._animateProxyZoom,this),this.on("load moveend",this._animMoveEnd,this),on(this._proxy,"transitionend",this._catchTransitionEnd,this)}_animateProxyZoom(t){var e=this._proxy.style.transform;setTransform(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),e===this._proxy.style.transform&&this._animatingZoom&&this._onZoomTransitionEnd()}_animMoveEnd(){var t=this.getCenter(),e=this.getZoom();setTransform(this._proxy,this.project(t,e),this.getZoomScale(e,1))}_destroyAnimProxy(){this._proxy&&(off(this._proxy,"transitionend",this._catchTransitionEnd,this),this._proxy.remove(),this.off("zoomanim",this._animateProxyZoom,this),this.off("load moveend",this._animMoveEnd,this),delete this._proxy)}_catchTransitionEnd(t){this._animatingZoom&&t.propertyName.includes("transform")&&this._onZoomTransitionEnd()}_nothingToAnimate(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length}_tryAnimatedZoom(t,e,i){if(!this._animatingZoom){if(i??={},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var o=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/o);if(!0!==i.animate&&!this.getSize().contains(o))return!1;requestAnimationFrame(()=>{this._moveStart(!0,i.noMoveStart??!1)._animateZoom(t,e,!0)})}return!0}_animateZoom(t,e,i,o){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,this._mapPane.classList.add("leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:o}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._transitionEndTimer=setTimeout(this._onZoomTransitionEnd.bind(this),250))}_onZoomTransitionEnd(){this._animatingZoom&&(this._mapPane?.classList.remove("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))}},LeafletMap=Map$1;class Control extends Class{static{this.setDefaultOptions({position:"topright"})}initialize(t){setOptions(this,t)}getPosition(){return this.options.position}setPosition(t){var e=this._map;return e?.removeControl(this),this.options.position=t,e?.addControl(this),this}getContainer(){return this._container}addTo(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),t=t._controlCorners[i];return e.classList.add("leaflet-control"),i.includes("bottom")?t.insertBefore(e,t.firstChild):t.appendChild(e),this._map.on("unload",this.remove,this),this}remove(){return this._map&&(this._container.remove(),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this}_refocusOnMap(t){this._map&&t&&(0!==t.screenX||0!==t.screenY)&&this._map.getContainer().focus()}}Map$1.include({addControl(t){return t.addTo(this),this},removeControl(t){return t.remove(),this},_initControlPos(){let o=this._controlCorners={},s="leaflet-",n=this._controlContainer=create$1("div",s+"control-container",this._container);function t(t,e){var i=s+t+" "+s+e;o[t+e]=create$1("div",i,n)}t("top","left"),t("top","right"),t("bottom","left"),t("bottom","right")},_clearControlPos(){for(var t of Object.values(this._controlCorners))t.remove();this._controlContainer.remove(),delete this._controlCorners,delete this._controlContainer}});class Layers extends Control{static{this.setDefaultOptions({collapsed:!0,collapseDelay:0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction(t,e,i,o){return i<o?-1:o<i?1:0}})}initialize(t,e,i){setOptions(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var[o,s]of Object.entries(t??{}))this._addLayer(s,o);for(var[n,a]of Object.entries(e??{}))this._addLayer(a,n,!0)}onAdd(t){this._initLayout(),this._update(),(this._map=t).on("zoomend",this._checkDisabledLayers,this);for(var e of this._layers)e.layer.on("add remove",this._onLayerChange,this);return this.options.collapsed||t.on("resize",this._expandIfNotCollapsed,this),this._container}addTo(t){return Control.prototype.addTo.call(this,t),this._expandIfNotCollapsed()}onRemove(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t of this._layers)t.layer.off("add remove",this._onLayerChange,this);this._map.off("resize",this._expandIfNotCollapsed,this)}addBaseLayer(t,e){return this._addLayer(t,e),this._map?this._update():this}addOverlay(t,e){return this._addLayer(t,e,!0),this._map?this._update():this}removeLayer(t){t.off("add remove",this._onLayerChange,this);t=this._getLayer(stamp(t));return t&&this._layers.splice(this._layers.indexOf(t),1),this._map?this._update():this}expand(){clearTimeout(this._collapseDelayTimeout),this._container.classList.add("leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(this._section.classList.add("leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):this._section.classList.remove("leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this}collapse(t){if(!t||"pointerleave"!==t.type&&"pointerout"!==t.type||"touch"!==t.pointerType){if(0<this.options.collapseDelay)return this._collapseDelayTimeout=setTimeout(()=>{this._container.classList.remove("leaflet-control-layers-expanded")},this.options.collapseDelay),this;this._container.classList.remove("leaflet-control-layers-expanded")}return this}_initLayout(){var t="leaflet-control-layers",e=this._container=create$1("div",t),i=this.options.collapsed,o=(disableClickPropagation(e),disableScrollPropagation(e),this._section=create$1("fieldset",t+"-list")),s=(i&&(this._map.on("click",this.collapse,this),on(e,{pointerenter:this._expandSafely,pointerleave:this.collapse},this)),this._layersLink=create$1("a",t+"-toggle",e));s.href="#",s.title="Layers",s.setAttribute("role","button"),on(s,{keydown(t){"Enter"===t.code&&this._expandSafely()},click(t){preventDefault(t),this._expandSafely()}},this),i||this.expand(),this._baseLayersList=create$1("div",t+"-base",o),this._separator=create$1("div",t+"-separator",o),this._overlaysList=create$1("div",t+"-overlays",o),e.appendChild(o)}_getLayer(t){for(var e of this._layers)if(e&&stamp(e.layer)===t)return e}_addLayer(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort((t,e)=>this.options.sortFunction(t.layer,e.layer,t.name,e.name)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()}_update(){if(this._container){this._baseLayersList.replaceChildren(),this._overlaysList.replaceChildren(),this._layerControlInputs=[];let t,e,i=0;for(var o of this._layers)this._addItem(o),e||=o.overlay,t||=!o.overlay,i+=o.overlay?0:1;this.options.hideSingleBase&&(t=t&&1<i,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none"}return this}_onLayerChange(t){this._handlingClick||this._update();var e=this._getLayer(stamp(t.target)),t=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;t&&this._map.fire(t,e)}_addItem(t){var e=document.createElement("label"),i=this._map.hasLayer(t.layer),o=document.createElement("input"),i=(o.type=t.overlay?"checkbox":"radio",o.className="leaflet-control-layers-selector",o.defaultChecked=i,t.overlay||(o.name="leaflet-base-layers_"+stamp(this)),this._layerControlInputs.push(o),o.layerId=stamp(t.layer),on(o,"click",this._onInputClick,this),document.createElement("span")),s=(i.innerHTML=" "+t.name,document.createElement("span"));return e.appendChild(s),s.appendChild(o),s.appendChild(i),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e}_onInputClick(t){if(!this._preventClick){var e,i,o,s=this._layerControlInputs,n=[],a=[];this._ha