UNPKG

@infobus/vue

Version:

Vue components and composables for public transportation websites using GTFS data through the Infobús API

4 lines 161 kB
(function(at,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(at=typeof globalThis<"u"?globalThis:at||self,u(at.InfobusVue={},at.Vue))})(this,function(at,u){"use strict";function Le(O){const Q=u.ref(!1),l=u.ref(null);return{isLoading:Q,error:l,makeRequest:async(p,D={})=>{Q.value=!0,l.value=null;try{const P=new URL(p,O.baseUrl),F={"Content-Type":"application/json",...D.headers};O.apiKey&&(F.Authorization=`Bearer ${O.apiKey}`);const g=await fetch(P.toString(),{...D,headers:F,signal:AbortSignal.timeout(O.timeout||1e4)});if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);const J=await g.json();if(J.success===!1)throw new Error(J.error||J.message||"API request failed");return J.data||J}catch(P){const F=P instanceof Error?P.message:"Unknown error";throw l.value=F,new Error(F)}finally{Q.value=!1}}}}function ai(O){const{isLoading:Q,error:l,makeRequest:j}=Le(O),p=u.ref(null),D=u.ref(null),P=u.computed(()=>{var b;return((b=p.value)==null?void 0:b.trips)||[]}),F=u.computed(()=>{var b;return((b=p.value)==null?void 0:b.stop_info)||null}),g=u.computed(()=>{var b;return((b=p.value)==null?void 0:b.last_updated)||null}),J=async(b,d={})=>{try{const M=new URLSearchParams({stop_id:b,...d.limit&&{limit:d.limit.toString()},...d.routeId&&{route_id:d.routeId},...d.directionId!==void 0&&{direction_id:d.directionId.toString()},...d.includeRealtime!==void 0&&{realtime:d.includeRealtime.toString()}}),Y=await j(`/next-trips?${M.toString()}`);return p.value=Y,D.value=new Date,Y.trips}catch(M){throw console.error("Error fetching next trips:",M),M}};return{isLoading:Q,error:l,data:p,trips:P,stopInfo:F,lastUpdated:g,lastFetch:D,fetchNextTrips:J,refresh:async(b,d={})=>await J(b,d),getTripsByRoute:b=>P.value.filter(d=>d.route_id===b),getNextTrips:b=>P.value.slice(0,b),isStale:(b=5)=>D.value?(new Date().getTime()-D.value.getTime())/(1e3*60)>b:!0}}const Mn={class:"infobus-next-trips"},Sn={key:0,class:"stop-info"},kn={class:"stop-name"},Cn={key:0,class:"stop-description"},En={key:1,class:"loading"},zn={key:2,class:"error"},In={class:"error-message"},Bn={key:3,class:"no-trips"},Zn={key:4,class:"trips-container"},On={key:0,class:"last-updated"},An={class:"trips-list"},Nn={class:"route-info"},Rn={class:"route-long-name"},Dn={class:"trip-details"},Fn={class:"headsign"},Hn={class:"times"},Wn={class:"scheduled-time"},Vn={key:0,class:"estimated-time"},Un={key:1,class:"delay"},qn={key:0,class:"accessibility"},Gn={key:0,class:"wheelchair-accessible",title:"Accesible para sillas de ruedas"},jn={key:1,class:"bikes-allowed",title:"Permite bicicletas"},Kn={key:1,class:"refresh-section"},Yn=["disabled"],$n=u.defineComponent({__name:"InfobusNextTrips",props:{stopId:{},config:{},limit:{default:10},routeId:{},directionId:{},includeRealtime:{type:Boolean,default:!0},autoRefresh:{type:Boolean,default:!1},refreshInterval:{default:6e4},showStopInfo:{type:Boolean,default:!0},showLastUpdated:{type:Boolean,default:!0},showRefreshButton:{type:Boolean,default:!0},showAccessibility:{type:Boolean,default:!0},maxTrips:{default:5}},emits:["tripsLoaded","error","refresh"],setup(O,{emit:Q}){const l=O,j=Q,{isLoading:p,error:D,trips:P,stopInfo:F,lastUpdated:g,fetchNextTrips:J,refresh:K,isStale:E}=ai(l.config),A=u.ref(null),yt=u.computed(()=>P.value.slice(0,l.maxTrips)),b=u.computed(()=>({limit:l.limit,routeId:l.routeId,directionId:l.directionId,includeRealtime:l.includeRealtime})),d=async()=>{try{j("refresh");const z=await K(l.stopId,b.value);j("tripsLoaded",z)}catch(z){const G=z instanceof Error?z.message:"Error al actualizar";j("error",G)}},M=()=>{l.autoRefresh&&l.refreshInterval>0&&(A.value=setInterval(d,l.refreshInterval))},Y=()=>{A.value&&(clearInterval(A.value),A.value=null)},tt=z=>{try{return new Date(z).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return z}},I=z=>{try{return new Date(z).toLocaleString()}catch{return z}},ht=z=>{const G=z.route_color||"#007bff",H=z.route_text_color||"#ffffff";return{backgroundColor:`#${G}`,color:`#${H}`}};return u.watch(()=>l.stopId,async z=>{z&&await d()}),u.watch(()=>[l.routeId,l.directionId,l.limit],async()=>{await d()}),u.onMounted(async()=>{await d(),M()}),u.onUnmounted(()=>{Y()}),(z,G)=>(u.openBlock(),u.createElementBlock("div",Mn,[z.showStopInfo&&u.unref(F)?(u.openBlock(),u.createElementBlock("div",Sn,[u.createElementVNode("h3",kn,u.toDisplayString(u.unref(F).stop_name),1),u.unref(F).stop_desc?(u.openBlock(),u.createElementBlock("p",Cn,u.toDisplayString(u.unref(F).stop_desc),1)):u.createCommentVNode("",!0)])):u.createCommentVNode("",!0),u.unref(p)?(u.openBlock(),u.createElementBlock("div",En,[u.renderSlot(z.$slots,"loading",{},()=>[G[0]||(G[0]=u.createElementVNode("div",{class:"spinner"},null,-1)),G[1]||(G[1]=u.createElementVNode("p",null,"Cargando próximos viajes...",-1))],!0)])):u.unref(D)?(u.openBlock(),u.createElementBlock("div",zn,[u.renderSlot(z.$slots,"error",{error:u.unref(D)},()=>[u.createElementVNode("p",In,u.toDisplayString(u.unref(D)),1),u.createElementVNode("button",{onClick:d,class:"retry-button"}," Reintentar ")],!0)])):u.unref(P).length===0?(u.openBlock(),u.createElementBlock("div",Bn,[u.renderSlot(z.$slots,"no-trips",{},()=>[G[2]||(G[2]=u.createElementVNode("p",null,"No hay viajes disponibles para esta parada.",-1))],!0)])):(u.openBlock(),u.createElementBlock("div",Zn,[z.showLastUpdated&&u.unref(g)?(u.openBlock(),u.createElementBlock("div",On,[u.createElementVNode("small",null,"Última actualización: "+u.toDisplayString(I(u.unref(g))),1)])):u.createCommentVNode("",!0),u.createElementVNode("div",An,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(yt.value,H=>(u.openBlock(),u.createElementBlock("div",{key:H.trip_id,class:u.normalizeClass(["trip-item",{"has-delay":H.delay&&H.delay>0}])},[u.createElementVNode("div",Nn,[u.createElementVNode("span",{class:"route-short-name",style:u.normalizeStyle(ht(H))},u.toDisplayString(H.route_short_name),5),u.createElementVNode("span",Rn,u.toDisplayString(H.route_long_name),1)]),u.createElementVNode("div",Dn,[u.createElementVNode("div",Fn,u.toDisplayString(H.trip_headsign),1),u.createElementVNode("div",Hn,[u.createElementVNode("span",Wn,u.toDisplayString(tt(H.arrival_time)),1),H.estimated_arrival&&H.estimated_arrival!==H.arrival_time?(u.openBlock(),u.createElementBlock("span",Vn," ("+u.toDisplayString(tt(H.estimated_arrival))+") ",1)):u.createCommentVNode("",!0),H.delay&&H.delay>0?(u.openBlock(),u.createElementBlock("span",Un," +"+u.toDisplayString(Math.round(H.delay/60))+"min ",1)):u.createCommentVNode("",!0)])]),z.showAccessibility?(u.openBlock(),u.createElementBlock("div",qn,[H.wheelchair_accessible===1?(u.openBlock(),u.createElementBlock("span",Gn," ♿ ")):u.createCommentVNode("",!0),H.bikes_allowed===1?(u.openBlock(),u.createElementBlock("span",jn," 🚲 ")):u.createCommentVNode("",!0)])):u.createCommentVNode("",!0)],2))),128))]),z.showRefreshButton?(u.openBlock(),u.createElementBlock("div",Kn,[u.createElementVNode("button",{onClick:d,class:"refresh-button",disabled:u.unref(p)}," 🔄 Actualizar ",8,Yn)])):u.createCommentVNode("",!0)]))]))}}),Os="",hi=(O,Q)=>{const l=O.__vccOpts||O;for(const[j,p]of Q)l[j]=p;return l},ui=hi($n,[["__scopeId","data-v-518e5bb3"]]);function li(O){const{isLoading:Q,error:l,makeRequest:j}=Le(O),p=u.ref(null),D=u.ref(null),P=u.computed(()=>{var d;return((d=p.value)==null?void 0:d.shapes)||null}),F=u.computed(()=>{var d;return((d=p.value)==null?void 0:d.route_info)||null}),g=u.computed(()=>{var d,M;return((M=(d=p.value)==null?void 0:d.shapes)==null?void 0:M.features)||[]}),J=async(d,M={})=>{try{const Y=new URLSearchParams({route_id:d,...M.directionId!==void 0&&{direction_id:M.directionId.toString()},...M.includeStops!==void 0&&{include_stops:M.includeStops.toString()},...M.simplify!==void 0&&{simplify:M.simplify.toString()},...M.format&&{format:M.format}}),tt=await j(`/geo-shapes?${Y.toString()}`);return p.value=tt,D.value=new Date,tt.shapes}catch(Y){throw console.error("Error fetching route shapes:",Y),Y}},K=async(d,M={})=>await J(d,M),E=d=>g.value.filter(M=>M.properties.direction_id===d),A=()=>{const d=[];return g.value.forEach(M=>{M.geometry.type==="LineString"&&d.push(...M.geometry.coordinates)}),d};return{isLoading:Q,error:l,data:p,shapes:P,routeInfo:F,features:g,lastFetch:D,fetchRouteShapes:J,refresh:K,getShapesByDirection:E,getAllCoordinates:A,getBounds:()=>{const d=A();if(d.length===0)return null;const M=d.map(tt=>tt[1]),Y=d.map(tt=>tt[0]);return{north:Math.max(...M),south:Math.min(...M),east:Math.max(...Y),west:Math.min(...Y)}},isStale:(d=30)=>D.value?(new Date().getTime()-D.value.getTime())/(1e3*60)>d:!0}}var Jn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xn(O){return O&&O.__esModule&&Object.prototype.hasOwnProperty.call(O,"default")?O.default:O}var Te={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(O,Q){(function(l,j){j(Q)})(Jn,function(l){var j="1.9.4";function p(t){var e,i,n,o;for(i=1,n=arguments.length;i<n;i++){o=arguments[i];for(e in o)t[e]=o[e]}return t}var D=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function P(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}}var F=0;function g(t){return"_leaflet_id"in t||(t._leaflet_id=++F),t._leaflet_id}function J(t,e,i){var n,o,s,r;return r=function(){n=!1,o&&(s.apply(i,o),o=!1)},s=function(){n?o=arguments:(t.apply(i,arguments),setTimeout(r,e),n=!0)},s}function K(t,e,i){var n=e[1],o=e[0],s=n-o;return t===n&&i?t:((t-o)%s+s)%s+o}function E(){return!1}function A(t,e){if(e===!1)return t;var i=Math.pow(10,e===void 0?6:e);return Math.round(t*i)/i}function yt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function b(t){return yt(t).split(/\s+/)}function d(t,e){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?D(t.options):{});for(var i in e)t.options[i]=e[i];return t.options}function M(t,e,i){var n=[];for(var o in t)n.push(encodeURIComponent(i?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(!e||e.indexOf("?")===-1?"?":"&")+n.join("&")}var Y=/\{ *([\w_ -]+) *\}/g;function tt(t,e){return t.replace(Y,function(i,n){var o=e[n];if(o===void 0)throw new Error("No value provided for variable "+i);return typeof o=="function"&&(o=o(e)),o})}var I=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function ht(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var z="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function G(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var H=0;function di(t){var e=+new Date,i=Math.max(0,16-(e-H));return H=e+i,window.setTimeout(t,i)}var Me=window.requestAnimationFrame||G("RequestAnimationFrame")||di,fi=window.cancelAnimationFrame||G("CancelAnimationFrame")||G("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function it(t,e,i){if(i&&Me===di)t.call(e);else return Me.call(window,P(t,e))}function ut(t){t&&fi.call(window,t)}var ho={__proto__:null,extend:p,create:D,bind:P,get lastId(){return F},stamp:g,throttle:J,wrapNum:K,falseFn:E,formatNum:A,trim:yt,splitWords:b,setOptions:d,getParamString:M,template:tt,isArray:I,indexOf:ht,emptyImageUrl:z,requestFn:Me,cancelFn:fi,requestAnimFrame:it,cancelAnimFrame:ut};function wt(){}wt.extend=function(t){var e=function(){d(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,n=D(i);n.constructor=e,e.prototype=n;for(var o in this)Object.prototype.hasOwnProperty.call(this,o)&&o!=="prototype"&&o!=="__super__"&&(e[o]=this[o]);return t.statics&&p(e,t.statics),t.includes&&(uo(t.includes),p.apply(null,[n].concat(t.includes))),p(n,t),delete n.statics,delete n.includes,n.options&&(n.options=i.options?D(i.options):{},p(n.options,t.options)),n._initHooks=[],n.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var s=0,r=n._initHooks.length;s<r;s++)n._initHooks[s].call(this)}},e},wt.include=function(t){var e=this.prototype.options;return p(this.prototype,t),t.options&&(this.prototype.options=e,this.mergeOptions(t.options)),this},wt.mergeOptions=function(t){return p(this.prototype.options,t),this},wt.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i=typeof t=="function"?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};function uo(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=I(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)}}var rt={on:function(t,e,i){if(typeof t=="object")for(var n in t)this._on(n,t[n],e);else{t=b(t);for(var o=0,s=t.length;o<s;o++)this._on(t[o],e,i)}return this},off:function(t,e,i){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var n in t)this._off(n,t[n],e);else{t=b(t);for(var o=arguments.length===1,s=0,r=t.length;s<r;s++)o?this._off(t[s]):this._off(t[s],e,i)}return this},_on:function(t,e,i,n){if(typeof e!="function"){console.warn("wrong listener type: "+typeof e);return}if(this._listens(t,e,i)===!1){i===this&&(i=void 0);var o={fn:e,ctx:i};n&&(o.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(o)}},_off:function(t,e,i){var n,o,s;if(this._events&&(n=this._events[t],!!n)){if(arguments.length===1){if(this._firingCount)for(o=0,s=n.length;o<s;o++)n[o].fn=E;delete this._events[t];return}if(typeof e!="function"){console.warn("wrong listener type: "+typeof e);return}var r=this._listens(t,e,i);if(r!==!1){var a=n[r];this._firingCount&&(a.fn=E,this._events[t]=n=n.slice()),n.splice(r,1)}}},fire:function(t,e,i){if(!this.listens(t,i))return this;var n=p({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var o=this._events[t];if(o){this._firingCount=this._firingCount+1||1;for(var s=0,r=o.length;s<r;s++){var a=o[s],h=a.fn;a.once&&this.off(t,h,a.ctx),h.call(a.ctx||this,n)}this._firingCount--}}return i&&this._propagateEvent(n),this},listens:function(t,e,i,n){typeof t!="string"&&console.warn('"string" type argument expected');var o=e;typeof e!="function"&&(n=!!e,o=void 0,i=void 0);var s=this._events&&this._events[t];if(s&&s.length&&this._listens(t,o,i)!==!1)return!0;if(n){for(var r in this._eventParents)if(this._eventParents[r].listens(t,e,i,n))return!0}return!1},_listens:function(t,e,i){if(!this._events)return!1;var n=this._events[t]||[];if(!e)return!!n.length;i===this&&(i=void 0);for(var o=0,s=n.length;o<s;o++)if(n[o].fn===e&&n[o].ctx===i)return o;return!1},once:function(t,e,i){if(typeof t=="object")for(var n in t)this._on(n,t[n],e,!0);else{t=b(t);for(var o=0,s=t.length;o<s;o++)this._on(t[o],e,i,!0)}return this},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[g(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[g(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,p({layer:t.target,propagatedFrom:t.target},t),!0)}};rt.addEventListener=rt.on,rt.removeEventListener=rt.clearAllEventListeners=rt.off,rt.addOneTimeEventListener=rt.once,rt.fireEvent=rt.fire,rt.hasEventListeners=rt.listens;var Vt=wt.extend(rt);function y(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var _i=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};y.prototype={clone:function(){return new y(this.x,this.y)},add:function(t){return this.clone()._add(v(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(v(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 y(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new y(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=_i(this.x),this.y=_i(this.y),this},distanceTo:function(t){t=v(t);var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return t=v(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=v(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+A(this.x)+", "+A(this.y)+")"}};function v(t,e,i){return t instanceof y?t:I(t)?new y(t[0],t[1]):t==null?t:typeof t=="object"&&"x"in t&&"y"in t?new y(t.x,t.y):new y(t,e,i)}function N(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}N.prototype={extend:function(t){var e,i;if(!t)return this;if(t instanceof y||typeof t[0]=="number"||"x"in t)e=i=v(t);else if(t=nt(t),e=t.min,i=t.max,!e||!i)return this;return!this.min&&!this.max?(this.min=e.clone(),this.max=i.clone()):(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},getCenter:function(t){return v((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return v(this.min.x,this.max.y)},getTopRight:function(){return v(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,i;return typeof t[0]=="number"||t instanceof y?t=v(t):t=nt(t),t instanceof N?(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:function(t){t=nt(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>=e.x&&n.x<=i.x,r=o.y>=e.y&&n.y<=i.y;return s&&r},overlaps:function(t){t=nt(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>e.x&&n.x<i.x,r=o.y>e.y&&n.y<i.y;return s&&r},isValid:function(){return!!(this.min&&this.max)},pad:function(t){var e=this.min,i=this.max,n=Math.abs(e.x-i.x)*t,o=Math.abs(e.y-i.y)*t;return nt(v(e.x-n,e.y-o),v(i.x+n,i.y+o))},equals:function(t){return t?(t=nt(t),this.min.equals(t.getTopLeft())&&this.max.equals(t.getBottomRight())):!1}};function nt(t,e){return!t||t instanceof N?t:new N(t,e)}function ot(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}ot.prototype={extend:function(t){var e=this._southWest,i=this._northEast,n,o;if(t instanceof B)n=t,o=t;else if(t instanceof ot){if(n=t._southWest,o=t._northEast,!n||!o)return this}else return t?this.extend(S(t)||V(t)):this;return!e&&!i?(this._southWest=new B(n.lat,n.lng),this._northEast=new B(o.lat,o.lng)):(e.lat=Math.min(n.lat,e.lat),e.lng=Math.min(n.lng,e.lng),i.lat=Math.max(o.lat,i.lat),i.lng=Math.max(o.lng,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,o=Math.abs(e.lng-i.lng)*t;return new ot(new B(e.lat-n,e.lng-o),new B(i.lat+n,i.lng+o))},getCenter:function(){return new B((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 B(this.getNorth(),this.getWest())},getSouthEast:function(){return new B(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){typeof t[0]=="number"||t instanceof B||"lat"in t?t=S(t):t=V(t);var e=this._southWest,i=this._northEast,n,o;return t instanceof ot?(n=t.getSouthWest(),o=t.getNorthEast()):n=o=t,n.lat>=e.lat&&o.lat<=i.lat&&n.lng>=e.lng&&o.lng<=i.lng},intersects:function(t){t=V(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=e.lat&&n.lat<=i.lat,r=o.lng>=e.lng&&n.lng<=i.lng;return s&&r},overlaps:function(t){t=V(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>e.lat&&n.lat<i.lat,r=o.lng>e.lng&&n.lng<i.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return t?(t=V(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function V(t,e){return t instanceof ot?t:new ot(t,e)}function B(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,i!==void 0&&(this.alt=+i)}B.prototype={equals:function(t,e){if(!t)return!1;t=S(t);var i=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return i<=(e===void 0?1e-9:e)},toString:function(t){return"LatLng("+A(this.lat,t)+", "+A(this.lng,t)+")"},distanceTo:function(t){return Mt.distance(this,S(t))},wrap:function(){return Mt.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return V([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new B(this.lat,this.lng,this.alt)}};function S(t,e,i){return t instanceof B?t:I(t)&&typeof t[0]!="object"?t.length===3?new B(t[0],t[1],t[2]):t.length===2?new B(t[0],t[1]):null:t==null?t:typeof t=="object"&&"lat"in t?new B(t.lat,"lng"in t?t.lng:t.lon,t.alt):e===void 0?null:new B(t,e,i)}var xt={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},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,i=this.scale(t),n=this.transformation.transform(e.min,i),o=this.transformation.transform(e.max,i);return new N(n,o)},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?K(t.lng,this.wrapLng,!0):t.lng,i=this.wrapLat?K(t.lat,this.wrapLat,!0):t.lat,n=t.alt;return new B(i,e,n)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),n=e.lat-i.lat,o=e.lng-i.lng;if(n===0&&o===0)return t;var s=t.getSouthWest(),r=t.getNorthEast(),a=new B(s.lat-n,s.lng-o),h=new B(r.lat-n,r.lng-o);return new ot(a,h)}},Mt=p({},xt,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,o=e.lat*i,s=Math.sin((e.lat-t.lat)*i/2),r=Math.sin((e.lng-t.lng)*i/2),a=s*s+Math.cos(n)*Math.cos(o)*r*r,h=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*h}}),mi=6378137,Se={R:mi,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),o=Math.sin(n*e);return new y(this.R*t.lng*e,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var e=180/Math.PI;return new B((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=mi*Math.PI;return new N([-t,-t],[t,t])}()};function ke(t,e,i,n){if(I(t)){this._a=t[0],this._b=t[1],this._c=t[2],this._d=t[3];return}this._a=t,this._b=e,this._c=i,this._d=n}ke.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 y((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};function Ut(t,e,i,n){return new ke(t,e,i,n)}var Ce=p({},Mt,{code:"EPSG:3857",projection:Se,transformation:function(){var t=.5/(Math.PI*Se.R);return Ut(t,.5,-t,.5)}()}),lo=p({},Ce,{code:"EPSG:900913"});function pi(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function gi(t,e){var i="",n,o,s,r,a,h;for(n=0,s=t.length;n<s;n++){for(a=t[n],o=0,r=a.length;o<r;o++)h=a[o],i+=(o?"L":"M")+h.x+" "+h.y;i+=e?_.svg?"z":"x":""}return i||"M0 0"}var Ee=document.documentElement.style,oe="ActiveXObject"in window,co=oe&&!document.addEventListener,vi="msLaunchUri"in navigator&&!("documentMode"in document),ze=mt("webkit"),yi=mt("android"),wi=mt("android 2")||mt("android 3"),fo=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),_o=yi&&mt("Google")&&fo<537&&!("AudioNode"in window),Ie=!!window.opera,xi=!vi&&mt("chrome"),Pi=mt("gecko")&&!ze&&!Ie&&!oe,mo=!xi&&mt("safari"),Li=mt("phantom"),Ti="OTransition"in Ee,po=navigator.platform.indexOf("Win")===0,bi=oe&&"transition"in Ee,Be="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!wi,Mi="MozPerspective"in Ee,go=!window.L_DISABLE_3D&&(bi||Be||Mi)&&!Ti&&!Li,qt=typeof orientation<"u"||mt("mobile"),vo=qt&&ze,yo=qt&&Be,Si=!window.PointerEvent&&window.MSPointerEvent,ki=!!(window.PointerEvent||Si),Ci="ontouchstart"in window||!!window.TouchEvent,wo=!window.L_NO_TOUCH&&(Ci||ki),xo=qt&&Ie,Po=qt&&Pi,Lo=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,To=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",E,e),window.removeEventListener("testPassiveEventSupport",E,e)}catch{}return t}(),bo=function(){return!!document.createElement("canvas").getContext}(),Ze=!!(document.createElementNS&&pi("svg").createSVGRect),Mo=!!Ze&&function(){var t=document.createElement("div");return t.innerHTML="<svg/>",(t.firstChild&&t.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),So=!Ze&&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&&typeof e.adj=="object"}catch{return!1}}(),ko=navigator.platform.indexOf("Mac")===0,Co=navigator.platform.indexOf("Linux")===0;function mt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var _={ie:oe,ielt9:co,edge:vi,webkit:ze,android:yi,android23:wi,androidStock:_o,opera:Ie,chrome:xi,gecko:Pi,safari:mo,phantom:Li,opera12:Ti,win:po,ie3d:bi,webkit3d:Be,gecko3d:Mi,any3d:go,mobile:qt,mobileWebkit:vo,mobileWebkit3d:yo,msPointer:Si,pointer:ki,touch:wo,touchNative:Ci,mobileOpera:xo,mobileGecko:Po,retina:Lo,passiveEvents:To,canvas:bo,svg:Ze,vml:So,inlineSvg:Mo,mac:ko,linux:Co},Ei=_.msPointer?"MSPointerDown":"pointerdown",zi=_.msPointer?"MSPointerMove":"pointermove",Ii=_.msPointer?"MSPointerUp":"pointerup",Bi=_.msPointer?"MSPointerCancel":"pointercancel",Oe={touchstart:Ei,touchmove:zi,touchend:Ii,touchcancel:Bi},Zi={touchstart:Oo,touchmove:se,touchend:se,touchcancel:se},Zt={},Oi=!1;function Eo(t,e,i){return e==="touchstart"&&Zo(),Zi[e]?(i=Zi[e].bind(this,i),t.addEventListener(Oe[e],i,!1),i):(console.warn("wrong event specified:",e),E)}function zo(t,e,i){if(!Oe[e]){console.warn("wrong event specified:",e);return}t.removeEventListener(Oe[e],i,!1)}function Io(t){Zt[t.pointerId]=t}function Bo(t){Zt[t.pointerId]&&(Zt[t.pointerId]=t)}function Ai(t){delete Zt[t.pointerId]}function Zo(){Oi||(document.addEventListener(Ei,Io,!0),document.addEventListener(zi,Bo,!0),document.addEventListener(Ii,Ai,!0),document.addEventListener(Bi,Ai,!0),Oi=!0)}function se(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){e.touches=[];for(var i in Zt)e.touches.push(Zt[i]);e.changedTouches=[e],t(e)}}function Oo(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&X(e),se(t,e)}function Ao(t){var e={},i,n;for(n in t)i=t[n],e[n]=i&&i.bind?i.bind(t):i;return t=e,e.type="dblclick",e.detail=2,e.isTrusted=!1,e._simulated=!0,e}var No=200;function Ro(t,e){t.addEventListener("dblclick",e);var i=0,n;function o(s){if(s.detail!==1){n=s.detail;return}if(!(s.pointerType==="mouse"||s.sourceCapabilities&&!s.sourceCapabilities.firesTouchEvents)){var r=Hi(s);if(!(r.some(function(h){return h instanceof HTMLLabelElement&&h.attributes.for})&&!r.some(function(h){return h instanceof HTMLInputElement||h instanceof HTMLSelectElement}))){var a=Date.now();a-i<=No?(n++,n===2&&e(Ao(s))):n=1,i=a}}}return t.addEventListener("click",o),{dblclick:e,simDblclick:o}}function Do(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}var Ae=he(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Gt=he(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Ni=Gt==="webkitTransition"||Gt==="OTransition"?Gt+"End":"transitionend";function Ri(t){return typeof t=="string"?document.getElementById(t):t}function jt(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||i==="auto")&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return i==="auto"?null:i}function C(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function R(t){var e=t.parentNode;e&&e.removeChild(t)}function re(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function Ot(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function At(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function Ne(t,e){if(t.classList!==void 0)return t.classList.contains(e);var i=ae(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function x(t,e){if(t.classList!==void 0)for(var i=b(e),n=0,o=i.length;n<o;n++)t.classList.add(i[n]);else if(!Ne(t,e)){var s=ae(t);Re(t,(s?s+" ":"")+e)}}function W(t,e){t.classList!==void 0?t.classList.remove(e):Re(t,yt((" "+ae(t)+" ").replace(" "+e+" "," ")))}function Re(t,e){t.className.baseVal===void 0?t.className=e:t.className.baseVal=e}function ae(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal}function lt(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&Fo(t,e)}function Fo(t,e){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch{if(e===1)return}e=Math.round(e*100),i?(i.Enabled=e!==100,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}function he(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function Ct(t,e,i){var n=e||new y(0,0);t.style[Ae]=(_.ie3d?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function U(t,e){t._leaflet_pos=e,_.any3d?Ct(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Et(t){return t._leaflet_pos||new y(0,0)}var Kt,Yt,De;if("onselectstart"in document)Kt=function(){w(window,"selectstart",X)},Yt=function(){Z(window,"selectstart",X)};else{var $t=he(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Kt=function(){if($t){var t=document.documentElement.style;De=t[$t],t[$t]="none"}},Yt=function(){$t&&(document.documentElement.style[$t]=De,De=void 0)}}function Fe(){w(window,"dragstart",X)}function He(){Z(window,"dragstart",X)}var ue,We;function Ve(t){for(;t.tabIndex===-1;)t=t.parentNode;t.style&&(le(),ue=t,We=t.style.outlineStyle,t.style.outlineStyle="none",w(window,"keydown",le))}function le(){ue&&(ue.style.outlineStyle=We,ue=void 0,We=void 0,Z(window,"keydown",le))}function Di(t){do t=t.parentNode;while((!t.offsetWidth||!t.offsetHeight)&&t!==document.body);return t}function Ue(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Ho={__proto__:null,TRANSFORM:Ae,TRANSITION:Gt,TRANSITION_END:Ni,get:Ri,getStyle:jt,create:C,remove:R,empty:re,toFront:Ot,toBack:At,hasClass:Ne,addClass:x,removeClass:W,setClass:Re,getClass:ae,setOpacity:lt,testProp:he,setTransform:Ct,setPosition:U,getPosition:Et,get disableTextSelection(){return Kt},get enableTextSelection(){return Yt},disableImageDrag:Fe,enableImageDrag:He,preventOutline:Ve,restoreOutline:le,getSizedParentNode:Di,getScale:Ue};function w(t,e,i,n){if(e&&typeof e=="object")for(var o in e)Ge(t,o,e[o],i);else{e=b(e);for(var s=0,r=e.length;s<r;s++)Ge(t,e[s],i,n)}return this}var pt="_leaflet_events";function Z(t,e,i,n){if(arguments.length===1)Fi(t),delete t[pt];else if(e&&typeof e=="object")for(var o in e)je(t,o,e[o],i);else if(e=b(e),arguments.length===2)Fi(t,function(a){return ht(e,a)!==-1});else for(var s=0,r=e.length;s<r;s++)je(t,e[s],i,n);return this}function Fi(t,e){for(var i in t[pt]){var n=i.split(/\d/)[0];(!e||e(n))&&je(t,n,null,null,i)}}var qe={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Ge(t,e,i,n){var o=e+g(i)+(n?"_"+g(n):"");if(t[pt]&&t[pt][o])return this;var s=function(a){return i.call(n||t,a||window.event)},r=s;!_.touchNative&&_.pointer&&e.indexOf("touch")===0?s=Eo(t,e,s):_.touch&&e==="dblclick"?s=Ro(t,s):"addEventListener"in t?e==="touchstart"||e==="touchmove"||e==="wheel"||e==="mousewheel"?t.addEventListener(qe[e]||e,s,_.passiveEvents?{passive:!1}:!1):e==="mouseenter"||e==="mouseleave"?(s=function(a){a=a||window.event,Ye(t,a)&&r(a)},t.addEventListener(qe[e],s,!1)):t.addEventListener(e,r,!1):t.attachEvent("on"+e,s),t[pt]=t[pt]||{},t[pt][o]=s}function je(t,e,i,n,o){o=o||e+g(i)+(n?"_"+g(n):"");var s=t[pt]&&t[pt][o];if(!s)return this;!_.touchNative&&_.pointer&&e.indexOf("touch")===0?zo(t,e,s):_.touch&&e==="dblclick"?Do(t,s):"removeEventListener"in t?t.removeEventListener(qe[e]||e,s,!1):t.detachEvent("on"+e,s),t[pt][o]=null}function zt(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function Ke(t){return Ge(t,"wheel",zt),this}function Jt(t){return w(t,"mousedown touchstart dblclick contextmenu",zt),t._leaflet_disable_click=!0,this}function X(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function It(t){return X(t),zt(t),this}function Hi(t){if(t.composedPath)return t.composedPath();for(var e=[],i=t.target;i;)e.push(i),i=i.parentNode;return e}function Wi(t,e){if(!e)return new y(t.clientX,t.clientY);var i=Ue(e),n=i.boundingClientRect;return new y((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var Wo=_.linux&&_.chrome?window.devicePixelRatio:_.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Vi(t){return _.edge?t.wheelDeltaY/2:t.deltaY&&t.deltaMode===0?-t.deltaY/Wo:t.deltaY&&t.deltaMode===1?-t.deltaY*20:t.deltaY&&t.deltaMode===2?-t.deltaY*60:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?-t.detail*20:t.detail?t.detail/-32765*60:0}function Ye(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch{return!1}return i!==t}var Vo={__proto__:null,on:w,off:Z,stopPropagation:zt,disableScrollPropagation:Ke,disableClickPropagation:Jt,preventDefault:X,stop:It,getPropagationPath:Hi,getMousePosition:Wi,getWheelDelta:Vi,isExternalTarget:Ye,addListener:w,removeListener:Z},Ui=Vt.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Et(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=it(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=this._duration*1e3;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),U(this._el,i),this.fire("step")},_complete:function(){ut(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),k=Vt.extend({options:{crs:Ce,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=d(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=P(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),e.zoom!==void 0&&(this._zoom=this._limitZoom(e.zoom)),e.center&&e.zoom!==void 0&&this.setView(S(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=Gt&&_.any3d&&!_.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),w(this._proxy,Ni,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){if(e=e===void 0?this._zoom:this._limitZoom(e),t=this._limitCenter(S(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&i!==!0){i.animate!==void 0&&(i.zoom=p({animate:i.animate},i.zoom),i.pan=p({animate:i.animate,duration:i.duration},i.pan));var n=this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan);if(n)return clearTimeout(this._sizeTimer),this}return 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||(_.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(_.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),o=this.getSize().divideBy(2),s=t instanceof y?t:this.latLngToContainerPoint(t),r=s.subtract(o).multiplyBy(1-1/n),a=this.containerPointToLatLng(o.add(r));return this.setView(a,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():V(t);var i=v(e.paddingTopLeft||e.padding||[0,0]),n=v(e.paddingBottomRight||e.padding||[0,0]),o=this.getBoundsZoom(t,!1,i.add(n));if(o=typeof e.maxZoom=="number"?Math.min(e.maxZoom,o):o,o===1/0)return{center:t.getCenter(),zoom:o};var s=n.subtract(i).divideBy(2),r=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o),h=this.unproject(r.add(a).divideBy(2).add(s),o);return{center:h,zoom:o}},fitBounds:function(t,e){if(t=V(t),!t.isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.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(t=v(t).round(),e=e||{},!t.x&&!t.y)return this.fire("moveend");if(e.animate!==!0&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new Ui,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),e.animate!==!1){x(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(i=i||{},i.animate===!1||!_.any3d)return this.setView(t,e,i);this._stop();var n=this.project(this.getCenter()),o=this.project(t),s=this.getSize(),r=this._zoom;t=S(t),e=e===void 0?r:e;var a=Math.max(s.x,s.y),h=a*this.getZoomScale(r,e),c=o.distanceTo(n)||1,f=1.42,m=f*f;function T(q){var Pe=q?-1:1,zs=q?h:a,Is=h*h-a*a+Pe*m*m*c*c,Bs=2*zs*m*c,ri=Is/Bs,bn=Math.sqrt(ri*ri+1)-ri,Zs=bn<1e-9?-18:Math.log(bn);return Zs}function et(q){return(Math.exp(q)-Math.exp(-q))/2}function $(q){return(Math.exp(q)+Math.exp(-q))/2}function dt(q){return et(q)/$(q)}var st=T(0);function Wt(q){return a*($(st)/$(st+f*q))}function Ss(q){return a*($(st)*dt(st+f*q)-et(st))/m}function ks(q){return 1-Math.pow(1-q,1.5)}var Cs=Date.now(),Ln=(T(1)-st)/f,Es=i.duration?1e3*i.duration:1e3*Ln*.8;function Tn(){var q=(Date.now()-Cs)/Es,Pe=ks(q)*Ln;q<=1?(this._flyToFrame=it(Tn,this),this._move(this.unproject(n.add(o.subtract(n).multiplyBy(Ss(Pe)/c)),r),this.getScaleZoom(a/Wt(Pe),r),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),Tn.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return t=V(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 i=this.getCenter(),n=this._limitCenter(i,this._zoom,V(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){e=e||{};var i=v(e.paddingTopLeft||e.padding||[0,0]),n=v(e.paddingBottomRight||e.padding||[0,0]),o=this.project(this.getCenter()),s=this.project(t),r=this.getPixelBounds(),a=nt([r.min.add(i),r.max.subtract(n)]),h=a.getSize();if(!a.contains(s)){this._enforcingBounds=!0;var c=s.subtract(a.getCenter()),f=a.extend(s).getSize().subtract(h);o.x+=c.x<0?-f.x:f.x,o.y+=c.y<0?-f.y:f.y,this.panTo(this.unproject(o),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=p({animate:!1,pan:!0},t===!0?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),n=e.divideBy(2).round(),o=i.divideBy(2).round(),s=n.subtract(o);return!s.x&&!s.y?this:(t.animate&&t.pan?this.panBy(s):(t.pan&&this._rawPanBy(s),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(P(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=p({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=P(this._handleGeolocationResponse,this),i=P(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,i=t.message||(e===1?"permission denied":e===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e=t.coords.latitude,i=t.coords.longitude,n=new B(e,i),o=n.toBounds(t.coords.accuracy*2),s=this._locateOptions;if(s.setView){var r=this.getBoundsZoom(o);this.setView(n,s.maxZoom?Math.min(r,s.maxZoom):r)}var a={latlng:n,bounds:o,timestamp:t.timestamp};for(var h in t.coords)typeof t.coords[h]=="number"&&(a[h]=t.coords[h]);this.fire("locationfound",a)}},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.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{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),R(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(ut(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)R(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i="leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),n=C("div",i,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(),e=this.unproject(t.getBottomLeft()),i=this.unproject(t.getTopRight());return new ot(e,i)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=V(t),i=v(i||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),h=this.getSize().subtract(i),c=nt(this.project(a,n),this.project(r,n)).getSize(),f=_.any3d?this.options.zoomSnap:1,m=h.x/c.x,T=h.y/c.y,et=e?Math.max(m,T):Math.min(m,T);return n=this.getScaleZoom(et,n),f&&(n=Math.round(n/(f/100))*(f/100),n=e?Math.ceil(n/f)*f:Math.floor(n/f)*f),Math.max(o,Math.min(s,n))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new y(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new N(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(t===void 0?this.getZoom():t)},getPane:function(t){return typeof t=="string"?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=e===void 0?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=e===void 0?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.latLngToPoint(S(t),e)},unproject:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.pointToLatLng(v(t),e)},layerPointToLatLng:function(t){var e=v(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){var e=this.project(S(t))._round();return e._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(S(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(V(t))},distance:function(t,e){return this.options.crs.distance(S(t),S(e))},containerPointToLayerPoint:function(t){return v(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return v(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(v(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(S(t)))},mouseEventToContainerPoint:function(t){return Wi(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=Ri(t);if(e){if(e._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");w(e,"scroll",this._onScroll,this),this._containerId=g(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&_.any3d,x(t,"leaflet-container"+(_.touch?" leaflet-touch":"")+(_.retina?" leaflet-retina":"")+(_.ielt9?" leaflet-oldie":"")+(_.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=jt(t,"position");e!=="absolute"&&e!=="relative"&&e!=="fixed"&&e!=="sticky"&&(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),U(this._mapPane,new y(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(x(t.markerPane,"leaflet-zoom-hide"),x(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,i){U(this._mapPane,new y(0,0));var n=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var o=this._zoom!==e;this._moveStart(o,i)._move(t,e)._moveEnd(o),this.fire("viewreset"),n&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i,n){e===void 0&&(e=this._zoom);var o=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),n?i&&i.pinch&&this.fire("zoom",i):((o||i&&i.pinch)&&this.fir