(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))_(d);new MutationObserver(d=>{for(const g of d)if(g.type==="childList")for(const p of g.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&_(p)}).observe(document,{childList:!0,subtree:!0});function r(d){const g={};return d.integrity&&(g.integrity=d.integrity),d.referrerPolicy&&(g.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?g.credentials="include":d.crossOrigin==="anonymous"?g.credentials="omit":g.credentials="same-origin",g}function _(d){if(d.ep)return;d.ep=!0;const g=r(d);fetch(d.href,g)}})();const _r={app_name:"Tilfluktsrom",status_ready:"Ready",status_loading:"Loading shelter data…",status_updating:"Updating…",status_offline:"Offline mode",status_shelters_loaded:"%d shelters loaded",status_no_location:"Waiting for GPS…",status_caching_map:"Caching map for offline use…",loading_shelters:"Downloading shelter data…",loading_map:"Caching map tiles…",loading_map_explanation:`Preparing offline map. The map will scroll briefly to cache your surroundings.`,loading_first_time:"Setting up for first use…",shelter_capacity:"%d places",shelter_room_nr:"Room %d",nearest_shelter:"Nearest shelter",no_shelters:"No shelter data available",action_refresh:"Refresh data",action_toggle_view:"Toggle map/compass view",action_skip:"Skip",action_cache_ok:"Cache map",action_cache_now:"Cache now",warning_no_map_cache:"No offline map cached. Map requires internet.",permission_location_title:"Location permission required",permission_location_message:"This app needs your location to find the nearest shelter. Please grant location access.",permission_denied:"Location permission denied. The app cannot find nearby shelters without it.",error_download_failed:"Could not download shelter data. Check your internet connection.",error_no_data_offline:"No cached data available. Connect to the internet to download shelter data.",update_success:"Shelter data updated",update_failed:"Update failed — using cached data"},mr={app_name:"Tilfluktsrom",status_ready:"Klar",status_loading:"Laster tilfluktsromdata…",status_updating:"Oppdaterer…",status_offline:"Frakoblet modus",status_shelters_loaded:"%d tilfluktsrom lastet",status_no_location:"Venter på GPS…",status_caching_map:"Lagrer kart for frakoblet bruk…",loading_shelters:"Laster ned tilfluktsromdata…",loading_map:"Lagrer kartfliser…",loading_map_explanation:`Forbereder frakoblet kart. Kartet vil rulle kort for å lagre omgivelsene dine.`,loading_first_time:"Gjør klar for første gangs bruk…",shelter_capacity:"%d plasser",shelter_room_nr:"Rom %d",nearest_shelter:"Nærmeste tilfluktsrom",no_shelters:"Ingen tilfluktsromdata tilgjengelig",action_refresh:"Oppdater data",action_toggle_view:"Bytt mellom kart og kompassvisning",action_skip:"Hopp over",action_cache_ok:"Lagre kart",action_cache_now:"Lagre nå",warning_no_map_cache:"Ingen frakoblet kart lagret. Kartet krever internett.",permission_location_title:"Posisjonstillatelse kreves",permission_location_message:"Denne appen trenger din posisjon for å finne nærmeste tilfluktsrom. Vennligst gi tilgang til posisjon.",permission_denied:"Posisjonstillatelse avslått. Appen kan ikke finne tilfluktsrom i nærheten uten den.",error_download_failed:"Kunne ikke laste ned tilfluktsromdata. Sjekk internettforbindelsen.",error_no_data_offline:"Ingen lagrede data tilgjengelig. Koble til internett for å laste ned tilfluktsromdata.",update_success:"Tilfluktsromdata oppdatert",update_failed:"Oppdatering mislyktes — bruker lagrede data"},pr={app_name:"Tilfluktsrom",status_ready:"Klar",status_loading:"Lastar tilfluktsromdata…",status_updating:"Oppdaterer…",status_offline:"Fråkopla modus",status_shelters_loaded:"%d tilfluktsrom lasta",status_no_location:"Ventar på GPS…",status_caching_map:"Lagrar kart for fråkopla bruk…",loading_shelters:"Lastar ned tilfluktsromdata…",loading_map:"Lagrar kartfliser…",loading_map_explanation:`Førebur fråkopla kart. Kartet vil rulle kort for å lagre omgjevnadene dine.`,loading_first_time:"Gjer klar for fyrste gongs bruk…",shelter_capacity:"%d plassar",shelter_room_nr:"Rom %d",nearest_shelter:"Næraste tilfluktsrom",no_shelters:"Ingen tilfluktsromdata tilgjengeleg",action_refresh:"Oppdater data",action_toggle_view:"Byt mellom kart og kompassvising",action_skip:"Hopp over",action_cache_ok:"Lagre kart",action_cache_now:"Lagre no",warning_no_map_cache:"Ingen fråkopla kart lagra. Kartet krev internett.",permission_location_title:"Posisjonsløyve krevst",permission_location_message:"Denne appen treng posisjonen din for å finne næraste tilfluktsrom. Ver venleg og gje tilgang til posisjon.",permission_denied:"Posisjonsløyve avslått. Appen kan ikkje finne tilfluktsrom i nærleiken utan det.",error_download_failed:"Kunne ikkje laste ned tilfluktsromdata. Sjekk internettilkoplinga.",error_no_data_offline:"Ingen lagra data tilgjengeleg. Kopla til internett for å laste ned tilfluktsromdata.",update_success:"Tilfluktsromdata oppdatert",update_failed:"Oppdatering mislukkast — brukar lagra data"},Oi={en:_r,nb:mr,nn:pr};let Bi="en";function gr(){const a=navigator.languages??[navigator.language];for(const l of a){const r=l.toLowerCase().split("-")[0];if(r in Oi){Bi=r;return}if(r==="no"){Bi="nb";return}}}function O(a,...l){var _;let r=((_=Oi[Bi])==null?void 0:_[a])??Oi.en[a]??a;for(const d of l)r=r.replace(/%[ds]/,String(d));return r}const vr=6371e3;function Bt(a){return a*Math.PI/180}function yr(a){return a*180/Math.PI}function wr(a,l,r,_){const d=Bt(r-a),g=Bt(_-l),p=Math.sin(d/2)**2+Math.cos(Bt(a))*Math.cos(Bt(r))*Math.sin(g/2)**2;return vr*2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p))}function xr(a,l,r,_){const d=Bt(a),g=Bt(r),p=Bt(_-l),S=Math.sin(p)*Math.cos(g),y=Math.cos(d)*Math.sin(g)-Math.sin(d)*Math.cos(g)*Math.cos(p);return(yr(Math.atan2(S,y))+360)%360}function Mo(a){return a<1e3?`${Math.round(a)} m`:`${(a/1e3).toFixed(1)} km`}function Lr(a,l,r,_=3){return a.map(d=>({shelter:d,distanceMeters:wr(l,r,d.latitude,d.longitude),bearingDegrees:xr(l,r,d.latitude,d.longitude)})).sort((d,g)=>d.distanceMeters-g.distanceMeters).slice(0,_)}const Zi=(a,l)=>l.some(r=>a instanceof r);let po,go;function Pr(){return po||(po=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function br(){return go||(go=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ai=new WeakMap,Ci=new WeakMap,We=new WeakMap;function Tr(a){const l=new Promise((r,_)=>{const d=()=>{a.removeEventListener("success",g),a.removeEventListener("error",p)},g=()=>{r(Zt(a.result)),d()},p=()=>{_(a.error),d()};a.addEventListener("success",g),a.addEventListener("error",p)});return We.set(l,a),l}function Mr(a){if(Ai.has(a))return;const l=new Promise((r,_)=>{const d=()=>{a.removeEventListener("complete",g),a.removeEventListener("error",p),a.removeEventListener("abort",p)},g=()=>{r(),d()},p=()=>{_(a.error||new DOMException("AbortError","AbortError")),d()};a.addEventListener("complete",g),a.addEventListener("error",p),a.addEventListener("abort",p)});Ai.set(a,l)}let Di={get(a,l,r){if(a instanceof IDBTransaction){if(l==="done")return Ai.get(a);if(l==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Zt(a[l])},set(a,l,r){return a[l]=r,!0},has(a,l){return a instanceof IDBTransaction&&(l==="done"||l==="store")?!0:l in a}};function ko(a){Di=a(Di)}function kr(a){return br().includes(a)?function(...l){return a.apply(Ni(this),l),Zt(this.request)}:function(...l){return Zt(a.apply(Ni(this),l))}}function Cr(a){return typeof a=="function"?kr(a):(a instanceof IDBTransaction&&Mr(a),Zi(a,Pr())?new Proxy(a,Di):a)}function Zt(a){if(a instanceof IDBRequest)return Tr(a);if(Ci.has(a))return Ci.get(a);const l=Cr(a);return l!==a&&(Ci.set(a,l),We.set(l,a)),l}const Ni=a=>We.get(a);function Sr(a,l,{blocked:r,upgrade:_,blocking:d,terminated:g}={}){const p=indexedDB.open(a,l),S=Zt(p);return _&&p.addEventListener("upgradeneeded",y=>{_(Zt(p.result),y.oldVersion,y.newVersion,Zt(p.transaction),y)}),r&&p.addEventListener("blocked",y=>r(y.oldVersion,y.newVersion,y)),S.then(y=>{g&&y.addEventListener("close",()=>g()),d&&y.addEventListener("versionchange",q=>d(q.oldVersion,q.newVersion,q))}).catch(()=>{}),S}const Er=["get","getKey","getAll","getAllKeys","count"],Ir=["put","add","delete","clear"],Si=new Map;function vo(a,l){if(!(a instanceof IDBDatabase&&!(l in a)&&typeof l=="string"))return;if(Si.get(l))return Si.get(l);const r=l.replace(/FromIndex$/,""),_=l!==r,d=Ir.includes(r);if(!(r in(_?IDBIndex:IDBObjectStore).prototype)||!(d||Er.includes(r)))return;const g=async function(p,...S){const y=this.transaction(p,d?"readwrite":"readonly");let q=y.store;return _&&(q=q.index(S.shift())),(await Promise.all([q[r](...S),d&&y.done]))[0]};return Si.set(l,g),g}ko(a=>({...a,get:(l,r,_)=>vo(l,r)||a.get(l,r,_),has:(l,r)=>!!vo(l,r)||a.has(l,r)}));const zr=["continue","continuePrimaryKey","advance"],yo={},Ri=new WeakMap,Co=new WeakMap,Or={get(a,l){if(!zr.includes(l))return a[l];let r=yo[l];return r||(r=yo[l]=function(..._){Ri.set(this,Co.get(this)[l](..._))}),r}};async function*Br(...a){let l=this;if(l instanceof IDBCursor||(l=await l.openCursor(...a)),!l)return;l=l;const r=new Proxy(l,Or);for(Co.set(r,l),We.set(r,Ni(l));l;)yield r,l=await(Ri.get(r)||l.continue()),Ri.delete(r)}function wo(a,l){return l===Symbol.asyncIterator&&Zi(a,[IDBIndex,IDBObjectStore,IDBCursor])||l==="iterate"&&Zi(a,[IDBIndex,IDBObjectStore])}ko(a=>({...a,get(l,r,_){return wo(l,r)?Br:a.get(l,r,_)},has(l,r){return wo(l,r)||a.has(l,r)}}));const Zr="tilfluktsrom",Ar=1,ue="shelters",Re="metadata",So="lastUpdate";let Ei=null;function Ue(){return Ei||(Ei=Sr(Zr,Ar,{upgrade(a){a.objectStoreNames.contains(ue)||a.createObjectStore(ue,{keyPath:"lokalId"}),a.objectStoreNames.contains(Re)||a.createObjectStore(Re)}})),Ei}async function Fi(){return(await Ue()).getAll(ue)}async function Dr(){return await(await Ue()).count(ue)>0}async function Nr(a){const l=await Ue(),r=l.transaction(ue,"readwrite");await r.store.clear();for(const d of a)await r.store.put(d);await r.done;const _=l.transaction(Re,"readwrite");await _.store.put(Date.now(),So),await _.done}async function Rr(a=7*24*60*60*1e3){const r=await(await Ue()).get(Re,So);return r==null?!0:Date.now()-r>a}const Fr="./data/shelters.json";async function Hi(){try{const a=await fetch(Fr);if(!a.ok)return!1;const l=await a.json();return await Nr(l),!0}catch{return!1}}let le=null;function Hr(a,l){le!==null&&Wr(),le=navigator.geolocation.watchPosition(r=>{a({latitude:r.coords.latitude,longitude:r.coords.longitude})},r=>{l==null||l(r)},{enableHighAccuracy:!0,maximumAge:1e4,timeout:3e4})}function Wr(){le!==null&&(navigator.geolocation.clearWatch(le),le=null)}function Ur(){return"geolocation"in navigator}const Vr=.3;let Oe=0,Fe=null,Wi=!1;function Ui(a){let l=null;if("webkitCompassHeading"in a?l=a.webkitCompassHeading:a.alpha!=null&&(l=(360-a.alpha)%360),l==null||Fe==null)return;let r=l-Oe;r>180&&(r-=360),r<-180&&(r+=360),Oe=(Oe+r*Vr+360)%360,Fe(Oe)}async function jr(){const a=DeviceOrientationEvent;if(typeof a.requestPermission=="function")try{return await a.requestPermission()==="granted"}catch{return!1}return!0}function Gr(a){if(Fe=a,Wi)return;Wi=!0;const l="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(l,Ui)}function qr(){Wi=!1,Fe=null,window.removeEventListener("deviceorientationabsolute",Ui),window.removeEventListener("deviceorientation",Ui)}var Kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yr(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Vi={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(a,l){(function(r,_){_(l)})(Kr,function(r){var _="1.9.4";function d(t){var e,i,n,o;for(i=1,n=arguments.length;i"u"||!L||!L.Mixin)){t=at(t)?t:[t];for(var e=0;e0?Math.floor(t):Math.ceil(t)};P.prototype={clone:function(){return new P(this.x,this.y)},add:function(t){return this.clone()._add(x(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(x(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 P(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new P(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=on(this.x),this.y=on(this.y),this},distanceTo:function(t){t=x(t);var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return t=x(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=x(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+it(this.x)+", "+it(this.y)+")"}};function x(t,e,i){return t instanceof P?t:at(t)?new P(t[0],t[1]):t==null?t:typeof t=="object"&&"x"in t&&"y"in t?new P(t.x,t.y):new P(t,e,i)}function A(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=Y(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>=e.x&&n.x<=i.x,h=o.y>=e.y&&n.y<=i.y;return s&&h},overlaps:function(t){t=Y(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>e.x&&n.xe.y&&n.y=e.lat&&o.lat<=i.lat&&n.lng>=e.lng&&o.lng<=i.lng},intersects:function(t){t=F(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=e.lat&&n.lat<=i.lat,h=o.lng>=e.lng&&n.lng<=i.lng;return s&&h},overlaps:function(t){t=F(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>e.lat&&n.late.lng&&n.lng1,ns=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",Z,e),window.removeEventListener("testPassiveEventSupport",Z,e)}catch{}return t}(),os=function(){return!!document.createElement("canvas").getContext}(),ei=!!(document.createElementNS&&rn("svg").createSVGRect),ss=!!ei&&function(){var t=document.createElement("div");return t.innerHTML="",(t.firstChild&&t.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),rs=!ei&&function(){try{var t=document.createElement("div");t.innerHTML='';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&typeof e.adj=="object"}catch{return!1}}(),as=navigator.platform.indexOf("Mac")===0,hs=navigator.platform.indexOf("Linux")===0;function dt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var v={ie:_e,ielt9:jo,edge:hn,webkit:Qe,android:ln,android23:un,androidStock:qo,opera:$e,chrome:cn,gecko:dn,safari:Ko,phantom:fn,opera12:_n,win:Yo,ie3d:mn,webkit3d:ti,gecko3d:pn,any3d:Jo,mobile:Yt,mobileWebkit:Xo,mobileWebkit3d:Qo,msPointer:gn,pointer:vn,touch:$o,touchNative:yn,mobileOpera:ts,mobileGecko:es,retina:is,passiveEvents:ns,canvas:os,svg:ei,vml:rs,inlineSvg:ss,mac:as,linux:hs},wn=v.msPointer?"MSPointerDown":"pointerdown",xn=v.msPointer?"MSPointerMove":"pointermove",Ln=v.msPointer?"MSPointerUp":"pointerup",Pn=v.msPointer?"MSPointerCancel":"pointercancel",ii={touchstart:wn,touchmove:xn,touchend:Ln,touchcancel:Pn},bn={touchstart:_s,touchmove:me,touchend:me,touchcancel:me},At={},Tn=!1;function ls(t,e,i){return e==="touchstart"&&fs(),bn[e]?(i=bn[e].bind(this,i),t.addEventListener(ii[e],i,!1),i):(console.warn("wrong event specified:",e),Z)}function us(t,e,i){if(!ii[e]){console.warn("wrong event specified:",e);return}t.removeEventListener(ii[e],i,!1)}function cs(t){At[t.pointerId]=t}function ds(t){At[t.pointerId]&&(At[t.pointerId]=t)}function Mn(t){delete At[t.pointerId]}function fs(){Tn||(document.addEventListener(wn,cs,!0),document.addEventListener(xn,ds,!0),document.addEventListener(Ln,Mn,!0),document.addEventListener(Pn,Mn,!0),Tn=!0)}function me(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){e.touches=[];for(var i in At)e.touches.push(At[i]);e.changedTouches=[e],t(e)}}function _s(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&j(e),me(t,e)}function ms(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 ps=200;function gs(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 h=In(s);if(!(h.some(function(c){return c instanceof HTMLLabelElement&&c.attributes.for})&&!h.some(function(c){return c instanceof HTMLInputElement||c instanceof HTMLSelectElement}))){var u=Date.now();u-i<=ps?(n++,n===2&&e(ms(s))):n=1,i=u}}}return t.addEventListener("click",o),{dblclick:e,simDblclick:o}}function vs(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}var ni=ve(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Jt=ve(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),kn=Jt==="webkitTransition"||Jt==="OTransition"?Jt+"End":"transitionend";function Cn(t){return typeof t=="string"?document.getElementById(t):t}function Xt(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 E(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function D(t){var e=t.parentNode;e&&e.removeChild(t)}function pe(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function Dt(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function Nt(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function oi(t,e){if(t.classList!==void 0)return t.classList.contains(e);var i=ge(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function T(t,e){if(t.classList!==void 0)for(var i=Ct(e),n=0,o=i.length;n0?2*window.devicePixelRatio:1;function On(t){return v.edge?t.wheelDeltaY/2:t.deltaY&&t.deltaMode===0?-t.deltaY/xs: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 pi(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 Ls={__proto__:null,on:b,off:z,stopPropagation:It,disableScrollPropagation:mi,disableClickPropagation:ee,preventDefault:j,stop:zt,getPropagationPath:In,getMousePosition:zn,getWheelDelta:On,isExternalTarget:pi,addListener:b,removeListener:z},Bn=qt.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=K(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=this._duration*1e3;ethis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,F(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){e=e||{};var i=x(e.paddingTopLeft||e.padding||[0,0]),n=x(e.paddingBottomRight||e.padding||[0,0]),o=this.project(this.getCenter()),s=this.project(t),h=this.getPixelBounds(),u=Y([h.min.add(i),h.max.subtract(n)]),c=u.getSize();if(!u.contains(s)){this._enforcingBounds=!0;var f=s.subtract(u.getCenter()),m=u.extend(s).getSize().subtract(c);o.x+=f.x<0?-m.x:m.x,o.y+=f.y<0?-m.y:m.y,this.panTo(this.unproject(o),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=d({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=d({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 I(e,i),o=n.toBounds(t.coords.accuracy*2),s=this._locateOptions;if(s.setView){var h=this.getBoundsZoom(o);this.setView(n,s.maxZoom?Math.min(h,s.maxZoom):h)}var u={latlng:n,bounds:o,timestamp:t.timestamp};for(var c in t.coords)typeof t.coords[c]=="number"&&(u[c]=t.coords[c]);this.fire("locationfound",u)}},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(),D(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(nt(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)D(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=E("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 J(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=F(t),i=x(i||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),h=t.getNorthWest(),u=t.getSouthEast(),c=this.getSize().subtract(i),f=Y(this.project(u,n),this.project(h,n)).getSize(),m=v.any3d?this.options.zoomSnap:1,w=c.x/f.x,M=c.y/f.y,G=e?Math.max(w,M):Math.min(w,M);return n=this.getScaleZoom(G,n),m&&(n=Math.round(n/(m/100))*(m/100),n=e?Math.ceil(n/m)*m:Math.floor(n/m)*m),Math.max(o,Math.min(s,n))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new P(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 A(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(k(t),e)},unproject:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.pointToLatLng(x(t),e)},layerPointToLatLng:function(t){var e=x(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){var e=this.project(k(t))._round();return e._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(k(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(F(t))},distance:function(t,e){return this.options.crs.distance(k(t),k(e))},containerPointToLayerPoint:function(t){return x(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return x(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(x(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(k(t)))},mouseEventToContainerPoint:function(t){return zn(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=Cn(t);if(e){if(e._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");b(e,"scroll",this._onScroll,this),this._containerId=y(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&v.any3d,T(t,"leaflet-container"+(v.touch?" leaflet-touch":"")+(v.retina?" leaflet-retina":"")+(v.ielt9?" leaflet-oldie":"")+(v.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=Xt(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),H(this._mapPane,new P(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(T(t.markerPane,"leaflet-zoom-hide"),T(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,i){H(this._mapPane,new P(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.fire("zoom",i),this.fire("move",i)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return nt(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){H(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[y(this._container)]=this;var e=t?z:b;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),v.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){nt(this._resizeRequest),this._resizeRequest=K(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i=[],n,o=e==="mouseout"||e==="mouseover",s=t.target||t.srcElement,h=!1;s;){if(n=this._targets[y(s)],n&&(e==="click"||e==="preclick")&&this._draggableMoved(n)){h=!0;break}if(n&&n.listens(e,!0)&&(o&&!pi(s,t)||(i.push(n),o))||s===this._container)break;s=s.parentNode}return!i.length&&!h&&!o&&this.listens(e,!0)&&(i=[this]),i},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e=t.target||t.srcElement;if(!(!this._loaded||e._leaflet_disable_events||t.type==="click"&&this._isClickDisabled(e))){var i=t.type;i==="mousedown"&&ui(e),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if(t.type==="click"){var n=d({},t);n.type="preclick",this._fireDOMEvent(n,n.type,i)}var o=this._findEventTargets(t,e);if(i){for(var s=[],h=0;h0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),n=v.any3d?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){N(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return(e&&e.animate)!==!0&&!this.getSize().contains(i)?!1:(this.panBy(i,e),!0)},_createAnimProxy:function(){var t=this._proxy=E("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(e){var i=ni,n=this._proxy.style[i];St(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),n===this._proxy.style[i]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){D(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),e=this.getZoom();St(this._proxy,this.project(t,e),this.getZoomScale(e,1))},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||i.animate===!1||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/n);return i.animate!==!0&&!this.getSize().contains(o)?!1:(K(function(){this._moveStart(!0,i.noMoveStart||!1)._animateZoom(t,e,!0)},this),!0)},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,T(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(p(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&N(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Ps(t,e){return new C(t,e)}var ht=gt.extend({options:{position:"topright"},initialize:function(t){B(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return T(e,"leaflet-control"),i.indexOf("bottom")!==-1?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(D(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),ie=function(t){return new ht(t)};C.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=E("div",e+"control-container",this._container);function n(o,s){var h=e+o+" "+e+s;t[o+s]=E("div",h,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)D(this._controlCorners[t]);D(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Zn=ht.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(y(t.target)),i=e.overlay?t.type==="add"?"overlayadd":"overlayremove":t.type==="add"?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e=document.createElement("label"),i=this._map.hasLayer(t.layer),n;t.overlay?(n=document.createElement("input"),n.type="checkbox",n.className="leaflet-control-layers-selector",n.defaultChecked=i):n=this._createRadioElement("leaflet-base-layers_"+y(this),i),this._layerControlInputs.push(n),n.layerId=y(t.layer),b(n,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("span");e.appendChild(s),s.appendChild(n),s.appendChild(o);var h=t.overlay?this._overlaysList:this._baseLayersList;return h.appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){if(!this._preventClick){var t=this._layerControlInputs,e,i,n=[],o=[];this._handlingClick=!0;for(var s=t.length-1;s>=0;s--)e=t[s],i=this._getLayer(e.layerId).layer,e.checked?n.push(i):e.checked||o.push(i);for(s=0;s=0;o--)e=t[o],i=this._getLayer(e.layerId).layer,e.disabled=i.options.minZoom!==void 0&&ni.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,b(t,"click",j),this.expand();var e=this;setTimeout(function(){z(t,"click",j),e._preventClick=!1})}}),bs=function(t,e,i){return new Zn(t,e,i)},gi=ht.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=E("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,o){var s=E("a",i,n);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),ee(s),b(s,"click",zt),b(s,"click",o,this),b(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";N(this._zoomInButton,e),N(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(T(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(T(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}});C.mergeOptions({zoomControl:!0}),C.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new gi,this.addControl(this.zoomControl))});var Ts=function(t){return new gi(t)},An=ht.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=E("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=E("div",e,i)),t.imperial&&(this._iScale=E("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e=t*3.2808399,i,n,o;e>5280?(i=e/5280,n=this._getRoundNum(i),this._updateScale(this._iScale,n+" mi",n/i)):(o=this._getRoundNum(e),this._updateScale(this._iScale,o+" ft",o/e))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1,e*i}}),Ms=function(t){return new An(t)},ks='',vi=ht.extend({options:{position:"bottomright",prefix:''+(v.inlineSvg?ks+" ":"")+"Leaflet"},initialize:function(t){B(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=E("div","leaflet-control-attribution"),ee(this._container);for(var e in t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(' ')}}});C.mergeOptions({attributionControl:!0}),C.addInitHook(function(){this.options.attributionControl&&new vi().addTo(this)});var Cs=function(t){return new vi(t)};ht.Layers=Zn,ht.Zoom=gi,ht.Scale=An,ht.Attribution=vi,ie.layers=bs,ie.zoom=Ts,ie.scale=Ms,ie.attribution=Cs;var _t=gt.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});_t.addTo=function(t,e){return t.addHandler(e,this),this};var Ss={Events:$},Dn=v.touch?"touchstart mousedown":"mousedown",Tt=qt.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){B(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(b(this._dragStartTarget,Dn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Tt._dragging===this&&this.finishDrag(!0),z(this._dragStartTarget,Dn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!oi(this._element,"leaflet-zoom-anim"))){if(t.touches&&t.touches.length!==1){Tt._dragging===this&&this.finishDrag();return}if(!(Tt._dragging||t.shiftKey||t.which!==1&&t.button!==1&&!t.touches)&&(Tt._dragging=this,this._preventOutline&&ui(this._element),ai(),Qt(),!this._moving)){this.fire("down");var e=t.touches?t.touches[0]:t,i=Sn(this._element);this._startPoint=new P(e.clientX,e.clientY),this._startPos=Et(this._element),this._parentScale=ci(i);var n=t.type==="mousedown";b(document,n?"mousemove":"touchmove",this._onMove,this),b(document,n?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(t){if(this._enabled){if(t.touches&&t.touches.length>1){this._moved=!0;return}var e=t.touches&&t.touches.length===1?t.touches[0]:t,i=new P(e.clientX,e.clientY)._subtract(this._startPoint);!i.x&&!i.y||Math.abs(i.x)+Math.abs(i.y)s&&(h=u,s=c);s>i&&(e[h]=1,wi(t,e,i,n,h),wi(t,e,i,h,o))}function Os(t,e){for(var i=[t[0]],n=1,o=0,s=t.length;ne&&(i.push(t[n]),o=n);return oe.max.x&&(i|=2),t.ye.max.y&&(i|=8),i}function Bs(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function ne(t,e,i,n){var o=e.x,s=e.y,h=i.x-o,u=i.y-s,c=h*h+u*u,f;return c>0&&(f=((t.x-o)*h+(t.y-s)*u)/c,f>1?(o=i.x,s=i.y):f>0&&(o+=h*f,s+=u*f)),h=t.x-o,u=t.y-s,n?h*h+u*u:new P(o,s)}function st(t){return!at(t[0])||typeof t[0][0]!="object"&&typeof t[0][0]<"u"}function Vn(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),st(t)}function jn(t,e){var i,n,o,s,h,u,c,f;if(!t||t.length===0)throw new Error("latlngs not passed");st(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var m=k([0,0]),w=F(t),M=w.getNorthWest().distanceTo(w.getSouthWest())*w.getNorthEast().distanceTo(w.getNorthWest());M<1700&&(m=yi(t));var G=t.length,U=[];for(i=0;in){c=(s-n)/o,f=[u.x-c*(u.x-h.x),u.y-c*(u.y-h.y)];break}var X=e.unproject(x(f));return k([X.lat+m.lat,X.lng+m.lng])}var Zs={__proto__:null,simplify:Fn,pointToSegmentDistance:Hn,closestPointOnSegment:Is,clipSegment:Un,_getEdgeIntersection:xe,_getBitCode:Ot,_sqClosestPointOnSegment:ne,isFlat:st,_flat:Vn,polylineCenter:jn},xi={project:function(t){return new P(t.lng,t.lat)},unproject:function(t){return new I(t.y,t.x)},bounds:new A([-180,-90],[180,90])},Li={R:6378137,R_MINOR:6356752314245179e-9,bounds:new A([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,o=this.R_MINOR/i,s=Math.sqrt(1-o*o),h=s*Math.sin(n),u=Math.tan(Math.PI/4-n/2)/Math.pow((1-h)/(1+h),s/2);return n=-i*Math.log(Math.max(u,1e-10)),new P(t.lng*e*i,n)},unproject:function(t){for(var e=180/Math.PI,i=this.R,n=this.R_MINOR/i,o=Math.sqrt(1-n*n),s=Math.exp(-t.y/i),h=Math.PI/2-2*Math.atan(s),u=0,c=.1,f;u<15&&Math.abs(c)>1e-7;u++)f=o*Math.sin(h),f=Math.pow((1-f)/(1+f),o/2),c=Math.PI/2-2*Math.atan(s*f)-h,h+=c;return new I(h*e,t.x*e/i)}},As={__proto__:null,LonLat:xi,Mercator:Li,SphericalMercator:Ke},Ds=d({},bt,{code:"EPSG:3395",projection:Li,transformation:function(){var t=.5/(Math.PI*Li.R);return Kt(t,.5,-t,.5)}()}),Gn=d({},bt,{code:"EPSG:4326",projection:xi,transformation:Kt(1/180,1,-1/180,.5)}),Ns=d({},vt,{projection:xi,transformation:Kt(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});vt.Earth=bt,vt.EPSG3395=Ds,vt.EPSG3857=Je,vt.EPSG900913=Vo,vt.EPSG4326=Gn,vt.Simple=Ns;var lt=qt.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[y(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[y(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",function(){e.off(i,this)},this)}this.onAdd(e),this.fire("add"),e.fire("layeradd",{layer:this})}}});C.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=y(t);return this._layers[e]?this:(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var e=y(t);return this._layers[e]?(this._loaded&&t.onRemove(this),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return y(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){t=t?at(t)?t:[t]:[];for(var e=0,i=t.length;ethis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&e[0]instanceof I&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){wt.prototype._setLatLngs.call(this,t),st(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return st(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new P(e,e);if(t=new A(t.min.subtract(i),t.max.add(i)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}for(var n=0,o=this._rings.length,s;nt.y!=o.y>t.y&&t.x<(o.x-n.x)*(t.y-n.y)/(o.y-n.y)+n.x&&(e=!e);return e||wt.prototype._containsPoint.call(this,t,!0)}});function Gs(t,e){return new Ht(t,e)}var xt=yt.extend({initialize:function(t,e){B(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e=at(t)?t:t.features,i,n,o;if(e){for(i=0,n=e.length;i0&&o.push(o[0].slice()),o}function Wt(t,e){return t.feature?d({},t.feature,{geometry:e}):ke(e)}function ke(t){return t.type==="Feature"||t.type==="FeatureCollection"?t:{type:"Feature",properties:{},geometry:t}}var Mi={toGeoJSON:function(t){return Wt(this,{type:"Point",coordinates:Ti(this.getLatLng(),t)})}};Le.include(Mi),Pi.include(Mi),Pe.include(Mi),wt.include({toGeoJSON:function(t){var e=!st(this._latlngs),i=Me(this._latlngs,e?1:0,!1,t);return Wt(this,{type:(e?"Multi":"")+"LineString",coordinates:i})}}),Ht.include({toGeoJSON:function(t){var e=!st(this._latlngs),i=e&&!st(this._latlngs[0]),n=Me(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),Wt(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),Rt.include({toMultiPoint:function(t){var e=[];return this.eachLayer(function(i){e.push(i.toGeoJSON(t).geometry.coordinates)}),Wt(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(e==="MultiPoint")return this.toMultiPoint(t);var i=e==="GeometryCollection",n=[];return this.eachLayer(function(o){if(o.toGeoJSON){var s=o.toGeoJSON(t);if(i)n.push(s.geometry);else{var h=ke(s);h.type==="FeatureCollection"?n.push.apply(n,h.features):n.push(h)}}}),i?Wt(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});function Yn(t,e){return new xt(t,e)}var qs=Yn,Ce=lt.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=F(e),B(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(T(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){D(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&Dt(this._image),this},bringToBack:function(){return this._map&&Nt(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=F(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t=this._url.tagName==="IMG",e=this._image=t?this._url:E("img");if(T(e,"leaflet-image-layer"),this._zoomAnimated&&T(e,"leaflet-zoom-animated"),this.options.className&&T(e,this.options.className),e.onselectstart=Z,e.onmousemove=Z,e.onload=p(this.fire,this,"load"),e.onerror=p(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(e.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t){this._url=e.src;return}e.src=this._url,e.alt=this.options.alt},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;St(this._image,i,e)},_reset:function(){var t=this._image,e=new A(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();H(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){ot(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)},getCenter:function(){return this._bounds.getCenter()}}),Ks=function(t,e,i){return new Ce(t,e,i)},Jn=Ce.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t=this._url.tagName==="VIDEO",e=this._image=t?this._url:E("video");if(T(e,"leaflet-image-layer"),this._zoomAnimated&&T(e,"leaflet-zoom-animated"),this.options.className&&T(e,this.options.className),e.onselectstart=Z,e.onmousemove=Z,e.onloadeddata=p(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),n=[],o=0;o0?n:[e.src];return}at(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(e.style,"objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop,e.muted=!!this.options.muted,e.playsInline=!!this.options.playsInline;for(var s=0;so?(e.height=o+"px",T(t,s)):N(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();H(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var t=this._map,e=parseInt(Xt(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,o=new P(this._containerLeft,-i-this._containerBottom);o._add(Et(this._container));var s=t.layerPointToContainerPoint(o),h=x(this.options.autoPanPadding),u=x(this.options.autoPanPaddingTopLeft||h),c=x(this.options.autoPanPaddingBottomRight||h),f=t.getSize(),m=0,w=0;s.x+n+c.x>f.x&&(m=s.x+n-f.x+c.x),s.x-m-u.x<0&&(m=s.x-u.x),s.y+i+c.y>f.y&&(w=s.y+i-f.y+c.y),s.y-w-u.y<0&&(w=s.y-u.y),(m||w)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([m,w]))}},_getAnchor:function(){return x(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Xs=function(t,e){return new Se(t,e)};C.mergeOptions({closePopupOnClick:!0}),C.include({openPopup:function(t,e,i){return this._initOverlay(Se,t,e,i).openOn(this),this},closePopup:function(t){return t=arguments.length?t:this._popup,t&&t.close(),this}}),lt.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Se,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof yt||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(!(!this._popup||!this._map)){zt(t);var e=t.layer||t.target;if(this._popup._source===e&&!(e instanceof Mt)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);return}this._popup._source=e,this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){t.originalEvent.keyCode===13&&this._openPopup(t)}});var Ee=mt.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){mt.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){mt.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=mt.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip",e=t+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=E("div",e),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+y(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,i,n=this._map,o=this._container,s=n.latLngToContainerPoint(n.getCenter()),h=n.layerPointToContainerPoint(t),u=this.options.direction,c=o.offsetWidth,f=o.offsetHeight,m=x(this.options.offset),w=this._getAnchor();u==="top"?(e=c/2,i=f):u==="bottom"?(e=c/2,i=0):u==="center"?(e=c/2,i=f/2):u==="right"?(e=0,i=f/2):u==="left"?(e=c,i=f/2):h.xthis.options.maxZoom||in?this._retainParent(o,s,h,n):!1)},_retainChildren:function(t,e,i,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*e;s<2*e+2;s++){var h=new P(o,s);h.z=i+1;var u=this._tileCoordsToKey(h),c=this._tiles[u];if(c&&c.active){c.retain=!0;continue}else c&&c.loaded&&(c.retain=!0);i+1this.options.maxZoom||this.options.minZoom!==void 0&&o1){this._setView(t,i);return}for(var w=o.min.y;w<=o.max.y;w++)for(var M=o.min.x;M<=o.max.x;M++){var G=new P(M,w);if(G.z=this._tileZoom,!!this._isValidTile(G)){var U=this._tiles[this._tileCoordsToKey(G)];U?U.current=!0:h.push(G)}}if(h.sort(function(X,Vt){return X.distanceTo(s)-Vt.distanceTo(s)}),h.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var rt=document.createDocumentFragment();for(M=0;Mi.max.x)||!e.wrapLat&&(t.yi.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return F(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),o=n.add(i),s=e.unproject(n,t.z),h=e.unproject(o,t.z);return[s,h]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new J(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new P(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(D(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){T(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=Z,t.onmousemove=Z,v.ielt9&&this.options.opacity<1&&ot(t,this.options.opacity)},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),p(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&K(p(this._tileReady,this,t,null,o)),H(o,i),this._tiles[n]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);i=this._tiles[n],i&&(i.loaded=+new Date,this._map._fadeAnimated?(ot(i.el,0),nt(this._fadeFrame),this._fadeFrame=K(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(T(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),v.ielt9||!this._map._fadeAnimated?K(this._pruneTiles,this):setTimeout(p(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new P(this._wrapX?pt(t.x,this._wrapX):t.x,this._wrapY?pt(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new A(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function tr(t){return new se(t)}var Ut=se.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,e=B(this,e),e.detectRetina&&v.retina&&e.maxZoom>0?(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom=Math.min(e.maxZoom,e.minZoom+1)):(e.zoomOffset++,e.maxZoom=Math.max(e.minZoom,e.maxZoom-1)),e.minZoom=Math.max(0,e.minZoom)):e.zoomReverse?e.minZoom=Math.min(e.maxZoom,e.minZoom):e.maxZoom=Math.max(e.minZoom,e.maxZoom),typeof e.subdomains=="string"&&(e.subdomains=e.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&e===void 0&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return b(i,"load",p(this._tileOnLoad,this,e,i)),b(i,"error",p(this._tileOnError,this,e,i)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(i.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(i.referrerPolicy=this.options.referrerPolicy),i.alt="",i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:v.retina?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return $i(this._url,d(e,this.options))},_tileOnLoad:function(t,e){v.ielt9?setTimeout(p(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom,i=this.options.zoomReverse,n=this.options.zoomOffset;return i&&(t=e-t),t+n},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)if(this._tiles[t].coords.z!==this._tileZoom&&(e=this._tiles[t].el,e.onload=Z,e.onerror=Z,!e.complete)){e.src=fe;var i=this._tiles[t].coords;D(e),delete this._tiles[t],this.fire("tileabort",{tile:e,coords:i})}},_removeTile:function(t){var e=this._tiles[t];if(e)return e.el.setAttribute("src",fe),se.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(!(!this._map||i&&i.getAttribute("src")===fe))return se.prototype._tileReady.call(this,t,e,i)}});function $n(t,e){return new Ut(t,e)}var to=Ut.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=d({},this.defaultWmsParams);for(var n in e)n in this.options||(i[n]=e[n]);e=B(this,e);var o=e.detectRetina&&v.retina?2:1,s=this.getTileSize();i.width=s.x*o,i.height=s.y*o,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,Ut.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=Y(i.project(e[0]),i.project(e[1])),o=n.min,s=n.max,h=(this._wmsVersion>=1.3&&this._crs===Gn?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),u=Ut.prototype.getTileUrl.call(this,t);return u+Qi(this.wmsParams,u,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+h},setParams:function(t,e){return d(this.wmsParams,t),e||this.redraw(),this}});function er(t,e){return new to(t,e)}Ut.WMS=to,$n.wms=er;var Lt=lt.extend({options:{padding:.1},initialize:function(t){B(this,t),y(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),T(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),n=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,e),s=n.multiplyBy(-i).add(o).subtract(this._map._getNewPixelOrigin(t,e));v.any3d?St(this._container,s,i):H(this._container,s)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new A(i,i.add(e.multiplyBy(1+t*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),eo=Lt.extend({options:{tolerance:0},getEvents:function(){var t=Lt.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Lt.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");b(t,"mousemove",this._onMouseMove,this),b(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),b(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){nt(this._redrawRequest),delete this._ctx,D(this._container),z(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;this._redrawBounds=null;for(var e in this._layers)t=this._layers[e],t._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Lt.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=v.retina?2:1;H(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",v.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Lt.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[y(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[y(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if(typeof t.options.dashArray=="string"){var e=t.options.dashArray.split(/[, ]+/),i=[],n,o;for(o=0;o')}}catch{}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),ir={_initContainer:function(){this._container=E("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Lt.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=re("shape");T(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=re("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[y(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;D(e),t.removeInteractiveTarget(e),delete this._layers[y(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(e||(e=t._stroke=re("stroke")),o.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=at(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(o.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=re("fill")),o.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(o.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,"+65535*360)},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){Dt(t._container)},_bringToBack:function(t){Nt(t._container)}},Ie=v.vml?re:rn,ae=Lt.extend({_initContainer:function(){this._container=Ie("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Ie("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){D(this._container),z(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Lt.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;(!this._svgSize||!this._svgSize.equals(e))&&(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),H(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Ie("path");t.options.className&&T(e,t.options.className),t.options.interactive&&T(e,"leaflet-interactive"),this._updateStyle(t),this._layers[y(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){D(t._path),t.removeInteractiveTarget(t._path),delete this._layers[y(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,an(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n=Math.max(Math.round(t._radiusY),1)||i,o="a"+i+","+n+" 0 1,0 ",s=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+o+i*2+",0 "+o+-i*2+",0 ";this._setPath(t,s)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){Dt(t._path)},_bringToBack:function(t){Nt(t._path)}});v.vml&&ae.include(ir);function no(t){return v.svg||v.vml?new ae(t):null}C.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if(t==="overlayPane"||t===void 0)return!1;var e=this._paneRenderers[t];return e===void 0&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&io(t)||no(t)}});var oo=Ht.extend({initialize:function(t,e){Ht.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=F(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function nr(t,e){return new oo(t,e)}ae.create=Ie,ae.pointsToPath=an,xt.geometryToLayer=be,xt.coordsToLatLng=bi,xt.coordsToLatLngs=Te,xt.latLngToCoords=Ti,xt.latLngsToCoords=Me,xt.getFeature=Wt,xt.asFeature=ke,C.mergeOptions({boxZoom:!0});var so=_t.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){b(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){z(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){D(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||t.which!==1&&t.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Qt(),ai(),this._startPoint=this._map.mouseEventToContainerPoint(t),b(document,{contextmenu:zt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=E("div","leaflet-zoom-box",this._container),T(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new A(this._point,this._startPoint),i=e.getSize();H(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(D(this._box),N(this._container,"leaflet-crosshair")),$t(),hi(),z(document,{contextmenu:zt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if(!(t.which!==1&&t.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(p(this._resetState,this),0);var e=new J(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){t.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});C.addInitHook("addHandler","boxZoom",so),C.mergeOptions({doubleClickZoom:!0});var ro=_t.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,o=t.originalEvent.shiftKey?i-n:i+n;e.options.doubleClickZoom==="center"?e.setZoom(o):e.setZoomAround(t.containerPoint,o)}});C.addInitHook("addHandler","doubleClickZoom",ro),C.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var ao=_t.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new Tt(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}T(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){N(this._map._container,"leaflet-grab"),N(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=F(this._map.options.maxBounds);this._offsetLimit=Y(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.xe.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-e+i)%t+e-i,s=(n+e+i)%t-e-i,h=Math.abs(o+i)0?s:-s))-e;this._delta=0,this._startTime=null,h&&(t.options.scrollWheelZoom==="center"?t.setZoom(e+h):t.setZoomAround(this._lastMousePos,e+h))}});C.addInitHook("addHandler","scrollWheelZoom",lo);var or=600;C.mergeOptions({tapHold:v.touchNative&&v.safari&&v.mobile,tapTolerance:15});var uo=_t.extend({addHooks:function(){b(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){z(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),t.touches.length===1){var e=t.touches[0];this._startPos=this._newPos=new P(e.clientX,e.clientY),this._holdTimeout=setTimeout(p(function(){this._cancel(),this._isTapValid()&&(b(document,"touchend",j),b(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",e))},this),or),b(document,"touchend touchcancel contextmenu",this._cancel,this),b(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){z(document,"touchend",j),z(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),z(document,"touchend touchcancel contextmenu",this._cancel,this),z(document,"touchmove",this._onMove,this)},_onMove:function(t){var e=t.touches[0];this._newPos=new P(e.clientX,e.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,e){var i=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY});i._simulated=!0,e.target.dispatchEvent(i)}});C.addInitHook("addHandler","tapHold",uo),C.mergeOptions({touchZoom:v.touch,bounceAtZoomLimits:!0});var co=_t.extend({addHooks:function(){T(this._map._container,"leaflet-touch-zoom"),b(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){N(this._map._container,"leaflet-touch-zoom"),z(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(!(!t.touches||t.touches.length!==2||e._animatingZoom||this._zooming)){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),e.options.touchZoom!=="center"&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),b(document,"touchmove",this._onTouchMove,this),b(document,"touchend touchcancel",this._onTouchEnd,this),j(t)}},_onTouchMove:function(t){if(!(!t.touches||t.touches.length!==2||!this._zooming)){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),o=i.distanceTo(n)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoome.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),e.options.touchZoom==="center"){if(this._center=this._startLatLng,o===1)return}else{var s=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(o===1&&s.x===0&&s.y===0)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(s),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),nt(this._animRequest);var h=p(e._move,e,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=K(h,this,!0),j(t)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,nt(this._animRequest),z(document,"touchmove",this._onTouchMove,this),z(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});C.addInitHook("addHandler","touchZoom",co),C.BoxZoom=so,C.DoubleClickZoom=ro,C.Drag=ao,C.Keyboard=ho,C.ScrollWheelZoom=lo,C.TapHold=uo,C.TouchZoom=co,r.Bounds=A,r.Browser=v,r.CRS=vt,r.Canvas=eo,r.Circle=Pi,r.CircleMarker=Pe,r.Class=gt,r.Control=ht,r.DivIcon=Qn,r.DivOverlay=mt,r.DomEvent=Ls,r.DomUtil=ws,r.Draggable=Tt,r.Evented=qt,r.FeatureGroup=yt,r.GeoJSON=xt,r.GridLayer=se,r.Handler=_t,r.Icon=Ft,r.ImageOverlay=Ce,r.LatLng=I,r.LatLngBounds=J,r.Layer=lt,r.LayerGroup=Rt,r.LineUtil=Zs,r.Map=C,r.Marker=Le,r.Mixin=Ss,r.Path=Mt,r.Point=P,r.PolyUtil=Es,r.Polygon=Ht,r.Polyline=wt,r.Popup=Se,r.PosAnimation=Bn,r.Projection=As,r.Rectangle=oo,r.Renderer=Lt,r.SVG=ae,r.SVGOverlay=Xn,r.TileLayer=Ut,r.Tooltip=Ee,r.Transformation=Ye,r.Util=Wo,r.VideoOverlay=Jn,r.bind=p,r.bounds=Y,r.canvas=io,r.circle=Vs,r.circleMarker=Us,r.control=ie,r.divIcon=$s,r.extend=d,r.featureGroup=Fs,r.geoJSON=Yn,r.geoJson=qs,r.gridLayer=tr,r.icon=Hs,r.imageOverlay=Ks,r.latLng=k,r.latLngBounds=F,r.layerGroup=Rs,r.map=Ps,r.marker=Ws,r.point=x,r.polygon=Gs,r.polyline=js,r.popup=Xs,r.rectangle=nr,r.setOptions=B,r.stamp=y,r.svg=no,r.svgOverlay=Js,r.tileLayer=$n,r.tooltip=Qs,r.transformation=Kt,r.version=_,r.videoOverlay=Ys;var sr=window.L;r.noConflict=function(){return window.L=sr,this},window.L=r})})(Vi,Vi.exports);var Jr=Vi.exports;const et=Yr(Jr);delete et.Icon.Default.prototype._getIconUrl;et.Icon.Default.mergeOptions({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",iconRetinaUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"});const Ki=14,Xr=[59.9,10.7],Eo=et.divIcon({className:"shelter-marker",html:` T `,iconSize:[28,28],iconAnchor:[14,28],popupAnchor:[0,-28]}),Qr=et.divIcon({className:"shelter-marker selected",html:` T `,iconSize:[36,36],iconAnchor:[18,36],popupAnchor:[0,-36]});let V=null,Ii=null,Ze=[],Ae=null,He=!1,De=null;function $r(a,l){return De=l,V=et.map(a,{zoomControl:!0,attributionControl:!0}).setView(Xr,Ki),et.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© OpenStreetMap',maxZoom:19}).addTo(V),V.on("dragstart",()=>{He=!0}),V.on("zoomstart",r=>{ce||(He=!0)}),V}let ce=!1;function ta(a){if(!V)return;const l=et.latLng(a.latitude,a.longitude);Ii?Ii.setLatLng(l):Ii=et.circleMarker(l,{radius:8,fillColor:"#4285F4",fillOpacity:1,color:"#fff",weight:3}).addTo(V)}function ji(a){if(V){for(const l of Ze)V.removeLayer(l);Ze=[],Ae=null;for(const l of a){const r=et.marker([l.latitude,l.longitude],{icon:Eo}).bindPopup(`${l.adresse}
${O("shelter_capacity",l.plasser)} · ${O("shelter_room_nr",l.romnr)}`).on("click",()=>{De==null||De(l)});r.addTo(V),r._shelterLokalId=l.lokalId,Ze.push(r)}}}function ea(a,l){if(V){for(const r of Ze){const _=r._shelterLokalId;_===a.shelter.lokalId?(r.setIcon(Qr),Ae=_):(_===Ae||Ae===null)&&r.setIcon(Eo)}He||Io(a,l)}}function Io(a,l){if(!V)return;ce=!0;const r=et.latLng(a.shelter.latitude,a.shelter.longitude);if(l){const _=et.latLng(l.latitude,l.longitude),d=et.latLngBounds([_,r]);V.fitBounds(d.pad(.3),{animate:!0})}else V.setView(r,Ki,{animate:!0});setTimeout(()=>{ce=!1},500)}function zo(a,l){He=!1,a?Io(a,l):l&&(ce=!0,V==null||V.setView(et.latLng(l.latitude,l.longitude),Ki,{animate:!0}),setTimeout(()=>{ce=!1},500))}function Gi(){return V}const ia="#FF6B35",na="#FFFFFF",oa=4;let tt=null,R=null,Oo=0,zi=0;function sa(a){tt=document.createElement("canvas"),tt.id="compass-canvas",tt.style.width="100%",tt.style.height="100%",a.prepend(tt),xo(),window.addEventListener("resize",xo)}function xo(){if(!tt)return;const a=tt.parentElement.getBoundingClientRect();tt.width=a.width*devicePixelRatio,tt.height=a.height*devicePixelRatio,Zo()}function Bo(a){Oo=a,zi&&cancelAnimationFrame(zi),zi=requestAnimationFrame(Zo)}function Zo(){if(!tt||(R=tt.getContext("2d"),!R))return;const a=tt.width,l=tt.height,r=a/2,_=l/2,d=Math.min(a,l)*.4;R.clearRect(0,0,a,l),R.save(),R.translate(r,_),R.rotate(Oo*Math.PI/180),R.beginPath(),R.moveTo(0,-d),R.lineTo(d*.5,d*.3),R.lineTo(d*.15,d*.1),R.lineTo(d*.15,d*.7),R.lineTo(-d*.15,d*.7),R.lineTo(-d*.15,d*.1),R.lineTo(-d*.5,d*.3),R.closePath(),R.fillStyle=ia,R.fill(),R.strokeStyle=na,R.lineWidth=oa,R.stroke(),R.restore()}let Gt=null,Ne=null,Lo=0;function ra(a,l){Gt=a,Ne=l}function Ao(a,l){if(Gt){for(Lo=l;Gt.firstChild;)Gt.removeChild(Gt.firstChild);a.forEach((r,_)=>{const d=document.createElement("button");d.className=`shelter-item${_===Lo?" selected":""}`;const g=document.createElement("span");g.className="shelter-item-address",g.textContent=r.shelter.adresse;const p=document.createElement("span");p.className="shelter-item-details",p.textContent=[Mo(r.distanceMeters),O("shelter_capacity",r.shelter.plasser),O("shelter_room_nr",r.shelter.romnr)].join(" · "),d.appendChild(g),d.appendChild(p),d.addEventListener("click",()=>{Ne==null||Ne(_)}),Gt.appendChild(d)})}}function Q(a){const l=document.getElementById("status-text");l&&(l.textContent=a)}function aa(a){const l=document.getElementById("refresh-btn");l&&l.addEventListener("click",a)}function Do(a,l=!0){const r=document.getElementById("loading-overlay"),_=document.getElementById("loading-text"),d=document.getElementById("loading-spinner"),g=document.getElementById("loading-button-row");_.textContent=a,d.style.display=l?"block":"none",g.style.display="none",r.style.display="flex"}function ha(a,l,r){const _=document.getElementById("loading-overlay"),d=document.getElementById("loading-text"),g=document.getElementById("loading-spinner"),p=document.getElementById("loading-button-row"),S=document.getElementById("loading-ok-btn"),y=document.getElementById("loading-skip-btn");d.textContent=a,g.style.display="none",p.style.display="flex",_.style.display="flex",S.onclick=()=>{de(),l()},y.onclick=()=>{de(),r()}}function la(a){const l=document.getElementById("loading-text");l&&(l.textContent=a)}function de(){const a=document.getElementById("loading-overlay");a&&(a.style.display="none")}const he=.15,Po=[10,12,14,16],jt=3,ua=400,No="mapCache";function ca(){try{const a=localStorage.getItem(No);return a?JSON.parse(a):null}catch{return null}}function da(a){localStorage.setItem(No,JSON.stringify(a))}function fa(a,l){const r=ca();if(!(r!=null&&r.complete))return!1;const _=r.radius*.3;return Math.abs(a-r.lat)setTimeout(l,a))}const pa=3;let ut=[],Pt=[],kt=0,ct=null,qi=0,Be=!1,bo=!0,Yi=!1;async function ga(){va(),ya(),wa(),xa(),await La()}function va(){const a=document.getElementById("map-container");$r(a,l=>{const r=Pt.findIndex(_=>_.shelter.lokalId===l.lokalId);r>=0&&(Yi=!0,kt=r,Xi(!0))})}function ya(){const a=document.getElementById("compass-container");sa(a)}function wa(){const a=document.getElementById("shelter-list");ra(a,l=>{Yi=!0,kt=l,Xi(!0)})}function xa(){const a=document.getElementById("toggle-fab");a.addEventListener("click",async()=>{Be=!Be;const g=document.getElementById("map-container"),p=document.getElementById("compass-container");if(Be){if(!await jr()){Be=!1;return}g.style.display="none",p.classList.add("active"),a.textContent="🗺️",Gr(ba)}else{p.classList.remove("active"),g.style.display="block",a.textContent="🧭";const S=Gi();S&&setTimeout(()=>S.invalidateSize(),100),qr()}}),aa(Ma);const l=document.getElementById("cache-retry-btn");l.textContent=O("action_cache_now"),l.addEventListener("click",()=>{ct&&navigator.onLine&&Fo(ct.latitude,ct.longitude)});const r=document.getElementById("reset-view-btn");r.addEventListener("click",()=>{const g=Pt[kt]??null;zo(g,ct),r.classList.remove("visible")}),document.getElementById("map-container");const _=Gi();_&&(_.on("dragstart",To),_.on("zoomstart",To));const d=document.getElementById("no-cache-text");d.textContent=O("warning_no_map_cache")}function To(){const a=document.getElementById("reset-view-btn");a&&a.classList.add("visible")}async function La(){const a=await Dr();if(!a){if(!navigator.onLine){Q(O("error_no_data_offline"));return}Do(O("loading_shelters"));const l=await Hi();if(de(),!l){Q(O("error_download_failed"));return}}ut=await Fi(),Q(O("status_shelters_loaded",ut.length)),ji(ut),Pa(),a&&await Rr()&&navigator.onLine&&await Hi()&&(ut=await Fi(),Q(O("update_success")),ji(ut),ct&&Ji(ct))}function Pa(){if(!Ur()){Q(O("permission_denied"));return}Q(O("status_no_location")),Hr(a=>{ct=a,ta(a),Ji(a),bo&&(bo=!1,!fa(a.latitude,a.longitude)&&navigator.onLine&&Ta(a.latitude,a.longitude))},()=>{Q(O("permission_denied"))})}function Ji(a){ut.length!==0&&(Pt=Lr(ut,a.latitude,a.longitude,pa),Yi||(kt=0),Ao(Pt,kt),Xi(!1),Q(O("status_shelters_loaded",ut.length)))}function Xi(a){var g;if(Pt.length===0)return;const l=Pt[kt];if(!l)return;const r=Mo(l.distanceMeters),_=document.getElementById("selected-shelter-address"),d=document.getElementById("selected-shelter-details");_.textContent=l.shelter.adresse,d.textContent=[r,O("shelter_capacity",l.shelter.plasser),O("shelter_room_nr",l.shelter.romnr)].join(" · "),Ro(l.bearingDegrees-qi),document.getElementById("compass-distance").textContent=r,document.getElementById("compass-address").textContent=l.shelter.adresse,Bo(l.bearingDegrees-qi),Ao(Pt,kt),a&&(zo(l,ct),(g=document.getElementById("reset-view-btn"))==null||g.classList.remove("visible")),ea(l,ct)}function ba(a){if(qi=a,Pt.length===0)return;const r=Pt[kt].bearingDegrees-a;Bo(r),Ro(r)}function Ro(a){const l=document.getElementById("mini-arrow");if(!l)return;const r=l.getContext("2d");if(!r)return;const _=l.width,d=l.height,g=_/2,p=d/2,S=Math.min(_,d)*.4;r.clearRect(0,0,_,d),r.save(),r.translate(g,p),r.rotate(a*Math.PI/180),r.beginPath(),r.moveTo(0,-S),r.lineTo(S*.5,S*.3),r.lineTo(S*.15,S*.1),r.lineTo(S*.15,S*.7),r.lineTo(-S*.15,S*.7),r.lineTo(-S*.15,S*.1),r.lineTo(-S*.5,S*.3),r.closePath(),r.fillStyle="#FF6B35",r.fill(),r.strokeStyle="#FFFFFF",r.lineWidth=2,r.stroke(),r.restore()}function Ta(a,l){ha(O("loading_map_explanation"),()=>Fo(a,l),()=>{var r;(r=document.getElementById("no-cache-banner"))==null||r.classList.add("visible")})}async function Fo(a,l){var _;(_=document.getElementById("no-cache-banner"))==null||_.classList.remove("visible"),Do(O("loading_map"));const r=Gi();if(!r){de();return}await _a(r,a,l,d=>{la(`${O("loading_map")} (${Math.round(d*100)}%)`)}),de(),Q(O("status_shelters_loaded",ut.length))}async function Ma(){if(!navigator.onLine){Q(O("error_download_failed"));return}Q(O("status_updating")),await Hi()?(ut=await Fi(),ji(ut),ct&&Ji(ct),Q(O("update_success"))):Q(O("update_failed"))}console.info("[tilfluktsrom] build 2026-03-08T16:11");document.addEventListener("DOMContentLoaded",async()=>{var a;gr(),(a=navigator.storage)!=null&&a.persist&&await navigator.storage.persist(),"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("controllerchange",()=>{Q(O("update_success"))}),await ga()});