diff --git a/assets/backend_bg.wasm b/assets/backend_bg.wasm index 7e5f120..0f9f9b9 100644 Binary files a/assets/backend_bg.wasm and b/assets/backend_bg.wasm differ diff --git a/assets/main-3c63f0b8.js b/assets/main-35dd03a3.js similarity index 85% rename from assets/main-3c63f0b8.js rename to assets/main-35dd03a3.js index 2decf9b..d52530b 100644 --- a/assets/main-3c63f0b8.js +++ b/assets/main-35dd03a3.js @@ -1,12 +1,12 @@ -var SL=Object.defineProperty;var EL=(e,t,n)=>t in e?SL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ci=(e,t,n)=>(EL(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const h of a.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function Se(){}function IL(e,t){for(const n in t)e[n]=t[n];return e}function CL(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function DS(e){return e()}function Wb(){return Object.create(null)}function Ri(e){e.forEach(DS)}function cy(e){return typeof e=="function"}function He(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let eg;function wo(e,t){return e===t?!0:(eg||(eg=document.createElement("a")),eg.href=t,e===eg.href)}function TL(e){return Object.keys(e).length===0}function RS(e,...t){if(e==null){for(const r of t)r(void 0);return Se}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function NS(e){let t;return RS(e,n=>t=n)(),t}function qe(e,t,n){e.$$.on_destroy.push(RS(t,n))}function xi(e,t,n,r){if(e){const i=OS(e,t,n,r);return e[0](i)}}function OS(e,t,n,r){return e[1]&&r?IL(n.ctx.slice(),e[1](r(t))):n.ctx}function wi(e,t,n,r){if(e[2]&&r){const i=e[2](r(n));if(t.dirty===void 0)return i;if(typeof i=="object"){const a=[],h=Math.max(t.dirty.length,i.length);for(let u=0;u32){const t=[],n=e.ctx.length/32;for(let r=0;re.removeEventListener(t,n,r)}function ML(e){return function(t){return t.preventDefault(),e.call(this,t)}}function B_(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Zt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function AL(e){return e===""?null:+e}function kL(e){return Array.from(e.childNodes)}function Nr(e,t){t=""+t,e.data!==t&&(e.data=t)}function Ea(e,t){e.value=t??""}function Ui(e,t,n,r){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Mg(e,t,n){for(let r=0;r{const i=e.$$.callbacks[t];if(i){const a=DL(t,n,{cancelable:r});return i.slice().forEach(h=>{h.call(e,a)}),!a.defaultPrevented}return!0}}function cv(e,t){return Rf().$$.context.set(e,t),t}function hv(e){return Rf().$$.context.get(e)}function En(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(r=>r.call(this,t))}const Jh=[],rr=[];let of=[];const _0=[],FS=Promise.resolve();let v0=!1;function BS(){v0||(v0=!0,FS.then(fv))}function VS(){return BS(),FS}function dd(e){of.push(e)}function Xo(e){_0.push(e)}const V_=new Set;let jh=0;function fv(){if(jh!==0)return;const e=pd;do{try{for(;jhe.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),of=t}const mg=new Set;let vc;function Fn(){vc={r:0,c:[],p:vc}}function Bn(){vc.r||Ri(vc.c),vc=vc.p}function It(e,t){e&&e.i&&(mg.delete(e),e.i(t))}function Mt(e,t,n,r){if(e&&e.o){if(mg.has(e))return;mg.add(e),vc.c.push(()=>{mg.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function Hb(e,t){const n=t.token={};function r(i,a,h,u){if(t.token!==n)return;t.resolved=u;let y=t.ctx;h!==void 0&&(y=y.slice(),y[h]=u);const w=i&&(t.current=i)(y);let S=!1;t.block&&(t.blocks?t.blocks.forEach((I,P)=>{P!==a&&I&&(Fn(),Mt(I,1,1,()=>{t.blocks[P]===I&&(t.blocks[P]=null)}),Bn())}):t.block.d(1),w.c(),It(w,1),w.m(t.mount(),t.anchor),S=!0),t.block=w,t.blocks&&(t.blocks[a]=w),S&&fv()}if(CL(e)){const i=Rf();if(e.then(a=>{Vl(i),r(t.then,1,t.value,a),Vl(null)},a=>{if(Vl(i),r(t.catch,2,t.error,a),Vl(null),!t.hasCatch)throw a}),t.current!==t.pending)return r(t.pending,0),!0}else{if(t.current!==t.then)return r(t.then,1,t.value,e),!0;t.resolved=e}}function OL(e,t,n){const r=t.slice(),{resolved:i}=e;e.current===e.then&&(r[e.value]=i),e.current===e.catch&&(r[e.error]=i),e.block.p(r,n)}function ti(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function zL(e,t){Mt(e,1,1,()=>{t.delete(e.key)})}function FL(e,t,n,r,i,a,h,u,y,w,S,I){let P=e.length,z=a.length,R=P;const Z={};for(;R--;)Z[e[R].key]=R;const X=[],et=new Map,B=new Map,q=[];for(R=z;R--;){const ut=I(i,a,R),ft=n(ut);let _t=h.get(ft);_t?r&&q.push(()=>_t.p(ut,t)):(_t=w(ft,ut),_t.c()),et.set(ft,X[R]=_t),ft in Z&&B.set(ft,Math.abs(R-Z[ft]))}const Y=new Set,lt=new Set;function dt(ut){It(ut,1),ut.m(u,S),h.set(ut.key,ut),S=ut.first,z--}for(;P&&z;){const ut=X[z-1],ft=e[P-1],_t=ut.key,kt=ft.key;ut===ft?(S=ut.first,P--,z--):et.has(kt)?!h.has(_t)||Y.has(_t)?dt(ut):lt.has(kt)?P--:B.get(_t)>B.get(kt)?(lt.add(_t),dt(ut)):(Y.add(kt),P--):(y(ft,h),P--)}for(;P--;){const ut=e[P];et.has(ut.key)||y(ut,h)}for(;z;)dt(X[z-1]);return Ri(q),X}function Yo(e,t,n){const r=e.$$.props[t];r!==void 0&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function _e(e){e&&e.c()}function de(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),dd(()=>{const a=e.$$.on_mount.map(DS).filter(cy);e.$$.on_destroy?e.$$.on_destroy.push(...a):Ri(a),e.$$.on_mount=[]}),i.forEach(dd)}function me(e,t){const n=e.$$;n.fragment!==null&&(NL(n.after_update),Ri(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function BL(e,t){e.$$.dirty[0]===-1&&(Jh.push(e),BS(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const R=z.length?z[0]:P;return w.ctx&&i(w.ctx[I],w.ctx[I]=R)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](R),S&&BL(e,I)),P}):[],w.update(),S=!0,Ri(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const I=kL(t.target);w.fragment&&w.fragment.l(I),I.forEach(Bt)}else w.fragment&&w.fragment.c();t.intro&&It(e.$$.fragment),de(e,t.target,t.anchor),fv()}Vl(y)}class an{constructor(){ci(this,"$$");ci(this,"$$set")}$destroy(){me(this,1),this.$destroy=Se}$on(t,n){if(!cy(n))return Se;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!TL(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const VL="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(VL);const UL=e=>({dialog:e&1}),Zb=e=>({dialog:e[0]});function GL(e){let t,n,r,i,a;const h=e[4].default,u=xi(h,e,e[3],Zb);return{c(){t=jt("dialog"),n=jt("article"),u&&u.c(),t.open=!0},m(y,w){Vt(y,t,w),Ot(t,n),u&&u.m(n,null),e[6](t),r=!0,i||(a=[Ye(window,"click",e[1]),Ye(window,"keydown",e[2]),Ye(t,"close",e[5])],i=!0)},p(y,[w]){u&&u.p&&(!r||w&9)&&Si(u,h,y,y[3],r?wi(h,y[3],w,UL):Ei(y[3]),Zb)},i(y){r||(It(u,y),r=!0)},o(y){Mt(u,y),r=!1},d(y){y&&Bt(t),u&&u.d(y),e[6](null),i=!1,Ri(a)}}}function qL(e,t,n){let{$$slots:r={},$$scope:i}=t,a;function h(S){a.open&&S.target==a&&a.close()}function u(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),a.close())}function y(S){En.call(this,e,S)}function w(S){rr[S?"unshift":"push"](()=>{a=S,n(0,a)})}return e.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[a,h,u,i,r,y,w]}class US extends an{constructor(t){super(),sn(this,t,qL,GL,He,{})}}function Xb(e,t,n){const r=e.slice();return r[1]=t[n][0],r[2]=t[n][1],r}function Yb(e){let t,n,r=e[1]+"",i,a,h,u=e[2]+"",y,w;return{c(){t=jt("tr"),n=jt("td"),i=hn(r),a=fe(),h=jt("td"),y=hn(u),w=fe()},m(S,I){Vt(S,t,I),Ot(t,n),Ot(n,i),Ot(t,a),Ot(t,h),Ot(h,y),Ot(t,w)},p(S,I){I&1&&r!==(r=S[1]+"")&&Nr(i,r),I&1&&u!==(u=S[2]+"")&&Nr(y,u)},d(S){S&&Bt(t)}}}function jL(e){let t,n,r=ti(Object.entries(e[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class pv extends an{constructor(t){super(),sn(this,t,WL,jL,He,{properties:0})}}function Kb(e,t,n){const r=e.slice();return r[3]=t[n],r}function Jb(e,t,n){const r=e.slice();return r[6]=t[n],r}function Qb(e){let t,n;return{c(){t=jt("span"),n=hn(`  - `),Ui(t,"background",e[6]),Ui(t,"width","100%"),Ui(t,"border","1px solid black")},m(r,i){Vt(r,t,i),Ot(t,n)},p(r,i){i&1&&Ui(t,"background",r[6])},d(r){r&&Bt(t)}}}function HL(e){let t,n=e[3]+"",r;return{c(){t=jt("span"),r=hn(n)},m(i,a){Vt(i,t,a),Ot(t,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&Nr(r,n)},d(i){i&&Bt(t)}}}function ZL(e){let t,n=e[3].toFixed(e[2])+"",r;return{c(){t=jt("span"),r=hn(n)},m(i,a){Vt(i,t,a),Ot(t,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&Nr(r,n)},d(i){i&&Bt(t)}}}function $b(e){let t;function n(a,h){return a[2]>0?ZL:HL}let r=n(e),i=r(e);return{c(){i.c(),t=di()},m(a,h){i.m(a,h),Vt(a,t,h)},p(a,h){r===(r=n(a))&&i?i.p(a,h):(i.d(1),i=r(a),i&&(i.c(),i.m(t.parentNode,t)))},d(a){a&&Bt(t),i.d(a)}}}function XL(e){let t,n,r,i=ti(e[0]),a=[];for(let y=0;y{"colorScale"in h&&n(0,r=h.colorScale),"limits"in h&&n(1,i=h.limits),"decimalPlaces"in h&&n(2,a=h.decimalPlaces)},[r,i,a]}class KL extends an{constructor(t){super(),sn(this,t,YL,XL,He,{colorScale:0,limits:1,decimalPlaces:2})}}function Hl(e){if(e==null||e==null)throw new Error("Oops, notNull given something null");return e}var Nd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function hy(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var tx=Object.prototype.toString,GS=function(t){var n=tx.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&tx.call(t.callee)==="[object Function]"),r},U_,ex;function JL(){if(ex)return U_;ex=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=GS,i=Object.prototype.propertyIsEnumerable,a=!i.call({toString:null},"toString"),h=i.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],y=function(P){var z=P.constructor;return z&&z.prototype===P},w={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var P in window)try{if(!w["$"+P]&&t.call(window,P)&&window[P]!==null&&typeof window[P]=="object")try{y(window[P])}catch{return!0}}catch{return!0}return!1}(),I=function(P){if(typeof window>"u"||!S)return y(P);try{return y(P)}catch{return!1}};e=function(z){var R=z!==null&&typeof z=="object",Z=n.call(z)==="[object Function]",X=r(z),et=R&&n.call(z)==="[object String]",B=[];if(!R&&!Z&&!X)throw new TypeError("Object.keys called on a non-object");var q=h&&Z;if(et&&z.length>0&&!t.call(z,0))for(var Y=0;Y0)for(var lt=0;lt"u"||!Bi?Rn:Bi(Uint8Array),xc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Rn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Rn:ArrayBuffer,"%ArrayIteratorPrototype%":Wh&&Bi?Bi([][Symbol.iterator]()):Rn,"%AsyncFromSyncIteratorPrototype%":Rn,"%AsyncFunction%":Qh,"%AsyncGenerator%":Qh,"%AsyncGeneratorFunction%":Qh,"%AsyncIteratorPrototype%":Qh,"%Atomics%":typeof Atomics>"u"?Rn:Atomics,"%BigInt%":typeof BigInt>"u"?Rn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Rn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Rn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Rn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":vP,"%eval%":eval,"%EvalError%":bP,"%Float32Array%":typeof Float32Array>"u"?Rn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Rn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Rn:FinalizationRegistry,"%Function%":WS,"%GeneratorFunction%":Qh,"%Int8Array%":typeof Int8Array>"u"?Rn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Rn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Rn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Wh&&Bi?Bi(Bi([][Symbol.iterator]())):Rn,"%JSON%":typeof JSON=="object"?JSON:Rn,"%Map%":typeof Map>"u"?Rn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Wh||!Bi?Rn:Bi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Rn:Promise,"%Proxy%":typeof Proxy>"u"?Rn:Proxy,"%RangeError%":xP,"%ReferenceError%":wP,"%Reflect%":typeof Reflect>"u"?Rn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Rn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Wh||!Bi?Rn:Bi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Rn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Wh&&Bi?Bi(""[Symbol.iterator]()):Rn,"%Symbol%":Wh?Symbol:Rn,"%SyntaxError%":uf,"%ThrowTypeError%":EP,"%TypedArray%":CP,"%TypeError%":sf,"%Uint8Array%":typeof Uint8Array>"u"?Rn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Rn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Rn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Rn:Uint32Array,"%URIError%":SP,"%WeakMap%":typeof WeakMap>"u"?Rn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Rn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Rn:WeakSet};if(Bi)try{null.error}catch(e){var TP=Bi(Bi(e));xc["%Error.prototype%"]=TP}var LP=function e(t){var n;if(t==="%AsyncFunction%")n=q_("async function () {}");else if(t==="%GeneratorFunction%")n=q_("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=q_("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Bi&&(n=Bi(i.prototype))}return xc[t]=n,n},sx={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Od=yv,Ag=jS,PP=Od.call(Function.call,Array.prototype.concat),MP=Od.call(Function.apply,Array.prototype.splice),ax=Od.call(Function.call,String.prototype.replace),kg=Od.call(Function.call,String.prototype.slice),AP=Od.call(Function.call,RegExp.prototype.exec),kP=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,DP=/\\(\\)?/g,RP=function(t){var n=kg(t,0,1),r=kg(t,-1);if(n==="%"&&r!=="%")throw new uf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new uf("invalid intrinsic syntax, expected opening `%`");var i=[];return ax(t,kP,function(a,h,u,y){i[i.length]=u?ax(y,DP,"$1"):h||a}),i},NP=function(t,n){var r=t,i;if(Ag(sx,r)&&(i=sx[r],r="%"+i[0]+"%"),Ag(xc,r)){var a=xc[r];if(a===Qh&&(a=LP(r)),typeof a>"u"&&!n)throw new sf("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new uf("intrinsic "+t+" does not exist!")},ml=function(t,n){if(typeof t!="string"||t.length===0)throw new sf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new sf('"allowMissing" argument must be a boolean');if(AP(/^%?[^%]*%?$/,t)===null)throw new uf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=RP(t),i=r.length>0?r[0]:"",a=NP("%"+i+"%",n),h=a.name,u=a.value,y=!1,w=a.alias;w&&(i=w[0],MP(r,PP([0,1],w)));for(var S=1,I=!0;S=r.length){var Z=bc(u,P);I=!!Z,I&&"get"in Z&&!("originalValue"in Z.get)?u=Z.get:u=u[P]}else I=Ag(u,P),u=u[P];I&&!y&&(xc[h]=u)}}return u},W_,lx;function _v(){if(lx)return W_;lx=1;var e=ml,t=e("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return W_=t,W_}var OP=ml,yg=OP("%Object.getOwnPropertyDescriptor%",!0);if(yg)try{yg([],"length")}catch{yg=null}var vv=yg,ux=_v(),zP=qS,Hh=Gu,cx=vv,bv=function(t,n,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Hh("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Hh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Hh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Hh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Hh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Hh("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,y=!!cx&&cx(t,n);if(ux)ux(t,n,{configurable:h===null&&y?y.configurable:!h,enumerable:i===null&&y?y.enumerable:!i,value:r,writable:a===null&&y?y.writable:!a});else if(u||!i&&!a&&!h)t[n]=r;else throw new zP("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},b0=_v(),HS=function(){return!!b0};HS.hasArrayLengthDefineBug=function(){if(!b0)return null;try{return b0([],"length",{value:1}).length!==1}catch{return!0}};var xv=HS,FP=mv,BP=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",VP=Object.prototype.toString,UP=Array.prototype.concat,hx=bv,GP=function(e){return typeof e=="function"&&VP.call(e)==="[object Function]"},ZS=xv(),qP=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!GP(r)||!r())return}ZS?hx(e,t,n,!0):hx(e,t,n)},XS=function(e,t){var n=arguments.length>2?arguments[2]:{},r=FP(t);BP&&(r=UP.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i4294967295||HP(n)!==n)throw new dx("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in t&&px){var h=px(t,"length");h&&!h.configurable&&(i=!1),h&&!h.writable&&(a=!1)}return(i||a||!r)&&(WP?fx(t,"length",n,!0,!0):fx(t,"length",n)),t};(function(e){var t=yv,n=ml,r=ZP,i=Gu,a=n("%Function.prototype.apply%"),h=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||t.call(h,a),y=_v(),w=n("%Math.max%");e.exports=function(P){if(typeof P!="function")throw new i("a function is required");var z=u(t,h,arguments);return r(z,1+w(0,P.length-(arguments.length-1)),!0)};var S=function(){return u(t,a,arguments)};y?y(e.exports,"apply",{value:S}):e.exports.apply=S})(YS);var Nf=YS.exports,KS=ml,JS=Nf,XP=JS(KS("String.prototype.indexOf")),ha=function(t,n){var r=KS(t,!!n);return typeof r=="function"&&XP(t,".prototype.")>-1?JS(r):r},YP=mv,QS=fy(),$S=ha,mx=Object,KP=$S("Array.prototype.push"),gx=$S("Object.prototype.propertyIsEnumerable"),JP=QS?Object.getOwnPropertySymbols:null,tE=function(t,n){if(t==null)throw new TypeError("target must be an object");var r=mx(t);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||fM)&&(hM?yx(t,"name",n,!0,!0):yx(t,"name",n)),t},mM=dM,gM=Gu,yM=Object,iE=mM(function(){if(this==null||this!==yM(this))throw new gM("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),_M=iE,vM=Vc.supportsDescriptors,bM=Object.getOwnPropertyDescriptor,oE=function(){if(vM&&/a/mig.flags==="gim"){var t=bM(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return t.get}}return _M},xM=Vc.supportsDescriptors,wM=oE,SM=Object.getOwnPropertyDescriptor,EM=Object.defineProperty,IM=TypeError,_x=Object.getPrototypeOf,CM=/a/,TM=function(){if(!xM||!_x)throw new IM("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=wM(),n=_x(CM),r=SM(n,"flags");return(!r||r.get!==t)&&EM(n,"flags",{configurable:!0,enumerable:!1,get:t}),t},LM=Vc,PM=Nf,MM=iE,sE=oE,AM=TM,aE=PM(sE());LM(aE,{getPolyfill:sE,implementation:MM,shim:AM});var kM=aE,_g={exports:{}},DM=fy,Uc=function(){return DM()&&!!Symbol.toStringTag},RM=Uc(),NM=ha,x0=NM("Object.prototype.toString"),py=function(t){return RM&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:x0(t)==="[object Arguments]"},lE=function(t){return py(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&x0(t)!=="[object Array]"&&x0(t.callee)==="[object Function]"},OM=function(){return py(arguments)}();py.isLegacyArguments=lE;var uE=OM?py:lE;const zM={},FM=Object.freeze(Object.defineProperty({__proto__:null,default:zM},Symbol.toStringTag,{value:"Module"})),BM=hy(FM);var wv=typeof Map=="function"&&Map.prototype,Z_=Object.getOwnPropertyDescriptor&&wv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Dg=wv&&Z_&&typeof Z_.get=="function"?Z_.get:null,vx=wv&&Map.prototype.forEach,Sv=typeof Set=="function"&&Set.prototype,X_=Object.getOwnPropertyDescriptor&&Sv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Rg=Sv&&X_&&typeof X_.get=="function"?X_.get:null,bx=Sv&&Set.prototype.forEach,VM=typeof WeakMap=="function"&&WeakMap.prototype,ad=VM?WeakMap.prototype.has:null,UM=typeof WeakSet=="function"&&WeakSet.prototype,ld=UM?WeakSet.prototype.has:null,GM=typeof WeakRef=="function"&&WeakRef.prototype,xx=GM?WeakRef.prototype.deref:null,qM=Boolean.prototype.valueOf,jM=Object.prototype.toString,WM=Function.prototype.toString,HM=String.prototype.match,Ev=String.prototype.slice,Cu=String.prototype.replace,ZM=String.prototype.toUpperCase,wx=String.prototype.toLowerCase,cE=RegExp.prototype.test,Sx=Array.prototype.concat,rl=Array.prototype.join,XM=Array.prototype.slice,Ex=Math.floor,w0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Y_=Object.getOwnPropertySymbols,S0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,cf=typeof Symbol=="function"&&typeof Symbol.iterator=="object",So=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===cf||"symbol")?Symbol.toStringTag:null,hE=Object.prototype.propertyIsEnumerable,Ix=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function Cx(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||cE.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var r=e<0?-Ex(-e):Ex(e);if(r!==e){var i=String(r),a=Ev.call(t,i.length+1);return Cu.call(i,n,"$&_")+"."+Cu.call(Cu.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Cu.call(t,n,"$&_")}var E0=BM,Tx=E0.custom,Lx=pE(Tx)?Tx:null,YM=function e(t,n,r,i){var a=n||{};if(Eu(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Eu(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var h=Eu(a,"customInspect")?a.customInspect:!0;if(typeof h!="boolean"&&h!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Eu(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Eu(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=a.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return mE(t,a);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var y=String(t);return u?Cx(t,y):y}if(typeof t=="bigint"){var w=String(t)+"n";return u?Cx(t,w):w}var S=typeof a.depth>"u"?5:a.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof t=="object")return I0(t)?"[Array]":"[Object]";var I=pA(a,r);if(typeof i>"u")i=[];else if(dE(i,t)>=0)return"[Circular]";function P(Kt,bt,Ut){if(bt&&(i=XM.call(i),i.push(bt)),Ut){var ee={depth:a.depth};return Eu(a,"quoteStyle")&&(ee.quoteStyle=a.quoteStyle),e(Kt,ee,r+1,i)}return e(Kt,a,r+1,i)}if(typeof t=="function"&&!Px(t)){var z=iA(t),R=ng(t,P);return"[Function"+(z?": "+z:" (anonymous)")+"]"+(R.length>0?" { "+rl.call(R,", ")+" }":"")}if(pE(t)){var Z=cf?Cu.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):S0.call(t);return typeof t=="object"&&!cf?Hp(Z):Z}if(cA(t)){for(var X="<"+wx.call(String(t.nodeName)),et=t.attributes||[],B=0;B",X}if(I0(t)){if(t.length===0)return"[]";var q=ng(t,P);return I&&!fA(q)?"["+C0(q,I)+"]":"[ "+rl.call(q,", ")+" ]"}if(QM(t)){var Y=ng(t,P);return!("cause"in Error.prototype)&&"cause"in t&&!hE.call(t,"cause")?"{ ["+String(t)+"] "+rl.call(Sx.call("[cause]: "+P(t.cause),Y),", ")+" }":Y.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+rl.call(Y,", ")+" }"}if(typeof t=="object"&&h){if(Lx&&typeof t[Lx]=="function"&&E0)return E0(t,{depth:S-r});if(h!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(oA(t)){var lt=[];return vx&&vx.call(t,function(Kt,bt){lt.push(P(bt,t,!0)+" => "+P(Kt,t))}),Mx("Map",Dg.call(t),lt,I)}if(lA(t)){var dt=[];return bx&&bx.call(t,function(Kt){dt.push(P(Kt,t))}),Mx("Set",Rg.call(t),dt,I)}if(sA(t))return K_("WeakMap");if(uA(t))return K_("WeakSet");if(aA(t))return K_("WeakRef");if(tA(t))return Hp(P(Number(t)));if(nA(t))return Hp(P(w0.call(t)));if(eA(t))return Hp(qM.call(t));if($M(t))return Hp(P(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===Nd)return"{ [object globalThis] }";if(!JM(t)&&!Px(t)){var ut=ng(t,P),ft=Ix?Ix(t)===Object.prototype:t instanceof Object||t.constructor===Object,_t=t instanceof Object?"":"null prototype",kt=!ft&&So&&Object(t)===t&&So in t?Ev.call(qu(t),8,-1):_t?"Object":"",Q=ft||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",yt=Q+(kt||_t?"["+rl.call(Sx.call([],kt||[],_t||[]),": ")+"] ":"");return ut.length===0?yt+"{}":I?yt+"{"+C0(ut,I)+"}":yt+"{ "+rl.call(ut,", ")+" }"}return String(t)};function fE(e,t,n){var r=(n.quoteStyle||t)==="double"?'"':"'";return r+e+r}function KM(e){return Cu.call(String(e),/"/g,""")}function I0(e){return qu(e)==="[object Array]"&&(!So||!(typeof e=="object"&&So in e))}function JM(e){return qu(e)==="[object Date]"&&(!So||!(typeof e=="object"&&So in e))}function Px(e){return qu(e)==="[object RegExp]"&&(!So||!(typeof e=="object"&&So in e))}function QM(e){return qu(e)==="[object Error]"&&(!So||!(typeof e=="object"&&So in e))}function $M(e){return qu(e)==="[object String]"&&(!So||!(typeof e=="object"&&So in e))}function tA(e){return qu(e)==="[object Number]"&&(!So||!(typeof e=="object"&&So in e))}function eA(e){return qu(e)==="[object Boolean]"&&(!So||!(typeof e=="object"&&So in e))}function pE(e){if(cf)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!S0)return!1;try{return S0.call(e),!0}catch{}return!1}function nA(e){if(!e||typeof e!="object"||!w0)return!1;try{return w0.call(e),!0}catch{}return!1}var rA=Object.prototype.hasOwnProperty||function(e){return e in this};function Eu(e,t){return rA.call(e,t)}function qu(e){return jM.call(e)}function iA(e){if(e.name)return e.name;var t=HM.call(WM.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function dE(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;nt.maxStringLength){var n=e.length-t.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return mE(Ev.call(e,0,t.maxStringLength),t)+r}var i=Cu.call(Cu.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,hA);return fE(i,"single",t)}function hA(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+ZM.call(t.toString(16))}function Hp(e){return"Object("+e+")"}function K_(e){return e+" { ? }"}function Mx(e,t,n,r){var i=r?C0(n,r):rl.call(n,", ");return e+" ("+t+") {"+i+"}"}function fA(e){for(var t=0;tt in e?SL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ci=(e,t,n)=>(EL(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const h of a.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function Se(){}function IL(e,t){for(const n in t)e[n]=t[n];return e}function CL(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function DS(e){return e()}function Wb(){return Object.create(null)}function Ri(e){e.forEach(DS)}function cy(e){return typeof e=="function"}function Ze(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let eg;function wo(e,t){return e===t?!0:(eg||(eg=document.createElement("a")),eg.href=t,e===eg.href)}function TL(e){return Object.keys(e).length===0}function RS(e,...t){if(e==null){for(const r of t)r(void 0);return Se}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function NS(e){let t;return RS(e,n=>t=n)(),t}function qe(e,t,n){e.$$.on_destroy.push(RS(t,n))}function xi(e,t,n,r){if(e){const i=OS(e,t,n,r);return e[0](i)}}function OS(e,t,n,r){return e[1]&&r?IL(n.ctx.slice(),e[1](r(t))):n.ctx}function wi(e,t,n,r){if(e[2]&&r){const i=e[2](r(n));if(t.dirty===void 0)return i;if(typeof i=="object"){const a=[],h=Math.max(t.dirty.length,i.length);for(let u=0;u32){const t=[],n=e.ctx.length/32;for(let r=0;re.removeEventListener(t,n,r)}function ML(e){return function(t){return t.preventDefault(),e.call(this,t)}}function B_(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Zt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function AL(e){return e===""?null:+e}function kL(e){return Array.from(e.childNodes)}function Nr(e,t){t=""+t,e.data!==t&&(e.data=t)}function Ea(e,t){e.value=t??""}function Ui(e,t,n,r){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Mg(e,t,n){for(let r=0;r{const i=e.$$.callbacks[t];if(i){const a=DL(t,n,{cancelable:r});return i.slice().forEach(h=>{h.call(e,a)}),!a.defaultPrevented}return!0}}function cv(e,t){return Rf().$$.context.set(e,t),t}function hv(e){return Rf().$$.context.get(e)}function En(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(r=>r.call(this,t))}const Jh=[],rr=[];let of=[];const _0=[],FS=Promise.resolve();let v0=!1;function BS(){v0||(v0=!0,FS.then(fv))}function VS(){return BS(),FS}function dd(e){of.push(e)}function Xo(e){_0.push(e)}const V_=new Set;let jh=0;function fv(){if(jh!==0)return;const e=pd;do{try{for(;jhe.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),of=t}const mg=new Set;let vc;function Fn(){vc={r:0,c:[],p:vc}}function Bn(){vc.r||Ri(vc.c),vc=vc.p}function It(e,t){e&&e.i&&(mg.delete(e),e.i(t))}function At(e,t,n,r){if(e&&e.o){if(mg.has(e))return;mg.add(e),vc.c.push(()=>{mg.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function Hb(e,t){const n=t.token={};function r(i,a,h,u){if(t.token!==n)return;t.resolved=u;let y=t.ctx;h!==void 0&&(y=y.slice(),y[h]=u);const w=i&&(t.current=i)(y);let S=!1;t.block&&(t.blocks?t.blocks.forEach((I,P)=>{P!==a&&I&&(Fn(),At(I,1,1,()=>{t.blocks[P]===I&&(t.blocks[P]=null)}),Bn())}):t.block.d(1),w.c(),It(w,1),w.m(t.mount(),t.anchor),S=!0),t.block=w,t.blocks&&(t.blocks[a]=w),S&&fv()}if(CL(e)){const i=Rf();if(e.then(a=>{Vl(i),r(t.then,1,t.value,a),Vl(null)},a=>{if(Vl(i),r(t.catch,2,t.error,a),Vl(null),!t.hasCatch)throw a}),t.current!==t.pending)return r(t.pending,0),!0}else{if(t.current!==t.then)return r(t.then,1,t.value,e),!0;t.resolved=e}}function OL(e,t,n){const r=t.slice(),{resolved:i}=e;e.current===e.then&&(r[e.value]=i),e.current===e.catch&&(r[e.error]=i),e.block.p(r,n)}function ti(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function zL(e,t){At(e,1,1,()=>{t.delete(e.key)})}function FL(e,t,n,r,i,a,h,u,y,w,S,I){let P=e.length,z=a.length,R=P;const Y={};for(;R--;)Y[e[R].key]=R;const Z=[],et=new Map,B=new Map,j=[];for(R=z;R--;){const lt=I(i,a,R),ht=n(lt);let pt=h.get(ht);pt?r&&j.push(()=>pt.p(lt,t)):(pt=w(ht,lt),pt.c()),et.set(ht,Z[R]=pt),ht in Y&&B.set(ht,Math.abs(R-Y[ht]))}const q=new Set,ct=new Set;function _t(lt){It(lt,1),lt.m(u,S),h.set(lt.key,lt),S=lt.first,z--}for(;P&&z;){const lt=Z[z-1],ht=e[P-1],pt=lt.key,Tt=ht.key;lt===ht?(S=lt.first,P--,z--):et.has(Tt)?!h.has(pt)||q.has(pt)?_t(lt):ct.has(Tt)?P--:B.get(pt)>B.get(Tt)?(ct.add(pt),_t(lt)):(q.add(Tt),P--):(y(ht,h),P--)}for(;P--;){const lt=e[P];et.has(lt.key)||y(lt,h)}for(;z;)_t(Z[z-1]);return Ri(j),Z}function Yo(e,t,n){const r=e.$$.props[t];r!==void 0&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function _e(e){e&&e.c()}function de(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),dd(()=>{const a=e.$$.on_mount.map(DS).filter(cy);e.$$.on_destroy?e.$$.on_destroy.push(...a):Ri(a),e.$$.on_mount=[]}),i.forEach(dd)}function me(e,t){const n=e.$$;n.fragment!==null&&(NL(n.after_update),Ri(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function BL(e,t){e.$$.dirty[0]===-1&&(Jh.push(e),BS(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const R=z.length?z[0]:P;return w.ctx&&i(w.ctx[I],w.ctx[I]=R)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](R),S&&BL(e,I)),P}):[],w.update(),S=!0,Ri(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const I=kL(t.target);w.fragment&&w.fragment.l(I),I.forEach(Bt)}else w.fragment&&w.fragment.c();t.intro&&It(e.$$.fragment),de(e,t.target,t.anchor),fv()}Vl(y)}class an{constructor(){ci(this,"$$");ci(this,"$$set")}$destroy(){me(this,1),this.$destroy=Se}$on(t,n){if(!cy(n))return Se;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!TL(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const VL="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(VL);const UL=e=>({dialog:e&1}),Zb=e=>({dialog:e[0]});function GL(e){let t,n,r,i,a;const h=e[4].default,u=xi(h,e,e[3],Zb);return{c(){t=jt("dialog"),n=jt("article"),u&&u.c(),t.open=!0},m(y,w){Vt(y,t,w),Ot(t,n),u&&u.m(n,null),e[6](t),r=!0,i||(a=[We(window,"click",e[1]),We(window,"keydown",e[2]),We(t,"close",e[5])],i=!0)},p(y,[w]){u&&u.p&&(!r||w&9)&&Si(u,h,y,y[3],r?wi(h,y[3],w,UL):Ei(y[3]),Zb)},i(y){r||(It(u,y),r=!0)},o(y){At(u,y),r=!1},d(y){y&&Bt(t),u&&u.d(y),e[6](null),i=!1,Ri(a)}}}function qL(e,t,n){let{$$slots:r={},$$scope:i}=t,a;function h(S){a.open&&S.target==a&&a.close()}function u(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),a.close())}function y(S){En.call(this,e,S)}function w(S){rr[S?"unshift":"push"](()=>{a=S,n(0,a)})}return e.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[a,h,u,i,r,y,w]}class US extends an{constructor(t){super(),sn(this,t,qL,GL,Ze,{})}}function Xb(e,t,n){const r=e.slice();return r[1]=t[n][0],r[2]=t[n][1],r}function Yb(e){let t,n,r=e[1]+"",i,a,h,u=e[2]+"",y,w;return{c(){t=jt("tr"),n=jt("td"),i=un(r),a=fe(),h=jt("td"),y=un(u),w=fe()},m(S,I){Vt(S,t,I),Ot(t,n),Ot(n,i),Ot(t,a),Ot(t,h),Ot(h,y),Ot(t,w)},p(S,I){I&1&&r!==(r=S[1]+"")&&Nr(i,r),I&1&&u!==(u=S[2]+"")&&Nr(y,u)},d(S){S&&Bt(t)}}}function jL(e){let t,n,r=ti(Object.entries(e[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class pv extends an{constructor(t){super(),sn(this,t,WL,jL,Ze,{properties:0})}}function Kb(e,t,n){const r=e.slice();return r[3]=t[n],r}function Jb(e,t,n){const r=e.slice();return r[6]=t[n],r}function Qb(e){let t,n;return{c(){t=jt("span"),n=un(`  + `),Ui(t,"background",e[6]),Ui(t,"width","100%"),Ui(t,"border","1px solid black")},m(r,i){Vt(r,t,i),Ot(t,n)},p(r,i){i&1&&Ui(t,"background",r[6])},d(r){r&&Bt(t)}}}function HL(e){let t,n=e[3]+"",r;return{c(){t=jt("span"),r=un(n)},m(i,a){Vt(i,t,a),Ot(t,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&Nr(r,n)},d(i){i&&Bt(t)}}}function ZL(e){let t,n=e[3].toFixed(e[2])+"",r;return{c(){t=jt("span"),r=un(n)},m(i,a){Vt(i,t,a),Ot(t,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&Nr(r,n)},d(i){i&&Bt(t)}}}function $b(e){let t;function n(a,h){return a[2]>0?ZL:HL}let r=n(e),i=r(e);return{c(){i.c(),t=di()},m(a,h){i.m(a,h),Vt(a,t,h)},p(a,h){r===(r=n(a))&&i?i.p(a,h):(i.d(1),i=r(a),i&&(i.c(),i.m(t.parentNode,t)))},d(a){a&&Bt(t),i.d(a)}}}function XL(e){let t,n,r,i=ti(e[0]),a=[];for(let y=0;y{"colorScale"in h&&n(0,r=h.colorScale),"limits"in h&&n(1,i=h.limits),"decimalPlaces"in h&&n(2,a=h.decimalPlaces)},[r,i,a]}class KL extends an{constructor(t){super(),sn(this,t,YL,XL,Ze,{colorScale:0,limits:1,decimalPlaces:2})}}function Hl(e){if(e==null||e==null)throw new Error("Oops, notNull given something null");return e}var Nd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function hy(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var tx=Object.prototype.toString,GS=function(t){var n=tx.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&tx.call(t.callee)==="[object Function]"),r},U_,ex;function JL(){if(ex)return U_;ex=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=GS,i=Object.prototype.propertyIsEnumerable,a=!i.call({toString:null},"toString"),h=i.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],y=function(P){var z=P.constructor;return z&&z.prototype===P},w={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var P in window)try{if(!w["$"+P]&&t.call(window,P)&&window[P]!==null&&typeof window[P]=="object")try{y(window[P])}catch{return!0}}catch{return!0}return!1}(),I=function(P){if(typeof window>"u"||!S)return y(P);try{return y(P)}catch{return!1}};e=function(z){var R=z!==null&&typeof z=="object",Y=n.call(z)==="[object Function]",Z=r(z),et=R&&n.call(z)==="[object String]",B=[];if(!R&&!Y&&!Z)throw new TypeError("Object.keys called on a non-object");var j=h&&Y;if(et&&z.length>0&&!t.call(z,0))for(var q=0;q0)for(var ct=0;ct"u"||!Bi?Rn:Bi(Uint8Array),xc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Rn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Rn:ArrayBuffer,"%ArrayIteratorPrototype%":Wh&&Bi?Bi([][Symbol.iterator]()):Rn,"%AsyncFromSyncIteratorPrototype%":Rn,"%AsyncFunction%":Qh,"%AsyncGenerator%":Qh,"%AsyncGeneratorFunction%":Qh,"%AsyncIteratorPrototype%":Qh,"%Atomics%":typeof Atomics>"u"?Rn:Atomics,"%BigInt%":typeof BigInt>"u"?Rn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Rn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Rn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Rn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":vP,"%eval%":eval,"%EvalError%":bP,"%Float32Array%":typeof Float32Array>"u"?Rn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Rn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Rn:FinalizationRegistry,"%Function%":WS,"%GeneratorFunction%":Qh,"%Int8Array%":typeof Int8Array>"u"?Rn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Rn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Rn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Wh&&Bi?Bi(Bi([][Symbol.iterator]())):Rn,"%JSON%":typeof JSON=="object"?JSON:Rn,"%Map%":typeof Map>"u"?Rn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Wh||!Bi?Rn:Bi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Rn:Promise,"%Proxy%":typeof Proxy>"u"?Rn:Proxy,"%RangeError%":xP,"%ReferenceError%":wP,"%Reflect%":typeof Reflect>"u"?Rn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Rn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Wh||!Bi?Rn:Bi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Rn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Wh&&Bi?Bi(""[Symbol.iterator]()):Rn,"%Symbol%":Wh?Symbol:Rn,"%SyntaxError%":uf,"%ThrowTypeError%":EP,"%TypedArray%":CP,"%TypeError%":sf,"%Uint8Array%":typeof Uint8Array>"u"?Rn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Rn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Rn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Rn:Uint32Array,"%URIError%":SP,"%WeakMap%":typeof WeakMap>"u"?Rn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Rn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Rn:WeakSet};if(Bi)try{null.error}catch(e){var TP=Bi(Bi(e));xc["%Error.prototype%"]=TP}var LP=function e(t){var n;if(t==="%AsyncFunction%")n=q_("async function () {}");else if(t==="%GeneratorFunction%")n=q_("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=q_("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Bi&&(n=Bi(i.prototype))}return xc[t]=n,n},sx={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Od=yv,Ag=jS,PP=Od.call(Function.call,Array.prototype.concat),MP=Od.call(Function.apply,Array.prototype.splice),ax=Od.call(Function.call,String.prototype.replace),kg=Od.call(Function.call,String.prototype.slice),AP=Od.call(Function.call,RegExp.prototype.exec),kP=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,DP=/\\(\\)?/g,RP=function(t){var n=kg(t,0,1),r=kg(t,-1);if(n==="%"&&r!=="%")throw new uf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new uf("invalid intrinsic syntax, expected opening `%`");var i=[];return ax(t,kP,function(a,h,u,y){i[i.length]=u?ax(y,DP,"$1"):h||a}),i},NP=function(t,n){var r=t,i;if(Ag(sx,r)&&(i=sx[r],r="%"+i[0]+"%"),Ag(xc,r)){var a=xc[r];if(a===Qh&&(a=LP(r)),typeof a>"u"&&!n)throw new sf("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new uf("intrinsic "+t+" does not exist!")},ml=function(t,n){if(typeof t!="string"||t.length===0)throw new sf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new sf('"allowMissing" argument must be a boolean');if(AP(/^%?[^%]*%?$/,t)===null)throw new uf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=RP(t),i=r.length>0?r[0]:"",a=NP("%"+i+"%",n),h=a.name,u=a.value,y=!1,w=a.alias;w&&(i=w[0],MP(r,PP([0,1],w)));for(var S=1,I=!0;S=r.length){var Y=bc(u,P);I=!!Y,I&&"get"in Y&&!("originalValue"in Y.get)?u=Y.get:u=u[P]}else I=Ag(u,P),u=u[P];I&&!y&&(xc[h]=u)}}return u},W_,lx;function _v(){if(lx)return W_;lx=1;var e=ml,t=e("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return W_=t,W_}var OP=ml,yg=OP("%Object.getOwnPropertyDescriptor%",!0);if(yg)try{yg([],"length")}catch{yg=null}var vv=yg,ux=_v(),zP=qS,Hh=Gu,cx=vv,bv=function(t,n,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Hh("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Hh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Hh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Hh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Hh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Hh("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,y=!!cx&&cx(t,n);if(ux)ux(t,n,{configurable:h===null&&y?y.configurable:!h,enumerable:i===null&&y?y.enumerable:!i,value:r,writable:a===null&&y?y.writable:!a});else if(u||!i&&!a&&!h)t[n]=r;else throw new zP("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},b0=_v(),HS=function(){return!!b0};HS.hasArrayLengthDefineBug=function(){if(!b0)return null;try{return b0([],"length",{value:1}).length!==1}catch{return!0}};var xv=HS,FP=mv,BP=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",VP=Object.prototype.toString,UP=Array.prototype.concat,hx=bv,GP=function(e){return typeof e=="function"&&VP.call(e)==="[object Function]"},ZS=xv(),qP=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!GP(r)||!r())return}ZS?hx(e,t,n,!0):hx(e,t,n)},XS=function(e,t){var n=arguments.length>2?arguments[2]:{},r=FP(t);BP&&(r=UP.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i4294967295||HP(n)!==n)throw new dx("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in t&&px){var h=px(t,"length");h&&!h.configurable&&(i=!1),h&&!h.writable&&(a=!1)}return(i||a||!r)&&(WP?fx(t,"length",n,!0,!0):fx(t,"length",n)),t};(function(e){var t=yv,n=ml,r=ZP,i=Gu,a=n("%Function.prototype.apply%"),h=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||t.call(h,a),y=_v(),w=n("%Math.max%");e.exports=function(P){if(typeof P!="function")throw new i("a function is required");var z=u(t,h,arguments);return r(z,1+w(0,P.length-(arguments.length-1)),!0)};var S=function(){return u(t,a,arguments)};y?y(e.exports,"apply",{value:S}):e.exports.apply=S})(YS);var Nf=YS.exports,KS=ml,JS=Nf,XP=JS(KS("String.prototype.indexOf")),ha=function(t,n){var r=KS(t,!!n);return typeof r=="function"&&XP(t,".prototype.")>-1?JS(r):r},YP=mv,QS=fy(),$S=ha,mx=Object,KP=$S("Array.prototype.push"),gx=$S("Object.prototype.propertyIsEnumerable"),JP=QS?Object.getOwnPropertySymbols:null,tE=function(t,n){if(t==null)throw new TypeError("target must be an object");var r=mx(t);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||fM)&&(hM?yx(t,"name",n,!0,!0):yx(t,"name",n)),t},mM=dM,gM=Gu,yM=Object,iE=mM(function(){if(this==null||this!==yM(this))throw new gM("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),_M=iE,vM=Vc.supportsDescriptors,bM=Object.getOwnPropertyDescriptor,oE=function(){if(vM&&/a/mig.flags==="gim"){var t=bM(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return t.get}}return _M},xM=Vc.supportsDescriptors,wM=oE,SM=Object.getOwnPropertyDescriptor,EM=Object.defineProperty,IM=TypeError,_x=Object.getPrototypeOf,CM=/a/,TM=function(){if(!xM||!_x)throw new IM("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=wM(),n=_x(CM),r=SM(n,"flags");return(!r||r.get!==t)&&EM(n,"flags",{configurable:!0,enumerable:!1,get:t}),t},LM=Vc,PM=Nf,MM=iE,sE=oE,AM=TM,aE=PM(sE());LM(aE,{getPolyfill:sE,implementation:MM,shim:AM});var kM=aE,_g={exports:{}},DM=fy,Uc=function(){return DM()&&!!Symbol.toStringTag},RM=Uc(),NM=ha,x0=NM("Object.prototype.toString"),py=function(t){return RM&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:x0(t)==="[object Arguments]"},lE=function(t){return py(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&x0(t)!=="[object Array]"&&x0(t.callee)==="[object Function]"},OM=function(){return py(arguments)}();py.isLegacyArguments=lE;var uE=OM?py:lE;const zM={},FM=Object.freeze(Object.defineProperty({__proto__:null,default:zM},Symbol.toStringTag,{value:"Module"})),BM=hy(FM);var wv=typeof Map=="function"&&Map.prototype,Z_=Object.getOwnPropertyDescriptor&&wv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Dg=wv&&Z_&&typeof Z_.get=="function"?Z_.get:null,vx=wv&&Map.prototype.forEach,Sv=typeof Set=="function"&&Set.prototype,X_=Object.getOwnPropertyDescriptor&&Sv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Rg=Sv&&X_&&typeof X_.get=="function"?X_.get:null,bx=Sv&&Set.prototype.forEach,VM=typeof WeakMap=="function"&&WeakMap.prototype,ad=VM?WeakMap.prototype.has:null,UM=typeof WeakSet=="function"&&WeakSet.prototype,ld=UM?WeakSet.prototype.has:null,GM=typeof WeakRef=="function"&&WeakRef.prototype,xx=GM?WeakRef.prototype.deref:null,qM=Boolean.prototype.valueOf,jM=Object.prototype.toString,WM=Function.prototype.toString,HM=String.prototype.match,Ev=String.prototype.slice,Cu=String.prototype.replace,ZM=String.prototype.toUpperCase,wx=String.prototype.toLowerCase,cE=RegExp.prototype.test,Sx=Array.prototype.concat,rl=Array.prototype.join,XM=Array.prototype.slice,Ex=Math.floor,w0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Y_=Object.getOwnPropertySymbols,S0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,cf=typeof Symbol=="function"&&typeof Symbol.iterator=="object",So=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===cf||"symbol")?Symbol.toStringTag:null,hE=Object.prototype.propertyIsEnumerable,Ix=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function Cx(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||cE.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var r=e<0?-Ex(-e):Ex(e);if(r!==e){var i=String(r),a=Ev.call(t,i.length+1);return Cu.call(i,n,"$&_")+"."+Cu.call(Cu.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Cu.call(t,n,"$&_")}var E0=BM,Tx=E0.custom,Lx=pE(Tx)?Tx:null,YM=function e(t,n,r,i){var a=n||{};if(Eu(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Eu(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var h=Eu(a,"customInspect")?a.customInspect:!0;if(typeof h!="boolean"&&h!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Eu(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Eu(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=a.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return mE(t,a);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var y=String(t);return u?Cx(t,y):y}if(typeof t=="bigint"){var w=String(t)+"n";return u?Cx(t,w):w}var S=typeof a.depth>"u"?5:a.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof t=="object")return I0(t)?"[Array]":"[Object]";var I=pA(a,r);if(typeof i>"u")i=[];else if(dE(i,t)>=0)return"[Circular]";function P(Kt,bt,Ut){if(bt&&(i=XM.call(i),i.push(bt)),Ut){var ee={depth:a.depth};return Eu(a,"quoteStyle")&&(ee.quoteStyle=a.quoteStyle),e(Kt,ee,r+1,i)}return e(Kt,a,r+1,i)}if(typeof t=="function"&&!Px(t)){var z=iA(t),R=ng(t,P);return"[Function"+(z?": "+z:" (anonymous)")+"]"+(R.length>0?" { "+rl.call(R,", ")+" }":"")}if(pE(t)){var Y=cf?Cu.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):S0.call(t);return typeof t=="object"&&!cf?Hp(Y):Y}if(cA(t)){for(var Z="<"+wx.call(String(t.nodeName)),et=t.attributes||[],B=0;B",Z}if(I0(t)){if(t.length===0)return"[]";var j=ng(t,P);return I&&!fA(j)?"["+C0(j,I)+"]":"[ "+rl.call(j,", ")+" ]"}if(QM(t)){var q=ng(t,P);return!("cause"in Error.prototype)&&"cause"in t&&!hE.call(t,"cause")?"{ ["+String(t)+"] "+rl.call(Sx.call("[cause]: "+P(t.cause),q),", ")+" }":q.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+rl.call(q,", ")+" }"}if(typeof t=="object"&&h){if(Lx&&typeof t[Lx]=="function"&&E0)return E0(t,{depth:S-r});if(h!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(oA(t)){var ct=[];return vx&&vx.call(t,function(Kt,bt){ct.push(P(bt,t,!0)+" => "+P(Kt,t))}),Mx("Map",Dg.call(t),ct,I)}if(lA(t)){var _t=[];return bx&&bx.call(t,function(Kt){_t.push(P(Kt,t))}),Mx("Set",Rg.call(t),_t,I)}if(sA(t))return K_("WeakMap");if(uA(t))return K_("WeakSet");if(aA(t))return K_("WeakRef");if(tA(t))return Hp(P(Number(t)));if(nA(t))return Hp(P(w0.call(t)));if(eA(t))return Hp(qM.call(t));if($M(t))return Hp(P(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===Nd)return"{ [object globalThis] }";if(!JM(t)&&!Px(t)){var lt=ng(t,P),ht=Ix?Ix(t)===Object.prototype:t instanceof Object||t.constructor===Object,pt=t instanceof Object?"":"null prototype",Tt=!ht&&So&&Object(t)===t&&So in t?Ev.call(qu(t),8,-1):pt?"Object":"",Q=ht||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",gt=Q+(Tt||pt?"["+rl.call(Sx.call([],Tt||[],pt||[]),": ")+"] ":"");return lt.length===0?gt+"{}":I?gt+"{"+C0(lt,I)+"}":gt+"{ "+rl.call(lt,", ")+" }"}return String(t)};function fE(e,t,n){var r=(n.quoteStyle||t)==="double"?'"':"'";return r+e+r}function KM(e){return Cu.call(String(e),/"/g,""")}function I0(e){return qu(e)==="[object Array]"&&(!So||!(typeof e=="object"&&So in e))}function JM(e){return qu(e)==="[object Date]"&&(!So||!(typeof e=="object"&&So in e))}function Px(e){return qu(e)==="[object RegExp]"&&(!So||!(typeof e=="object"&&So in e))}function QM(e){return qu(e)==="[object Error]"&&(!So||!(typeof e=="object"&&So in e))}function $M(e){return qu(e)==="[object String]"&&(!So||!(typeof e=="object"&&So in e))}function tA(e){return qu(e)==="[object Number]"&&(!So||!(typeof e=="object"&&So in e))}function eA(e){return qu(e)==="[object Boolean]"&&(!So||!(typeof e=="object"&&So in e))}function pE(e){if(cf)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!S0)return!1;try{return S0.call(e),!0}catch{}return!1}function nA(e){if(!e||typeof e!="object"||!w0)return!1;try{return w0.call(e),!0}catch{}return!1}var rA=Object.prototype.hasOwnProperty||function(e){return e in this};function Eu(e,t){return rA.call(e,t)}function qu(e){return jM.call(e)}function iA(e){if(e.name)return e.name;var t=HM.call(WM.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function dE(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;nt.maxStringLength){var n=e.length-t.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return mE(Ev.call(e,0,t.maxStringLength),t)+r}var i=Cu.call(Cu.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,hA);return fE(i,"single",t)}function hA(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+ZM.call(t.toString(16))}function Hp(e){return"Object("+e+")"}function K_(e){return e+" { ? }"}function Mx(e,t,n,r){var i=r?C0(n,r):rl.call(n,", ");return e+" ("+t+") {"+i+"}"}function fA(e){for(var t=0;t=0)return!1;return!0}function pA(e,t){var n;if(e.indent===" ")n=" ";else if(typeof e.indent=="number"&&e.indent>0)n=rl.call(Array(e.indent+1)," ");else return null;return{base:n,prev:rl.call(Array(t+1),n)}}function C0(e,t){if(e.length===0)return"";var n=` `+t.prev+t.base;return n+rl.call(e,","+n)+` -`+t.prev}function ng(e,t){var n=I0(e),r=[];if(n){r.length=e.length;for(var i=0;i=r)return n+1;var i=Fx(t,n);if(i<55296||i>56319)return n+1;var a=Fx(t,n+1);return a<56320||a>57343?n+1:n+2},Q_=function(t){var n=0;return{next:function(){var i=n>=t.length,a;return i||(a=t[n],n+=1),{done:i,value:a}}}},Bx=function(t,n){if(zA(t)||Rx(t))return Q_(t);if(FA(t)){var r=0;return{next:function(){var a=GA(t,r),h=UA(t,r,a);return r=a,{done:a>t.length,value:h}}}}if(n&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()};if(!BA&&!VA)_g.exports=function(t){if(t!=null)return Bx(t,!0)};else{var qA=xE,jA=SE,Vx=wa("Map.prototype.forEach",!0),Ux=wa("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Gx=wa("Map.prototype.iterator",!0),qx=wa("Set.prototype.iterator",!0);var jx=wa("Map.prototype.@@iterator",!0)||wa("Map.prototype._es6-shim iterator_",!0),Wx=wa("Set.prototype.@@iterator",!0)||wa("Set.prototype._es6-shim iterator_",!0),WA=function(t){if(qA(t)){if(Gx)return Nx(Gx(t));if(jx)return jx(t);if(Vx){var n=[];return Vx(t,function(i,a){zx(n,[a,i])}),Q_(n)}}if(jA(t)){if(qx)return Nx(qx(t));if(Wx)return Wx(t);if(Ux){var r=[];return Ux(t,function(i){zx(r,i)}),Q_(r)}}};_g.exports=function(t){return WA(t)||Bx(t)}}}var HA=_g.exports,Hx=function(e){return e!==e},EE=function(t,n){return t===0&&n===0?1/t===1/n:!!(t===n||Hx(t)&&Hx(n))},ZA=EE,IE=function(){return typeof Object.is=="function"?Object.is:ZA},XA=IE,YA=Vc,KA=function(){var t=XA();return YA(Object,{is:t},{is:function(){return Object.is!==t}}),t},JA=Vc,QA=Nf,$A=EE,CE=IE,tk=KA,TE=QA(CE(),Object);JA(TE,{getPolyfill:CE,implementation:$A,shim:tk});var ek=TE,nk=Nf,LE=ha,rk=ml,T0=rk("%ArrayBuffer%",!0),vg=LE("ArrayBuffer.prototype.byteLength",!0),ik=LE("Object.prototype.toString"),Zx=!!T0&&!vg&&new T0(0).slice,Xx=!!Zx&&nk(Zx),PE=vg||Xx?function(t){if(!t||typeof t!="object")return!1;try{return vg?vg(t):Xx(t,0),!0}catch{return!1}}:T0?function(t){return ik(t)==="[object ArrayBuffer]"}:function(t){return!1},ok=Date.prototype.getDay,sk=function(t){try{return ok.call(t),!0}catch{return!1}},ak=Object.prototype.toString,lk="[object Date]",uk=Uc(),ck=function(t){return typeof t!="object"||t===null?!1:uk?sk(t):ak.call(t)===lk},L0=ha,ME=Uc(),AE,kE,P0,M0;if(ME){AE=L0("Object.prototype.hasOwnProperty"),kE=L0("RegExp.prototype.exec"),P0={};var $_=function(){throw P0};M0={toString:$_,valueOf:$_},typeof Symbol.toPrimitive=="symbol"&&(M0[Symbol.toPrimitive]=$_)}var hk=L0("Object.prototype.toString"),fk=Object.getOwnPropertyDescriptor,pk="[object RegExp]",dk=ME?function(t){if(!t||typeof t!="object")return!1;var n=fk(t,"lastIndex"),r=n&&AE(n,"value");if(!r)return!1;try{kE(t,M0)}catch(i){return i===P0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:hk(t)===pk},mk=ha,Yx=mk("SharedArrayBuffer.prototype.byteLength",!0),gk=Yx?function(t){if(!t||typeof t!="object")return!1;try{return Yx(t),!0}catch{return!1}}:function(t){return!1},yk=Number.prototype.toString,_k=function(t){try{return yk.call(t),!0}catch{return!1}},vk=Object.prototype.toString,bk="[object Number]",xk=Uc(),wk=function(t){return typeof t=="number"?!0:typeof t!="object"?!1:xk?_k(t):vk.call(t)===bk},DE=ha,Sk=DE("Boolean.prototype.toString"),Ek=DE("Object.prototype.toString"),Ik=function(t){try{return Sk(t),!0}catch{return!1}},Ck="[object Boolean]",Tk=Uc(),Lk=function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:Tk&&Symbol.toStringTag in t?Ik(t):Ek(t)===Ck},A0={exports:{}},Pk=Object.prototype.toString,Mk=gv();if(Mk){var Ak=Symbol.prototype.toString,kk=/^Symbol\(.*\)$/,Dk=function(t){return typeof t.valueOf()!="symbol"?!1:kk.test(Ak.call(t))};A0.exports=function(t){if(typeof t=="symbol")return!0;if(Pk.call(t)!=="[object Symbol]")return!1;try{return Dk(t)}catch{return!1}}}else A0.exports=function(t){return!1};var Rk=A0.exports,k0={exports:{}},Kx=typeof BigInt<"u"&&BigInt,Nk=function(){return typeof Kx=="function"&&typeof BigInt=="function"&&typeof Kx(42)=="bigint"&&typeof BigInt(42)=="bigint"},Ok=Nk();if(Ok){var zk=BigInt.prototype.valueOf,Fk=function(t){try{return zk.call(t),!0}catch{}return!1};k0.exports=function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:Fk(t)}}else k0.exports=function(t){return!1};var Bk=k0.exports,Vk=vE,Uk=wk,Gk=Lk,qk=Rk,jk=Bk,Wk=function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(Vk(t))return"String";if(Uk(t))return"Number";if(Gk(t))return"Boolean";if(qk(t))return"Symbol";if(jk(t))return"BigInt"},zg=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Jx=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Fg;zg||(Fg=function(t){return!1});var D0=zg?zg.prototype.has:null,t0=Jx?Jx.prototype.has:null;!Fg&&!D0&&(Fg=function(t){return!1});var Hk=Fg||function(t){if(!t||typeof t!="object")return!1;try{if(D0.call(t,D0),t0)try{t0.call(t,t0)}catch{return!0}return t instanceof zg}catch{}return!1},R0={exports:{}},Zk=ml,RE=ha,Xk=Zk("%WeakSet%",!0),e0=RE("WeakSet.prototype.has",!0);if(e0){var n0=RE("WeakMap.prototype.has",!0);R0.exports=function(t){if(!t||typeof t!="object")return!1;try{if(e0(t,e0),n0)try{n0(t,n0)}catch{return!0}return t instanceof Xk}catch{}return!1}}else R0.exports=function(t){return!1};var Yk=R0.exports,Kk=xE,Jk=SE,Qk=Hk,$k=Yk,t3=function(t){if(t&&typeof t=="object"){if(Kk(t))return"Map";if(Jk(t))return"Set";if(Qk(t))return"WeakMap";if($k(t))return"WeakSet"}return!1},NE=Function.prototype.toString,nf=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,N0,bg;if(typeof nf=="function"&&typeof Object.defineProperty=="function")try{N0=Object.defineProperty({},"length",{get:function(){throw bg}}),bg={},nf(function(){throw 42},null,N0)}catch(e){e!==bg&&(nf=null)}else nf=null;var e3=/^\s*class\b/,O0=function(t){try{var n=NE.call(t);return e3.test(n)}catch{return!1}},r0=function(t){try{return O0(t)?!1:(NE.call(t),!0)}catch{return!1}},xg=Object.prototype.toString,n3="[object Object]",r3="[object Function]",i3="[object GeneratorFunction]",o3="[object HTMLAllCollection]",s3="[object HTML document.all class]",a3="[object HTMLCollection]",l3=typeof Symbol=="function"&&!!Symbol.toStringTag,u3=!(0 in[,]),z0=function(){return!1};if(typeof document=="object"){var c3=document.all;xg.call(c3)===xg.call(document.all)&&(z0=function(t){if((u3||!t)&&(typeof t>"u"||typeof t=="object"))try{var n=xg.call(t);return(n===o3||n===s3||n===a3||n===n3)&&t("")==null}catch{}return!1})}var h3=nf?function(t){if(z0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{nf(t,null,N0)}catch(n){if(n!==bg)return!1}return!O0(t)&&r0(t)}:function(t){if(z0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(l3)return r0(t);if(O0(t))return!1;var n=xg.call(t);return n!==r3&&n!==i3&&!/^\[object HTML/.test(n)?!1:r0(t)},f3=h3,p3=Object.prototype.toString,OE=Object.prototype.hasOwnProperty,d3=function(t,n,r){for(var i=0,a=t.length;i=3&&(i=r),p3.call(t)==="[object Array]"?d3(t,n,i):typeof t=="string"?m3(t,n,i):g3(t,n,i)},_3=y3,v3=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],i0=v3,b3=typeof globalThis>"u"?Nd:globalThis,x3=function(){for(var t=[],n=0;n"u"?Nd:globalThis,F0=w3(),Mv=Pv("String.prototype.slice"),o0=Object.getPrototypeOf,E3=Pv("Array.prototype.indexOf",!0)||function(t,n){for(var r=0;r-1?n:n!=="Object"?!1:C3(t)}return wg?I3(t):null},L3=ha,tw=L3("ArrayBuffer.prototype.byteLength",!0),P3=PE,M3=function(t){return P3(t)?tw?tw(t):t.byteLength:NaN},FE=lM,gl=ha,ew=kM,A3=ml,hf=HA,k3=yE,nw=ek,rw=uE,iw=_E,ow=PE,sw=ck,aw=dk,lw=gk,uw=mv,cw=Wk,hw=t3,fw=T3,pw=M3,dw=gl("SharedArrayBuffer.prototype.byteLength",!0),mw=gl("Date.prototype.getTime"),s0=Object.getPrototypeOf,gw=gl("Object.prototype.toString"),Ug=A3("%Set%",!0),B0=gl("Map.prototype.has",!0),Gg=gl("Map.prototype.get",!0),yw=gl("Map.prototype.size",!0),qg=gl("Set.prototype.add",!0),BE=gl("Set.prototype.delete",!0),jg=gl("Set.prototype.has",!0),Sg=gl("Set.prototype.size",!0);function _w(e,t,n,r){for(var i=hf(e),a;(a=i.next())&&!a.done;)if(Ca(t,a.value,n,r))return BE(e,a.value),!0;return!1}function VE(e){if(typeof e>"u")return null;if(typeof e!="object")return typeof e=="symbol"?!1:typeof e=="string"||typeof e=="number"?+e==+e:!0}function D3(e,t,n,r,i,a){var h=VE(n);if(h!=null)return h;var u=Gg(t,h),y=FE({},i,{strict:!1});return typeof u>"u"&&!B0(t,h)||!Ca(r,u,y,a)?!1:!B0(e,h)&&Ca(r,u,y,a)}function R3(e,t,n){var r=VE(n);return r??(jg(t,r)&&!jg(e,r))}function vw(e,t,n,r,i,a){for(var h=hf(e),u,y;(u=h.next())&&!u.done;)if(y=u.value,Ca(n,y,i,a)&&Ca(r,Gg(t,y),i,a))return BE(e,y),!0;return!1}function Ca(e,t,n,r){var i=n||{};if(i.strict?nw(e,t):e===t)return!0;var a=cw(e),h=cw(t);if(a!==h)return!1;if(!e||!t||typeof e!="object"&&typeof t!="object")return i.strict?nw(e,t):e==t;var u=r.has(e),y=r.has(t),w;if(u&&y){if(r.get(e)===r.get(t))return!0}else w={};return u||r.set(e,w),y||r.set(t,w),z3(e,t,i,r)}function bw(e){return!e||typeof e!="object"||typeof e.length!="number"||typeof e.copy!="function"||typeof e.slice!="function"||e.length>0&&typeof e[0]!="number"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function N3(e,t,n,r){if(Sg(e)!==Sg(t))return!1;for(var i=hf(e),a=hf(t),h,u,y;(h=i.next())&&!h.done;)if(h.value&&typeof h.value=="object")y||(y=new Ug),qg(y,h.value);else if(!jg(t,h.value)){if(n.strict||!R3(e,t,h.value))return!1;y||(y=new Ug),qg(y,h.value)}if(y){for(;(u=a.next())&&!u.done;)if(u.value&&typeof u.value=="object"){if(!_w(y,u.value,n.strict,r))return!1}else if(!n.strict&&!jg(e,u.value)&&!_w(y,u.value,n.strict,r))return!1;return Sg(y)===0}return!0}function O3(e,t,n,r){if(yw(e)!==yw(t))return!1;for(var i=hf(e),a=hf(t),h,u,y,w,S,I;(h=i.next())&&!h.done;)if(w=h.value[0],S=h.value[1],w&&typeof w=="object")y||(y=new Ug),qg(y,w);else if(I=Gg(t,w),typeof I>"u"&&!B0(t,w)||!Ca(S,I,n,r)){if(n.strict||!D3(e,t,w,S,n,r))return!1;y||(y=new Ug),qg(y,w)}if(y){for(;(u=a.next())&&!u.done;)if(w=u.value[0],I=u.value[1],w&&typeof w=="object"){if(!vw(y,e,w,I,n,r))return!1}else if(!n.strict&&(!e.has(w)||!Ca(Gg(e,w),I,n,r))&&!vw(y,e,w,I,FE({},n,{strict:!1}),r))return!1;return Sg(y)===0}return!0}function z3(e,t,n,r){var i,a;if(typeof e!=typeof t||e==null||t==null||gw(e)!==gw(t)||rw(e)!==rw(t))return!1;var h=iw(e),u=iw(t);if(h!==u)return!1;var y=e instanceof Error,w=t instanceof Error;if(y!==w||(y||w)&&(e.name!==t.name||e.message!==t.message))return!1;var S=aw(e),I=aw(t);if(S!==I||(S||I)&&(e.source!==t.source||ew(e)!==ew(t)))return!1;var P=sw(e),z=sw(t);if(P!==z||(P||z)&&mw(e)!==mw(t)||n.strict&&s0&&s0(e)!==s0(t))return!1;var R=fw(e),Z=fw(t);if(R!==Z)return!1;if(R||Z){if(e.length!==t.length)return!1;for(i=0;i=0;i--)if(dt[i]!=ut[i])return!1;for(i=dt.length-1;i>=0;i--)if(a=dt[i],!Ca(e[a],t[a],n,r))return!1;var ft=hw(e),_t=hw(t);return ft!==_t?!1:ft==="Set"||_t==="Set"?N3(e,t,n,r):ft==="Map"?O3(e,t,n,r):!0}var F3=function(t,n,r){return Ca(t,n,r,k3())};const B3=dv(F3);var V3=Object.defineProperty,$n=(e,t)=>V3(e,"name",{value:t,configurable:!0}),U3=class{constructor(t){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=t==null?void 0:t.precision)!=null?n:17),this.direction=(r=t==null?void 0:t.direction)!=null?r:!1,this.compareProperties=(i=t==null?void 0:t.compareProperties)!=null?i:!0}compare(t,n){if(t.type!==n.type||!td(t,n))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,n.coordinates);case"LineString":return this.compareLine(t.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(t,n);case"GeometryCollection":return this.compareGeometryCollection(t,n);case"Feature":return this.compareFeature(t,n);case"FeatureCollection":return this.compareFeatureCollection(t,n);default:if(t.type.startsWith("Multi")){const r=V0(t),i=V0(n);return r.every(a=>i.some(h=>this.compare(a,h)))}}return!1}compareCoord(t,n){return t.length===n.length&&t.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(t.slice(i,t.length),t.slice(1,i+1))),r}comparePath(t,n){return t.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(t,n){if(this.compareLine(t.coordinates[0],n.coordinates[0],1,!0)){const r=t.coordinates.slice(1,t.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(a=>i.some(h=>this.compareLine(a,h,1,!0)))}return!1}compareGeometryCollection(t,n){return td(t.geometries,n.geometries)&&this.compareBBox(t,n)&&t.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(t,n){return t.id===n.id&&(this.compareProperties?B3(t.properties,n.properties):!0)&&this.compareBBox(t,n)&&this.compare(t.geometry,n.geometry)}compareFeatureCollection(t,n){return td(t.features,n.features)&&this.compareBBox(t,n)&&t.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(t,n){return!t.bbox&&!n.bbox||(t.bbox&&n.bbox?this.compareCoord(t.bbox,n.bbox):!1)}};$n(U3,"GeojsonEquality");function td(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}$n(td,"sameLength");function V0(e){return e.coordinates.map(t=>({type:e.type.replace("Multi",""),coordinates:t}))}$n(V0,"explode");var Ss=63710088e-1,UE={centimeters:Ss*100,centimetres:Ss*100,degrees:360/(2*Math.PI),feet:Ss*3.28084,inches:Ss*39.37,kilometers:Ss/1e3,kilometres:Ss/1e3,meters:Ss,metres:Ss,miles:Ss/1609.344,millimeters:Ss*1e3,millimetres:Ss*1e3,nauticalmiles:Ss/1852,radians:1,yards:Ss*1.0936},xw={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ll(e,t,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}$n(ll,"feature");function G3(e,t,n={}){switch(e){case"Point":return zl(t).geometry;case"LineString":return Ul(t).geometry;case"Polygon":return Av(t).geometry;case"MultiPoint":return qE(t).geometry;case"MultiLineString":return GE(t).geometry;case"MultiPolygon":return jE(t).geometry;default:throw new Error(e+" is invalid")}}$n(G3,"geometry");function zl(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Wg(e[0])||!Wg(e[1]))throw new Error("coordinates must contain numbers");return ll({type:"Point",coordinates:e},t,n)}$n(zl,"point");function q3(e,t,n={}){return dy(e.map(r=>zl(r,t)),n)}$n(q3,"points");function Av(e,t,n={}){for(const i of e){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let a=0;aAv(r,t)),n)}$n(j3,"polygons");function Ul(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return ll({type:"LineString",coordinates:e},t,n)}$n(Ul,"lineString");function W3(e,t,n={}){return dy(e.map(r=>Ul(r,t)),n)}$n(W3,"lineStrings");function dy(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}$n(dy,"featureCollection");function GE(e,t,n={}){return ll({type:"MultiLineString",coordinates:e},t,n)}$n(GE,"multiLineString");function qE(e,t,n={}){return ll({type:"MultiPoint",coordinates:e},t,n)}$n(qE,"multiPoint");function jE(e,t,n={}){return ll({type:"MultiPolygon",coordinates:e},t,n)}$n(jE,"multiPolygon");function H3(e,t,n={}){return ll({type:"GeometryCollection",geometries:e},t,n)}$n(H3,"geometryCollection");function Z3(e,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,t||0);return Math.round(e*n)/n}$n(Z3,"round");function WE(e,t="kilometers"){const n=UE[t];if(!n)throw new Error(t+" units is invalid");return e*n}$n(WE,"radiansToLength");function kv(e,t="kilometers"){const n=UE[t];if(!n)throw new Error(t+" units is invalid");return e/n}$n(kv,"lengthToRadians");function X3(e,t){return HE(kv(e,t))}$n(X3,"lengthToDegrees");function Y3(e){let t=e%360;return t<0&&(t+=360),t}$n(Y3,"bearingToAzimuth");function HE(e){return e%(2*Math.PI)*180/Math.PI}$n(HE,"radiansToDegrees");function K3(e){return e%360*Math.PI/180}$n(K3,"degreesToRadians");function J3(e,t="kilometers",n="kilometers"){if(!(e>=0))throw new Error("length must be a positive number");return WE(kv(e,t),n)}$n(J3,"convertLength");function Q3(e,t="meters",n="kilometers"){if(!(e>=0))throw new Error("area must be a positive number");const r=xw[t];if(!r)throw new Error("invalid original units");const i=xw[n];if(!i)throw new Error("invalid final units");return e/r*i}$n(Q3,"convertArea");function Wg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}$n(Wg,"isNumber");function Dv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}$n(Dv,"isObject");function $3(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(t=>{if(!Wg(t))throw new Error("bbox must only contain numbers")})}$n($3,"validateBBox");function t4(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}$n(t4,"validateId");var e4=Object.defineProperty,uo=(e,t)=>e4(e,"name",{value:t,configurable:!0});function zf(e,t,n){if(e!==null)for(var r,i,a,h,u,y,w,S=0,I=0,P,z=e.type,R=z==="FeatureCollection",Z=z==="Feature",X=R?e.features.length:1,et=0;ety||R>w||Z>S){u=I,y=r,w=R,S=Z,a=0;return}var X=Ul([u,I],n.properties);if(t(X,r,i,Z,a)===!1)return!1;a++,u=I})===!1)return!1}}})}uo(YE,"segmentEach");function l4(e,t,n){var r=n,i=!1;return YE(e,function(a,h,u,y,w){i===!1&&n===void 0?r=a:r=t(r,a,h,u,y,w),i=!0}),r}uo(l4,"segmentReduce");function KE(e,t){if(!e)throw new Error("geojson is required");my(e,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,h=n.geometry.coordinates;switch(a){case"LineString":if(t(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;uf4(e,"name",{value:t,configurable:!0});function Nv(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const n=[1/0,1/0,-1/0,-1/0];return zf(e,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]=r)return n+1;var i=Fx(t,n);if(i<55296||i>56319)return n+1;var a=Fx(t,n+1);return a<56320||a>57343?n+1:n+2},Q_=function(t){var n=0;return{next:function(){var i=n>=t.length,a;return i||(a=t[n],n+=1),{done:i,value:a}}}},Bx=function(t,n){if(zA(t)||Rx(t))return Q_(t);if(FA(t)){var r=0;return{next:function(){var a=GA(t,r),h=UA(t,r,a);return r=a,{done:a>t.length,value:h}}}}if(n&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()};if(!BA&&!VA)_g.exports=function(t){if(t!=null)return Bx(t,!0)};else{var qA=xE,jA=SE,Vx=wa("Map.prototype.forEach",!0),Ux=wa("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Gx=wa("Map.prototype.iterator",!0),qx=wa("Set.prototype.iterator",!0);var jx=wa("Map.prototype.@@iterator",!0)||wa("Map.prototype._es6-shim iterator_",!0),Wx=wa("Set.prototype.@@iterator",!0)||wa("Set.prototype._es6-shim iterator_",!0),WA=function(t){if(qA(t)){if(Gx)return Nx(Gx(t));if(jx)return jx(t);if(Vx){var n=[];return Vx(t,function(i,a){zx(n,[a,i])}),Q_(n)}}if(jA(t)){if(qx)return Nx(qx(t));if(Wx)return Wx(t);if(Ux){var r=[];return Ux(t,function(i){zx(r,i)}),Q_(r)}}};_g.exports=function(t){return WA(t)||Bx(t)}}}var HA=_g.exports,Hx=function(e){return e!==e},EE=function(t,n){return t===0&&n===0?1/t===1/n:!!(t===n||Hx(t)&&Hx(n))},ZA=EE,IE=function(){return typeof Object.is=="function"?Object.is:ZA},XA=IE,YA=Vc,KA=function(){var t=XA();return YA(Object,{is:t},{is:function(){return Object.is!==t}}),t},JA=Vc,QA=Nf,$A=EE,CE=IE,tk=KA,TE=QA(CE(),Object);JA(TE,{getPolyfill:CE,implementation:$A,shim:tk});var ek=TE,nk=Nf,LE=ha,rk=ml,T0=rk("%ArrayBuffer%",!0),vg=LE("ArrayBuffer.prototype.byteLength",!0),ik=LE("Object.prototype.toString"),Zx=!!T0&&!vg&&new T0(0).slice,Xx=!!Zx&&nk(Zx),PE=vg||Xx?function(t){if(!t||typeof t!="object")return!1;try{return vg?vg(t):Xx(t,0),!0}catch{return!1}}:T0?function(t){return ik(t)==="[object ArrayBuffer]"}:function(t){return!1},ok=Date.prototype.getDay,sk=function(t){try{return ok.call(t),!0}catch{return!1}},ak=Object.prototype.toString,lk="[object Date]",uk=Uc(),ck=function(t){return typeof t!="object"||t===null?!1:uk?sk(t):ak.call(t)===lk},L0=ha,ME=Uc(),AE,kE,P0,M0;if(ME){AE=L0("Object.prototype.hasOwnProperty"),kE=L0("RegExp.prototype.exec"),P0={};var $_=function(){throw P0};M0={toString:$_,valueOf:$_},typeof Symbol.toPrimitive=="symbol"&&(M0[Symbol.toPrimitive]=$_)}var hk=L0("Object.prototype.toString"),fk=Object.getOwnPropertyDescriptor,pk="[object RegExp]",dk=ME?function(t){if(!t||typeof t!="object")return!1;var n=fk(t,"lastIndex"),r=n&&AE(n,"value");if(!r)return!1;try{kE(t,M0)}catch(i){return i===P0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:hk(t)===pk},mk=ha,Yx=mk("SharedArrayBuffer.prototype.byteLength",!0),gk=Yx?function(t){if(!t||typeof t!="object")return!1;try{return Yx(t),!0}catch{return!1}}:function(t){return!1},yk=Number.prototype.toString,_k=function(t){try{return yk.call(t),!0}catch{return!1}},vk=Object.prototype.toString,bk="[object Number]",xk=Uc(),wk=function(t){return typeof t=="number"?!0:typeof t!="object"?!1:xk?_k(t):vk.call(t)===bk},DE=ha,Sk=DE("Boolean.prototype.toString"),Ek=DE("Object.prototype.toString"),Ik=function(t){try{return Sk(t),!0}catch{return!1}},Ck="[object Boolean]",Tk=Uc(),Lk=function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:Tk&&Symbol.toStringTag in t?Ik(t):Ek(t)===Ck},A0={exports:{}},Pk=Object.prototype.toString,Mk=gv();if(Mk){var Ak=Symbol.prototype.toString,kk=/^Symbol\(.*\)$/,Dk=function(t){return typeof t.valueOf()!="symbol"?!1:kk.test(Ak.call(t))};A0.exports=function(t){if(typeof t=="symbol")return!0;if(Pk.call(t)!=="[object Symbol]")return!1;try{return Dk(t)}catch{return!1}}}else A0.exports=function(t){return!1};var Rk=A0.exports,k0={exports:{}},Kx=typeof BigInt<"u"&&BigInt,Nk=function(){return typeof Kx=="function"&&typeof BigInt=="function"&&typeof Kx(42)=="bigint"&&typeof BigInt(42)=="bigint"},Ok=Nk();if(Ok){var zk=BigInt.prototype.valueOf,Fk=function(t){try{return zk.call(t),!0}catch{}return!1};k0.exports=function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:Fk(t)}}else k0.exports=function(t){return!1};var Bk=k0.exports,Vk=vE,Uk=wk,Gk=Lk,qk=Rk,jk=Bk,Wk=function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(Vk(t))return"String";if(Uk(t))return"Number";if(Gk(t))return"Boolean";if(qk(t))return"Symbol";if(jk(t))return"BigInt"},zg=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Jx=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Fg;zg||(Fg=function(t){return!1});var D0=zg?zg.prototype.has:null,t0=Jx?Jx.prototype.has:null;!Fg&&!D0&&(Fg=function(t){return!1});var Hk=Fg||function(t){if(!t||typeof t!="object")return!1;try{if(D0.call(t,D0),t0)try{t0.call(t,t0)}catch{return!0}return t instanceof zg}catch{}return!1},R0={exports:{}},Zk=ml,RE=ha,Xk=Zk("%WeakSet%",!0),e0=RE("WeakSet.prototype.has",!0);if(e0){var n0=RE("WeakMap.prototype.has",!0);R0.exports=function(t){if(!t||typeof t!="object")return!1;try{if(e0(t,e0),n0)try{n0(t,n0)}catch{return!0}return t instanceof Xk}catch{}return!1}}else R0.exports=function(t){return!1};var Yk=R0.exports,Kk=xE,Jk=SE,Qk=Hk,$k=Yk,t3=function(t){if(t&&typeof t=="object"){if(Kk(t))return"Map";if(Jk(t))return"Set";if(Qk(t))return"WeakMap";if($k(t))return"WeakSet"}return!1},NE=Function.prototype.toString,nf=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,N0,bg;if(typeof nf=="function"&&typeof Object.defineProperty=="function")try{N0=Object.defineProperty({},"length",{get:function(){throw bg}}),bg={},nf(function(){throw 42},null,N0)}catch(e){e!==bg&&(nf=null)}else nf=null;var e3=/^\s*class\b/,O0=function(t){try{var n=NE.call(t);return e3.test(n)}catch{return!1}},r0=function(t){try{return O0(t)?!1:(NE.call(t),!0)}catch{return!1}},xg=Object.prototype.toString,n3="[object Object]",r3="[object Function]",i3="[object GeneratorFunction]",o3="[object HTMLAllCollection]",s3="[object HTML document.all class]",a3="[object HTMLCollection]",l3=typeof Symbol=="function"&&!!Symbol.toStringTag,u3=!(0 in[,]),z0=function(){return!1};if(typeof document=="object"){var c3=document.all;xg.call(c3)===xg.call(document.all)&&(z0=function(t){if((u3||!t)&&(typeof t>"u"||typeof t=="object"))try{var n=xg.call(t);return(n===o3||n===s3||n===a3||n===n3)&&t("")==null}catch{}return!1})}var h3=nf?function(t){if(z0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{nf(t,null,N0)}catch(n){if(n!==bg)return!1}return!O0(t)&&r0(t)}:function(t){if(z0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(l3)return r0(t);if(O0(t))return!1;var n=xg.call(t);return n!==r3&&n!==i3&&!/^\[object HTML/.test(n)?!1:r0(t)},f3=h3,p3=Object.prototype.toString,OE=Object.prototype.hasOwnProperty,d3=function(t,n,r){for(var i=0,a=t.length;i=3&&(i=r),p3.call(t)==="[object Array]"?d3(t,n,i):typeof t=="string"?m3(t,n,i):g3(t,n,i)},_3=y3,v3=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],i0=v3,b3=typeof globalThis>"u"?Nd:globalThis,x3=function(){for(var t=[],n=0;n"u"?Nd:globalThis,F0=w3(),Mv=Pv("String.prototype.slice"),o0=Object.getPrototypeOf,E3=Pv("Array.prototype.indexOf",!0)||function(t,n){for(var r=0;r-1?n:n!=="Object"?!1:C3(t)}return wg?I3(t):null},L3=ha,tw=L3("ArrayBuffer.prototype.byteLength",!0),P3=PE,M3=function(t){return P3(t)?tw?tw(t):t.byteLength:NaN},FE=lM,gl=ha,ew=kM,A3=ml,hf=HA,k3=yE,nw=ek,rw=uE,iw=_E,ow=PE,sw=ck,aw=dk,lw=gk,uw=mv,cw=Wk,hw=t3,fw=T3,pw=M3,dw=gl("SharedArrayBuffer.prototype.byteLength",!0),mw=gl("Date.prototype.getTime"),s0=Object.getPrototypeOf,gw=gl("Object.prototype.toString"),Ug=A3("%Set%",!0),B0=gl("Map.prototype.has",!0),Gg=gl("Map.prototype.get",!0),yw=gl("Map.prototype.size",!0),qg=gl("Set.prototype.add",!0),BE=gl("Set.prototype.delete",!0),jg=gl("Set.prototype.has",!0),Sg=gl("Set.prototype.size",!0);function _w(e,t,n,r){for(var i=hf(e),a;(a=i.next())&&!a.done;)if(Ca(t,a.value,n,r))return BE(e,a.value),!0;return!1}function VE(e){if(typeof e>"u")return null;if(typeof e!="object")return typeof e=="symbol"?!1:typeof e=="string"||typeof e=="number"?+e==+e:!0}function D3(e,t,n,r,i,a){var h=VE(n);if(h!=null)return h;var u=Gg(t,h),y=FE({},i,{strict:!1});return typeof u>"u"&&!B0(t,h)||!Ca(r,u,y,a)?!1:!B0(e,h)&&Ca(r,u,y,a)}function R3(e,t,n){var r=VE(n);return r??(jg(t,r)&&!jg(e,r))}function vw(e,t,n,r,i,a){for(var h=hf(e),u,y;(u=h.next())&&!u.done;)if(y=u.value,Ca(n,y,i,a)&&Ca(r,Gg(t,y),i,a))return BE(e,y),!0;return!1}function Ca(e,t,n,r){var i=n||{};if(i.strict?nw(e,t):e===t)return!0;var a=cw(e),h=cw(t);if(a!==h)return!1;if(!e||!t||typeof e!="object"&&typeof t!="object")return i.strict?nw(e,t):e==t;var u=r.has(e),y=r.has(t),w;if(u&&y){if(r.get(e)===r.get(t))return!0}else w={};return u||r.set(e,w),y||r.set(t,w),z3(e,t,i,r)}function bw(e){return!e||typeof e!="object"||typeof e.length!="number"||typeof e.copy!="function"||typeof e.slice!="function"||e.length>0&&typeof e[0]!="number"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function N3(e,t,n,r){if(Sg(e)!==Sg(t))return!1;for(var i=hf(e),a=hf(t),h,u,y;(h=i.next())&&!h.done;)if(h.value&&typeof h.value=="object")y||(y=new Ug),qg(y,h.value);else if(!jg(t,h.value)){if(n.strict||!R3(e,t,h.value))return!1;y||(y=new Ug),qg(y,h.value)}if(y){for(;(u=a.next())&&!u.done;)if(u.value&&typeof u.value=="object"){if(!_w(y,u.value,n.strict,r))return!1}else if(!n.strict&&!jg(e,u.value)&&!_w(y,u.value,n.strict,r))return!1;return Sg(y)===0}return!0}function O3(e,t,n,r){if(yw(e)!==yw(t))return!1;for(var i=hf(e),a=hf(t),h,u,y,w,S,I;(h=i.next())&&!h.done;)if(w=h.value[0],S=h.value[1],w&&typeof w=="object")y||(y=new Ug),qg(y,w);else if(I=Gg(t,w),typeof I>"u"&&!B0(t,w)||!Ca(S,I,n,r)){if(n.strict||!D3(e,t,w,S,n,r))return!1;y||(y=new Ug),qg(y,w)}if(y){for(;(u=a.next())&&!u.done;)if(w=u.value[0],I=u.value[1],w&&typeof w=="object"){if(!vw(y,e,w,I,n,r))return!1}else if(!n.strict&&(!e.has(w)||!Ca(Gg(e,w),I,n,r))&&!vw(y,e,w,I,FE({},n,{strict:!1}),r))return!1;return Sg(y)===0}return!0}function z3(e,t,n,r){var i,a;if(typeof e!=typeof t||e==null||t==null||gw(e)!==gw(t)||rw(e)!==rw(t))return!1;var h=iw(e),u=iw(t);if(h!==u)return!1;var y=e instanceof Error,w=t instanceof Error;if(y!==w||(y||w)&&(e.name!==t.name||e.message!==t.message))return!1;var S=aw(e),I=aw(t);if(S!==I||(S||I)&&(e.source!==t.source||ew(e)!==ew(t)))return!1;var P=sw(e),z=sw(t);if(P!==z||(P||z)&&mw(e)!==mw(t)||n.strict&&s0&&s0(e)!==s0(t))return!1;var R=fw(e),Y=fw(t);if(R!==Y)return!1;if(R||Y){if(e.length!==t.length)return!1;for(i=0;i=0;i--)if(_t[i]!=lt[i])return!1;for(i=_t.length-1;i>=0;i--)if(a=_t[i],!Ca(e[a],t[a],n,r))return!1;var ht=hw(e),pt=hw(t);return ht!==pt?!1:ht==="Set"||pt==="Set"?N3(e,t,n,r):ht==="Map"?O3(e,t,n,r):!0}var F3=function(t,n,r){return Ca(t,n,r,k3())};const B3=dv(F3);var V3=Object.defineProperty,$n=(e,t)=>V3(e,"name",{value:t,configurable:!0}),U3=class{constructor(t){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=t==null?void 0:t.precision)!=null?n:17),this.direction=(r=t==null?void 0:t.direction)!=null?r:!1,this.compareProperties=(i=t==null?void 0:t.compareProperties)!=null?i:!0}compare(t,n){if(t.type!==n.type||!td(t,n))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,n.coordinates);case"LineString":return this.compareLine(t.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(t,n);case"GeometryCollection":return this.compareGeometryCollection(t,n);case"Feature":return this.compareFeature(t,n);case"FeatureCollection":return this.compareFeatureCollection(t,n);default:if(t.type.startsWith("Multi")){const r=V0(t),i=V0(n);return r.every(a=>i.some(h=>this.compare(a,h)))}}return!1}compareCoord(t,n){return t.length===n.length&&t.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(t.slice(i,t.length),t.slice(1,i+1))),r}comparePath(t,n){return t.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(t,n){if(this.compareLine(t.coordinates[0],n.coordinates[0],1,!0)){const r=t.coordinates.slice(1,t.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(a=>i.some(h=>this.compareLine(a,h,1,!0)))}return!1}compareGeometryCollection(t,n){return td(t.geometries,n.geometries)&&this.compareBBox(t,n)&&t.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(t,n){return t.id===n.id&&(this.compareProperties?B3(t.properties,n.properties):!0)&&this.compareBBox(t,n)&&this.compare(t.geometry,n.geometry)}compareFeatureCollection(t,n){return td(t.features,n.features)&&this.compareBBox(t,n)&&t.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(t,n){return!t.bbox&&!n.bbox||(t.bbox&&n.bbox?this.compareCoord(t.bbox,n.bbox):!1)}};$n(U3,"GeojsonEquality");function td(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}$n(td,"sameLength");function V0(e){return e.coordinates.map(t=>({type:e.type.replace("Multi",""),coordinates:t}))}$n(V0,"explode");var Ss=63710088e-1,UE={centimeters:Ss*100,centimetres:Ss*100,degrees:360/(2*Math.PI),feet:Ss*3.28084,inches:Ss*39.37,kilometers:Ss/1e3,kilometres:Ss/1e3,meters:Ss,metres:Ss,miles:Ss/1609.344,millimeters:Ss*1e3,millimetres:Ss*1e3,nauticalmiles:Ss/1852,radians:1,yards:Ss*1.0936},xw={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ll(e,t,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}$n(ll,"feature");function G3(e,t,n={}){switch(e){case"Point":return zl(t).geometry;case"LineString":return Ul(t).geometry;case"Polygon":return Av(t).geometry;case"MultiPoint":return qE(t).geometry;case"MultiLineString":return GE(t).geometry;case"MultiPolygon":return jE(t).geometry;default:throw new Error(e+" is invalid")}}$n(G3,"geometry");function zl(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Wg(e[0])||!Wg(e[1]))throw new Error("coordinates must contain numbers");return ll({type:"Point",coordinates:e},t,n)}$n(zl,"point");function q3(e,t,n={}){return dy(e.map(r=>zl(r,t)),n)}$n(q3,"points");function Av(e,t,n={}){for(const i of e){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let a=0;aAv(r,t)),n)}$n(j3,"polygons");function Ul(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return ll({type:"LineString",coordinates:e},t,n)}$n(Ul,"lineString");function W3(e,t,n={}){return dy(e.map(r=>Ul(r,t)),n)}$n(W3,"lineStrings");function dy(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}$n(dy,"featureCollection");function GE(e,t,n={}){return ll({type:"MultiLineString",coordinates:e},t,n)}$n(GE,"multiLineString");function qE(e,t,n={}){return ll({type:"MultiPoint",coordinates:e},t,n)}$n(qE,"multiPoint");function jE(e,t,n={}){return ll({type:"MultiPolygon",coordinates:e},t,n)}$n(jE,"multiPolygon");function H3(e,t,n={}){return ll({type:"GeometryCollection",geometries:e},t,n)}$n(H3,"geometryCollection");function Z3(e,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,t||0);return Math.round(e*n)/n}$n(Z3,"round");function WE(e,t="kilometers"){const n=UE[t];if(!n)throw new Error(t+" units is invalid");return e*n}$n(WE,"radiansToLength");function kv(e,t="kilometers"){const n=UE[t];if(!n)throw new Error(t+" units is invalid");return e/n}$n(kv,"lengthToRadians");function X3(e,t){return HE(kv(e,t))}$n(X3,"lengthToDegrees");function Y3(e){let t=e%360;return t<0&&(t+=360),t}$n(Y3,"bearingToAzimuth");function HE(e){return e%(2*Math.PI)*180/Math.PI}$n(HE,"radiansToDegrees");function K3(e){return e%360*Math.PI/180}$n(K3,"degreesToRadians");function J3(e,t="kilometers",n="kilometers"){if(!(e>=0))throw new Error("length must be a positive number");return WE(kv(e,t),n)}$n(J3,"convertLength");function Q3(e,t="meters",n="kilometers"){if(!(e>=0))throw new Error("area must be a positive number");const r=xw[t];if(!r)throw new Error("invalid original units");const i=xw[n];if(!i)throw new Error("invalid final units");return e/r*i}$n(Q3,"convertArea");function Wg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}$n(Wg,"isNumber");function Dv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}$n(Dv,"isObject");function $3(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(t=>{if(!Wg(t))throw new Error("bbox must only contain numbers")})}$n($3,"validateBBox");function t4(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}$n(t4,"validateId");var e4=Object.defineProperty,uo=(e,t)=>e4(e,"name",{value:t,configurable:!0});function zf(e,t,n){if(e!==null)for(var r,i,a,h,u,y,w,S=0,I=0,P,z=e.type,R=z==="FeatureCollection",Y=z==="Feature",Z=R?e.features.length:1,et=0;ety||R>w||Y>S){u=I,y=r,w=R,S=Y,a=0;return}var Z=Ul([u,I],n.properties);if(t(Z,r,i,Y,a)===!1)return!1;a++,u=I})===!1)return!1}}})}uo(YE,"segmentEach");function l4(e,t,n){var r=n,i=!1;return YE(e,function(a,h,u,y,w){i===!1&&n===void 0?r=a:r=t(r,a,h,u,y,w),i=!0}),r}uo(l4,"segmentReduce");function KE(e,t){if(!e)throw new Error("geojson is required");my(e,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,h=n.geometry.coordinates;switch(a){case"LineString":if(t(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;uf4(e,"name",{value:t,configurable:!0});function Nv(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const n=[1/0,1/0,-1/0,-1/0];return zf(e,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]1)return 1;for(var c=l,p=0;p<8;p++){var g=this.sampleCurveX(c)-l;if(Math.abs(g)g?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var R=y(P);let Z,X;function et(){return Z==null&&(Z=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Z}function B(){if(X==null&&(X=!1,et())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const g=4*p;o.fillStyle=`rgb(${g},${g+1},${g+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const c=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&c[p]!==p){X=!0;break}}}return X||!1}function q(l,o,c,p){const g=new R(l,o,c,p);return function(b){return g.solve(b)}}const Y=q(.25,.1,.25,1);function lt(l,o,c){return Math.min(c,Math.max(o,l))}function dt(l,o,c){const p=c-o,g=((l-o)%p+p)%p+o;return g===o?c:g}function ut(l,...o){for(const c of o)for(const p in c)l[p]=c[p];return l}let ft=1;function _t(l,o,c){const p={};for(const g in l)p[g]=o.call(c||this,l[g],g,l);return p}function kt(l,o,c){const p={};for(const g in l)o.call(c||this,l[g],g,l)&&(p[g]=l[g]);return p}function Q(l){return Array.isArray(l)?l.map(Q):typeof l=="object"&&l?_t(l,Q):l}const yt={};function Kt(l){yt[l]||(typeof console<"u"&&console.warn(l),yt[l]=!0)}function bt(l,o,c){return(c.y-l.y)*(o.x-l.x)>(o.y-l.y)*(c.x-l.x)}function Ut(l){let o=0;for(let c,p,g=0,b=l.length,x=b-1;g"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(l,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const E=x.startsWith("BGR"),L=new Uint8ClampedArray(p*g*4);if(yield b.copyTo(L,function(A,D,N,U,j){const H=4*Math.max(-D,0),tt=(Math.max(0,N)-N)*U*4+H,ot=4*U,ht=Math.max(0,D),Lt=Math.max(0,N);return{rect:{x:ht,y:Lt,width:Math.min(A.width,D+U)-ht,height:Math.min(A.height,N+j)-Lt},layout:[{offset:tt,stride:ot}]}}(l,o,c,p,g)),E)for(let A=0;Aee(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,br=function(l,o){if(/:\/\//.test(l.url)&&!/^https?:|^file:/.test(l.url)){const p=gn(l.url);if(p)return p(l,o);if(ee(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,targetMapId:An},o)}if(!(/^file:/.test(c=l.url)||/^file:/.test(Pr())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,g){return u(this,void 0,void 0,function*(){const b=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:Pr(),signal:g.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new vr(x.status,x.statusText,p.url,A)}let E;E=p.type==="arrayBuffer"||p.type==="image"?x.arrayBuffer():p.type==="json"?x.json():x.text();const L=yield E;if(g.signal.aborted)throw Cn();return{data:L,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(l,o);if(ee(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,mustQueue:!0,targetMapId:An},o)}var c;return function(p,g){return new Promise((b,x)=>{const E=new XMLHttpRequest;E.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(E.responseType="arraybuffer");for(const L in p.headers)E.setRequestHeader(L,p.headers[L]);p.type==="json"&&(E.responseType="text",E.setRequestHeader("Accept","application/json")),E.withCredentials=p.credentials==="include",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if(!g.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let L=E.response;if(p.type==="json")try{L=JSON.parse(E.response)}catch(A){return void x(A)}b({data:L,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const L=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});x(new vr(E.status,E.statusText,p.url,L))}},g.signal.addEventListener("abort",()=>{E.abort(),x(Cn())}),E.send(p.body)})}(l,o)};function hr(l){if(!l||l.indexOf("://")<=0||l.indexOf("data:image/")===0||l.indexOf("blob:")===0)return!0;const o=new URL(l),c=window.location;return o.protocol===c.protocol&&o.host===c.host}function Qt(l,o,c){c[l]&&c[l].indexOf(o)!==-1||(c[l]=c[l]||[],c[l].push(o))}function mt(l,o,c){if(c&&c[l]){const p=c[l].indexOf(o);p!==-1&&c[l].splice(p,1)}}class Ct{constructor(o,c={}){ut(this,c),this.type=o}}class Ie extends Ct{constructor(o,c={}){super("error",ut({error:o},c))}}class kn{on(o,c){return this._listeners=this._listeners||{},Qt(o,c,this._listeners),this}off(o,c){return mt(o,c,this._listeners),mt(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},Qt(o,c,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,c){typeof o=="string"&&(o=new Ct(o,c||{}));const p=o.type;if(this.listens(p)){o.target=this;const g=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of g)E.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of b)mt(p,E,this._oneTimeListeners),E.call(this,o);const x=this._eventedParent;x&&(ut(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(o))}else o instanceof Ie&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,c){return this._eventedParent=o,this._eventedParentData=c,this}}var At={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Ze=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Mr(l,o){const c={};for(const p in l)p!=="ref"&&(c[p]=l[p]);return Ze.forEach(p=>{p in o&&(c[p]=o[p])}),c}function on(l,o){if(Array.isArray(l)){if(!Array.isArray(o)||l.length!==o.length)return!1;for(let c=0;c`:l.itemType.kind==="value"?"array":`array<${o}>`}return l.kind}const xt=[Hr,ae,Qe,Ke,Ar,zr,Jo,K(Xe),st,V,G];function J(l,o){if(o.kind==="error")return null;if(l.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!J(l.itemType,o.itemType))&&(typeof l.N!="number"||l.N===o.N))return null}else{if(l.kind===o.kind)return null;if(l.kind==="value"){for(const c of xt)if(!J(c,o))return null}}return`Expected ${nt(l)} but found ${nt(o)} instead.`}function wt(l,o){return o.some(c=>c.kind===l.kind)}function pt(l,o){return o.some(c=>c==="null"?l===null:c==="array"?Array.isArray(l):c==="object"?l&&!Array.isArray(l)&&typeof l=="object":c===typeof l)}function Tt(l,o){return l.kind==="array"&&o.kind==="array"?l.itemType.kind===o.itemType.kind&&typeof l.N=="number":l.kind===o.kind}const zt=.96422,Wt=.82521,Xt=4/29,Te=6/29,Ae=3*Te*Te,Ge=Te*Te*Te,je=Math.PI/180,bn=180/Math.PI;function jn(l){return(l%=360)<0&&(l+=360),l}function or([l,o,c,p]){let g,b;const x=nn((.2225045*(l=Zr(l))+.7168786*(o=Zr(o))+.0606169*(c=Zr(c)))/1);l===o&&o===c?g=b=x:(g=nn((.4360747*l+.3850649*o+.1430804*c)/zt),b=nn((.0139322*l+.0971045*o+.7141733*c)/Wt));const E=116*x-16;return[E<0?0:E,500*(g-x),200*(x-b),p]}function Zr(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function nn(l){return l>Ge?Math.pow(l,1/3):l/Ae+Xt}function xr([l,o,c,p]){let g=(l+16)/116,b=isNaN(o)?g:g+o/500,x=isNaN(c)?g:g-c/200;return g=1*Ji(g),b=zt*Ji(b),x=Wt*Ji(x),[ei(3.1338561*b-1.6168667*g-.4906146*x),ei(-.9787684*b+1.9161415*g+.033454*x),ei(.0719453*b-.2289914*g+1.4052427*x),p]}function ei(l){return(l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055)<0?0:l>1?1:l}function Ji(l){return l>Te?l*l*l:Ae*(l-Xt)}function co(l){return parseInt(l.padEnd(2,l),16)/255}function mi(l,o){return zs(o?l/100:l,0,1)}function zs(l,o,c){return Math.min(Math.max(o,l),c)}function Kd(l){return!l.some(Number.isNaN)}const Ry={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Vn{constructor(o,c,p,g=1,b=!0){this.r=o,this.g=c,this.b=p,this.a=g,b||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[o,c,p,g]))}static parse(o){if(o instanceof Vn)return o;if(typeof o!="string")return;const c=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=Ry[p];if(g){const[x,E,L]=g;return[x/255,E/255,L/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let E=1;return[co(p.slice(E,E+=x)),co(p.slice(E,E+=x)),co(p.slice(E,E+=x)),co(p.slice(E,E+x)||"ff")]}if(p.startsWith("rgb")){const x=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[E,L,A,D,N,U,j,H,tt,ot,ht,Lt]=x,gt=[D||" ",j||" ",ot].join("");if(gt===" "||gt===" /"||gt===",,"||gt===",,,"){const St=[A,U,tt].join(""),Yt=St==="%%%"?100:St===""?255:0;if(Yt){const Jt=[zs(+L/Yt,0,1),zs(+N/Yt,0,1),zs(+H/Yt,0,1),ht?mi(+ht,Lt):1];if(Kd(Jt))return Jt}}return}}const b=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,E,L,A,D,N,U,j,H]=b,tt=[L||" ",D||" ",U].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const ot=[+E,zs(+A,0,100),zs(+N,0,100),j?mi(+j,H):1];if(Kd(ot))return function([ht,Lt,gt,St]){function Yt(Jt){const ve=(Jt+ht/30)%12,Ce=Lt*Math.min(gt,1-gt);return gt-Ce*Math.max(-1,Math.min(ve-3,9-ve,1))}return ht=jn(ht),Lt/=100,gt/=100,[Yt(0),Yt(8),Yt(4),St]}(ot)}}}(o);return c?new Vn(...c,!1):void 0}get rgb(){const{r:o,g:c,b:p,a:g}=this,b=g||1/0;return this.overwriteGetter("rgb",[o/b,c/b,p/b,g])}get hcl(){return this.overwriteGetter("hcl",function(o){const[c,p,g,b]=or(o),x=Math.sqrt(p*p+g*g);return[Math.round(1e4*x)?jn(Math.atan2(g,p)*bn):NaN,x,c,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",or(this.rgb))}overwriteGetter(o,c){return Object.defineProperty(this,o,{value:c}),c}toString(){const[o,c,p,g]=this.rgb;return`rgba(${[o,c,p].map(b=>Math.round(255*b)).join(",")},${g})`}}Vn.black=new Vn(0,0,0,1),Vn.white=new Vn(1,1,1,1),Vn.transparent=new Vn(0,0,0,0),Vn.red=new Vn(1,0,0,1);class Hf{constructor(o,c,p){this.sensitivity=o?c?"variant":"case":c?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,c){return this.collator.compare(o,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Zf{constructor(o,c,p,g,b){this.text=o,this.image=c,this.scale=p,this.fontStack=g,this.textColor=b}}class Po{constructor(o){this.sections=o}static fromString(o){return new Po([new Zf(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Po?o:Po.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class ho{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof ho)return o;if(typeof o=="number")return new ho([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const c of o)if(typeof c!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new ho(o)}}toString(){return JSON.stringify(this.values)}}const Hu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Qo{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Qo)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let c=0;c=0&&l<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof c=="number"&&c>=0&&c<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[l,o,c,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[l,o,c,p]:[l,o,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Zc(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof Vn||l instanceof Hf||l instanceof Po||l instanceof ho||l instanceof Qo||l instanceof $o)return!0;if(Array.isArray(l)){for(const o of l)if(!Zc(o))return!1;return!0}if(typeof l=="object"){for(const o in l)if(!Zc(l[o]))return!1;return!0}return!1}function Xr(l){if(l===null)return Hr;if(typeof l=="string")return Qe;if(typeof l=="boolean")return Ke;if(typeof l=="number")return ae;if(l instanceof Vn)return Ar;if(l instanceof Hf)return ma;if(l instanceof Po)return zr;if(l instanceof ho)return st;if(l instanceof Qo)return G;if(l instanceof $o)return V;if(Array.isArray(l)){const o=l.length;let c;for(const p of l){const g=Xr(p);if(c){if(c===g)continue;c=Xe;break}c=g}return K(c||Xe,o)}return Jo}function Zu(l){const o=typeof l;return l===null?"":o==="string"||o==="number"||o==="boolean"?String(l):l instanceof Vn||l instanceof Po||l instanceof ho||l instanceof Qo||l instanceof $o?l.toString():JSON.stringify(l)}class Va{constructor(o,c){this.type=o,this.value=c}static parse(o,c){if(o.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!Zc(o[1]))return c.error("invalid value");const p=o[1];let g=Xr(p);const b=c.expectedType;return g.kind!=="array"||g.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(g=b),new Va(g,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class fr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Xc={string:Qe,number:ae,boolean:Ke,object:Jo};class Mo{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let p,g=1;const b=o[0];if(b==="array"){let E,L;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in Xc)||A==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);E=Xc[A],g++}else E=Xe;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return c.error('The length argument to "array" must be a positive integer literal',2);L=o[2],g++}p=K(E,L)}else{if(!Xc[b])throw new Error(`Types doesn't contain name = ${b}`);p=Xc[b]}const x=[];for(;go.outputDefined())}}const Yc={"to-boolean":Ke,"to-color":Ar,"to-number":ae,"to-string":Qe};class Fs{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[0];if(!Yc[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return c.error("Expected one argument.");const g=Yc[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:nu(c[0],c[1],c[2],c[3]),!p))return new Vn(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new fr(p||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(const p of this.args){c=p.evaluate(o);const g=ho.parse(c);if(g)return g}throw new fr(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(const p of this.args){c=p.evaluate(o);const g=Qo.parse(c);if(g)return g}throw new fr(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(const p of this.args){if(c=p.evaluate(o),c===null)return 0;const g=Number(c);if(!isNaN(g))return g}throw new fr(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Po.fromString(Zu(this.args[0].evaluate(o)));case"resolvedImage":return $o.fromString(Zu(this.args[0].evaluate(o)));default:return Zu(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Xu=["Unknown","Point","LineString","Polygon"];class Un{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Xu[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(o){let c=this._parseColorCache[o];return c||(c=this._parseColorCache[o]=Vn.parse(o)),c}}class Kc{constructor(o,c,p=[],g,b=new bl,x=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=g,this._isConstant=c}parse(o,c,p,g,b={}){return c?this.concat(c,p,g)._parse(o,b):this._parse(o,b)}_parse(o,c){function p(g,b,x){return x==="assert"?new Mo(b,[g]):x==="coerce"?new Fs(b,[g]):g}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=o[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[g];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,L=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||L.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string")if(E.kind!=="padding"||L.kind!=="value"&&L.kind!=="number"&&L.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||L.kind!=="value"&&L.kind!=="array"){if(this.checkSubtype(E,L))return null}else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"assert")}if(!(x instanceof Va)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new Un;try{x=new Va(x.type,x.evaluate(E))}catch(L){return this.error(L.message),null}}return x}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,c,p){const g=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new Kc(this.registry,this._isConstant,g,c||null,b,this.errors)}error(o,...c){const p=`${this.key}${c.map(g=>`[${g}]`).join("")}`;this.errors.push(new Ki(p,o))}checkSubtype(o,c){const p=J(o,c);return p&&this.error(p),p}}class ru{constructor(o,c,p){this.type=ma,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=c}static parse(o,c){if(o.length!==2)return c.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return c.error("Collator options argument must be an object.");const g=c.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Ke);if(!g)return null;const b=c.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Ke);if(!b)return null;let x=null;return p.locale&&(x=c.parse(p.locale,1,Qe),!x)?null:new ru(g,b,x)}evaluate(o){return new Hf(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}const Ua=8192;function Jc(l,o){l[0]=Math.min(l[0],o[0]),l[1]=Math.min(l[1],o[1]),l[2]=Math.max(l[2],o[0]),l[3]=Math.max(l[3],o[1])}function Yu(l,o){return!(l[0]<=o[0]||l[2]>=o[2]||l[1]<=o[1]||l[3]>=o[3])}function Ny(l,o){const c=(180+l[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,g=Math.pow(2,o.z);return[Math.round(c*g*Ua),Math.round(p*g*Ua)]}function Jd(l,o,c){const p=l[0]-o[0],g=l[1]-o[1],b=l[0]-c[0],x=l[1]-c[1];return p*x-b*g==0&&p*b<=0&&g*x<=0}function Qc(l,o){let c=!1;for(let x=0,E=o.length;x(p=l)[1]!=(b=L[A+1])[1]>p[1]&&p[0]<(b[0]-g[0])*(p[1]-g[1])/(b[1]-g[1])+g[0]&&(c=!c)}}var p,g,b;return c}function Oy(l,o){for(let c=0;c0&&E<0||x<0&&E>0}function zy(l,o,c){for(const A of c)for(let D=0;Dc[2]){const g=.5*p;let b=l[0]-c[0]>g?-p:c[0]-l[0]>g?p:0;b===0&&(b=l[0]-c[2]>g?-p:c[2]-l[0]>g?p:0),l[0]+=b}Jc(o,l)}function th(l,o,c,p){const g=Math.pow(2,p.z)*Ua,b=[p.x*Ua,p.y*Ua],x=[];for(const E of l)for(const L of E){const A=[L.x+b[0],L.y+b[1]];nm(A,o,c,g),x.push(A)}return x}function rm(l,o,c,p){const g=Math.pow(2,p.z)*Ua,b=[p.x*Ua,p.y*Ua],x=[];for(const L of l){const A=[];for(const D of L){const N=[D.x+b[0],D.y+b[1]];Jc(o,N),A.push(N)}x.push(A)}if(o[2]-o[0]<=g/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const L of x)for(const A of L)nm(A,o,c,g)}var E;return x}class xl{constructor(o,c){this.type=Ke,this.geojson=o,this.geometries=c}static parse(o,c){if(o.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(Zc(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const g=[];for(const b of p.features){const{type:x,coordinates:E}=b.geometry;x==="Polygon"&&g.push(E),x==="MultiPolygon"&&g.push(...E)}if(g.length)return new xl(p,{type:"MultiPolygon",coordinates:g})}else if(p.type==="Feature"){const g=p.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new xl(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new xl(p,p)}return c.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(c,p){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=$c(p.coordinates,b,x),L=th(c.geometry(),g,b,x);if(!Yu(g,b))return!1;for(const A of L)if(!Qc(A,E))return!1}if(p.type==="MultiPolygon"){const E=em(p.coordinates,b,x),L=th(c.geometry(),g,b,x);if(!Yu(g,b))return!1;for(const A of L)if(!Oy(A,E))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(c,p){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=$c(p.coordinates,b,x),L=rm(c.geometry(),g,b,x);if(!Yu(g,b))return!1;for(const A of L)if(!$d(A,E))return!1}if(p.type==="MultiPolygon"){const E=em(p.coordinates,b,x),L=rm(c.geometry(),g,b,x);if(!Yu(g,b))return!1;for(const A of L)if(!tm(A,E))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class eh{constructor(o,c){this.type=c.type,this.name=o,this.boundExpression=c}static parse(o,c){if(o.length!==2||typeof o[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");const p=o[1];return c.scope.has(p)?new eh(p,c.scope.get(p)):c.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Ao{constructor(o,c,p,g){this.name=o,this.type=c,this._evaluate=p,this.args=g}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,c){const p=o[0],g=Ao.definitions[p];if(!g)return c.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(g)?g[0]:g.type,x=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,E=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let L=null;for(const[A,D]of E){L=new Kc(c.registry,Ku,c.path,null,c.scope);const N=[];let U=!1;for(let j=1;j{return U=N,Array.isArray(U)?`(${U.map(nt).join(", ")})`:`(${nt(U.type)}...)`;var U}).join(" | "),D=[];for(let N=1;N{c=o?c&&Ku(p):c&&p instanceof Va}),!!c&&nh(l)&&Qu(l,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function nh(l){if(l instanceof Ao&&(l.name==="get"&&l.args.length===1||l.name==="feature-state"||l.name==="has"&&l.args.length===1||l.name==="properties"||l.name==="geometry-type"||l.name==="id"||/^filter-/.test(l.name))||l instanceof xl)return!1;let o=!0;return l.eachChild(c=>{o&&!nh(c)&&(o=!1)}),o}function Ju(l){if(l instanceof Ao&&l.name==="feature-state")return!1;let o=!0;return l.eachChild(c=>{o&&!Ju(c)&&(o=!1)}),o}function Qu(l,o){if(l instanceof Ao&&o.indexOf(l.name)>=0)return!1;let c=!0;return l.eachChild(p=>{c&&!Qu(p,o)&&(c=!1)}),c}function $u(l,o){const c=l.length-1;let p,g,b=0,x=c,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),p=l[E],g=l[E+1],p<=o){if(E===c||oo))throw new fr("Input is not a number.");x=E-1}return 0}class tc{constructor(o,c,p){this.type=o,this.input=c,this.labels=[],this.outputs=[];for(const[g,b]of p)this.labels.push(g),this.outputs.push(b)}static parse(o,c){if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");const p=c.parse(o[1],1,ae);if(!p)return null;const g=[];let b=null;c.expectedType&&c.expectedType.kind!=="value"&&(b=c.expectedType);for(let x=1;x=E)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const N=c.parse(L,D,b);if(!N)return null;b=b||N.type,g.push([E,N])}return new tc(b,p,g)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const g=this.input.evaluate(o);if(g<=c[0])return p[0].evaluate(o);const b=c.length;return g>=c[b-1]?p[b-1].evaluate(o):p[$u(c,g)].evaluate(o)}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Fy(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var By=im;function im(l,o,c,p){this.cx=3*l,this.bx=3*(c-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=c,this.p2y=p}im.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,o){if(o===void 0&&(o=1e-6),l<0)return 0;if(l>1)return 1;for(var c=l,p=0;p<8;p++){var g=this.sampleCurveX(c)-l;if(Math.abs(g)g?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var Vy=Fy(By);function wl(l,o,c){return l+c*(o-l)}function rh(l,o,c){return l.map((p,g)=>wl(p,o[g],c))}const Qi={number:wl,color:function(l,o,c,p="rgb"){switch(p){case"rgb":{const[g,b,x,E]=rh(l.rgb,o.rgb,c);return new Vn(g,b,x,E,!1)}case"hcl":{const[g,b,x,E]=l.hcl,[L,A,D,N]=o.hcl;let U,j;if(isNaN(g)||isNaN(L))isNaN(g)?isNaN(L)?U=NaN:(U=L,x!==1&&x!==0||(j=A)):(U=g,D!==1&&D!==0||(j=b));else{let Lt=L-g;L>g&&Lt>180?Lt-=360:L180&&(Lt+=360),U=g+c*Lt}const[H,tt,ot,ht]=function([Lt,gt,St,Yt]){return Lt=isNaN(Lt)?0:Lt*je,xr([St,Math.cos(Lt)*gt,Math.sin(Lt)*gt,Yt])}([U,j??wl(b,A,c),wl(x,D,c),wl(E,N,c)]);return new Vn(H,tt,ot,ht,!1)}case"lab":{const[g,b,x,E]=xr(rh(l.lab,o.lab,c));return new Vn(g,b,x,E,!1)}}},array:rh,padding:function(l,o,c){return new ho(rh(l.values,o.values,c))},variableAnchorOffsetCollection:function(l,o,c){const p=l.values,g=o.values;if(p.length!==g.length)throw new fr(`Cannot interpolate values of different length. from: ${l.toString()}, to: ${o.toString()}`);const b=[];for(let x=0;xtypeof D!="number"||D<0||D>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:A}}}if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(b=c.parse(b,2,ae),!b)return null;const E=[];let L=null;p==="interpolate-hcl"||p==="interpolate-lab"?L=Ar:c.expectedType&&c.expectedType.kind!=="value"&&(L=c.expectedType);for(let A=0;A=D)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const H=c.parse(N,j,L);if(!H)return null;L=L||H.type,E.push([D,H])}return Tt(L,ae)||Tt(L,Ar)||Tt(L,st)||Tt(L,G)||Tt(L,K(ae))?new Ni(L,p,g,b,E):c.error(`Type ${nt(L)} is not interpolatable.`)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const g=this.input.evaluate(o);if(g<=c[0])return p[0].evaluate(o);const b=c.length;if(g>=c[b-1])return p[b-1].evaluate(o);const x=$u(c,g),E=Ni.interpolationFactor(this.interpolation,g,c[x],c[x+1]),L=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return Qi[this.type.kind](L,A,E);case"interpolate-hcl":return Qi.color(L,A,E,"hcl");case"interpolate-lab":return Qi.color(L,A,E,"lab")}}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Dn(l,o,c,p){const g=p-c,b=l-c;return g===0?0:o===1?b/g:(Math.pow(o,b)-1)/(Math.pow(o,g)-1)}class ih{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expectected at least one argument.");let p=null;const g=c.expectedType;g&&g.kind!=="value"&&(p=g);const b=[];for(const E of o.slice(1)){const L=c.parse(E,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!L)return null;p=p||L.type,b.push(L)}if(!p)throw new Error("No output type");const x=g&&b.some(E=>J(g,E.type));return new ih(x?Xe:p,b)}evaluate(o){let c,p=null,g=0;for(const b of this.args)if(g++,p=b.evaluate(o),p&&p instanceof $o&&!p.available&&(c||(c=p.name),p=null,g===this.args.length&&(p=c)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class oh{constructor(o,c){this.type=c.type,this.bindings=[].concat(o),this.result=c}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const c of this.bindings)o(c[1]);o(this.result)}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let b=1;b=p.length)throw new fr(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new fr(`Array index must be an integer, but found ${c} instead.`);return p[c]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class Yf{constructor(o,c){this.type=Ke,this.needle=o,this.haystack=c}static parse(o,c){if(o.length!==3)return c.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,Xe),g=c.parse(o[2],2,Xe);return p&&g?wt(p.type,[Ke,Qe,ae,Hr,Xe])?new Yf(p,g):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${nt(p.type)} instead`):null}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!pt(c,["boolean","string","number","null"]))throw new fr(`Expected first argument to be of type boolean, string, number or null, but found ${nt(Xr(c))} instead.`);if(!pt(p,["string","array"]))throw new fr(`Expected second argument to be of type array or string, but found ${nt(Xr(p))} instead.`);return p.indexOf(c)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class sh{constructor(o,c,p){this.type=ae,this.needle=o,this.haystack=c,this.fromIndex=p}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,Xe),g=c.parse(o[2],2,Xe);if(!p||!g)return null;if(!wt(p.type,[Ke,Qe,ae,Hr,Xe]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${nt(p.type)} instead`);if(o.length===4){const b=c.parse(o[3],3,ae);return b?new sh(p,g,b):null}return new sh(p,g)}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!pt(c,["boolean","string","number","null"]))throw new fr(`Expected first argument to be of type boolean, string, number or null, but found ${nt(Xr(c))} instead.`);if(!pt(p,["string","array"]))throw new fr(`Expected second argument to be of type array or string, but found ${nt(Xr(p))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(o);return p.indexOf(c,g)}return p.indexOf(c)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class Kf{constructor(o,c,p,g,b,x){this.inputType=o,this.type=c,this.input=p,this.cases=g,this.outputs=b,this.otherwise=x}static parse(o,c){if(o.length<5)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return c.error("Expected an even number of arguments.");let p,g;c.expectedType&&c.expectedType.kind!=="value"&&(g=c.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof H=="number"&&Math.floor(H)!==H)return U.error("Numeric branch labels must be integer values.");if(p){if(U.checkSubtype(p,Xr(H)))return null}else p=Xr(H);if(b[String(H)]!==void 0)return U.error("Branch labels must be unique.");b[String(H)]=x.length}const j=c.parse(N,A,g);if(!j)return null;g=g||j.type,x.push(j)}const E=c.parse(o[1],1,Xe);if(!E)return null;const L=c.parse(o[o.length-1],o.length-1,g);return L?E.type.kind!=="value"&&c.concat(1).checkSubtype(p,E.type)?null:new Kf(p,g,E,b,x,L):null}evaluate(o){const c=this.input.evaluate(o);return(Xr(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class Jf{constructor(o,c,p){this.type=o,this.branches=c,this.otherwise=p}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return c.error("Expected an odd number of arguments.");let p;c.expectedType&&c.expectedType.kind!=="value"&&(p=c.expectedType);const g=[];for(let x=1;xc.outputDefined())&&this.otherwise.outputDefined()}}class ah{constructor(o,c,p,g){this.type=o,this.input=c,this.beginIndex=p,this.endIndex=g}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,Xe),g=c.parse(o[2],2,ae);if(!p||!g)return null;if(!wt(p.type,[K(Xe),Qe,Xe]))return c.error(`Expected first argument to be of type array or string, but found ${nt(p.type)} instead`);if(o.length===4){const b=c.parse(o[3],3,ae);return b?new ah(p.type,p,g,b):null}return new ah(p.type,p,g)}evaluate(o){const c=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!pt(c,["string","array"]))throw new fr(`Expected first argument to be of type array or string, but found ${nt(Xr(c))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(o);return c.slice(p,g)}return c.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function om(l,o){return l==="=="||l==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function sm(l,o,c,p){return p.compare(o,c)===0}function iu(l,o,c){const p=l!=="=="&&l!=="!=";return class QE{constructor(b,x,E){this.type=Ke,this.lhs=b,this.rhs=x,this.collator=E,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const E=b[0];let L=x.parse(b[1],1,Xe);if(!L)return null;if(!om(E,L.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${nt(L.type)}'.`);let A=x.parse(b[2],2,Xe);if(!A)return null;if(!om(E,A.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${nt(A.type)}'.`);if(L.type.kind!==A.type.kind&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${nt(L.type)}' and '${nt(A.type)}'.`);p&&(L.type.kind==="value"&&A.type.kind!=="value"?L=new Mo(A.type,[L]):L.type.kind!=="value"&&A.type.kind==="value"&&(A=new Mo(L.type,[A])));let D=null;if(b.length===4){if(L.type.kind!=="string"&&A.type.kind!=="string"&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(D=x.parse(b[3],3,ma),!D)return null}return new QE(L,A,D)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const L=Xr(x),A=Xr(E);if(L.kind!==A.kind||L.kind!=="string"&&L.kind!=="number")throw new fr(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${L.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const L=Xr(x),A=Xr(E);if(L.kind!=="string"||A.kind!=="string")return o(b,x,E)}return this.collator?c(b,x,E,this.collator.evaluate(b)):o(b,x,E)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const Uy=iu("==",function(l,o,c){return o===c},sm),Gy=iu("!=",function(l,o,c){return o!==c},function(l,o,c,p){return!sm(0,o,c,p)}),qy=iu("<",function(l,o,c){return o",function(l,o,c){return o>c},function(l,o,c,p){return p.compare(o,c)>0}),Wy=iu("<=",function(l,o,c){return o<=c},function(l,o,c,p){return p.compare(o,c)<=0}),Hy=iu(">=",function(l,o,c){return o>=c},function(l,o,c,p){return p.compare(o,c)>=0});class Qf{constructor(o,c,p,g,b){this.type=Qe,this.number=o,this.locale=c,this.currency=p,this.minFractionDigits=g,this.maxFractionDigits=b}static parse(o,c){if(o.length!==3)return c.error("Expected two arguments.");const p=c.parse(o[1],1,ae);if(!p)return null;const g=o[2];if(typeof g!="object"||Array.isArray(g))return c.error("NumberFormat options argument must be an object.");let b=null;if(g.locale&&(b=c.parse(g.locale,1,Qe),!b))return null;let x=null;if(g.currency&&(x=c.parse(g.currency,1,Qe),!x))return null;let E=null;if(g["min-fraction-digits"]&&(E=c.parse(g["min-fraction-digits"],1,ae),!E))return null;let L=null;return g["max-fraction-digits"]&&(L=c.parse(g["max-fraction-digits"],1,ae),!L)?null:new Qf(p,b,x,E,L)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class lh{constructor(o){this.type=zr,this.sections=o}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return c.error("First argument must be an image or text section.");const g=[];let b=!1;for(let x=1;x<=o.length-1;++x){const E=o[x];if(b&&typeof E=="object"&&!Array.isArray(E)){b=!1;let L=null;if(E["font-scale"]&&(L=c.parse(E["font-scale"],1,ae),!L))return null;let A=null;if(E["text-font"]&&(A=c.parse(E["text-font"],1,K(Qe)),!A))return null;let D=null;if(E["text-color"]&&(D=c.parse(E["text-color"],1,Ar),!D))return null;const N=g[g.length-1];N.scale=L,N.font=A,N.textColor=D}else{const L=c.parse(o[x],1,Xe);if(!L)return null;const A=L.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,g.push({content:L,scale:null,font:null,textColor:null})}}return new lh(g)}evaluate(o){return new Po(this.sections.map(c=>{const p=c.content.evaluate(o);return Xr(p)===V?new Zf("",p,null,null,null):new Zf(Zu(p),null,c.scale?c.scale.evaluate(o):null,c.font?c.font.evaluate(o).join(","):null,c.textColor?c.textColor.evaluate(o):null)}))}eachChild(o){for(const c of this.sections)o(c.content),c.scale&&o(c.scale),c.font&&o(c.font),c.textColor&&o(c.textColor)}outputDefined(){return!1}}class $f{constructor(o){this.type=V,this.input=o}static parse(o,c){if(o.length!==2)return c.error("Expected two arguments.");const p=c.parse(o[1],1,Qe);return p?new $f(p):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),p=$o.fromString(c);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(c)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class tp{constructor(o){this.type=ae,this.input=o}static parse(o,c){if(o.length!==2)return c.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=c.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${nt(p.type)} instead.`):new tp(p):null}evaluate(o){const c=this.input.evaluate(o);if(typeof c=="string"||Array.isArray(c))return c.length;throw new fr(`Expected value to be of type string or array, but found ${nt(Xr(c))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const ou={"==":Uy,"!=":Gy,">":jy,"<":qy,">=":Hy,"<=":Wy,array:Mo,at:Xf,boolean:Mo,case:Jf,coalesce:ih,collator:ru,format:lh,image:$f,in:Yf,"index-of":sh,interpolate:Ni,"interpolate-hcl":Ni,"interpolate-lab":Ni,length:tp,let:oh,literal:Va,match:Kf,number:Mo,"number-format":Qf,object:Mo,slice:ah,step:tc,string:Mo,"to-boolean":Fs,"to-color":Fs,"to-number":Fs,"to-string":Fs,var:eh,within:xl};function am(l,[o,c,p,g]){o=o.evaluate(l),c=c.evaluate(l),p=p.evaluate(l);const b=g?g.evaluate(l):1,x=nu(o,c,p,b);if(x)throw new fr(x);return new Vn(o/255,c/255,p/255,b,!1)}function lm(l,o){return l in o}function ep(l,o){const c=o[l];return c===void 0?null:c}function Sl(l){return{type:l}}function um(l){return{result:"success",value:l}}function su(l){return{result:"error",value:l}}function au(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function cm(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function np(l){return!!l.expression&&l.expression.interpolated}function In(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function uh(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function Zy(l){return l}function hm(l,o){const c=o.type==="color",p=l.stops&&typeof l.stops[0][0]=="object",g=p||!(p||l.property!==void 0),b=l.type||(np(o)?"exponential":"interval");if(c||o.type==="padding"){const D=c?Vn.parse:ho.parse;(l=Ko({},l)).stops&&(l.stops=l.stops.map(N=>[N[0],D(N[1])])),l.default=D(l.default?l.default:o.default)}if(l.colorSpace&&(x=l.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${l.colorSpace}"`);var x;let E,L,A;if(b==="exponential")E=xn;else if(b==="interval")E=Xy;else if(b==="categorical"){E=Fr,L=Object.create(null);for(const D of l.stops)L[D[0]]=D[1];A=typeof l.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=rp}if(p){const D={},N=[];for(let H=0;HH[0]),evaluate:({zoom:H},tt)=>xn({stops:U,base:l.base},o,H).evaluate(H,tt)}}if(g){const D=b==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:Ni.interpolationFactor.bind(void 0,D),zoomStops:l.stops.map(N=>N[0]),evaluate:({zoom:N})=>E(l,o,N,L,A)}}return{kind:"source",evaluate(D,N){const U=N&&N.properties?N.properties[l.property]:void 0;return U===void 0?ec(l.default,o.default):E(l,o,U,L,A)}}}function ec(l,o,c){return l!==void 0?l:o!==void 0?o:c!==void 0?c:void 0}function Fr(l,o,c,p,g){return ec(typeof c===g?p[c]:void 0,l.default,o.default)}function Xy(l,o,c){if(In(c)!=="number")return ec(l.default,o.default);const p=l.stops.length;if(p===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[p-1][0])return l.stops[p-1][1];const g=$u(l.stops.map(b=>b[0]),c);return l.stops[g][1]}function xn(l,o,c){const p=l.base!==void 0?l.base:1;if(In(c)!=="number")return ec(l.default,o.default);const g=l.stops.length;if(g===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[g-1][0])return l.stops[g-1][1];const b=$u(l.stops.map(D=>D[0]),c),x=function(D,N,U,j){const H=j-U,tt=D-U;return H===0?0:N===1?tt/H:(Math.pow(N,tt)-1)/(Math.pow(N,H)-1)}(c,p,l.stops[b][0],l.stops[b+1][0]),E=l.stops[b][1],L=l.stops[b+1][1],A=Qi[o.type]||Zy;return typeof E.evaluate=="function"?{evaluate(...D){const N=E.evaluate.apply(void 0,D),U=L.evaluate.apply(void 0,D);if(N!==void 0&&U!==void 0)return A(N,U,x,l.colorSpace)}}:A(E,L,x,l.colorSpace)}function rp(l,o,c){switch(o.type){case"color":c=Vn.parse(c);break;case"formatted":c=Po.fromString(c.toString());break;case"resolvedImage":c=$o.fromString(c.toString());break;case"padding":c=ho.parse(c);break;default:In(c)===o.type||o.type==="enum"&&o.values[c]||(c=void 0)}return ec(c,l.default,o.default)}Ao.register(ou,{error:[{kind:"error"},[Qe],(l,[o])=>{throw new fr(o.evaluate(l))}],typeof:[Qe,[Xe],(l,[o])=>nt(Xr(o.evaluate(l)))],"to-rgba":[K(ae,4),[Ar],(l,[o])=>{const[c,p,g,b]=o.evaluate(l).rgb;return[255*c,255*p,255*g,b]}],rgb:[Ar,[ae,ae,ae],am],rgba:[Ar,[ae,ae,ae,ae],am],has:{type:Ke,overloads:[[[Qe],(l,[o])=>lm(o.evaluate(l),l.properties())],[[Qe,Jo],(l,[o,c])=>lm(o.evaluate(l),c.evaluate(l))]]},get:{type:Xe,overloads:[[[Qe],(l,[o])=>ep(o.evaluate(l),l.properties())],[[Qe,Jo],(l,[o,c])=>ep(o.evaluate(l),c.evaluate(l))]]},"feature-state":[Xe,[Qe],(l,[o])=>ep(o.evaluate(l),l.featureState||{})],properties:[Jo,[],l=>l.properties()],"geometry-type":[Qe,[],l=>l.geometryType()],id:[Xe,[],l=>l.id()],zoom:[ae,[],l=>l.globals.zoom],"heatmap-density":[ae,[],l=>l.globals.heatmapDensity||0],"line-progress":[ae,[],l=>l.globals.lineProgress||0],accumulated:[Xe,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[ae,Sl(ae),(l,o)=>{let c=0;for(const p of o)c+=p.evaluate(l);return c}],"*":[ae,Sl(ae),(l,o)=>{let c=1;for(const p of o)c*=p.evaluate(l);return c}],"-":{type:ae,overloads:[[[ae,ae],(l,[o,c])=>o.evaluate(l)-c.evaluate(l)],[[ae],(l,[o])=>-o.evaluate(l)]]},"/":[ae,[ae,ae],(l,[o,c])=>o.evaluate(l)/c.evaluate(l)],"%":[ae,[ae,ae],(l,[o,c])=>o.evaluate(l)%c.evaluate(l)],ln2:[ae,[],()=>Math.LN2],pi:[ae,[],()=>Math.PI],e:[ae,[],()=>Math.E],"^":[ae,[ae,ae],(l,[o,c])=>Math.pow(o.evaluate(l),c.evaluate(l))],sqrt:[ae,[ae],(l,[o])=>Math.sqrt(o.evaluate(l))],log10:[ae,[ae],(l,[o])=>Math.log(o.evaluate(l))/Math.LN10],ln:[ae,[ae],(l,[o])=>Math.log(o.evaluate(l))],log2:[ae,[ae],(l,[o])=>Math.log(o.evaluate(l))/Math.LN2],sin:[ae,[ae],(l,[o])=>Math.sin(o.evaluate(l))],cos:[ae,[ae],(l,[o])=>Math.cos(o.evaluate(l))],tan:[ae,[ae],(l,[o])=>Math.tan(o.evaluate(l))],asin:[ae,[ae],(l,[o])=>Math.asin(o.evaluate(l))],acos:[ae,[ae],(l,[o])=>Math.acos(o.evaluate(l))],atan:[ae,[ae],(l,[o])=>Math.atan(o.evaluate(l))],min:[ae,Sl(ae),(l,o)=>Math.min(...o.map(c=>c.evaluate(l)))],max:[ae,Sl(ae),(l,o)=>Math.max(...o.map(c=>c.evaluate(l)))],abs:[ae,[ae],(l,[o])=>Math.abs(o.evaluate(l))],round:[ae,[ae],(l,[o])=>{const c=o.evaluate(l);return c<0?-Math.round(-c):Math.round(c)}],floor:[ae,[ae],(l,[o])=>Math.floor(o.evaluate(l))],ceil:[ae,[ae],(l,[o])=>Math.ceil(o.evaluate(l))],"filter-==":[Ke,[Qe,Xe],(l,[o,c])=>l.properties()[o.value]===c.value],"filter-id-==":[Ke,[Xe],(l,[o])=>l.id()===o.value],"filter-type-==":[Ke,[Qe],(l,[o])=>l.geometryType()===o.value],"filter-<":[Ke,[Qe,Xe],(l,[o,c])=>{const p=l.properties()[o.value],g=c.value;return typeof p==typeof g&&p{const c=l.id(),p=o.value;return typeof c==typeof p&&c":[Ke,[Qe,Xe],(l,[o,c])=>{const p=l.properties()[o.value],g=c.value;return typeof p==typeof g&&p>g}],"filter-id->":[Ke,[Xe],(l,[o])=>{const c=l.id(),p=o.value;return typeof c==typeof p&&c>p}],"filter-<=":[Ke,[Qe,Xe],(l,[o,c])=>{const p=l.properties()[o.value],g=c.value;return typeof p==typeof g&&p<=g}],"filter-id-<=":[Ke,[Xe],(l,[o])=>{const c=l.id(),p=o.value;return typeof c==typeof p&&c<=p}],"filter->=":[Ke,[Qe,Xe],(l,[o,c])=>{const p=l.properties()[o.value],g=c.value;return typeof p==typeof g&&p>=g}],"filter-id->=":[Ke,[Xe],(l,[o])=>{const c=l.id(),p=o.value;return typeof c==typeof p&&c>=p}],"filter-has":[Ke,[Xe],(l,[o])=>o.value in l.properties()],"filter-has-id":[Ke,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[Ke,[K(Qe)],(l,[o])=>o.value.indexOf(l.geometryType())>=0],"filter-id-in":[Ke,[K(Xe)],(l,[o])=>o.value.indexOf(l.id())>=0],"filter-in-small":[Ke,[Qe,K(Xe)],(l,[o,c])=>c.value.indexOf(l.properties()[o.value])>=0],"filter-in-large":[Ke,[Qe,K(Xe)],(l,[o,c])=>function(p,g,b,x){for(;b<=x;){const E=b+x>>1;if(g[E]===p)return!0;g[E]>p?x=E-1:b=E+1}return!1}(l.properties()[o.value],c.value,0,c.value.length-1)],all:{type:Ke,overloads:[[[Ke,Ke],(l,[o,c])=>o.evaluate(l)&&c.evaluate(l)],[Sl(Ke),(l,o)=>{for(const c of o)if(!c.evaluate(l))return!1;return!0}]]},any:{type:Ke,overloads:[[[Ke,Ke],(l,[o,c])=>o.evaluate(l)||c.evaluate(l)],[Sl(Ke),(l,o)=>{for(const c of o)if(c.evaluate(l))return!0;return!1}]]},"!":[Ke,[Ke],(l,[o])=>!o.evaluate(l)],"is-supported-script":[Ke,[Qe],(l,[o])=>{const c=l.globals&&l.globals.isSupportedScript;return!c||c(o.evaluate(l))}],upcase:[Qe,[Qe],(l,[o])=>o.evaluate(l).toUpperCase()],downcase:[Qe,[Qe],(l,[o])=>o.evaluate(l).toLowerCase()],concat:[Qe,Sl(Xe),(l,o)=>o.map(c=>Zu(c.evaluate(l))).join("")],"resolved-locale":[Qe,[ma],(l,[o])=>o.evaluate(l).resolvedLocale()]});class tr{constructor(o,c){var p;this.expression=o,this._warningHistory={},this._evaluator=new Un,this._defaultValue=c?(p=c).type==="color"&&uh(p.default)?new Vn(0,0,0,0):p.type==="color"?Vn.parse(p.default)||null:p.type==="padding"?ho.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Qo.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(o,c,p,g,b,x){return this._evaluator.globals=o,this._evaluator.feature=c,this._evaluator.featureState=p,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,c,p,g,b,x){this._evaluator.globals=o,this._evaluator.feature=c||null,this._evaluator.featureState=p||null,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new fr(`Expected value to be one of ${Object.keys(this._enumValues).map(L=>JSON.stringify(L)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function Yn(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in ou}function El(l,o){const c=new Kc(ou,Ku,[],o?function(g){const b={color:Ar,string:Qe,number:ae,enum:Qe,boolean:Ke,formatted:zr,padding:st,resolvedImage:V,variableAnchorOffsetCollection:G};return g.type==="array"?K(b[g.value]||Xe,g.length):b[g.type]}(o):void 0),p=c.parse(l,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?um(new tr(p,o)):su(c.errors)}class ch{constructor(o,c){this.kind=o,this._styleExpression=c,this.isStateDependent=o!=="constant"&&!Ju(c.expression)}evaluateWithoutErrorHandling(o,c,p,g,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,g,b,x)}evaluate(o,c,p,g,b,x){return this._styleExpression.evaluate(o,c,p,g,b,x)}}class ip{constructor(o,c,p,g){this.kind=o,this.zoomStops=p,this._styleExpression=c,this.isStateDependent=o!=="camera"&&!Ju(c.expression),this.interpolationType=g}evaluateWithoutErrorHandling(o,c,p,g,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,g,b,x)}evaluate(o,c,p,g,b,x){return this._styleExpression.evaluate(o,c,p,g,b,x)}interpolationFactor(o,c,p){return this.interpolationType?Ni.interpolationFactor(this.interpolationType,o,c,p):0}}function fm(l,o){const c=El(l,o);if(c.result==="error")return c;const p=c.value.expression,g=nh(p);if(!g&&!au(o))return su([new Ki("","data expressions not supported")]);const b=Qu(p,["zoom"]);if(!b&&!cm(o))return su([new Ki("","zoom expressions not supported")]);const x=fh(p);return x||b?x instanceof Ki?su([x]):x instanceof Ni&&!np(o)?su([new Ki("",'"interpolate" expressions cannot be used with this property')]):um(x?new ip(g?"camera":"composite",c.value,x.labels,x instanceof Ni?x.interpolation:void 0):new ch(g?"constant":"source",c.value)):su([new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class hh{constructor(o,c){this._parameters=o,this._specification=c,Ko(this,hm(this._parameters,this._specification))}static deserialize(o){return new hh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function fh(l){let o=null;if(l instanceof oh)o=fh(l.result);else if(l instanceof ih){for(const c of l.args)if(o=fh(c),o)break}else(l instanceof tc||l instanceof Ni)&&l.input instanceof Ao&&l.input.name==="zoom"&&(o=l);return o instanceof Ki||l.eachChild(c=>{const p=fh(c);p instanceof Ki?o=p:!o&&p?o=new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new Ki("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function ph(l){if(l===!0||l===!1)return!0;if(!Array.isArray(l)||l.length===0)return!1;switch(l[0]){case"has":return l.length>=2&&l[1]!=="$id"&&l[1]!=="$type";case"in":return l.length>=3&&(typeof l[1]!="string"||Array.isArray(l[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return l.length!==3||Array.isArray(l[1])||Array.isArray(l[2]);case"any":case"all":for(const o of l.slice(1))if(!ph(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const pm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function dh(l){if(l==null)return{filter:()=>!0,needGeometry:!1};ph(l)||(l=gh(l));const o=El(l,pm);if(o.result==="error")throw new Error(o.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,p,g)=>o.value.evaluate(c,p,{},g),needGeometry:mh(l)}}function dm(l,o){return lo?1:0}function mh(l){if(!Array.isArray(l))return!1;if(l[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?op(l[1],l[2],o):o==="any"?(c=l.slice(1),["any"].concat(c.map(gh))):o==="all"?["all"].concat(l.slice(1).map(gh)):o==="none"?["all"].concat(l.slice(1).map(gh).map(yh)):o==="in"?mm(l[1],l.slice(2)):o==="!in"?yh(mm(l[1],l.slice(2))):o==="has"?gm(l[1]):o==="!has"?yh(gm(l[1])):o!=="within"||l;var c}function op(l,o,c){switch(l){case"$type":return[`filter-type-${c}`,o];case"$id":return[`filter-id-${c}`,o];default:return[`filter-${c}`,l,o]}}function mm(l,o){if(o.length===0)return!1;switch(l){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(c=>typeof c!=typeof o[0])?["filter-in-large",l,["literal",o.sort(dm)]]:["filter-in-small",l,["literal",o]]}}function gm(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function yh(l){return["!",l]}function sp(l){const o=typeof l;if(o==="number"||o==="boolean"||o==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let g="[";for(const b of l)g+=`${sp(b)},`;return`${g}]`}const c=Object.keys(l).sort();let p="{";for(let g=0;gp.maximum?[new re(o,c,`${c} is greater than the maximum value ${p.maximum}`)]:[]}function _m(l){const o=l.valueSpec,c=wr(l.value.type);let p,g,b,x={};const E=c!=="categorical"&&l.value.property===void 0,L=!E,A=In(l.value.stops)==="array"&&In(l.value.stops[0])==="array"&&In(l.value.stops[0][0])==="object",D=$i({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(j){if(c==="identity")return[new re(j.key,j.value,'identity function may not have a "stops" property')];let H=[];const tt=j.value;return H=H.concat(ap({key:j.key,value:tt,valueSpec:j.valueSpec,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,arrayElementValidator:N})),In(tt)==="array"&&tt.length===0&&H.push(new re(j.key,tt,"array must have at least one stop")),H},default:function(j){return j.validateSpec({key:j.key,value:j.value,valueSpec:o,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec})}}});return c==="identity"&&E&&D.push(new re(l.key,l.value,'missing required property "property"')),c==="identity"||l.value.stops||D.push(new re(l.key,l.value,'missing required property "stops"')),c==="exponential"&&l.valueSpec.expression&&!np(l.valueSpec)&&D.push(new re(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(L&&!au(l.valueSpec)?D.push(new re(l.key,l.value,"property functions not supported")):E&&!cm(l.valueSpec)&&D.push(new re(l.key,l.value,"zoom functions not supported"))),c!=="categorical"&&!A||l.value.property!==void 0||D.push(new re(l.key,l.value,'"property" property is required')),D;function N(j){let H=[];const tt=j.value,ot=j.key;if(In(tt)!=="array")return[new re(ot,tt,`array expected, ${In(tt)} found`)];if(tt.length!==2)return[new re(ot,tt,`array length 2 expected, length ${tt.length} found`)];if(A){if(In(tt[0])!=="object")return[new re(ot,tt,`object expected, ${In(tt[0])} found`)];if(tt[0].zoom===void 0)return[new re(ot,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new re(ot,tt,"object stop key must have value")];if(b&&b>wr(tt[0].zoom))return[new re(ot,tt[0].zoom,"stop zoom values must appear in ascending order")];wr(tt[0].zoom)!==b&&(b=wr(tt[0].zoom),g=void 0,x={}),H=H.concat($i({key:`${ot}[0]`,value:tt[0],valueSpec:{zoom:{}},validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,objectElementValidators:{zoom:_h,value:U}}))}else H=H.concat(U({key:`${ot}[0]`,value:tt[0],valueSpec:{},validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec},tt));return Yn(Ga(tt[1]))?H.concat([new re(`${ot}[1]`,tt[1],"expressions are not allowed in function stops.")]):H.concat(j.validateSpec({key:`${ot}[1]`,value:tt[1],valueSpec:o,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec}))}function U(j,H){const tt=In(j.value),ot=wr(j.value),ht=j.value!==null?j.value:H;if(p){if(tt!==p)return[new re(j.key,ht,`${tt} stop domain type must match previous stop domain type ${p}`)]}else p=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new re(j.key,ht,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&c!=="categorical"){let Lt=`number expected, ${tt} found`;return au(o)&&c===void 0&&(Lt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new re(j.key,ht,Lt)]}return c!=="categorical"||tt!=="number"||isFinite(ot)&&Math.floor(ot)===ot?c!=="categorical"&&tt==="number"&&g!==void 0&&otnew re(`${l.key}${p.key}`,l.value,p.message));const c=o.value.expression||o.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!c.outputDefined())return[new re(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!Ju(c))return[new re(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!Ju(c))return[new re(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!Qu(c,["zoom","feature-state"]))return[new re(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!nh(c))return[new re(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ja(l){const o=l.key,c=l.value,p=l.valueSpec,g=[];return Array.isArray(p.values)?p.values.indexOf(wr(c))===-1&&g.push(new re(o,c,`expected one of [${p.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(p.values).indexOf(wr(c))===-1&&g.push(new re(o,c,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(c)} found`)),g}function lu(l){return ph(Ga(l.value))?qa(Ko({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):lp(l)}function lp(l){const o=l.value,c=l.key;if(In(o)!=="array")return[new re(c,o,`array expected, ${In(o)} found`)];const p=l.styleSpec;let g,b=[];if(o.length<1)return[new re(c,o,"filter array must have at least 1 element")];switch(b=b.concat(ja({key:`${c}[0]`,value:o[0],valueSpec:p.filter_operator,style:l.style,styleSpec:l.styleSpec})),wr(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&wr(o[1])==="$type"&&b.push(new re(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new re(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(g=In(o[1]),g!=="string"&&b.push(new re(`${c}[1]`,o[1],`string expected, ${g} found`)));for(let x=2;x{A in c&&o.push(new re(p,c[A],`"${A}" is prohibited for ref layers`))}),g.layers.forEach(A=>{wr(A.id)===E&&(L=A)}),L?L.ref?o.push(new re(p,c.ref,"ref cannot reference another ref layer")):x=wr(L.type):o.push(new re(p,c.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(c.source){const L=g.sources&&g.sources[c.source],A=L&&wr(L.type);L?A==="vector"&&x==="raster"?o.push(new re(p,c.source,`layer "${c.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new re(p,c.source,`layer "${c.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new re(p,c.source,`layer "${c.id}" requires a vector source`)):A!=="vector"||c["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new re(p,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!c.paint||!c.paint["line-gradient"]||A==="geojson"&&L.lineMetrics||o.push(new re(p,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new re(p,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new re(p,c.source,`source "${c.source}" not found`))}else o.push(new re(p,c,'missing required property "source"'));return o=o.concat($i({key:p,value:c,valueSpec:b.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${p}.type`,value:c.type,valueSpec:b.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:c,objectKey:"type"}),filter:lu,layout:L=>$i({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>cp(Ko({layerType:x},A))}}),paint:L=>$i({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>up(Ko({layerType:x},A))}})}})),o}function Il(l){const o=l.value,c=l.key,p=In(o);return p!=="string"?[new re(c,o,`string expected, ${p} found`)]:[]}const vm={promoteId:function({key:l,value:o}){if(In(o)==="string")return Il({key:l,value:o});{const c=[];for(const p in o)c.push(...Il({key:`${l}.${p}`,value:o[p]}));return c}}};function bm(l){const o=l.value,c=l.key,p=l.styleSpec,g=l.style,b=l.validateSpec;if(!o.type)return[new re(c,o,'"type" is required')];const x=wr(o.type);let E;switch(x){case"vector":case"raster":return E=$i({key:c,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:l.style,styleSpec:p,objectElementValidators:vm,validateSpec:b}),E;case"raster-dem":return E=function(L){var A;const D=(A=L.sourceName)!==null&&A!==void 0?A:"",N=L.value,U=L.styleSpec,j=U.source_raster_dem,H=L.style;let tt=[];const ot=In(N);if(N===void 0)return tt;if(ot!=="object")return tt.push(new re("source_raster_dem",N,`object expected, ${ot} found`)),tt;const ht=wr(N.encoding)==="custom",Lt=["redFactor","greenFactor","blueFactor","baseShift"],gt=L.value.encoding?`"${L.value.encoding}"`:"Default";for(const St in N)!ht&&Lt.includes(St)?tt.push(new re(St,N[St],`In "${D}": "${St}" is only valid when "encoding" is set to "custom". ${gt} encoding found`)):j[St]?tt=tt.concat(L.validateSpec({key:St,value:N[St],valueSpec:j[St],validateSpec:L.validateSpec,style:H,styleSpec:U})):tt.push(new re(St,N[St],`unknown property "${St}"`));return tt}({sourceName:c,value:o,style:l.style,styleSpec:p,validateSpec:b}),E;case"geojson":if(E=$i({key:c,value:o,valueSpec:p.source_geojson,style:g,styleSpec:p,validateSpec:b,objectElementValidators:vm}),o.cluster)for(const L in o.clusterProperties){const[A,D]=o.clusterProperties[L],N=typeof A=="string"?[A,["accumulated"],["get",L]]:A;E.push(...qa({key:`${c}.${L}.map`,value:D,validateSpec:b,expressionContext:"cluster-map"})),E.push(...qa({key:`${c}.${L}.reduce`,value:N,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return $i({key:c,value:o,valueSpec:p.source_video,style:g,validateSpec:b,styleSpec:p});case"image":return $i({key:c,value:o,valueSpec:p.source_image,style:g,validateSpec:b,styleSpec:p});case"canvas":return[new re(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ja({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:b,styleSpec:p})}}function xm(l){const o=l.value,c=l.styleSpec,p=c.light,g=l.style;let b=[];const x=In(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new re("light",o,`object expected, ${x} found`)]),b;for(const E in o){const L=E.match(/^(.*)-transition$/);b=b.concat(L&&p[L[1]]&&p[L[1]].transition?l.validateSpec({key:E,value:o[E],valueSpec:c.transition,validateSpec:l.validateSpec,style:g,styleSpec:c}):p[E]?l.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:l.validateSpec,style:g,styleSpec:c}):[new re(E,o[E],`unknown property "${E}"`)])}return b}function wm(l){const o=l.value,c=l.styleSpec,p=c.sky,g=l.style,b=In(o);if(o===void 0)return[];if(b!=="object")return[new re("sky",o,`object expected, ${b} found`)];let x=[];for(const E in o)x=x.concat(p[E]?Bs({key:E,value:o[E],valueSpec:p[E],style:g,styleSpec:c}):[new re(E,o[E],`unknown property "${E}"`)]);return x}function rc(l){const o=l.value,c=l.styleSpec,p=c.terrain,g=l.style;let b=[];const x=In(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new re("terrain",o,`object expected, ${x} found`)]),b;for(const E in o)b=b.concat(p[E]?l.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:l.validateSpec,style:g,styleSpec:c}):[new re(E,o[E],`unknown property "${E}"`)]);return b}function ic(l){let o=[];const c=l.value,p=l.key;if(Array.isArray(c)){const g=[],b=[];for(const x in c)c[x].id&&g.includes(c[x].id)&&o.push(new re(p,c,`all the sprites' ids must be unique, but ${c[x].id} is duplicated`)),g.push(c[x].id),c[x].url&&b.includes(c[x].url)&&o.push(new re(p,c,`all the sprites' URLs must be unique, but ${c[x].url} is duplicated`)),b.push(c[x].url),o=o.concat($i({key:`${p}[${x}]`,value:c[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return o}return Il({key:p,value:c})}const fo={"*":()=>[],array:ap,boolean:function(l){const o=l.value,c=l.key,p=In(o);return p!=="boolean"?[new re(c,o,`boolean expected, ${p} found`)]:[]},number:_h,color:function(l){const o=l.key,c=l.value,p=In(c);return p!=="string"?[new re(o,c,`color expected, ${p} found`)]:Vn.parse(String(c))?[]:[new re(o,c,`color expected, "${c}" found`)]},constants:ym,enum:ja,filter:lu,function:_m,layer:nc,object:$i,source:bm,light:xm,sky:wm,terrain:rc,string:Il,formatted:function(l){return Il(l).length===0?[]:qa(l)},resolvedImage:function(l){return Il(l).length===0?[]:qa(l)},padding:function(l){const o=l.key,c=l.value;if(In(c)==="array"){if(c.length<1||c.length>4)return[new re(o,c,`padding requires 1 to 4 values; ${c.length} values found`)];const p={type:"number"};let g=[];for(let b=0;b[]}})),l.constants&&(c=c.concat(ym({key:"constants",value:l.constants,style:l,styleSpec:o,validateSpec:Bs}))),uu(c)}function Vs(l){return function(o){return l({...o,validateSpec:Bs})}}function uu(l){return[].concat(l).sort((o,c)=>o.line-c.line)}function gs(l){return function(...o){return uu(l.apply(this,o))}}ms.source=gs(Vs(bm)),ms.sprite=gs(Vs(ic)),ms.glyphs=gs(Vs(hp)),ms.light=gs(Vs(xm)),ms.sky=gs(Vs(wm)),ms.terrain=gs(Vs(rc)),ms.layer=gs(Vs(nc)),ms.filter=gs(Vs(lu)),ms.paintProperty=gs(Vs(up)),ms.layoutProperty=gs(Vs(cp));const Cl=ms,Ky=Cl.light,fp=Cl.paintProperty,Jy=Cl.layoutProperty;function cu(l,o){let c=!1;if(o&&o.length)for(const p of o)l.fire(new Ie(new Error(p.message))),c=!0;return c}class oc{constructor(o,c,p){const g=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const x=new Int32Array(this.arrayBuffer);o=x[0],this.d=(c=x[1])+2*(p=x[2]);for(let L=0;L=N[H+0]&&g>=N[H+1])?(E[j]=!0,x.push(D[j])):E[j]=!1}}}}_forEachCell(o,c,p,g,b,x,E,L){const A=this._convertToCellCoord(o),D=this._convertToCellCoord(c),N=this._convertToCellCoord(p),U=this._convertToCellCoord(g);for(let j=A;j<=N;j++)for(let H=D;H<=U;H++){const tt=this.d*H+j;if((!L||L(this._convertFromCellCoord(j),this._convertFromCellCoord(H),this._convertFromCellCoord(j+1),this._convertFromCellCoord(H+1)))&&b.call(this,o,c,p,g,tt,x,E,L))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,c=3+this.cells.length+1+1;let p=0;for(let x=0;x=0)continue;const x=l[b];g[b]=Us[p].shallow.indexOf(b)>=0?x:hu(x,o)}l instanceof Error&&(g.message=l.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(g.$name=p),g}throw new Error("can't serialize object of type "+typeof l)}function fu(l){if(l==null||typeof l=="boolean"||typeof l=="number"||typeof l=="string"||l instanceof Boolean||l instanceof Number||l instanceof String||l instanceof Date||l instanceof RegExp||l instanceof Blob||l instanceof Error||bh(l)||Re(l)||ArrayBuffer.isView(l)||l instanceof ImageData)return l;if(Array.isArray(l))return l.map(fu);if(typeof l=="object"){const o=l.$name||"Object";if(!Us[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:c}=Us[o];if(!c)throw new Error(`can't deserialize unregistered class ${o}`);if(c.deserialize)return c.deserialize(l);const p=Object.create(c.prototype);for(const g of Object.keys(l)){if(g==="$name")continue;const b=l[g];p[g]=Us[o].shallow.indexOf(g)>=0?b:fu(b)}return p}throw new Error("can't deserialize object of type "+typeof l)}class Sm{constructor(){this.first=!0}update(o,c){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=c):this.lastFloorZooml>=128&&l<=255,Arabic:l=>l>=1536&&l<=1791,"Arabic Supplement":l=>l>=1872&&l<=1919,"Arabic Extended-A":l=>l>=2208&&l<=2303,"Hangul Jamo":l=>l>=4352&&l<=4607,"Unified Canadian Aboriginal Syllabics":l=>l>=5120&&l<=5759,Khmer:l=>l>=6016&&l<=6143,"Unified Canadian Aboriginal Syllabics Extended":l=>l>=6320&&l<=6399,"General Punctuation":l=>l>=8192&&l<=8303,"Letterlike Symbols":l=>l>=8448&&l<=8527,"Number Forms":l=>l>=8528&&l<=8591,"Miscellaneous Technical":l=>l>=8960&&l<=9215,"Control Pictures":l=>l>=9216&&l<=9279,"Optical Character Recognition":l=>l>=9280&&l<=9311,"Enclosed Alphanumerics":l=>l>=9312&&l<=9471,"Geometric Shapes":l=>l>=9632&&l<=9727,"Miscellaneous Symbols":l=>l>=9728&&l<=9983,"Miscellaneous Symbols and Arrows":l=>l>=11008&&l<=11263,"CJK Radicals Supplement":l=>l>=11904&&l<=12031,"Kangxi Radicals":l=>l>=12032&&l<=12255,"Ideographic Description Characters":l=>l>=12272&&l<=12287,"CJK Symbols and Punctuation":l=>l>=12288&&l<=12351,Hiragana:l=>l>=12352&&l<=12447,Katakana:l=>l>=12448&&l<=12543,Bopomofo:l=>l>=12544&&l<=12591,"Hangul Compatibility Jamo":l=>l>=12592&&l<=12687,Kanbun:l=>l>=12688&&l<=12703,"Bopomofo Extended":l=>l>=12704&&l<=12735,"CJK Strokes":l=>l>=12736&&l<=12783,"Katakana Phonetic Extensions":l=>l>=12784&&l<=12799,"Enclosed CJK Letters and Months":l=>l>=12800&&l<=13055,"CJK Compatibility":l=>l>=13056&&l<=13311,"CJK Unified Ideographs Extension A":l=>l>=13312&&l<=19903,"Yijing Hexagram Symbols":l=>l>=19904&&l<=19967,"CJK Unified Ideographs":l=>l>=19968&&l<=40959,"Yi Syllables":l=>l>=40960&&l<=42127,"Yi Radicals":l=>l>=42128&&l<=42191,"Hangul Jamo Extended-A":l=>l>=43360&&l<=43391,"Hangul Syllables":l=>l>=44032&&l<=55215,"Hangul Jamo Extended-B":l=>l>=55216&&l<=55295,"Private Use Area":l=>l>=57344&&l<=63743,"CJK Compatibility Ideographs":l=>l>=63744&&l<=64255,"Arabic Presentation Forms-A":l=>l>=64336&&l<=65023,"Vertical Forms":l=>l>=65040&&l<=65055,"CJK Compatibility Forms":l=>l>=65072&&l<=65103,"Small Form Variants":l=>l>=65104&&l<=65135,"Arabic Presentation Forms-B":l=>l>=65136&&l<=65279,"Halfwidth and Fullwidth Forms":l=>l>=65280&&l<=65519};function pu(l){for(const o of l)if(xh(o.charCodeAt(0)))return!0;return!1}function Em(l){for(const o of l)if(!Im(o.charCodeAt(0)))return!1;return!0}function Im(l){return!(ge.Arabic(l)||ge["Arabic Supplement"](l)||ge["Arabic Extended-A"](l)||ge["Arabic Presentation Forms-A"](l)||ge["Arabic Presentation Forms-B"](l))}function xh(l){return!(l!==746&&l!==747&&(l<4352||!(ge["Bopomofo Extended"](l)||ge.Bopomofo(l)||ge["CJK Compatibility Forms"](l)&&!(l>=65097&&l<=65103)||ge["CJK Compatibility Ideographs"](l)||ge["CJK Compatibility"](l)||ge["CJK Radicals Supplement"](l)||ge["CJK Strokes"](l)||!(!ge["CJK Symbols and Punctuation"](l)||l>=12296&&l<=12305||l>=12308&&l<=12319||l===12336)||ge["CJK Unified Ideographs Extension A"](l)||ge["CJK Unified Ideographs"](l)||ge["Enclosed CJK Letters and Months"](l)||ge["Hangul Compatibility Jamo"](l)||ge["Hangul Jamo Extended-A"](l)||ge["Hangul Jamo Extended-B"](l)||ge["Hangul Jamo"](l)||ge["Hangul Syllables"](l)||ge.Hiragana(l)||ge["Ideographic Description Characters"](l)||ge.Kanbun(l)||ge["Kangxi Radicals"](l)||ge["Katakana Phonetic Extensions"](l)||ge.Katakana(l)&&l!==12540||!(!ge["Halfwidth and Fullwidth Forms"](l)||l===65288||l===65289||l===65293||l>=65306&&l<=65310||l===65339||l===65341||l===65343||l>=65371&&l<=65503||l===65507||l>=65512&&l<=65519)||!(!ge["Small Form Variants"](l)||l>=65112&&l<=65118||l>=65123&&l<=65126)||ge["Unified Canadian Aboriginal Syllabics"](l)||ge["Unified Canadian Aboriginal Syllabics Extended"](l)||ge["Vertical Forms"](l)||ge["Yijing Hexagram Symbols"](l)||ge["Yi Syllables"](l)||ge["Yi Radicals"](l))))}function pp(l){return!(xh(l)||function(o){return!!(ge["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||ge["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||ge["Letterlike Symbols"](o)||ge["Number Forms"](o)||ge["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||ge["Control Pictures"](o)&&o!==9251||ge["Optical Character Recognition"](o)||ge["Enclosed Alphanumerics"](o)||ge["Geometric Shapes"](o)||ge["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||ge["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||ge["CJK Symbols and Punctuation"](o)||ge.Katakana(o)||ge["Private Use Area"](o)||ge["CJK Compatibility Forms"](o)||ge["Small Form Variants"](o)||ge["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(l))}function wh(l){return l>=1424&&l<=2303||ge["Arabic Presentation Forms-A"](l)||ge["Arabic Presentation Forms-B"](l)}function Cm(l,o){return!(!o&&wh(l)||l>=2304&&l<=3583||l>=3840&&l<=4255||ge.Khmer(l))}function Qy(l){for(const o of l)if(wh(o.charCodeAt(0)))return!0;return!1}const Wa=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(l){this.pluginStatus=l.pluginStatus,this.pluginURL=l.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(l){this.applyArabicShaping=l.applyArabicShaping,this.processBidirectionalText=l.processBidirectionalText,this.processStyledBidirectionalText=l.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class sr{constructor(o,c){this.zoom=o,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Sm,this.transition={})}isSupportedScript(o){return function(c,p){for(const g of c)if(!Cm(g.charCodeAt(0),p))return!1;return!0}(o,Wa.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,c=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*c}}}class sc{constructor(o,c){this.property=o,this.value=c,this.expression=function(p,g){if(uh(p))return new hh(p,g);if(Yn(p)){const b=fm(p,g);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return g.type==="color"&&typeof p=="string"?b=Vn.parse(p):g.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=Qo.parse(p)):b=ho.parse(p),{kind:"constant",evaluate:()=>b}}}(c===void 0?o.specification.default:c,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,c,p){return this.property.possiblyEvaluate(this,o,c,p)}}class Sh{constructor(o){this.property=o,this.value=new sc(o,void 0)}transitioned(o,c){return new Tm(this.property,this.value,c,ut({},o.transition,this.transition),o.now)}untransitioned(){return new Tm(this.property,this.value,null,{},0)}}class dp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return Q(this._values[o].value.value)}setValue(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Sh(this._values[o].property)),this._values[o].value=new sc(this._values[o].property,c===null?void 0:Q(c))}getTransition(o){return Q(this._values[o].transition)}setTransition(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Sh(this._values[o].property)),this._values[o].transition=Q(c)||void 0}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p);const g=this.getTransition(c);g!==void 0&&(o[`${c}-transition`]=g)}return o}transitioned(o,c){const p=new Lm(this._properties);for(const g of Object.keys(this._values))p._values[g]=this._values[g].transitioned(o,c._values[g]);return p}untransitioned(){const o=new Lm(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].untransitioned();return o}}class Tm{constructor(o,c,p,g,b){this.property=o,this.value=c,this.begin=b+g.delay||0,this.end=this.begin+g.duration||0,o.specification.transition&&(g.delay||g.duration)&&(this.prior=p)}possiblyEvaluate(o,c,p){const g=o.now||0,b=this.value.possiblyEvaluate(o,c,p),x=this.prior;if(x){if(g>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(g=1)return 1;const A=L*L,D=A*L;return 4*(L<.5?D:3*(L-A)+D-.75)}(E))}}return b}}class Lm{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,c,p){const g=new ac(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(o,c,p);return g}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Pm{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return Q(this._values[o].value)}setValue(o,c){this._values[o]=new sc(this._values[o].property,c===null?void 0:Q(c))}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p)}return o}possiblyEvaluate(o,c,p){const g=new ac(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(o,c,p);return g}}class ys{constructor(o,c,p){this.property=o,this.value=c,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,c,p,g){return this.property.evaluate(this.value,this.parameters,o,c,p,g)}}class ac{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Me{constructor(o){this.specification=o}possiblyEvaluate(o,c){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(c)}interpolate(o,c,p){const g=Qi[this.specification.type];return g?g(o,c,p):o}}class Oe{constructor(o,c){this.specification=o,this.overrides=c}possiblyEvaluate(o,c,p,g){return new ys(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(c,null,{},p,g)}:o.expression,c)}interpolate(o,c,p){if(o.value.kind!=="constant"||c.value.kind!=="constant")return o;if(o.value.value===void 0||c.value.value===void 0)return new ys(this,{kind:"constant",value:void 0},o.parameters);const g=Qi[this.specification.type];if(g){const b=g(o.value.value,c.value.value,p);return new ys(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,c,p,g,b,x){return o.kind==="constant"?o.value:o.evaluate(c,p,g,b,x)}}class Eh extends Oe{possiblyEvaluate(o,c,p,g){if(o.value===void 0)return new ys(this,{kind:"constant",value:void 0},c);if(o.expression.kind==="constant"){const b=o.expression.evaluate(c,null,{},p,g),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,c);return new ys(this,{kind:"constant",value:E},c)}if(o.expression.kind==="camera"){const b=this._calculate(o.expression.evaluate({zoom:c.zoom-1}),o.expression.evaluate({zoom:c.zoom}),o.expression.evaluate({zoom:c.zoom+1}),c);return new ys(this,{kind:"constant",value:b},c)}return new ys(this,o.expression,c)}evaluate(o,c,p,g,b,x){if(o.kind==="source"){const E=o.evaluate(c,p,g,b,x);return this._calculate(E,E,E,c)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(c.zoom)-1},p,g),o.evaluate({zoom:Math.floor(c.zoom)},p,g),o.evaluate({zoom:Math.floor(c.zoom)+1},p,g),c):o.value}_calculate(o,c,p,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class lc{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,g){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(c,null,{},p,g);return this._calculate(b,b,b,c)}return this._calculate(o.expression.evaluate(new sr(Math.floor(c.zoom-1),c)),o.expression.evaluate(new sr(Math.floor(c.zoom),c)),o.expression.evaluate(new sr(Math.floor(c.zoom+1),c)),c)}}_calculate(o,c,p,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class mp{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,g){return!!o.expression.evaluate(c,null,{},p,g)}interpolate(){return!1}}class po{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in o){const p=o[c];p.specification.overridable&&this.overridableProperties.push(c);const g=this.defaultPropertyValues[c]=new sc(p,void 0),b=this.defaultTransitionablePropertyValues[c]=new Sh(p);this.defaultTransitioningPropertyValues[c]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=g.possiblyEvaluate({})}}}we("DataDrivenProperty",Oe),we("DataConstantProperty",Me),we("CrossFadedDataDrivenProperty",Eh),we("CrossFadedProperty",lc),we("ColorRampProperty",mp);const gp="-transition";class _s extends kn{constructor(o,c){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),c.layout&&(this._unevaluatedLayout=new Pm(c.layout)),c.paint)){this._transitionablePaint=new dp(c.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ac(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,c,p={}){c!=null&&this._validate(Jy,`layers.${this.id}.layout.${o}`,o,c,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,c):this.visibility=c)}getPaintProperty(o){return o.endsWith(gp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,c,p={}){if(c!=null&&this._validate(fp,`layers.${this.id}.paint.${o}`,o,c,p))return!1;if(o.endsWith(gp))return this._transitionablePaint.setTransition(o.slice(0,-11),c||void 0),!1;{const g=this._transitionablePaint._values[o],b=g.property.specification["property-type"]==="cross-faded-data-driven",x=g.value.isDataDriven(),E=g.value;this._transitionablePaint.setValue(o,c),this._handleSpecialPaintPropertyUpdate(o);const L=this._transitionablePaint._values[o].value;return L.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,E,L)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,c,p){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,c){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,c)}serialize(){const o={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),kt(o,(c,p)=>!(c===void 0||p==="layout"&&!Object.keys(c).length||p==="paint"&&!Object.keys(c).length))}_validate(o,c,p,g,b={}){return(!b||b.validate!==!1)&&cu(this,o.call(Cl,{key:c,layerType:this.type,objectKey:p,value:g,styleSpec:At,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const c=this.paint.get(o);if(c instanceof ys&&au(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const Mm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class uc{constructor(o,c){this._structArray=o,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Sr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,c){return o._trim(),c&&(o.isTransferred=!0,c.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const c=Object.create(this.prototype);return c.arrayBuffer=o.arrayBuffer,c.length=o.length,c.capacity=o.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Br(l,o=1){let c=0,p=0;return{members:l.map(g=>{const b=Mm[g.type].BYTES_PER_ELEMENT,x=c=Am(c,Math.max(o,b)),E=g.components||1;return p=Math.max(p,b),c+=b*E,{name:g.name,type:g.type,components:E,offset:x}}),size:Am(c,Math.max(p,o)),alignment:o}}function Am(l,o){return Math.ceil(l/o)*o}class cc extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const g=2*o;return this.int16[g+0]=c,this.int16[g+1]=p,o}}cc.prototype.bytesPerElement=4,we("StructArrayLayout2i4",cc);class ga extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.int16[b+0]=c,this.int16[b+1]=p,this.int16[b+2]=g,o}}ga.prototype.bytesPerElement=6,we("StructArrayLayout3i6",ga);class yp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,g)}emplace(o,c,p,g,b){const x=4*o;return this.int16[x+0]=c,this.int16[x+1]=p,this.int16[x+2]=g,this.int16[x+3]=b,o}}yp.prototype.bytesPerElement=8,we("StructArrayLayout4i8",yp);class _p extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,g,b,x)}emplace(o,c,p,g,b,x,E){const L=6*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=g,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}_p.prototype.bytesPerElement=12,we("StructArrayLayout2i4i12",_p);class vp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,g,b,x)}emplace(o,c,p,g,b,x,E){const L=4*o,A=8*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.uint8[A+4]=g,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=E,o}}vp.prototype.bytesPerElement=8,we("StructArrayLayout2i4ub8",vp);class hc extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const g=2*o;return this.float32[g+0]=c,this.float32[g+1]=p,o}}hc.prototype.bytesPerElement=8,we("StructArrayLayout2f8",hc);class Ih extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,D){const N=this.length;return this.resize(N+1),this.emplace(N,o,c,p,g,b,x,E,L,A,D)}emplace(o,c,p,g,b,x,E,L,A,D,N){const U=10*o;return this.uint16[U+0]=c,this.uint16[U+1]=p,this.uint16[U+2]=g,this.uint16[U+3]=b,this.uint16[U+4]=x,this.uint16[U+5]=E,this.uint16[U+6]=L,this.uint16[U+7]=A,this.uint16[U+8]=D,this.uint16[U+9]=N,o}}Ih.prototype.bytesPerElement=20,we("StructArrayLayout10ui20",Ih);class bp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,D,N,U){const j=this.length;return this.resize(j+1),this.emplace(j,o,c,p,g,b,x,E,L,A,D,N,U)}emplace(o,c,p,g,b,x,E,L,A,D,N,U,j){const H=12*o;return this.int16[H+0]=c,this.int16[H+1]=p,this.int16[H+2]=g,this.int16[H+3]=b,this.uint16[H+4]=x,this.uint16[H+5]=E,this.uint16[H+6]=L,this.uint16[H+7]=A,this.int16[H+8]=D,this.int16[H+9]=N,this.int16[H+10]=U,this.int16[H+11]=j,o}}bp.prototype.bytesPerElement=24,we("StructArrayLayout4i4ui4i24",bp);class xp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.float32[b+0]=c,this.float32[b+1]=p,this.float32[b+2]=g,o}}xp.prototype.bytesPerElement=12,we("StructArrayLayout3f12",xp);class ya extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint32[1*o+0]=c,o}}ya.prototype.bytesPerElement=4,we("StructArrayLayout1ul4",ya);class Ch extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A){const D=this.length;return this.resize(D+1),this.emplace(D,o,c,p,g,b,x,E,L,A)}emplace(o,c,p,g,b,x,E,L,A,D){const N=10*o,U=5*o;return this.int16[N+0]=c,this.int16[N+1]=p,this.int16[N+2]=g,this.int16[N+3]=b,this.int16[N+4]=x,this.int16[N+5]=E,this.uint32[U+3]=L,this.uint16[N+8]=A,this.uint16[N+9]=D,o}}Ch.prototype.bytesPerElement=20,we("StructArrayLayout6i1ul2ui20",Ch);class fc extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,g,b,x)}emplace(o,c,p,g,b,x,E){const L=6*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=g,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}fc.prototype.bytesPerElement=12,we("StructArrayLayout2i2i2i12",fc);class Th extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,c,p,g,b)}emplace(o,c,p,g,b,x){const E=4*o,L=8*o;return this.float32[E+0]=c,this.float32[E+1]=p,this.float32[E+2]=g,this.int16[L+6]=b,this.int16[L+7]=x,o}}Th.prototype.bytesPerElement=16,we("StructArrayLayout2f1f2i16",Th);class pc extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,g)}emplace(o,c,p,g,b){const x=12*o,E=3*o;return this.uint8[x+0]=c,this.uint8[x+1]=p,this.float32[E+1]=g,this.float32[E+2]=b,o}}pc.prototype.bytesPerElement=12,we("StructArrayLayout2ub2f12",pc);class Lh extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.uint16[b+0]=c,this.uint16[b+1]=p,this.uint16[b+2]=g,o}}Lh.prototype.bytesPerElement=6,we("StructArrayLayout3ui6",Lh);class du extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,D,N,U,j,H,tt,ot,ht){const Lt=this.length;return this.resize(Lt+1),this.emplace(Lt,o,c,p,g,b,x,E,L,A,D,N,U,j,H,tt,ot,ht)}emplace(o,c,p,g,b,x,E,L,A,D,N,U,j,H,tt,ot,ht,Lt){const gt=24*o,St=12*o,Yt=48*o;return this.int16[gt+0]=c,this.int16[gt+1]=p,this.uint16[gt+2]=g,this.uint16[gt+3]=b,this.uint32[St+2]=x,this.uint32[St+3]=E,this.uint32[St+4]=L,this.uint16[gt+10]=A,this.uint16[gt+11]=D,this.uint16[gt+12]=N,this.float32[St+7]=U,this.float32[St+8]=j,this.uint8[Yt+36]=H,this.uint8[Yt+37]=tt,this.uint8[Yt+38]=ot,this.uint32[St+10]=ht,this.int16[gt+22]=Lt,o}}du.prototype.bytesPerElement=48,we("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",du);class Tl extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,D,N,U,j,H,tt,ot,ht,Lt,gt,St,Yt,Jt,ve,Ce,ye,pe,se,Ee){const ce=this.length;return this.resize(ce+1),this.emplace(ce,o,c,p,g,b,x,E,L,A,D,N,U,j,H,tt,ot,ht,Lt,gt,St,Yt,Jt,ve,Ce,ye,pe,se,Ee)}emplace(o,c,p,g,b,x,E,L,A,D,N,U,j,H,tt,ot,ht,Lt,gt,St,Yt,Jt,ve,Ce,ye,pe,se,Ee,ce){const ne=32*o,Ne=16*o;return this.int16[ne+0]=c,this.int16[ne+1]=p,this.int16[ne+2]=g,this.int16[ne+3]=b,this.int16[ne+4]=x,this.int16[ne+5]=E,this.int16[ne+6]=L,this.int16[ne+7]=A,this.uint16[ne+8]=D,this.uint16[ne+9]=N,this.uint16[ne+10]=U,this.uint16[ne+11]=j,this.uint16[ne+12]=H,this.uint16[ne+13]=tt,this.uint16[ne+14]=ot,this.uint16[ne+15]=ht,this.uint16[ne+16]=Lt,this.uint16[ne+17]=gt,this.uint16[ne+18]=St,this.uint16[ne+19]=Yt,this.uint16[ne+20]=Jt,this.uint16[ne+21]=ve,this.uint16[ne+22]=Ce,this.uint32[Ne+12]=ye,this.float32[Ne+13]=pe,this.float32[Ne+14]=se,this.uint16[ne+30]=Ee,this.uint16[ne+31]=ce,o}}Tl.prototype.bytesPerElement=64,we("StructArrayLayout8i15ui1ul2f2ui64",Tl);class Ph extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.float32[1*o+0]=c,o}}Ph.prototype.bytesPerElement=4,we("StructArrayLayout1f4",Ph);class Mh extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.uint16[6*o+0]=c,this.float32[b+1]=p,this.float32[b+2]=g,o}}Mh.prototype.bytesPerElement=12,we("StructArrayLayout1ui2f12",Mh);class Ll extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=4*o;return this.uint32[2*o+0]=c,this.uint16[b+2]=p,this.uint16[b+3]=g,o}}Ll.prototype.bytesPerElement=8,we("StructArrayLayout1ul2ui8",Ll);class wp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const g=2*o;return this.uint16[g+0]=c,this.uint16[g+1]=p,o}}wp.prototype.bytesPerElement=4,we("StructArrayLayout2ui4",wp);class Sp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint16[1*o+0]=c,o}}Sp.prototype.bytesPerElement=2,we("StructArrayLayout1ui2",Sp);class Ah extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,g)}emplace(o,c,p,g,b){const x=4*o;return this.float32[x+0]=c,this.float32[x+1]=p,this.float32[x+2]=g,this.float32[x+3]=b,o}}Ah.prototype.bytesPerElement=16,we("StructArrayLayout4f16",Ah);class km extends uc{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new I(this.anchorPointX,this.anchorPointY)}}km.prototype.size=20;class _ extends Ch{get(o){return new km(this,o)}}we("CollisionBoxArray",_);class s extends uc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}s.prototype.size=48;class f extends du{get(o){return new s(this,o)}}we("PlacedSymbolArray",f);class d extends uc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(o){this._structArray.uint32[this._pos4+12]=o}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}d.prototype.size=64;class m extends Tl{get(o){return new d(this,o)}}we("SymbolInstanceArray",m);class v extends Ph{getoffsetX(o){return this.float32[1*o+0]}}we("GlyphOffsetArray",v);class C extends ga{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}we("SymbolLineVertexArray",C);class T extends uc{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}T.prototype.size=12;class M extends Mh{get(o){return new T(this,o)}}we("TextAnchorOffsetArray",M);class k extends uc{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}k.prototype.size=8;class O extends Ll{get(o){return new k(this,o)}}we("FeatureIndexArray",O);class F extends cc{}class W extends cc{}class it extends cc{}class rt extends _p{}class at extends vp{}class $ extends hc{}class vt extends Ih{}class Rt extends bp{}class ct extends xp{}class Et extends ya{}class Nt extends fc{}class Ft extends pc{}class Ht extends Lh{}class te extends wp{}const $t=Br([{name:"a_pos",components:2,type:"Int16"}],4),{members:oe}=$t;class le{constructor(o=[]){this.segments=o}prepareSegment(o,c,p,g){let b=this.segments[this.segments.length-1];return o>le.MAX_VERTEX_ARRAY_LENGTH&&Kt(`Max vertices per segment is ${le.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>le.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==g)&&(b={vertexOffset:c.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},g!==void 0&&(b.sortKey=g),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const o of this.segments)for(const c in o.vaos)o.vaos[c].destroy()}static simpleSegment(o,c,p,g){return new le([{vertexOffset:o,primitiveOffset:c,vertexLength:p,primitiveLength:g,vaos:{},sortKey:0}])}}function $e(l,o){return 256*(l=lt(Math.floor(l),0,255))+lt(Math.floor(o),0,255)}le.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,we("SegmentVector",le);const ue=Br([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ze={exports:{}},tn={exports:{}};tn.exports=function(l,o){var c,p,g,b,x,E,L,A;for(p=l.length-(c=3&l.length),g=o,x=3432918353,E=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(L=0,c){case 3:L^=(255&l.charCodeAt(A+2))<<16;case 2:L^=(255&l.charCodeAt(A+1))<<8;case 1:g^=L=(65535&(L=(L=(65535&(L^=255&l.charCodeAt(A)))*x+(((L>>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295}return g^=l.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var wn=tn.exports,Ue={exports:{}};Ue.exports=function(l,o){for(var c,p=l.length,g=o^p,b=0;p>=4;)c=1540483477*(65535&(c=255&l.charCodeAt(b)|(255&l.charCodeAt(++b))<<8|(255&l.charCodeAt(++b))<<16|(255&l.charCodeAt(++b))<<24))+((1540483477*(c>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:g^=(255&l.charCodeAt(b+2))<<16;case 2:g^=(255&l.charCodeAt(b+1))<<8;case 1:g=1540483477*(65535&(g^=255&l.charCodeAt(b)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var rn=wn,cn=Ue.exports;ze.exports=rn,ze.exports.murmur3=rn,ze.exports.murmur2=cn;var Er=y(ze.exports);class Gn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,c,p,g){this.ids.push(ko(o)),this.positions.push(c,p,g)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=ko(o);let p=0,g=this.ids.length-1;for(;p>1;this.ids[x]>=c?g=x:p=x+1}const b=[];for(;this.ids[p]===c;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(o,c){const p=new Float64Array(o.ids),g=new Uint32Array(o.positions);return ni(p,g,0,p.length-1),c&&c.push(p.buffer,g.buffer),{ids:p,positions:g}}static deserialize(o){const c=new Gn;return c.ids=o.ids,c.positions=o.positions,c.indexed=!0,c}}function ko(l){const o=+l;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Er(String(l))}function ni(l,o,c,p){for(;c>1];let b=c-1,x=p+1;for(;;){do b++;while(l[b]g);if(b>=x)break;pr(l,b,x),pr(o,3*b,3*x),pr(o,3*b+1,3*x+1),pr(o,3*b+2,3*x+2)}x-c`u_${g}`),this.type=p}setUniform(o,c,p){o.set(p.constantOr(this.value))}getBinding(o,c,p){return this.type==="color"?new Ha(o,c):new Do(o,c)}}class Yr{constructor(o,c){this.uniformNames=c.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=o.tlbr}setUniform(o,c,p,g){const b=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,c,p){return p.substr(0,9)==="u_pattern"?new Gs(o,c):new Do(o,c)}}class dr{constructor(o,c,p,g){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=c.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(o,c,p,g,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new sr(0),c,{},g,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,E)}updatePaintArray(o,c,p,g){const b=this.expression.evaluate({zoom:0},p,g);this._setPaintValue(o,c,b)}_setPaintValue(o,c,p){if(this.type==="color"){const g=Za(p);for(let b=o;b`u_${E}_t`),this.type=p,this.useIntegerZoom=g,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=c.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(o,c,p,g,b){const x=this.expression.evaluate(new sr(this.zoom),c,{},g,[],b),E=this.expression.evaluate(new sr(this.zoom+1),c,{},g,[],b),L=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(L,o,x,E)}updatePaintArray(o,c,p,g){const b=this.expression.evaluate({zoom:this.zoom},p,g),x=this.expression.evaluate({zoom:this.zoom+1},p,g);this._setPaintValue(o,c,b,x)}_setPaintValue(o,c,p,g){if(this.type==="color"){const b=Za(p),x=Za(g);for(let E=o;E`#define HAS_UNIFORM_${g}`))}return o}getBinderAttributes(){const o=[];for(const c in this.binders){const p=this.binders[c];if(p instanceof dr||p instanceof ar)for(let g=0;g!0){this.programConfigurations={};for(const g of o)this.programConfigurations[g.id]=new Kr(g,c,p);this.needsUpload=!1,this._featureMap=new Gn,this._bufferOffset=0}populatePaintArrays(o,c,p,g,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,c,g,b,x);c.id!==void 0&&this._featureMap.add(c.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,c,p,g){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,c,b,g)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function es(l,o){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[l]||[l.replace(`${o}-`,"").replace(/-/g,"_")]}function Jr(l,o,c){const p={color:{source:hc,composite:Ah},number:{source:Ph,composite:hc}},g=function(b){return{"line-pattern":{source:vt,composite:vt},"fill-pattern":{source:vt,composite:vt},"fill-extrusion-pattern":{source:vt,composite:vt}}[b]}(l);return g&&g[c]||p[o][c]}we("ConstantBinder",qs),we("CrossFadedConstantBinder",Yr),we("SourceExpressionBinder",dr),we("CrossFadedCompositeBinder",ts),we("CompositeExpressionBinder",ar),we("ProgramConfiguration",Kr,{omit:["_buffers"]}),we("ProgramConfigurationSet",mr);const kr=8192,Ep=Math.pow(2,14)-1,Dm=-Ep-1;function Pl(l){const o=kr/l.extent,c=l.loadGeometry();for(let p=0;px.x+1||Lx.y+1)&&Kt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function Ml(l,o){return{type:l.type,id:l.id,properties:l.properties,geometry:o?Pl(l):[]}}function kh(l,o,c,p,g){l.emplaceBack(2*o+(p+1)/2,2*c+(g+1)/2)}class Xa{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new W,this.indexArray=new Ht,this.segments=new le,this.programConfigurations=new mr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){const g=this.layers[0],b=[];let x=null,E=!1;g.type==="circle"&&(x=g.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:L,id:A,index:D,sourceLayerIndex:N}of o){const U=this.layers[0]._featureFilter.needGeometry,j=Ml(L,U);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),j,p))continue;const H=E?x.evaluate(j,{},p):void 0,tt={id:A,properties:L.properties,type:L.type,sourceLayerIndex:N,index:D,geometry:U?j.geometry:Pl(L),patterns:{},sortKey:H};b.push(tt)}E&&b.sort((L,A)=>L.sortKey-A.sortKey);for(const L of b){const{geometry:A,index:D,sourceLayerIndex:N}=L,U=o[D].feature;this.addFeature(L,A,D,p),c.featureIndex.insert(U,A,D,N,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,oe),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,c,p,g){for(const b of c)for(const x of b){const E=x.x,L=x.y;if(E<0||E>=kr||L<0||L>=kr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),D=A.vertexLength;kh(this.layoutVertexArray,E,L,-1,-1),kh(this.layoutVertexArray,E,L,1,-1),kh(this.layoutVertexArray,E,L,1,1),kh(this.layoutVertexArray,E,L,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},g)}}function Ip(l,o){for(let c=0;c1){if(Dh(l,o))return!0;for(let p=0;p1?c:c.sub(o)._mult(g)._add(o))}function y1(l,o){let c,p,g,b=!1;for(let x=0;xo.y!=g.y>o.y&&o.x<(g.x-p.x)*(o.y-p.y)/(g.y-p.y)+p.x&&(b=!b)}return b}function Rh(l,o){let c=!1;for(let p=0,g=l.length-1;po.y!=x.y>o.y&&o.x<(x.x-b.x)*(o.y-b.y)/(x.y-b.y)+b.x&&(c=!c)}return c}function DC(l,o,c){const p=c[0],g=c[2];if(l.xg.x&&o.x>g.x||l.yg.y&&o.y>g.y)return!1;const b=bt(l,o,c[0]);return b!==bt(l,o,c[1])||b!==bt(l,o,c[2])||b!==bt(l,o,c[3])}function Pp(l,o,c){const p=o.paint.get(l).value;return p.kind==="constant"?p.value:c.programConfigurations.get(o.id).getMaxValue(l)}function Nm(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}function Om(l,o,c,p,g){if(!o[0]&&!o[1])return l;const b=I.convert(o)._mult(g);c==="viewport"&&b._rotate(-p);const x=[];for(let E=0;Ex1(ot,tt))}(A,L),j=N?D*E:D;for(const H of g)for(const tt of H){const ot=N?tt:x1(tt,L);let ht=j;const Lt=zm([],[tt.x,tt.y,0,1],L);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ht*=Lt[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ht*=x.cameraToCenterDistance/Lt[3]),Rm(U,ot,ht))return!0}return!1}}function x1(l,o){const c=zm([],[l.x,l.y,0,1],o);return new I(c[0]/c[3],c[1]/c[3])}class w1 extends Xa{}let S1;we("HeatmapBucket",w1,{omit:["layers"]});var zC={get paint(){return S1=S1||new po({"heatmap-radius":new Oe(At.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Oe(At.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Me(At.paint_heatmap["heatmap-intensity"]),"heatmap-color":new mp(At.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Me(At.paint_heatmap["heatmap-opacity"])})}};function e_(l,{width:o,height:c},p,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==o*c*p)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${o*c*p}`)}else g=new Uint8Array(o*c*p);return l.width=o,l.height=c,l.data=g,l}function E1(l,{width:o,height:c},p){if(o===l.width&&c===l.height)return;const g=e_({},{width:o,height:c},p);n_(l,g,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,o),height:Math.min(l.height,c)},p),l.width=o,l.height=c,l.data=g.data}function n_(l,o,c,p,g,b){if(g.width===0||g.height===0)return o;if(g.width>l.width||g.height>l.height||c.x>l.width-g.width||c.y>l.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>o.width||g.height>o.height||p.x>o.width-g.width||p.y>o.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const x=l.data,E=o.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let L=0;L{o[l.evaluationKey]=L;const A=l.expression.evaluate(o);g.data[x+E+0]=Math.floor(255*A.r/A.a),g.data[x+E+1]=Math.floor(255*A.g/A.a),g.data[x+E+2]=Math.floor(255*A.b/A.a),g.data[x+E+3]=Math.floor(255*A.a)};if(l.clips)for(let x=0,E=0;x80*c){p=b=l[0],g=x=l[1];for(var H=c;Hb&&(b=E),L>x&&(x=L);A=(A=Math.max(b-p,x-g))!==0?32767/A:0}return kp(U,j,c,p,g,A,0),j}function T1(l,o,c,p,g){var b,x;if(g===s_(l,o,c,p)>0)for(b=o;b=o;b-=p)x=M1(b,l[b],l[b+1],x);return x&&Bm(x,x.next)&&(Rp(x),x=x.next),x}function mc(l,o){if(!l)return l;o||(o=l);var c,p=l;do if(c=!1,p.steiner||!Bm(p,p.next)&&Vr(p.prev,p,p.next)!==0)p=p.next;else{if(Rp(p),(p=o=p.prev)===p.next)break;c=!0}while(c||p!==o);return o}function kp(l,o,c,p,g,b,x){if(l){!x&&b&&function(D,N,U,j){var H=D;do H.z===0&&(H.z=i_(H.x,H.y,N,U,j)),H.prevZ=H.prev,H.nextZ=H.next,H=H.next;while(H!==D);H.prevZ.nextZ=null,H.prevZ=null,function(tt){var ot,ht,Lt,gt,St,Yt,Jt,ve,Ce=1;do{for(ht=tt,tt=null,St=null,Yt=0;ht;){for(Yt++,Lt=ht,Jt=0,ot=0;ot0||ve>0&≪)Jt!==0&&(ve===0||!Lt||ht.z<=Lt.z)?(gt=ht,ht=ht.nextZ,Jt--):(gt=Lt,Lt=Lt.nextZ,ve--),St?St.nextZ=gt:tt=gt,gt.prevZ=St,St=gt;ht=Lt}St.nextZ=null,Ce*=2}while(Yt>1)}(H)}(l,p,g,b);for(var E,L,A=l;l.prev!==l.next;)if(E=l.prev,L=l.next,b?jC(l,p,g,b):qC(l))o.push(E.i/c|0),o.push(l.i/c|0),o.push(L.i/c|0),Rp(l),l=L.next,A=L.next;else if((l=L)===A){x?x===1?kp(l=WC(mc(l),o,c),o,c,p,g,b,2):x===2&&HC(l,o,c,p,g,b):kp(mc(l),o,c,p,g,b,1);break}}}function qC(l){var o=l.prev,c=l,p=l.next;if(Vr(o,c,p)>=0)return!1;for(var g=o.x,b=c.x,x=p.x,E=o.y,L=c.y,A=p.y,D=gb?g>x?g:x:b>x?b:x,j=E>L?E>A?E:A:L>A?L:A,H=p.next;H!==o;){if(H.x>=D&&H.x<=U&&H.y>=N&&H.y<=j&&Oh(g,E,b,L,x,A,H.x,H.y)&&Vr(H.prev,H,H.next)>=0)return!1;H=H.next}return!0}function jC(l,o,c,p){var g=l.prev,b=l,x=l.next;if(Vr(g,b,x)>=0)return!1;for(var E=g.x,L=b.x,A=x.x,D=g.y,N=b.y,U=x.y,j=EL?E>A?E:A:L>A?L:A,ot=D>N?D>U?D:U:N>U?N:U,ht=i_(j,H,o,c,p),Lt=i_(tt,ot,o,c,p),gt=l.prevZ,St=l.nextZ;gt&>.z>=ht&&St&&St.z<=Lt;){if(gt.x>=j&>.x<=tt&>.y>=H&>.y<=ot&>!==g&>!==x&&Oh(E,D,L,N,A,U,gt.x,gt.y)&&Vr(gt.prev,gt,gt.next)>=0||(gt=gt.prevZ,St.x>=j&&St.x<=tt&&St.y>=H&&St.y<=ot&&St!==g&&St!==x&&Oh(E,D,L,N,A,U,St.x,St.y)&&Vr(St.prev,St,St.next)>=0))return!1;St=St.nextZ}for(;gt&>.z>=ht;){if(gt.x>=j&>.x<=tt&>.y>=H&>.y<=ot&>!==g&>!==x&&Oh(E,D,L,N,A,U,gt.x,gt.y)&&Vr(gt.prev,gt,gt.next)>=0)return!1;gt=gt.prevZ}for(;St&&St.z<=Lt;){if(St.x>=j&&St.x<=tt&&St.y>=H&&St.y<=ot&&St!==g&&St!==x&&Oh(E,D,L,N,A,U,St.x,St.y)&&Vr(St.prev,St,St.next)>=0)return!1;St=St.nextZ}return!0}function WC(l,o,c){var p=l;do{var g=p.prev,b=p.next.next;!Bm(g,b)&&L1(g,p,p.next,b)&&Dp(g,b)&&Dp(b,g)&&(o.push(g.i/c|0),o.push(p.i/c|0),o.push(b.i/c|0),Rp(p),Rp(p.next),p=l=b),p=p.next}while(p!==l);return mc(p)}function HC(l,o,c,p,g,b){var x=l;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&JC(x,E)){var L=P1(x,E);return x=mc(x,x.next),L=mc(L,L.next),kp(x,o,c,p,g,b,0),void kp(L,o,c,p,g,b,0)}E=E.next}x=x.next}while(x!==l)}function ZC(l,o){return l.x-o.x}function XC(l,o){var c=function(g,b){var x,E=b,L=g.x,A=g.y,D=-1/0;do{if(A<=E.y&&A>=E.next.y&&E.next.y!==E.y){var N=E.x+(A-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(N<=L&&N>D&&(D=N,x=E.x=E.x&&E.x>=H&&L!==E.x&&Oh(Ax.x||E.x===x.x&&YC(x,E)))&&(x=E,ot=U)),E=E.next;while(E!==j);return x}(l,o);if(!c)return o;var p=P1(c,l);return mc(p,p.next),mc(c,c.next)}function YC(l,o){return Vr(l.prev,l,o.prev)<0&&Vr(o.next,l,l.next)<0}function i_(l,o,c,p,g){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-c)*g|0)|l<<8))|l<<4))|l<<2))|l<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*g|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function KC(l){var o=l,c=l;do(o.x=(l-x)*(b-E)&&(l-x)*(p-E)>=(c-x)*(o-E)&&(c-x)*(b-E)>=(g-x)*(p-E)}function JC(l,o){return l.next.i!==o.i&&l.prev.i!==o.i&&!function(c,p){var g=c;do{if(g.i!==c.i&&g.next.i!==c.i&&g.i!==p.i&&g.next.i!==p.i&&L1(g,g.next,c,p))return!0;g=g.next}while(g!==c);return!1}(l,o)&&(Dp(l,o)&&Dp(o,l)&&function(c,p){var g=c,b=!1,x=(c.x+p.x)/2,E=(c.y+p.y)/2;do g.y>E!=g.next.y>E&&g.next.y!==g.y&&x<(g.next.x-g.x)*(E-g.y)/(g.next.y-g.y)+g.x&&(b=!b),g=g.next;while(g!==c);return b}(l,o)&&(Vr(l.prev,l,o.prev)||Vr(l,o.prev,o))||Bm(l,o)&&Vr(l.prev,l,l.next)>0&&Vr(o.prev,o,o.next)>0)}function Vr(l,o,c){return(o.y-l.y)*(c.x-o.x)-(o.x-l.x)*(c.y-o.y)}function Bm(l,o){return l.x===o.x&&l.y===o.y}function L1(l,o,c,p){var g=Um(Vr(l,o,c)),b=Um(Vr(l,o,p)),x=Um(Vr(c,p,l)),E=Um(Vr(c,p,o));return g!==b&&x!==E||!(g!==0||!Vm(l,c,o))||!(b!==0||!Vm(l,p,o))||!(x!==0||!Vm(c,l,p))||!(E!==0||!Vm(c,o,p))}function Vm(l,o,c){return o.x<=Math.max(l.x,c.x)&&o.x>=Math.min(l.x,c.x)&&o.y<=Math.max(l.y,c.y)&&o.y>=Math.min(l.y,c.y)}function Um(l){return l>0?1:l<0?-1:0}function Dp(l,o){return Vr(l.prev,l,l.next)<0?Vr(l,o,l.next)>=0&&Vr(l,l.prev,o)>=0:Vr(l,o,l.prev)<0||Vr(l,l.next,o)<0}function P1(l,o){var c=new o_(l.i,l.x,l.y),p=new o_(o.i,o.x,o.y),g=l.next,b=o.prev;return l.next=o,o.prev=l,c.next=g,g.prev=c,p.next=c,c.prev=p,b.next=p,p.prev=b,p}function M1(l,o,c,p){var g=new o_(l,o,c);return p?(g.next=p.next,g.prev=p,p.next.prev=g,p.next=g):(g.prev=g,g.next=g),g}function Rp(l){l.next.prev=l.prev,l.prev.next=l.next,l.prevZ&&(l.prevZ.nextZ=l.nextZ),l.nextZ&&(l.nextZ.prevZ=l.prevZ)}function o_(l,o,c){this.i=l,this.x=o,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function s_(l,o,c,p){for(var g=0,b=o,x=c-p;b0&&c.holes.push(p+=l[g-1].length)}return c};var A1=y(r_.exports);function QC(l,o,c,p,g){k1(l,o,c||0,p||l.length-1,g||$C)}function k1(l,o,c,p,g){for(;p>c;){if(p-c>600){var b=p-c+1,x=o-c+1,E=Math.log(b),L=.5*Math.exp(2*E/3),A=.5*Math.sqrt(E*L*(b-L)/b)*(x-b/2<0?-1:1);k1(l,o,Math.max(c,Math.floor(o-x*L/b+A)),Math.min(p,Math.floor(o+(b-x)*L/b+A)),g)}var D=l[o],N=c,U=p;for(Np(l,c,o),g(l[p],D)>0&&Np(l,c,p);N0;)U--}g(l[c],D)===0?Np(l,c,U):Np(l,++U,p),U<=o&&(c=U+1),o<=U&&(p=U-1)}}function Np(l,o,c){var p=l[o];l[o]=l[c],l[c]=p}function $C(l,o){return lo?1:0}function a_(l,o){const c=l.length;if(c<=1)return[l];const p=[];let g,b;for(let x=0;x1)for(let x=0;xc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new it,this.indexArray=new Ht,this.indexArray2=new te,this.programConfigurations=new mr(o.layers,o.zoom),this.segments=new le,this.segments2=new le,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=l_("fill",this.layers,c);const g=this.layers[0].layout.get("fill-sort-key"),b=!g.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:D}of o){const N=this.layers[0]._featureFilter.needGeometry,U=Ml(E,N);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),U,p))continue;const j=b?g.evaluate(U,{},p,c.availableImages):void 0,H={id:L,properties:E.properties,type:E.type,sourceLayerIndex:D,index:A,geometry:N?U.geometry:Pl(E),patterns:{},sortKey:j};x.push(H)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:D}=E;if(this.hasPattern){const N=u_("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(N)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(o[A].feature,L,A,D,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,GC),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(o,c,p,g,b){for(const x of a_(c,500)){let E=0;for(const j of x)E+=j.length;const L=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),A=L.vertexLength,D=[],N=[];for(const j of x){if(j.length===0)continue;j!==x[0]&&N.push(D.length/2);const H=this.segments2.prepareSegment(j.length,this.layoutVertexArray,this.indexArray2),tt=H.vertexLength;this.layoutVertexArray.emplaceBack(j[0].x,j[0].y),this.indexArray2.emplaceBack(tt+j.length-1,tt),D.push(j[0].x),D.push(j[0].y);for(let ot=1;ot>3}if(g--,p===1||p===2)b+=l.readSVarint(),x+=l.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new sT(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},zh.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var o=l.readVarint()+l.pos,c=1,p=0,g=0,b=0,x=1/0,E=-1/0,L=1/0,A=-1/0;l.pos>3}if(p--,c===1||c===2)(g+=l.readSVarint())E&&(E=g),(b+=l.readSVarint())A&&(A=b);else if(c!==7)throw new Error("unknown command "+c)}return[x,L,E,A]},zh.prototype.toGeoJSON=function(l,o,c){var p,g,b=this.extent*Math.pow(2,c),x=this.extent*l,E=this.extent*o,L=this.loadGeometry(),A=zh.types[this.type];function D(j){for(var H=0;H>3;g=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return g}(c))}z1.prototype.feature=function(l){if(l<0||l>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];var o=this._pbf.readVarint()+this._pbf.pos;return new uT(this._pbf,o,this.extent,this._keys,this._values)};var hT=O1;function fT(l,o,c){if(l===3){var p=new hT(c,c.readVarint()+c.pos);p.length&&(o[p.name]=p)}}mu.VectorTile=function(l,o){this.layers=l.readFields(fT,{},o)},mu.VectorTileFeature=N1,mu.VectorTileLayer=O1;const pT=mu.VectorTileFeature.types,h_=Math.pow(2,13);function Op(l,o,c,p,g,b,x,E){l.emplaceBack(o,c,2*Math.floor(p*h_)+x,g*h_*2,b*h_*2,Math.round(E))}class f_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new rt,this.centroidVertexArray=new F,this.indexArray=new Ht,this.programConfigurations=new mr(o.layers,o.zoom),this.segments=new le,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.features=[],this.hasPattern=l_("fill-extrusion",this.layers,c);for(const{feature:g,id:b,index:x,sourceLayerIndex:E}of o){const L=this.layers[0]._featureFilter.needGeometry,A=Ml(g,L);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),A,p))continue;const D={id:b,sourceLayerIndex:E,index:x,geometry:L?A.geometry:Pl(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(u_("fill-extrusion",this.layers,D,this.zoom,c)):this.addFeature(D,D.geometry,x,p,{}),c.featureIndex.insert(g,D.geometry,x,E,this.index,!0)}}addFeatures(o,c,p){for(const g of this.features){const{geometry:b}=g;this.addFeature(g,b,g.index,c,p)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,oT),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,iT.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,c,p,g,b){const x={x:0,y:0,vertexCount:0};for(const E of a_(c,500)){let L=0;for(const H of E)L+=H.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const H of E){if(H.length===0||mT(H))continue;let tt=0;for(let ot=0;ot=1){const Lt=H[ot-1];if(!dT(ht,Lt)){A.vertexLength+4>le.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const gt=ht.sub(Lt)._perp()._unit(),St=Lt.dist(ht);tt+St>32768&&(tt=0),Op(this.layoutVertexArray,ht.x,ht.y,gt.x,gt.y,0,0,tt),Op(this.layoutVertexArray,ht.x,ht.y,gt.x,gt.y,0,1,tt),x.x+=2*ht.x,x.y+=2*ht.y,x.vertexCount+=2,tt+=St,Op(this.layoutVertexArray,Lt.x,Lt.y,gt.x,gt.y,0,0,tt),Op(this.layoutVertexArray,Lt.x,Lt.y,gt.x,gt.y,0,1,tt),x.x+=2*Lt.x,x.y+=2*Lt.y,x.vertexCount+=2;const Yt=A.vertexLength;this.indexArray.emplaceBack(Yt,Yt+2,Yt+1),this.indexArray.emplaceBack(Yt+1,Yt+2,Yt+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+L>le.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(L,this.layoutVertexArray,this.indexArray)),pT[o.type]!=="Polygon")continue;const D=[],N=[],U=A.vertexLength;for(const H of E)if(H.length!==0){H!==E[0]&&N.push(D.length/2);for(let tt=0;ttkr)||l.y===o.y&&(l.y<0||l.y>kr)}function mT(l){return l.every(o=>o.x<0)||l.every(o=>o.x>kr)||l.every(o=>o.y<0)||l.every(o=>o.y>kr)}let F1;we("FillExtrusionBucket",f_,{omit:["layers","features"]});var gT={get paint(){return F1=F1||new po({"fill-extrusion-opacity":new Me(At["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Oe(At["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Me(At["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Me(At["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Eh(At["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Oe(At["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Oe(At["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Me(At["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class yT extends _s{constructor(o){super(o,gT)}createBucket(o){return new f_(o)}queryRadius(){return Nm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,c,p,g,b,x,E,L){const A=Om(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),D=this.paint.get("fill-extrusion-height").evaluate(c,p),N=this.paint.get("fill-extrusion-base").evaluate(c,p),U=function(H,tt,ot,ht){const Lt=[];for(const gt of H){const St=[gt.x,gt.y,0,1];zm(St,St,tt),Lt.push(new I(St[0]/St[3],St[1]/St[3]))}return Lt}(A,L),j=function(H,tt,ot,ht){const Lt=[],gt=[],St=ht[8]*tt,Yt=ht[9]*tt,Jt=ht[10]*tt,ve=ht[11]*tt,Ce=ht[8]*ot,ye=ht[9]*ot,pe=ht[10]*ot,se=ht[11]*ot;for(const Ee of H){const ce=[],ne=[];for(const Ne of Ee){const Le=Ne.x,fn=Ne.y,er=ht[0]*Le+ht[4]*fn+ht[12],lr=ht[1]*Le+ht[5]*fn+ht[13],oi=ht[2]*Le+ht[6]*fn+ht[14],ns=ht[3]*Le+ht[7]*fn+ht[15],go=oi+Jt,Qr=ns+ve,Pi=er+Ce,zi=lr+ye,yo=oi+pe,_o=ns+se,si=new I((er+St)/Qr,(lr+Yt)/Qr);si.z=go/Qr,ce.push(si);const ai=new I(Pi/_o,zi/_o);ai.z=yo/_o,ne.push(ai)}Lt.push(ce),gt.push(ne)}return[Lt,gt]}(g,N,D,L);return function(H,tt,ot){let ht=1/0;Cp(ot,tt)&&(ht=B1(ot,tt[0]));for(let Lt=0;Ltc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new at,this.layoutVertexArray2=new $,this.indexArray=new Ht,this.programConfigurations=new mr(o.layers,o.zoom),this.segments=new le,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=l_("line",this.layers,c);const g=this.layers[0].layout.get("line-sort-key"),b=!g.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:D}of o){const N=this.layers[0]._featureFilter.needGeometry,U=Ml(E,N);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),U,p))continue;const j=b?g.evaluate(U,{},p):void 0,H={id:L,properties:E.properties,type:E.type,sourceLayerIndex:D,index:A,geometry:N?U.geometry:Pl(E),patterns:{},sortKey:j};x.push(H)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:D}=E;if(this.hasPattern){const N=u_("line",this.layers,E,this.zoom,c);this.patternFeatures.push(N)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(o[A].feature,L,A,D,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,xT)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,vT),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,c,p,g,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(o,{}),L=x.get("line-cap"),A=x.get("line-miter-limit"),D=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const N of c)this.addLine(N,o,E,L,A,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,g)}addLine(o,c,p,g,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ht=0;ht=2&&o[L-1].equals(o[L-2]);)L--;let A=0;for(;A0;if(ve&&ht>A){const se=U.dist(j);if(se>2*D){const Ee=U.sub(U.sub(j)._mult(D/se)._round());this.updateDistance(j,Ee),this.addCurrentVertex(Ee,tt,0,0,N),j=Ee}}const ye=j&&H;let pe=ye?p:E?"butt":g;if(ye&&pe==="round"&&(Ytb&&(pe="bevel"),pe==="bevel"&&(Yt>2&&(pe="flipbevel"),Yt100)Lt=ot.mult(-1);else{const se=Yt*tt.add(ot).mag()/tt.sub(ot).mag();Lt._perp()._mult(se*(Ce?-1:1))}this.addCurrentVertex(U,Lt,0,0,N),this.addCurrentVertex(U,Lt.mult(-1),0,0,N)}else if(pe==="bevel"||pe==="fakeround"){const se=-Math.sqrt(Yt*Yt-1),Ee=Ce?se:0,ce=Ce?0:se;if(j&&this.addCurrentVertex(U,tt,Ee,ce,N),pe==="fakeround"){const ne=Math.round(180*Jt/Math.PI/20);for(let Ne=1;Ne2*D){const Ee=U.add(H.sub(U)._mult(D/se)._round());this.updateDistance(U,Ee),this.addCurrentVertex(Ee,ot,0,0,N),U=Ee}}}}addCurrentVertex(o,c,p,g,b,x=!1){const E=c.y*g-c.x,L=-c.y-c.x*g;this.addHalfVertex(o,c.x+c.y*p,c.y-c.x*p,x,!1,p,b),this.addHalfVertex(o,E,L,x,!0,-g,b),this.distance>V1/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,c,p,g,b,x))}addHalfVertex({x:o,y:c},p,g,b,x,E,L){const A=.5*(this.lineClips?this.scaledDistance*(V1-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(c<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*g)+128,1+(E===0?0:E<0?-1:1)|(63&A)<<2,A>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=L.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),L.primitiveLength++),x?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,c){this.distance+=o.dist(c),this.updateScaledDistance()}}let U1,G1;we("LineBucket",p_,{omit:["layers","patternFeatures"]});var q1={get paint(){return G1=G1||new po({"line-opacity":new Oe(At.paint_line["line-opacity"]),"line-color":new Oe(At.paint_line["line-color"]),"line-translate":new Me(At.paint_line["line-translate"]),"line-translate-anchor":new Me(At.paint_line["line-translate-anchor"]),"line-width":new Oe(At.paint_line["line-width"]),"line-gap-width":new Oe(At.paint_line["line-gap-width"]),"line-offset":new Oe(At.paint_line["line-offset"]),"line-blur":new Oe(At.paint_line["line-blur"]),"line-dasharray":new lc(At.paint_line["line-dasharray"]),"line-pattern":new Eh(At.paint_line["line-pattern"]),"line-gradient":new mp(At.paint_line["line-gradient"])})},get layout(){return U1=U1||new po({"line-cap":new Me(At.layout_line["line-cap"]),"line-join":new Oe(At.layout_line["line-join"]),"line-miter-limit":new Me(At.layout_line["line-miter-limit"]),"line-round-limit":new Me(At.layout_line["line-round-limit"]),"line-sort-key":new Oe(At.layout_line["line-sort-key"])})}};class ET extends Oe{possiblyEvaluate(o,c){return c=new sr(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(o,c)}evaluate(o,c,p,g){return c=ut({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(o,c,p,g)}}let Gm;class IT extends _s{constructor(o){super(o,q1),this.gradientVersion=0,Gm||(Gm=new ET(q1.paint.properties["line-width"].specification),Gm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof tc,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,c){super.recalculate(o,c),this.paint._values["line-floorwidth"]=Gm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new p_(o)}queryRadius(o){const c=o,p=j1(Pp("line-width",this,c),Pp("line-gap-width",this,c)),g=Pp("line-offset",this,c);return p/2+Math.abs(g)+Nm(this.paint.get("line-translate"))}queryIntersectsFeature(o,c,p,g,b,x,E){const L=Om(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),A=E/2*j1(this.paint.get("line-width").evaluate(c,p),this.paint.get("line-gap-width").evaluate(c,p)),D=this.paint.get("line-offset").evaluate(c,p);return D&&(g=function(N,U){const j=[];for(let H=0;H=3){for(let ot=0;ot0?o+2*l:l}const CT=Br([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),TT=Br([{name:"a_projected_pos",components:3,type:"Float32"}],4);Br([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const LT=Br([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Br([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const W1=Br([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),PT=Br([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function MT(l,o,c){return l.sections.forEach(p=>{p.text=function(g,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?g=g.toLocaleUpperCase():E==="lowercase"&&(g=g.toLocaleLowerCase()),Wa.applyArabicShaping&&(g=Wa.applyArabicShaping(g)),g}(p.text,o,c)}),l}Br([{name:"triangle",components:3,type:"Uint16"}]),Br([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Br([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Br([{type:"Float32",name:"offsetX"}]),Br([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Br([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Fp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ii=24,H1=Wn,Z1=function(l,o,c,p,g){var b,x,E=8*g-p-1,L=(1<>1,D=-7,N=c?g-1:0,U=c?-1:1,j=l[o+N];for(N+=U,b=j&(1<<-D)-1,j>>=-D,D+=E;D>0;b=256*b+l[o+N],N+=U,D-=8);for(x=b&(1<<-D)-1,b>>=-D,D+=p;D>0;x=256*x+l[o+N],N+=U,D-=8);if(b===0)b=1-A;else{if(b===L)return x?NaN:1/0*(j?-1:1);x+=Math.pow(2,p),b-=A}return(j?-1:1)*x*Math.pow(2,b-p)},X1=function(l,o,c,p,g,b){var x,E,L,A=8*b-g-1,D=(1<>1,U=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,j=p?0:b-1,H=p?1:-1,tt=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,x=D):(x=Math.floor(Math.log(o)/Math.LN2),o*(L=Math.pow(2,-x))<1&&(x--,L*=2),(o+=x+N>=1?U/L:U*Math.pow(2,1-N))*L>=2&&(x++,L/=2),x+N>=D?(E=0,x=D):x+N>=1?(E=(o*L-1)*Math.pow(2,g),x+=N):(E=o*Math.pow(2,N-1)*Math.pow(2,g),x=0));g>=8;l[c+j]=255&E,j+=H,E/=256,g-=8);for(x=x<0;l[c+j]=255&x,j+=H,x/=256,A-=8);l[c+j-H]|=128*tt};function Wn(l){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(l)?l:new Uint8Array(l||0),this.pos=0,this.type=0,this.length=this.buf.length}Wn.Varint=0,Wn.Fixed64=1,Wn.Bytes=2,Wn.Fixed32=5;var d_=4294967296,Y1=1/d_,K1=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Al(l){return l.type===Wn.Bytes?l.readVarint()+l.pos:l.pos+1}function Fh(l,o,c){return c?4294967296*o+(l>>>0):4294967296*(o>>>0)+(l>>>0)}function J1(l,o,c){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));c.realloc(p);for(var g=c.pos-1;g>=l;g--)c.buf[g+p]=c.buf[g]}function AT(l,o){for(var c=0;c>>8,l[c+2]=o>>>16,l[c+3]=o>>>24}function Q1(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16)+(l[o+3]<<24)}Wn.prototype={destroy:function(){this.buf=null},readFields:function(l,o,c){for(c=c||this.length;this.pos>3,b=this.pos;this.type=7&p,l(g,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(l,o){return this.readFields(l,o,this.readVarint()+this.pos)},readFixed32:function(){var l=qm(this.buf,this.pos);return this.pos+=4,l},readSFixed32:function(){var l=Q1(this.buf,this.pos);return this.pos+=4,l},readFixed64:function(){var l=qm(this.buf,this.pos)+qm(this.buf,this.pos+4)*d_;return this.pos+=8,l},readSFixed64:function(){var l=qm(this.buf,this.pos)+Q1(this.buf,this.pos+4)*d_;return this.pos+=8,l},readFloat:function(){var l=Z1(this.buf,this.pos,!0,23,4);return this.pos+=4,l},readDouble:function(){var l=Z1(this.buf,this.pos,!0,52,8);return this.pos+=8,l},readVarint:function(l){var o,c,p=this.buf;return o=127&(c=p[this.pos++]),c<128?o:(o|=(127&(c=p[this.pos++]))<<7,c<128?o:(o|=(127&(c=p[this.pos++]))<<14,c<128?o:(o|=(127&(c=p[this.pos++]))<<21,c<128?o:function(g,b,x){var E,L,A=x.buf;if(E=(112&(L=A[x.pos++]))>>4,L<128||(E|=(127&(L=A[x.pos++]))<<3,L<128)||(E|=(127&(L=A[x.pos++]))<<10,L<128)||(E|=(127&(L=A[x.pos++]))<<17,L<128)||(E|=(127&(L=A[x.pos++]))<<24,L<128)||(E|=(1&(L=A[x.pos++]))<<31,L<128))return Fh(g,E,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(c=p[this.pos]))<<28,l,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var l=this.readVarint();return l%2==1?(l+1)/-2:l/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var l=this.readVarint()+this.pos,o=this.pos;return this.pos=l,l-o>=12&&K1?function(c,p,g){return K1.decode(c.subarray(p,g))}(this.buf,o,l):function(c,p,g){for(var b="",x=p;x239?4:D>223?3:D>191?2:1;if(x+U>g)break;U===1?D<128&&(N=D):U===2?(192&(E=c[x+1]))==128&&(N=(31&D)<<6|63&E)<=127&&(N=null):U===3?(L=c[x+2],(192&(E=c[x+1]))==128&&(192&L)==128&&((N=(15&D)<<12|(63&E)<<6|63&L)<=2047||N>=55296&&N<=57343)&&(N=null)):U===4&&(L=c[x+2],A=c[x+3],(192&(E=c[x+1]))==128&&(192&L)==128&&(192&A)==128&&((N=(15&D)<<18|(63&E)<<12|(63&L)<<6|63&A)<=65535||N>=1114112)&&(N=null)),N===null?(N=65533,U=1):N>65535&&(N-=65536,b+=String.fromCharCode(N>>>10&1023|55296),N=56320|1023&N),b+=String.fromCharCode(N),x+=U}return b}(this.buf,o,l)},readBytes:function(){var l=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,l);return this.pos=l,o},readPackedVarint:function(l,o){if(this.type!==Wn.Bytes)return l.push(this.readVarint(o));var c=Al(this);for(l=l||[];this.pos127;);else if(o===Wn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Wn.Fixed32)this.pos+=4;else{if(o!==Wn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(l,o){this.writeVarint(l<<3|o)},realloc:function(l){for(var o=this.length||16;o268435455||l<0?function(o,c){var p,g;if(o>=0?(p=o%4294967296|0,g=o/4294967296|0):(g=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,g=g+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(b,x,E){E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,E.buf[E.pos]=127&(b>>>=7)}(p,0,c),function(b,x){var E=(7&b)<<4;x.buf[x.pos++]|=E|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(g,c)}(l,this):(this.realloc(4),this.buf[this.pos++]=127&l|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=l>>>7&127))))},writeSVarint:function(l){this.writeVarint(l<0?2*-l-1:2*l)},writeBoolean:function(l){this.writeVarint(!!l)},writeString:function(l){l=String(l),this.realloc(4*l.length),this.pos++;var o=this.pos;this.pos=function(p,g,b){for(var x,E,L=0;L55295&&x<57344){if(!E){x>56319||L+1===g.length?(p[b++]=239,p[b++]=191,p[b++]=189):E=x;continue}if(x<56320){p[b++]=239,p[b++]=191,p[b++]=189,E=x;continue}x=E-55296<<10|x-56320|65536,E=null}else E&&(p[b++]=239,p[b++]=191,p[b++]=189,E=null);x<128?p[b++]=x:(x<2048?p[b++]=x>>6|192:(x<65536?p[b++]=x>>12|224:(p[b++]=x>>18|240,p[b++]=x>>12&63|128),p[b++]=x>>6&63|128),p[b++]=63&x|128)}return b}(this.buf,l,this.pos);var c=this.pos-o;c>=128&&J1(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeFloat:function(l){this.realloc(4),X1(this.buf,l,this.pos,!0,23,4),this.pos+=4},writeDouble:function(l){this.realloc(8),X1(this.buf,l,this.pos,!0,52,8),this.pos+=8},writeBytes:function(l){var o=l.length;this.writeVarint(o),this.realloc(o);for(var c=0;c=128&&J1(c,p,this),this.pos=c-1,this.writeVarint(p),this.pos+=p},writeMessage:function(l,o,c){this.writeTag(l,Wn.Bytes),this.writeRawMessage(o,c)},writePackedVarint:function(l,o){o.length&&this.writeMessage(l,AT,o)},writePackedSVarint:function(l,o){o.length&&this.writeMessage(l,kT,o)},writePackedBoolean:function(l,o){o.length&&this.writeMessage(l,NT,o)},writePackedFloat:function(l,o){o.length&&this.writeMessage(l,DT,o)},writePackedDouble:function(l,o){o.length&&this.writeMessage(l,RT,o)},writePackedFixed32:function(l,o){o.length&&this.writeMessage(l,OT,o)},writePackedSFixed32:function(l,o){o.length&&this.writeMessage(l,zT,o)},writePackedFixed64:function(l,o){o.length&&this.writeMessage(l,FT,o)},writePackedSFixed64:function(l,o){o.length&&this.writeMessage(l,BT,o)},writeBytesField:function(l,o){this.writeTag(l,Wn.Bytes),this.writeBytes(o)},writeFixed32Field:function(l,o){this.writeTag(l,Wn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(l,o){this.writeTag(l,Wn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(l,o){this.writeTag(l,Wn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(l,o){this.writeTag(l,Wn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(l,o){this.writeTag(l,Wn.Varint),this.writeVarint(o)},writeSVarintField:function(l,o){this.writeTag(l,Wn.Varint),this.writeSVarint(o)},writeStringField:function(l,o){this.writeTag(l,Wn.Bytes),this.writeString(o)},writeFloatField:function(l,o){this.writeTag(l,Wn.Fixed32),this.writeFloat(o)},writeDoubleField:function(l,o){this.writeTag(l,Wn.Fixed64),this.writeDouble(o)},writeBooleanField:function(l,o){this.writeVarintField(l,!!o)}};var m_=y(H1);const g_=3;function VT(l,o,c){l===1&&c.readMessage(UT,o)}function UT(l,o,c){if(l===3){const{id:p,bitmap:g,width:b,height:x,left:E,top:L,advance:A}=c.readMessage(GT,{});o.push({id:p,bitmap:new Ap({width:b+2*g_,height:x+2*g_},g),metrics:{width:b,height:x,left:E,top:L,advance:A}})}}function GT(l,o,c){l===1?o.id=c.readVarint():l===2?o.bitmap=c.readBytes():l===3?o.width=c.readVarint():l===4?o.height=c.readVarint():l===5?o.left=c.readSVarint():l===6?o.top=c.readSVarint():l===7&&(o.advance=c.readVarint())}const $1=g_;function tb(l){let o=0,c=0;for(const x of l)o+=x.w*x.h,c=Math.max(c,x.w);l.sort((x,E)=>E.h-x.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),c),h:1/0}];let g=0,b=0;for(const x of l)for(let E=p.length-1;E>=0;E--){const L=p[E];if(!(x.w>L.w||x.h>L.h)){if(x.x=L.x,x.y=L.y,b=Math.max(b,x.y+x.h),g=Math.max(g,x.x+x.w),x.w===L.w&&x.h===L.h){const A=p.pop();E=0&&p>=o&&Wm[this.text.charCodeAt(p)];p--)c--;this.text=this.text.substring(o,c),this.sectionIndex=this.sectionIndex.slice(o,c)}substring(o,c){const p=new Vh;return p.text=this.text.substring(o,c),p.sectionIndex=this.sectionIndex.slice(o,c),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,c)=>Math.max(o,this.sections[c].scale),0)}addTextSection(o,c){this.text+=o.text,this.sections.push(Vp.forText(o.scale,o.fontStack||c));const p=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function jm(l,o,c,p,g,b,x,E,L,A,D,N,U,j,H,tt){const ot=Vh.fromFeature(l,g);let ht;N===h.ah.vertical&&ot.verticalizePunctuation();const{processBidirectionalText:Lt,processStyledBidirectionalText:gt}=Wa;if(Lt&&ot.sections.length===1){ht=[];const Jt=Lt(ot.toString(),__(ot,A,b,o,p,j,H));for(const ve of Jt){const Ce=new Vh;Ce.text=ve,Ce.sections=ot.sections;for(let ye=0;ye0&&Dl>No&&(No=Dl)}else{const xs=Ce[_n.fontStack],zo=xs&&xs[Fi];if(zo&&zo.rect)_a=zo.rect,js=zo.metrics;else{const Dl=ve[_n.fontStack],Wp=Dl&&Dl[Fi];if(!Wp)continue;js=Wp.metrics}ui=(ai-_n.scale)*ii}Ws?(Jt.verticalizable=!0,eo.push({glyph:Fi,imageName:va,x:er,y:lr+ui,vertical:Ws,scale:_n.scale,fontStack:_n.fontStack,sectionIndex:no,metrics:js,rect:_a}),er+=kl*_n.scale+Ne):(eo.push({glyph:Fi,imageName:va,x:er,y:lr+ui,vertical:Ws,scale:_n.scale,fontStack:_n.fontStack,sectionIndex:no,metrics:js,rect:_a}),er+=js.advance*_n.scale+Ne)}eo.length!==0&&(oi=Math.max(er-Ne,oi),WT(eo,0,eo.length-1,go,No)),er=0;const Oo=se*ai+No;vo.lineOffset=Math.max(No,to),lr+=Oo,ns=Math.max(Oo,ns),++Qr}var Pi;const zi=lr-Bp,{horizontalAlign:yo,verticalAlign:_o}=v_(Ee);(function(si,ai,to,vo,eo,No,Oo,li,_n){const no=(ai-to)*eo;let Fi=0;Fi=No!==Oo?-li*vo-Bp:(-vo*_n+.5)*Oo;for(const ui of si)for(const js of ui.positionedGlyphs)js.x+=no,js.y+=Fi})(Jt.positionedLines,go,yo,_o,oi,ns,se,zi,pe.length),Jt.top+=-_o*zi,Jt.bottom=Jt.top+zi,Jt.left+=-yo*oi,Jt.right=Jt.left+oi}(Yt,o,c,p,ht,x,E,L,N,A,U,tt),!function(Jt){for(const ve of Jt)if(ve.positionedGlyphs.length!==0)return!1;return!0}(St)&&Yt}const Wm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},qT={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function nb(l,o,c,p,g,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*ii/b+g:0}{const x=c[o.fontStack],E=x&&x[l];return E?E.metrics.advance*o.scale+g:0}}function rb(l,o,c,p){const g=Math.pow(l-o,2);return p?l=0;let D=0;for(let U=0;Ux.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=t_([]),this.placementViewportMatrix=t_([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ab(this.zoom,c["text-size"]),this.iconSizeData=ab(this.zoom,c["icon-size"]);const p=this.layers[0].layout,g=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=b_(p,"text-overlap","text-allow-overlap")!=="never"||b_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>h.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=o.sourceID}createArrays(){this.text=new w_(new mr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new w_(new mr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new v,this.lineVertexArray=new C,this.symbolInstances=new m,this.textAnchorOffsets=new M}calculateGlyphDependencies(o,c,p,g,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),D=L.value.kind!=="constant"||!!L.value.value||Object.keys(L.parameters).length>0,N=b.get("symbol-sort-key");if(this.features=[],!A&&!D)return;const U=c.iconDependencies,j=c.glyphDependencies,H=c.availableImages,tt=new sr(this.zoom);for(const{feature:ot,id:ht,index:Lt,sourceLayerIndex:gt}of o){const St=g._featureFilter.needGeometry,Yt=Ml(ot,St);if(!g._featureFilter.filter(tt,Yt,p))continue;let Jt,ve;if(St||(Yt.geometry=Pl(ot)),A){const ye=g.getValueAndResolveTokens("text-field",Yt,p,H),pe=Po.factory(ye),se=this.hasRTLText=this.hasRTLText||YT(pe);(!se||Wa.getRTLTextPluginStatus()==="unavailable"||se&&Wa.isParsed())&&(Jt=MT(pe,g,Yt))}if(D){const ye=g.getValueAndResolveTokens("icon-image",Yt,p,H);ve=ye instanceof $o?ye:$o.fromString(ye)}if(!Jt&&!ve)continue;const Ce=this.sortFeaturesByKey?N.evaluate(Yt,{},p):void 0;if(this.features.push({id:ht,text:Jt,icon:ve,index:Lt,sourceLayerIndex:gt,geometry:Yt.geometry,properties:ot.properties,type:ZT[ot.type],sortKey:Ce}),ve&&(U[ve.name]=!0),Jt){const ye=x.evaluate(Yt,{},p).join(","),pe=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.ah.vertical)>=0;for(const se of Jt.sections)if(se.image)U[se.image.name]=!0;else{const Ee=pu(Jt.toString()),ce=se.fontStack||ye,ne=j[ce]=j[ce]||{};this.calculateGlyphDependencies(se.text,ne,pe,this.allowVerticalPlacement,Ee)}}}b.get("symbol-placement")==="line"&&(this.features=function(ot){const ht={},Lt={},gt=[];let St=0;function Yt(ye){gt.push(ot[ye]),St++}function Jt(ye,pe,se){const Ee=Lt[ye];return delete Lt[ye],Lt[pe]=Ee,gt[Ee].geometry[0].pop(),gt[Ee].geometry[0]=gt[Ee].geometry[0].concat(se[0]),Ee}function ve(ye,pe,se){const Ee=ht[pe];return delete ht[pe],ht[ye]=Ee,gt[Ee].geometry[0].shift(),gt[Ee].geometry[0]=se[0].concat(gt[Ee].geometry[0]),Ee}function Ce(ye,pe,se){const Ee=se?pe[0][pe[0].length-1]:pe[0][0];return`${ye}:${Ee.x}:${Ee.y}`}for(let ye=0;yeye.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ot,ht)=>ot.sortKey-ht.sortKey)}update(o,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,c,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,c,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(o,c){const p=this.lineVertexArray.length;if(o.segment!==void 0){let g=o.dist(c[o.segment+1]),b=o.dist(c[o.segment]);const x={};for(let E=o.segment+1;E=0;E--)x[E]={x:c[E].x,y:c[E].y,tileUnitDistanceFromAnchor:b},E>0&&(b+=c[E-1].dist(c[E]));for(let E=0;E0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(o,c){const p=o.placedSymbolArray.get(c),g=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;bg[E]-g[L]||b[L]-b[E]),x}addToSortKeyRanges(o,c){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===c?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const c of this.symbolInstanceIndexes){const p=this.symbolInstances.get(c);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((g,b,x)=>{g>=0&&x.indexOf(g)===b&&this.addIndicesForPlacedSymbol(this.text,g)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let lb,ub;we("SymbolBucket",Uh,{omit:["layers","collisionBoxArray","features","compareText"]}),Uh.MAX_GLYPHS=65535,Uh.addDynamicAttributes=x_;var E_={get paint(){return ub=ub||new po({"icon-opacity":new Oe(At.paint_symbol["icon-opacity"]),"icon-color":new Oe(At.paint_symbol["icon-color"]),"icon-halo-color":new Oe(At.paint_symbol["icon-halo-color"]),"icon-halo-width":new Oe(At.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Oe(At.paint_symbol["icon-halo-blur"]),"icon-translate":new Me(At.paint_symbol["icon-translate"]),"icon-translate-anchor":new Me(At.paint_symbol["icon-translate-anchor"]),"text-opacity":new Oe(At.paint_symbol["text-opacity"]),"text-color":new Oe(At.paint_symbol["text-color"],{runtimeType:Ar,getOverride:l=>l.textColor,hasOverride:l=>!!l.textColor}),"text-halo-color":new Oe(At.paint_symbol["text-halo-color"]),"text-halo-width":new Oe(At.paint_symbol["text-halo-width"]),"text-halo-blur":new Oe(At.paint_symbol["text-halo-blur"]),"text-translate":new Me(At.paint_symbol["text-translate"]),"text-translate-anchor":new Me(At.paint_symbol["text-translate-anchor"])})},get layout(){return lb=lb||new po({"symbol-placement":new Me(At.layout_symbol["symbol-placement"]),"symbol-spacing":new Me(At.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Me(At.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Oe(At.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Me(At.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Me(At.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Me(At.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Me(At.layout_symbol["icon-ignore-placement"]),"icon-optional":new Me(At.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Me(At.layout_symbol["icon-rotation-alignment"]),"icon-size":new Oe(At.layout_symbol["icon-size"]),"icon-text-fit":new Me(At.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Me(At.layout_symbol["icon-text-fit-padding"]),"icon-image":new Oe(At.layout_symbol["icon-image"]),"icon-rotate":new Oe(At.layout_symbol["icon-rotate"]),"icon-padding":new Oe(At.layout_symbol["icon-padding"]),"icon-keep-upright":new Me(At.layout_symbol["icon-keep-upright"]),"icon-offset":new Oe(At.layout_symbol["icon-offset"]),"icon-anchor":new Oe(At.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Me(At.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Me(At.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Me(At.layout_symbol["text-rotation-alignment"]),"text-field":new Oe(At.layout_symbol["text-field"]),"text-font":new Oe(At.layout_symbol["text-font"]),"text-size":new Oe(At.layout_symbol["text-size"]),"text-max-width":new Oe(At.layout_symbol["text-max-width"]),"text-line-height":new Me(At.layout_symbol["text-line-height"]),"text-letter-spacing":new Oe(At.layout_symbol["text-letter-spacing"]),"text-justify":new Oe(At.layout_symbol["text-justify"]),"text-radial-offset":new Oe(At.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Me(At.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Oe(At.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Oe(At.layout_symbol["text-anchor"]),"text-max-angle":new Me(At.layout_symbol["text-max-angle"]),"text-writing-mode":new Me(At.layout_symbol["text-writing-mode"]),"text-rotate":new Oe(At.layout_symbol["text-rotate"]),"text-padding":new Me(At.layout_symbol["text-padding"]),"text-keep-upright":new Me(At.layout_symbol["text-keep-upright"]),"text-transform":new Oe(At.layout_symbol["text-transform"]),"text-offset":new Oe(At.layout_symbol["text-offset"]),"text-allow-overlap":new Me(At.layout_symbol["text-allow-overlap"]),"text-overlap":new Me(At.layout_symbol["text-overlap"]),"text-ignore-placement":new Me(At.layout_symbol["text-ignore-placement"]),"text-optional":new Me(At.layout_symbol["text-optional"])})}};class cb{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:Hr,this.defaultValue=o}evaluate(o){if(o.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(o.formattedSection))return c.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}we("FormatSectionOverride",cb,{omit:["defaultValue"]});class Zm extends _s{constructor(o){super(o,E_)}recalculate(o,c){if(super.recalculate(o,c),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const g=[];for(const b of p)g.indexOf(b)<0&&g.push(b);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,c,p,g){const b=this.layout.get(o).evaluate(c,{},p,g),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||Yn(x.value)||!b?b:function(E,L){return L.replace(/{([^{}]+)}/g,(A,D)=>E&&D in E?String(E[D]):"")}(c.properties,b)}createBucket(o){return new Uh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of E_.paint.overridableProperties){if(!Zm.hasPaintOverride(this.layout,o))continue;const c=this.paint.get(o),p=new cb(c),g=new tr(p,c.property.specification);let b=null;b=c.value.kind==="constant"||c.value.kind==="source"?new ch("source",g):new ip("composite",g,c.value.zoomStops),this.paint._values[o]=new ys(c.property,b,c.parameters)}}_handleOverridablePaintPropertyUpdate(o,c,p){return!(!this.layout||c.isDataDriven()||p.isDataDriven())&&Zm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,c){const p=o.get("text-field"),g=E_.paint.properties[c];let b=!1;const x=E=>{for(const L of E)if(g.overrides&&g.overrides.hasOverride(L))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Po)x(p.value.value.sections);else if(p.value.kind==="source"){const E=A=>{b||(A instanceof Va&&Xr(A.value)===zr?x(A.value.sections):A instanceof lh?x(A.sections):A.eachChild(E))},L=p.value;L._styleExpression&&E(L._styleExpression.expression)}return b}}let hb;var KT={get paint(){return hb=hb||new po({"background-color":new Me(At.paint_background["background-color"]),"background-pattern":new lc(At.paint_background["background-pattern"]),"background-opacity":new Me(At.paint_background["background-opacity"])})}};class JT extends _s{constructor(o){super(o,KT)}}let fb;var QT={get paint(){return fb=fb||new po({"raster-opacity":new Me(At.paint_raster["raster-opacity"]),"raster-hue-rotate":new Me(At.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Me(At.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Me(At.paint_raster["raster-brightness-max"]),"raster-saturation":new Me(At.paint_raster["raster-saturation"]),"raster-contrast":new Me(At.paint_raster["raster-contrast"]),"raster-resampling":new Me(At.paint_raster["raster-resampling"]),"raster-fade-duration":new Me(At.paint_raster["raster-fade-duration"])})}};class $T extends _s{constructor(o){super(o,QT)}}class tL extends _s{constructor(o){super(o,{}),this.onAdd=c=>{this.implementation.onAdd&&this.implementation.onAdd(c,c.painter.context.gl)},this.onRemove=c=>{this.implementation.onRemove&&this.implementation.onRemove(c,c.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class eL{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const I_=63710088e-1;class _u{constructor(o,c){if(isNaN(o)||isNaN(c))throw new Error(`Invalid LngLat object: (${o}, ${c})`);if(this.lng=+o,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new _u(dt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const c=Math.PI/180,p=this.lat*c,g=o.lat*c,b=Math.sin(p)*Math.sin(g)+Math.cos(p)*Math.cos(g)*Math.cos((o.lng-this.lng)*c);return I_*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof _u)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new _u(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new _u(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const pb=2*Math.PI*I_;function db(l){return pb*Math.cos(l*Math.PI/180)}function mb(l){return(180+l)/360}function gb(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function yb(l,o){return l/db(o)}function C_(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90}class Xm{constructor(o,c,p=0){this.x=+o,this.y=+c,this.z=+p}static fromLngLat(o,c=0){const p=_u.convert(o);return new Xm(mb(p.lng),gb(p.lat),yb(c,p.lat))}toLngLat(){return new _u(360*this.x-180,C_(this.y))}toAltitude(){return this.z*db(C_(this.y))}meterInMercatorCoordinateUnits(){return 1/pb*(o=C_(this.y),1/Math.cos(o*Math.PI/180));var o}}function _b(l,o,c){var p=2*Math.PI*6378137/256/Math.pow(2,c);return[l*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class T_{constructor(o,c,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||c<0||c>=Math.pow(2,o))throw new Error(`x=${c}, y=${p}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=c,this.y=p,this.key=Gp(0,o,o,c,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,c,p){const g=(x=this.y,E=this.z,L=_b(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),A=_b(256*(b+1),256*(x+1),E),L[0]+","+L[1]+","+A[0]+","+A[1]);var b,x,E,L,A;const D=function(N,U,j){let H,tt="";for(let ot=N;ot>0;ot--)H=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,g)}isChildOf(o){const c=this.z-o.z;return c>0&&o.x===this.x>>c&&o.y===this.y>>c}getTilePoint(o){const c=Math.pow(2,this.z);return new I((o.x*c-this.x)*kr,(o.y*c-this.y)*kr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class vb{constructor(o,c){this.wrap=o,this.canonical=c,this.key=Gp(o,c.z,c.z,c.x,c.y)}}class bs{constructor(o,c,p,g,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=c,this.canonical=new T_(p,+g,+b),this.key=Gp(c,o,p,g,b)}clone(){return new bs(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-o;return o>this.canonical.z?new bs(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bs(o,this.wrap,o,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(o,c){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?Gp(this.wrap*+c,o,this.canonical.z,this.canonical.x,this.canonical.y):Gp(this.wrap*+c,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const c=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>c&&o.canonical.y===this.canonical.y>>c}children(o){if(this.overscaledZ>=o)return[new bs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const c=this.canonical.z+1,p=2*this.canonical.x,g=2*this.canonical.y;return[new bs(c,this.wrap,c,p,g),new bs(c,this.wrap,c,p+1,g),new bs(c,this.wrap,c,p,g+1),new bs(c,this.wrap,c,p+1,g+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=N),N=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(o+1)}unpack(o,c,p){return o*this.redFactor+c*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new vs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,c,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let g=c*this.dim,b=c*this.dim+this.dim,x=p*this.dim,E=p*this.dim+this.dim;switch(c){case-1:g=b-1;break;case 1:b=g+1}switch(p){case-1:x=E-1;break;case 1:E=x+1}const L=-c*this.dim,A=-p*this.dim;for(let D=x;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class wb{constructor(o,c,p,g,b){this.type="Feature",this._vectorTileFeature=o,o._z=c,o._x=p,o._y=g,this.properties=o.properties,this.id=b}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(o[c]=this[c]);return o}}class Sb{constructor(o,c){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new oc(kr,16,0),this.grid3D=new oc(kr,16,0),this.featureIndexArray=new O,this.promoteId=c}insert(o,c,p,g,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,g,b);const L=x?this.grid3D:this.grid;for(let A=0;A=0&&N[3]>=0&&L.insert(E,N[0],N[1],N[2],N[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new mu.VectorTile(new m_(this.rawTileData)).layers,this.sourceLayerCoder=new xb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,c,p,g){this.loadVTLayers();const b=o.params||{},x=kr/o.tileSize/o.scale,E=dh(b.filter),L=o.queryGeometry,A=o.queryPadding*x,D=Ib(L),N=this.grid.query(D.minX-A,D.minY-A,D.maxX+A,D.maxY+A),U=Ib(o.cameraQueryGeometry),j=this.grid3D.query(U.minX-A,U.minY-A,U.maxX+A,U.maxY+A,(ot,ht,Lt,gt)=>function(St,Yt,Jt,ve,Ce){for(const pe of St)if(Yt<=pe.x&&Jt<=pe.y&&ve>=pe.x&&Ce>=pe.y)return!0;const ye=[new I(Yt,Jt),new I(Yt,Ce),new I(ve,Ce),new I(ve,Jt)];if(St.length>2){for(const pe of ye)if(Rh(St,pe))return!0}for(let pe=0;pe(gt||(gt=Pl(St)),Yt.queryIntersectsFeature(L,St,Jt,gt,this.z,o.transform,x,o.pixelPosMatrix)))}return H}loadMatchingFeature(o,c,p,g,b,x,E,L,A,D,N){const U=this.bucketLayerIDs[c];if(x&&!function(ot,ht){for(let Lt=0;Lt=0)return!0;return!1}(x,U))return;const j=this.sourceLayerCoder.decode(p),H=this.vtLayers[j].feature(g);if(b.needGeometry){const ot=Ml(H,!0);if(!b.filter(new sr(this.tileID.overscaledZ),ot,this.tileID.canonical))return}else if(!b.filter(new sr(this.tileID.overscaledZ),H))return;const tt=this.getId(H,j);for(let ot=0;ot{const E=o instanceof ac?o.get(x):null;return E&&E.evaluate?E.evaluate(c,p,g):E})}function Ib(l){let o=1/0,c=1/0,p=-1/0,g=-1/0;for(const b of l)o=Math.min(o,b.x),c=Math.min(c,b.y),p=Math.max(p,b.x),g=Math.max(g,b.y);return{minX:o,minY:c,maxX:p,maxY:g}}function nL(l,o){return o-l}function Cb(l,o,c,p,g){const b=[];for(let x=0;x=p&&N.x>=p||(D.x>=p?D=new I(p,D.y+(p-D.x)/(N.x-D.x)*(N.y-D.y))._round():N.x>=p&&(N=new I(p,D.y+(p-D.x)/(N.x-D.x)*(N.y-D.y))._round()),D.y>=g&&N.y>=g||(D.y>=g?D=new I(D.x+(g-D.y)/(N.y-D.y)*(N.x-D.x),g)._round():N.y>=g&&(N=new I(D.x+(g-D.y)/(N.y-D.y)*(N.x-D.x),g)._round()),L&&D.equals(L[L.length-1])||(L=[D],b.push(L)),L.push(N)))))}}return b}we("FeatureIndex",Sb,{omit:["rawTileData","sourceLayerCoder"]});class vu extends I{constructor(o,c,p,g){super(o,c),this.angle=p,g!==void 0&&(this.segment=g)}clone(){return new vu(this.x,this.y,this.angle,this.segment)}}function Tb(l,o,c,p,g){if(o.segment===void 0||c===0)return!0;let b=o,x=o.segment+1,E=0;for(;E>-c/2;){if(x--,x<0)return!1;E-=l[x].dist(b),b=l[x]}E+=l[x].dist(l[x+1]),x++;const L=[];let A=0;for(;Ep;)A-=L.shift().angleDelta;if(A>g)return!1;x++,E+=D.dist(N)}return!0}function Lb(l){let o=0;for(let c=0;cA){const H=(A-L)/j,tt=Qi.number(N.x,U.x,H),ot=Qi.number(N.y,U.y,H),ht=new vu(tt,ot,U.angleTo(N),D);return ht._round(),!x||Tb(l,ht,E,x,o)?ht:void 0}L+=j}}function iL(l,o,c,p,g,b,x,E,L){const A=Pb(p,b,x),D=Mb(p,g),N=D*x,U=l[0].x===0||l[0].x===L||l[0].y===0||l[0].y===L;return o-N=0&&St=0&&Yt=0&&U+A<=D){const Jt=new vu(St,Yt,Lt,H);Jt._round(),p&&!Tb(l,Jt,b,p,g)||j.push(Jt)}}N+=ht}return E||j.length||x||(j=Ab(l,N/2,c,p,g,b,x,!0,L)),j}we("Anchor",vu);const Gh=Ro;function kb(l,o,c,p){const g=[],b=l.image,x=b.pixelRatio,E=b.paddedRect.w-2*Gh,L=b.paddedRect.h-2*Gh,A=l.right-l.left,D=l.bottom-l.top,N=b.stretchX||[[0,E]],U=b.stretchY||[[0,L]],j=(se,Ee)=>se+Ee[1]-Ee[0],H=N.reduce(j,0),tt=U.reduce(j,0),ot=E-H,ht=L-tt;let Lt=0,gt=H,St=0,Yt=tt,Jt=0,ve=ot,Ce=0,ye=ht;if(b.content&&p){const se=b.content;Lt=Ym(N,0,se[0]),St=Ym(U,0,se[1]),gt=Ym(N,se[0],se[2]),Yt=Ym(U,se[1],se[3]),Jt=se[0]-Lt,Ce=se[1]-St,ve=se[2]-se[0]-gt,ye=se[3]-se[1]-Yt}const pe=(se,Ee,ce,ne)=>{const Ne=Km(se.stretch-Lt,gt,A,l.left),Le=Jm(se.fixed-Jt,ve,se.stretch,H),fn=Km(Ee.stretch-St,Yt,D,l.top),er=Jm(Ee.fixed-Ce,ye,Ee.stretch,tt),lr=Km(ce.stretch-Lt,gt,A,l.left),oi=Jm(ce.fixed-Jt,ve,ce.stretch,H),ns=Km(ne.stretch-St,Yt,D,l.top),go=Jm(ne.fixed-Ce,ye,ne.stretch,tt),Qr=new I(Ne,fn),Pi=new I(lr,fn),zi=new I(lr,ns),yo=new I(Ne,ns),_o=new I(Le/x,er/x),si=new I(oi/x,go/x),ai=o*Math.PI/180;if(ai){const eo=Math.sin(ai),No=Math.cos(ai),Oo=[No,-eo,eo,No];Qr._matMult(Oo),Pi._matMult(Oo),yo._matMult(Oo),zi._matMult(Oo)}const to=se.stretch+se.fixed,vo=Ee.stretch+Ee.fixed;return{tl:Qr,tr:Pi,bl:yo,br:zi,tex:{x:b.paddedRect.x+Gh+to,y:b.paddedRect.y+Gh+vo,w:ce.stretch+ce.fixed-to,h:ne.stretch+ne.fixed-vo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:_o,pixelOffsetBR:si,minFontScaleX:ve/x/A,minFontScaleY:ye/x/D,isSDF:c}};if(p&&(b.stretchX||b.stretchY)){const se=Db(N,ot,H),Ee=Db(U,ht,tt);for(let ce=0;ce0&&(H=Math.max(10,H),this.circleDiameter=H)}else{let N=x.top*E-L[0],U=x.bottom*E+L[2],j=x.left*E-L[3],H=x.right*E+L[1];const tt=x.collisionPadding;if(tt&&(j-=tt[0]*E,N-=tt[1]*E,H+=tt[2]*E,U+=tt[3]*E),D){const ot=new I(j,N),ht=new I(H,N),Lt=new I(j,U),gt=new I(H,U),St=D*Math.PI/180;ot._rotate(St),ht._rotate(St),Lt._rotate(St),gt._rotate(St),j=Math.min(ot.x,ht.x,Lt.x,gt.x),H=Math.max(ot.x,ht.x,Lt.x,gt.x),N=Math.min(ot.y,ht.y,Lt.y,gt.y),U=Math.max(ot.y,ht.y,Lt.y,gt.y)}o.emplaceBack(c.x,c.y,j,N,H,U,p,g,b)}this.boxEndIndex=o.length}}class oL{constructor(o=[],c=sL){if(this.data=o,this.length=this.data.length,this.compare=c,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:c,compare:p}=this,g=c[o];for(;o>0;){const b=o-1>>1,x=c[b];if(p(g,x)>=0)break;c[o]=x,o=b}c[o]=g}_down(o){const{data:c,compare:p}=this,g=this.length>>1,b=c[o];for(;o=0)break;c[o]=E,o=x}c[o]=b}}function sL(l,o){return lo?1:0}function aL(l,o=1,c=!1){let p=1/0,g=1/0,b=-1/0,x=-1/0;const E=l[0];for(let j=0;jb)&&(b=H.x),(!j||H.y>x)&&(x=H.y)}const L=Math.min(b-p,x-g);let A=L/2;const D=new oL([],lL);if(L===0)return new I(p,g);for(let j=p;jN.d||!N.d)&&(N=j,c&&console.log("found best %d after %d probes",Math.round(1e4*j.d)/1e4,U)),j.max-N.d<=o||(A=j.h/2,D.push(new qh(j.p.x-A,j.p.y-A,A,l)),D.push(new qh(j.p.x+A,j.p.y-A,A,l)),D.push(new qh(j.p.x-A,j.p.y+A,A,l)),D.push(new qh(j.p.x+A,j.p.y+A,A,l)),U+=4)}return c&&(console.log(`num probes: ${U}`),console.log(`best distance: ${N.d}`)),N.p}function lL(l,o){return o.max-l.max}function qh(l,o,c,p){this.p=new I(l,o),this.h=c,this.d=function(g,b){let x=!1,E=1/0;for(let L=0;Lg.y!=H.y>g.y&&g.x<(H.x-j.x)*(g.y-j.y)/(H.y-j.y)+j.x&&(x=!x),E=Math.min(E,g1(g,j,H))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Oi;h.ap=void 0,(Oi=h.ap||(h.ap={}))[Oi.center=1]="center",Oi[Oi.left=2]="left",Oi[Oi.right=3]="right",Oi[Oi.top=4]="top",Oi[Oi.bottom=5]="bottom",Oi[Oi["top-left"]=6]="top-left",Oi[Oi["top-right"]=7]="top-right",Oi[Oi["bottom-left"]=8]="bottom-left",Oi[Oi["bottom-right"]=9]="bottom-right";const bu=7,L_=Number.POSITIVE_INFINITY;function Rb(l,o){return o[1]!==L_?function(c,p,g){let b=0,x=0;switch(p=Math.abs(p),g=Math.abs(g),c){case"top-right":case"top-left":case"top":x=g-bu;break;case"bottom-right":case"bottom-left":case"bottom":x=-g+bu}switch(c){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(l,o[0],o[1]):function(c,p){let g=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(c){case"top-right":case"top-left":b=x-bu;break;case"bottom-right":case"bottom-left":b=-x+bu;break;case"bottom":b=-p+bu;break;case"top":b=p-bu}switch(c){case"top-right":case"bottom-right":g=-x;break;case"top-left":case"bottom-left":g=x;break;case"left":g=p;break;case"right":g=-p}return[g,b]}(l,o[0])}function Nb(l,o,c){var p;const g=l.layout,b=(p=g.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},c);if(b){const E=b.values,L=[];for(let A=0;AU*ii);D.startsWith("top")?N[1]-=bu:D.startsWith("bottom")&&(N[1]+=bu),L[A+1]=N}return new Qo(L)}const x=g.get("text-variable-anchor");if(x){let E;E=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(o,{},c)*ii,L_]:g.get("text-offset").evaluate(o,{},c).map(A=>A*ii);const L=[];for(const A of x)L.push(A,Rb(A,E));return new Qo(L)}return null}function P_(l){switch(l){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function uL(l,o,c,p,g,b,x,E,L,A,D){let N=b.textMaxSize.evaluate(o,{});N===void 0&&(N=x);const U=l.layers[0].layout,j=U.get("icon-offset").evaluate(o,{},D),H=zb(c.horizontal),tt=x/24,ot=l.tilePixelRatio*tt,ht=l.tilePixelRatio*N/24,Lt=l.tilePixelRatio*E,gt=l.tilePixelRatio*U.get("symbol-spacing"),St=U.get("text-padding")*l.tilePixelRatio,Yt=function(ne,Ne,Le,fn=1){const er=ne.get("icon-padding").evaluate(Ne,{},Le),lr=er&&er.values;return[lr[0]*fn,lr[1]*fn,lr[2]*fn,lr[3]*fn]}(U,o,D,l.tilePixelRatio),Jt=U.get("text-max-angle")/180*Math.PI,ve=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",Ce=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",ye=U.get("symbol-placement"),pe=gt/2,se=U.get("icon-text-fit");let Ee;p&&se!=="none"&&(l.allowVerticalPlacement&&c.vertical&&(Ee=sb(p,c.vertical,se,U.get("icon-text-fit-padding"),j,tt)),H&&(p=sb(p,H,se,U.get("icon-text-fit-padding"),j,tt)));const ce=(ne,Ne)=>{Ne.x<0||Ne.x>=kr||Ne.y<0||Ne.y>=kr||function(Le,fn,er,lr,oi,ns,go,Qr,Pi,zi,yo,_o,si,ai,to,vo,eo,No,Oo,li,_n,no,Fi,ui,js){const _a=Le.addToLineVertexArray(fn,er);let va,kl,Ws,xs,zo=0,Dl=0,Wp=0,Ub=0,z_=-1,F_=-1;const Rl={};let Gb=Er("");if(Le.allowVerticalPlacement&&lr.vertical){const ro=Qr.layout.get("text-rotate").evaluate(_n,{},ui)+90;Ws=new Qm(Pi,fn,zi,yo,_o,lr.vertical,si,ai,to,ro),go&&(xs=new Qm(Pi,fn,zi,yo,_o,go,eo,No,to,ro))}if(oi){const ro=Qr.layout.get("icon-rotate").evaluate(_n,{}),ws=Qr.layout.get("icon-text-fit")!=="none",gc=kb(oi,ro,Fi,ws),xa=go?kb(go,ro,Fi,ws):void 0;kl=new Qm(Pi,fn,zi,yo,_o,oi,eo,No,!1,ro),zo=4*gc.length;const yc=Le.iconSizeData;let Ka=null;yc.kind==="source"?(Ka=[Ya*Qr.layout.get("icon-size").evaluate(_n,{})],Ka[0]>yu&&Kt(`${Le.layerIds[0]}: Value for "icon-size" is >= ${Up}. Reduce your "icon-size".`)):yc.kind==="composite"&&(Ka=[Ya*no.compositeIconSizes[0].evaluate(_n,{},ui),Ya*no.compositeIconSizes[1].evaluate(_n,{},ui)],(Ka[0]>yu||Ka[1]>yu)&&Kt(`${Le.layerIds[0]}: Value for "icon-size" is >= ${Up}. Reduce your "icon-size".`)),Le.addSymbols(Le.icon,gc,Ka,li,Oo,_n,h.ah.none,fn,_a.lineStartIndex,_a.lineLength,-1,ui),z_=Le.icon.placedSymbolArray.length-1,xa&&(Dl=4*xa.length,Le.addSymbols(Le.icon,xa,Ka,li,Oo,_n,h.ah.vertical,fn,_a.lineStartIndex,_a.lineLength,-1,ui),F_=Le.icon.placedSymbolArray.length-1)}const qb=Object.keys(lr.horizontal);for(const ro of qb){const ws=lr.horizontal[ro];if(!va){Gb=Er(ws.text);const xa=Qr.layout.get("text-rotate").evaluate(_n,{},ui);va=new Qm(Pi,fn,zi,yo,_o,ws,si,ai,to,xa)}const gc=ws.positionedLines.length===1;if(Wp+=Ob(Le,fn,ws,ns,Qr,to,_n,vo,_a,lr.vertical?h.ah.horizontal:h.ah.horizontalOnly,gc?qb:[ro],Rl,z_,no,ui),gc)break}lr.vertical&&(Ub+=Ob(Le,fn,lr.vertical,ns,Qr,to,_n,vo,_a,h.ah.vertical,["vertical"],Rl,F_,no,ui));const fL=va?va.boxStartIndex:Le.collisionBoxArray.length,pL=va?va.boxEndIndex:Le.collisionBoxArray.length,dL=Ws?Ws.boxStartIndex:Le.collisionBoxArray.length,mL=Ws?Ws.boxEndIndex:Le.collisionBoxArray.length,gL=kl?kl.boxStartIndex:Le.collisionBoxArray.length,yL=kl?kl.boxEndIndex:Le.collisionBoxArray.length,_L=xs?xs.boxStartIndex:Le.collisionBoxArray.length,vL=xs?xs.boxEndIndex:Le.collisionBoxArray.length;let ba=-1;const tg=(ro,ws)=>ro&&ro.circleDiameter?Math.max(ro.circleDiameter,ws):ws;ba=tg(va,ba),ba=tg(Ws,ba),ba=tg(kl,ba),ba=tg(xs,ba);const jb=ba>-1?1:0;jb&&(ba*=js/ii),Le.glyphOffsetArray.length>=Uh.MAX_GLYPHS&&Kt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_n.sortKey!==void 0&&Le.addToSortKeyRanges(Le.symbolInstances.length,_n.sortKey);const bL=Nb(Qr,_n,ui),[xL,wL]=function(ro,ws){const gc=ro.length,xa=ws==null?void 0:ws.values;if((xa==null?void 0:xa.length)>0)for(let yc=0;yc=0?Rl.right:-1,Rl.center>=0?Rl.center:-1,Rl.left>=0?Rl.left:-1,Rl.vertical||-1,z_,F_,Gb,fL,pL,dL,mL,gL,yL,_L,vL,zi,Wp,Ub,zo,Dl,jb,0,si,ba,xL,wL)}(l,Ne,ne,c,p,g,Ee,l.layers[0],l.collisionBoxArray,o.index,o.sourceLayerIndex,l.index,ot,[St,St,St,St],ve,L,Lt,Yt,Ce,j,o,b,A,D,x)};if(ye==="line")for(const ne of Cb(o.geometry,0,0,kr,kr)){const Ne=iL(ne,gt,Jt,c.vertical||H,p,24,ht,l.overscaling,kr);for(const Le of Ne)H&&cL(l,H.text,pe,Le)||ce(ne,Le)}else if(ye==="line-center"){for(const ne of o.geometry)if(ne.length>1){const Ne=rL(ne,Jt,c.vertical||H,p,24,ht);Ne&&ce(ne,Ne)}}else if(o.type==="Polygon")for(const ne of a_(o.geometry,0)){const Ne=aL(ne,16);ce(ne[0],new vu(Ne.x,Ne.y,0))}else if(o.type==="LineString")for(const ne of o.geometry)ce(ne,new vu(ne[0].x,ne[0].y,0));else if(o.type==="Point")for(const ne of o.geometry)for(const Ne of ne)ce([Ne],new vu(Ne.x,Ne.y,0))}function Ob(l,o,c,p,g,b,x,E,L,A,D,N,U,j,H){const tt=function(Lt,gt,St,Yt,Jt,ve,Ce,ye){const pe=Yt.layout.get("text-rotate").evaluate(ve,{})*Math.PI/180,se=[];for(const Ee of gt.positionedLines)for(const ce of Ee.positionedGlyphs){if(!ce.rect)continue;const ne=ce.rect||{};let Ne=$1+1,Le=!0,fn=1,er=0;const lr=(Jt||ye)&&ce.vertical,oi=ce.metrics.advance*ce.scale/2;if(ye&>.verticalizable&&(er=Ee.lineOffset/2-(ce.imageName?-(ii-ce.metrics.width*ce.scale)/2:(ce.scale-1)*ii)),ce.imageName){const li=Ce[ce.imageName];Le=li.sdf,fn=li.pixelRatio,Ne=Ro/fn}const ns=Jt?[ce.x+oi,ce.y]:[0,0];let go=Jt?[0,0]:[ce.x+oi+St[0],ce.y+St[1]-er],Qr=[0,0];lr&&(Qr=go,go=[0,0]);const Pi=ce.metrics.isDoubleResolution?2:1,zi=(ce.metrics.left-Ne)*ce.scale-oi+go[0],yo=(-ce.metrics.top-Ne)*ce.scale+go[1],_o=zi+ne.w/Pi*ce.scale/fn,si=yo+ne.h/Pi*ce.scale/fn,ai=new I(zi,yo),to=new I(_o,yo),vo=new I(zi,si),eo=new I(_o,si);if(lr){const li=new I(-oi,oi-Bp),_n=-Math.PI/2,no=ii/2-oi,Fi=new I(5-Bp-no,-(ce.imageName?no:0)),ui=new I(...Qr);ai._rotateAround(_n,li)._add(Fi)._add(ui),to._rotateAround(_n,li)._add(Fi)._add(ui),vo._rotateAround(_n,li)._add(Fi)._add(ui),eo._rotateAround(_n,li)._add(Fi)._add(ui)}if(pe){const li=Math.sin(pe),_n=Math.cos(pe),no=[_n,-li,li,_n];ai._matMult(no),to._matMult(no),vo._matMult(no),eo._matMult(no)}const No=new I(0,0),Oo=new I(0,0);se.push({tl:ai,tr:to,bl:vo,br:eo,tex:ne,writingMode:gt.writingMode,glyphOffset:ns,sectionIndex:ce.sectionIndex,isSDF:Le,pixelOffsetTL:No,pixelOffsetBR:Oo,minFontScaleX:0,minFontScaleY:0})}return se}(0,c,E,g,b,x,p,l.allowVerticalPlacement),ot=l.textSizeData;let ht=null;ot.kind==="source"?(ht=[Ya*g.layout.get("text-size").evaluate(x,{})],ht[0]>yu&&Kt(`${l.layerIds[0]}: Value for "text-size" is >= ${Up}. Reduce your "text-size".`)):ot.kind==="composite"&&(ht=[Ya*j.compositeTextSizes[0].evaluate(x,{},H),Ya*j.compositeTextSizes[1].evaluate(x,{},H)],(ht[0]>yu||ht[1]>yu)&&Kt(`${l.layerIds[0]}: Value for "text-size" is >= ${Up}. Reduce your "text-size".`)),l.addSymbols(l.text,tt,ht,E,b,x,A,o,L.lineStartIndex,L.lineLength,U,H);for(const Lt of D)N[Lt]=l.text.placedSymbolArray.length-1;return 4*tt.length}function zb(l){for(const o in l)return l[o];return null}function cL(l,o,c,p){const g=l.compareText;if(o in g){const b=g[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const b=Fb[15&p];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new M_(E,x,b,o)}constructor(o,c=64,p=Float64Array,g){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const b=Fb.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,L=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+L),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=o)}add(o,c){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=c,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return A_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,c,p,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,L=[0,b.length-1,0],A=[];for(;L.length;){const D=L.pop()||0,N=L.pop()||0,U=L.pop()||0;if(N-U<=E){for(let ot=U;ot<=N;ot++){const ht=x[2*ot],Lt=x[2*ot+1];ht>=o&&ht<=p&&Lt>=c&&Lt<=g&&A.push(b[ot])}continue}const j=U+N>>1,H=x[2*j],tt=x[2*j+1];H>=o&&H<=p&&tt>=c&&tt<=g&&A.push(b[j]),(D===0?o<=H:c<=tt)&&(L.push(U),L.push(j-1),L.push(1-D)),(D===0?p>=H:g>=tt)&&(L.push(j+1),L.push(N),L.push(1-D))}return A}within(o,c,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:b,nodeSize:x}=this,E=[0,g.length-1,0],L=[],A=p*p;for(;E.length;){const D=E.pop()||0,N=E.pop()||0,U=E.pop()||0;if(N-U<=x){for(let ot=U;ot<=N;ot++)Vb(b[2*ot],b[2*ot+1],o,c)<=A&&L.push(g[ot]);continue}const j=U+N>>1,H=b[2*j],tt=b[2*j+1];Vb(H,tt,o,c)<=A&&L.push(g[j]),(D===0?o-p<=H:c-p<=tt)&&(E.push(U),E.push(j-1),E.push(1-D)),(D===0?o+p>=H:c+p>=tt)&&(E.push(j+1),E.push(N),E.push(1-D))}return L}}function A_(l,o,c,p,g,b){if(g-p<=c)return;const x=p+g>>1;Bb(l,o,x,p,g,b),A_(l,o,c,p,x-1,1-b),A_(l,o,c,x+1,g,1-b)}function Bb(l,o,c,p,g,b){for(;g>p;){if(g-p>600){const A=g-p+1,D=c-p+1,N=Math.log(A),U=.5*Math.exp(2*N/3),j=.5*Math.sqrt(N*U*(A-U)/A)*(D-A/2<0?-1:1);Bb(l,o,c,Math.max(p,Math.floor(c-D*U/A+j)),Math.min(g,Math.floor(c+(A-D)*U/A+j)),b)}const x=o[2*c+b];let E=p,L=g;for(qp(l,o,p,c),o[2*g+b]>x&&qp(l,o,p,g);Ex;)L--}o[2*p+b]===x?qp(l,o,p,L):(L++,qp(l,o,L,g)),L<=c&&(p=L+1),c<=L&&(g=L-1)}}function qp(l,o,c,p){k_(l,c,p),k_(o,2*c,2*p),k_(o,2*c+1,2*p+1)}function k_(l,o,c){const p=l[o];l[o]=l[c],l[c]=p}function Vb(l,o,c,p){const g=l-c,b=o-p;return g*g+b*b}var D_;h.bd=void 0,(D_=h.bd||(h.bd={})).create="create",D_.load="load",D_.fullLoad="fullLoad";let $m=null,jp=[];const R_=1e3/60,N_="loadTime",O_="fullLoadTime",hL={mark(l){performance.mark(l)},frame(l){const o=l;$m!=null&&jp.push(o-$m),$m=o},clearMetrics(){$m=null,jp=[],performance.clearMeasures(N_),performance.clearMeasures(O_);for(const l in h.bd)performance.clearMarks(h.bd[l])},getPerformanceMetrics(){performance.measure(N_,h.bd.create,h.bd.load),performance.measure(O_,h.bd.create,h.bd.fullLoad);const l=performance.getEntriesByName(N_)[0].duration,o=performance.getEntriesByName(O_)[0].duration,c=jp.length,p=1/(jp.reduce((b,x)=>b+x,0)/c/1e3),g=jp.filter(b=>b>R_).reduce((b,x)=>b+(x-R_)/R_,0);return{loadTime:l,fullLoadTime:o,fps:p,percentDroppedFrames:g/(c+g)*100,totalFrames:c}}};h.$=le,h.A=Nh,h.B=function(l){if(Gt==null){const o=l.navigator?l.navigator.userAgent:null;Gt=!!l.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Gt},h.C=class{constructor(l,o){this.target=l,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new eL(()=>this.process()),this.subscription=function(c,p,g,b){return c.addEventListener(p,g,!1),{unsubscribe:()=>{c.removeEventListener(p,g,!1)}}}(this.target,"message",c=>this.receive(c)),this.globalScope=ee(self)?l:window}registerMessageHandler(l,o){this.messageHandlers[l]=o}sendAsync(l,o){return new Promise((c,p)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:c,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const E={id:g,type:"",origin:location.origin,targetMapId:l.targetMapId,sourceMapId:this.mapId};this.target.postMessage(E)},{once:!0});const b=[],x=Object.assign(Object.assign({},l),{id:g,sourceMapId:this.mapId,origin:location.origin,data:hu(l.data,b)});this.target.postMessage(x,{transfer:b})})}receive(l){const o=l.data,c=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type===""){delete this.tasks[c];const p=this.abortControllers[c];return delete this.abortControllers[c],void(p&&p.abort())}if(ee(self)||o.mustQueue)return this.tasks[c]=o,this.taskQueue.push(c),void this.invoker.trigger();this.processTask(c,o)}}process(){if(this.taskQueue.length===0)return;const l=this.taskQueue.shift(),o=this.tasks[l];delete this.tasks[l],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(l,o)}processTask(l,o){return u(this,void 0,void 0,function*(){if(o.type===""){const g=this.resolveRejects[l];return delete this.resolveRejects[l],g?void(o.error?g.reject(fu(o.error)):g.resolve(fu(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(l,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const c=fu(o.data),p=new AbortController;this.abortControllers[l]=p;try{const g=yield this.messageHandlers[o.type](o.sourceMapId,c,p);this.completeTask(l,null,g)}catch(g){this.completeTask(l,g)}})}completeTask(l,o,c){const p=[];delete this.abortControllers[l];const g={id:l,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?hu(o):null,data:hu(c,p)};this.target.postMessage(g,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},h.D=Me,h.E=kn,h.F=function(){var l=new Nh(16);return Nh!=Float32Array&&(l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0),l[0]=1,l[5]=1,l[10]=1,l[15]=1,l},h.G=An,h.H=function(l,o,c){var p,g,b,x,E,L,A,D,N,U,j,H,tt=c[0],ot=c[1],ht=c[2];return o===l?(l[12]=o[0]*tt+o[4]*ot+o[8]*ht+o[12],l[13]=o[1]*tt+o[5]*ot+o[9]*ht+o[13],l[14]=o[2]*tt+o[6]*ot+o[10]*ht+o[14],l[15]=o[3]*tt+o[7]*ot+o[11]*ht+o[15]):(g=o[1],b=o[2],x=o[3],E=o[4],L=o[5],A=o[6],D=o[7],N=o[8],U=o[9],j=o[10],H=o[11],l[0]=p=o[0],l[1]=g,l[2]=b,l[3]=x,l[4]=E,l[5]=L,l[6]=A,l[7]=D,l[8]=N,l[9]=U,l[10]=j,l[11]=H,l[12]=p*tt+E*ot+N*ht+o[12],l[13]=g*tt+L*ot+U*ht+o[13],l[14]=b*tt+A*ot+j*ht+o[14],l[15]=x*tt+D*ot+H*ht+o[15]),l},h.I=y_,h.J=function(l,o,c){var p=c[0],g=c[1],b=c[2];return l[0]=o[0]*p,l[1]=o[1]*p,l[2]=o[2]*p,l[3]=o[3]*p,l[4]=o[4]*g,l[5]=o[5]*g,l[6]=o[6]*g,l[7]=o[7]*g,l[8]=o[8]*b,l[9]=o[9]*b,l[10]=o[10]*b,l[11]=o[11]*b,l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},h.K=b1,h.L=function(l,o){const c={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(c=>{o.onloadstart=()=>{c(o)};for(const p of l){const g=window.document.createElement("source");hr(p)||(o.crossOrigin="Anonymous"),g.src=p,o.appendChild(g)}})},h.a3=function(){return ft++},h.a4=_,h.a5=Uh,h.a6=dh,h.a7=Ml,h.a8=sr,h.a9=wb,h.aA=Q,h.aB=function(l,o){if(!l)return[{command:"setStyle",args:[o]}];let c=[];try{if(!on(l.version,o.version))return[{command:"setStyle",args:[o]}];on(l.center,o.center)||c.push({command:"setCenter",args:[o.center]}),on(l.zoom,o.zoom)||c.push({command:"setZoom",args:[o.zoom]}),on(l.bearing,o.bearing)||c.push({command:"setBearing",args:[o.bearing]}),on(l.pitch,o.pitch)||c.push({command:"setPitch",args:[o.pitch]}),on(l.sprite,o.sprite)||c.push({command:"setSprite",args:[o.sprite]}),on(l.glyphs,o.glyphs)||c.push({command:"setGlyphs",args:[o.glyphs]}),on(l.transition,o.transition)||c.push({command:"setTransition",args:[o.transition]}),on(l.light,o.light)||c.push({command:"setLight",args:[o.light]}),on(l.terrain,o.terrain)||c.push({command:"setTerrain",args:[o.terrain]}),on(l.sky,o.sky)||c.push({command:"setSky",args:[o.sky]});const p={},g=[];(function(x,E,L,A){let D;for(D in E=E||{},x=x||{})Object.prototype.hasOwnProperty.call(x,D)&&(Object.prototype.hasOwnProperty.call(E,D)||ps(D,L,A));for(D in E)Object.prototype.hasOwnProperty.call(E,D)&&(Object.prototype.hasOwnProperty.call(x,D)?on(x[D],E[D])||(x[D].type==="geojson"&&E[D].type==="geojson"&&Ba(x,E,D)?Kn(L,{command:"setGeoJSONSourceData",args:[D,E[D].data]}):Os(D,E,L,A)):Lo(D,E,L))})(l.sources,o.sources,g,p);const b=[];l.layers&&l.layers.forEach(x=>{"source"in x&&p[x.source]?c.push({command:"removeLayer",args:[x.id]}):b.push(x)}),c=c.concat(g),function(x,E,L){E=E||[];const A=(x=x||[]).map(vl),D=E.map(vl),N=x.reduce(ds,{}),U=E.reduce(ds,{}),j=A.slice(),H=Object.create(null);let tt,ot,ht,Lt,gt;for(let St=0,Yt=0;St@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,p,g,b)=>{const x=g||b;return o[p]=!x||x.toLowerCase(),""}),o["max-age"]){const c=parseInt(o["max-age"],10);isNaN(c)?delete o["max-age"]:o["max-age"]=c}return o},h.ab=function(l,o){const c=[];for(const p in l)p in o||c.push(p);return c},h.ac=lt,h.ad=function(l,o,c){var p=Math.sin(c),g=Math.cos(c),b=o[0],x=o[1],E=o[2],L=o[3],A=o[4],D=o[5],N=o[6],U=o[7];return o!==l&&(l[8]=o[8],l[9]=o[9],l[10]=o[10],l[11]=o[11],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15]),l[0]=b*g+A*p,l[1]=x*g+D*p,l[2]=E*g+N*p,l[3]=L*g+U*p,l[4]=A*g-b*p,l[5]=D*g-x*p,l[6]=N*g-E*p,l[7]=U*g-L*p,l},h.ae=function(l){var o=new Nh(16);return o[0]=l[0],o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=l[6],o[7]=l[7],o[8]=l[8],o[9]=l[9],o[10]=l[10],o[11]=l[11],o[12]=l[12],o[13]=l[13],o[14]=l[14],o[15]=l[15],o},h.af=zm,h.ag=function(l,o){let c=0,p=0;if(l.kind==="constant")p=l.layoutSize;else if(l.kind!=="source"){const{interpolationType:g,minZoom:b,maxZoom:x}=l,E=g?lt(Ni.interpolationFactor(g,o,b,x),0,1):0;l.kind==="camera"?p=Qi.number(l.minSize,l.maxSize,E):c=E}return{uSizeT:c,uSize:p}},h.ai=function(l,{uSize:o,uSizeT:c},{lowerSize:p,upperSize:g}){return l.kind==="source"?p/Ya:l.kind==="composite"?Qi.number(p/Ya,g/Ya,c):o},h.aj=x_,h.ak=function(l,o,c,p){const g=o.y-l.y,b=o.x-l.x,x=p.y-c.y,E=p.x-c.x,L=x*b-E*g;if(L===0)return null;const A=(E*(l.y-c.y)-x*(l.x-c.x))/L;return new I(l.x+A*b,l.y+A*g)},h.al=Cb,h.am=Ip,h.an=t_,h.ao=ii,h.aq=b_,h.ar=function(l,o){var c=o[0],p=o[1],g=o[2],b=o[3],x=o[4],E=o[5],L=o[6],A=o[7],D=o[8],N=o[9],U=o[10],j=o[11],H=o[12],tt=o[13],ot=o[14],ht=o[15],Lt=c*E-p*x,gt=c*L-g*x,St=c*A-b*x,Yt=p*L-g*E,Jt=p*A-b*E,ve=g*A-b*L,Ce=D*tt-N*H,ye=D*ot-U*H,pe=D*ht-j*H,se=N*ot-U*tt,Ee=N*ht-j*tt,ce=U*ht-j*ot,ne=Lt*ce-gt*Ee+St*se+Yt*pe-Jt*ye+ve*Ce;return ne?(l[0]=(E*ce-L*Ee+A*se)*(ne=1/ne),l[1]=(g*Ee-p*ce-b*se)*ne,l[2]=(tt*ve-ot*Jt+ht*Yt)*ne,l[3]=(U*Jt-N*ve-j*Yt)*ne,l[4]=(L*pe-x*ce-A*ye)*ne,l[5]=(c*ce-g*pe+b*ye)*ne,l[6]=(ot*St-H*ve-ht*gt)*ne,l[7]=(D*ve-U*St+j*gt)*ne,l[8]=(x*Ee-E*pe+A*Ce)*ne,l[9]=(p*pe-c*Ee-b*Ce)*ne,l[10]=(H*Jt-tt*St+ht*Lt)*ne,l[11]=(N*St-D*Jt-j*Lt)*ne,l[12]=(E*ye-x*se-L*Ce)*ne,l[13]=(c*se-p*ye+g*Ce)*ne,l[14]=(tt*gt-H*Yt-ot*Lt)*ne,l[15]=(D*Yt-N*gt+U*Lt)*ne,l):null},h.as=P_,h.at=v_,h.au=M_,h.av=function(){const l={},o=At.$version;for(const c in At.$root){const p=At.$root[c];if(p.required){let g=null;g=c==="version"?o:p.type==="array"?[]:{},g!=null&&(l[c]=g)}}return l},h.aw=Sm,h.ax=Pr,h.ay=function(l){l=l.slice();const o=Object.create(null);for(let c=0;cne*ii)}let ye=x?"center":c.get("text-justify").evaluate(A,{},l.canonical);const pe=c.get("symbol-placement"),se=pe==="point"?c.get("text-max-width").evaluate(A,{},l.canonical)*ii:0,Ee=()=>{l.bucket.allowVerticalPlacement&&pu(St)&&(H.vertical=jm(tt,l.glyphMap,l.glyphPositions,l.imagePositions,D,se,b,ve,"left",Jt,ht,h.ah.vertical,!0,pe,U,N))};if(!x&&Ce){const ce=new Set;if(ye==="auto")for(let Ne=0;Neu(void 0,void 0,void 0,function*(){if(l.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(l)],{type:"image/png"});try{return createImageBitmap(o)}catch(c){throw new Error(`Could not load image because of ${c.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),h.e=ut,h.f=l=>new Promise((o,c)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=xe})},p.onerror=()=>c(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const g=new Blob([new Uint8Array(l)],{type:"image/png"});p.src=l.byteLength?URL.createObjectURL(g):xe}),h.g=gn,h.h=(l,o)=>br(ut(l,{type:"json"}),o),h.i=ee,h.j=Ie,h.k=Ct,h.l=(l,o)=>br(ut(l,{type:"arrayBuffer"}),o),h.m=br,h.n=function(l){return new m_(l).readFields(VT,[])},h.o=Ap,h.p=tb,h.q=po,h.r=Ky,h.s=hr,h.t=cu,h.u=ge,h.v=At,h.w=Kt,h.x=Cl,h.y=function([l,o,c]){return o+=90,o*=Math.PI/180,c*=Math.PI/180,{x:l*Math.cos(o)*Math.sin(c),y:l*Math.sin(o)*Math.sin(c),z:l*Math.cos(c)}},h.z=Qi}),i("worker",["./shared"],function(h){class u{constructor(V){this.keyCache={},V&&this.replace(V)}replace(V){this._layerConfigs={},this._layers={},this.update(V,[])}update(V,G){for(const nt of V){this._layerConfigs[nt.id]=nt;const xt=this._layers[nt.id]=h.az(nt);xt._featureFilter=h.a6(xt.filter),this.keyCache[nt.id]&&delete this.keyCache[nt.id]}for(const nt of G)delete this.keyCache[nt],delete this._layerConfigs[nt],delete this._layers[nt];this.familiesBySource={};const K=h.bh(Object.values(this._layerConfigs),this.keyCache);for(const nt of K){const xt=nt.map(Wt=>this._layers[Wt.id]),J=xt[0];if(J.visibility==="none")continue;const wt=J.source||"";let pt=this.familiesBySource[wt];pt||(pt=this.familiesBySource[wt]={});const Tt=J.sourceLayer||"_geojsonTileLayer";let zt=pt[Tt];zt||(zt=pt[Tt]=[]),zt.push(xt)}}}class y{constructor(V){const G={},K=[];for(const wt in V){const pt=V[wt],Tt=G[wt]={};for(const zt in pt){const Wt=pt[+zt];if(!Wt||Wt.bitmap.width===0||Wt.bitmap.height===0)continue;const Xt={x:0,y:0,w:Wt.bitmap.width+2,h:Wt.bitmap.height+2};K.push(Xt),Tt[zt]={rect:Xt,metrics:Wt.metrics}}}const{w:nt,h:xt}=h.p(K),J=new h.o({width:nt||1,height:xt||1});for(const wt in V){const pt=V[wt];for(const Tt in pt){const zt=pt[+Tt];if(!zt||zt.bitmap.width===0||zt.bitmap.height===0)continue;const Wt=G[wt][Tt].rect;h.o.copy(zt.bitmap,J,{x:0,y:0},{x:Wt.x+1,y:Wt.y+1},zt.bitmap)}}this.image=J,this.positions=G}}h.bi("GlyphAtlas",y);class w{constructor(V){this.tileID=new h.Q(V.tileID.overscaledZ,V.tileID.wrap,V.tileID.canonical.z,V.tileID.canonical.x,V.tileID.canonical.y),this.uid=V.uid,this.zoom=V.zoom,this.pixelRatio=V.pixelRatio,this.tileSize=V.tileSize,this.source=V.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=V.showCollisionBoxes,this.collectResourceTiming=!!V.collectResourceTiming,this.returnDependencies=!!V.returnDependencies,this.promoteId=V.promoteId,this.inFlightDependencies=[]}parse(V,G,K,nt){return h._(this,void 0,void 0,function*(){this.status="parsing",this.data=V,this.collisionBoxArray=new h.a4;const xt=new h.bj(Object.keys(V.layers).sort()),J=new h.bk(this.tileID,this.promoteId);J.bucketLayerIDs=[];const wt={},pt={featureIndex:J,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:K},Tt=G.familiesBySource[this.source];for(const nn in Tt){const xr=V.layers[nn];if(!xr)continue;xr.version===1&&h.w(`Vector tile source "${this.source}" layer "${nn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ei=xt.encode(nn),Ji=[];for(let co=0;co=mi.maxzoom||mi.visibility!=="none"&&(S(co,this.zoom,K),(wt[mi.id]=mi.createBucket({index:J.bucketLayerIDs.length,layers:co,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ei,sourceID:this.source})).populate(Ji,pt,this.tileID.canonical),J.bucketLayerIDs.push(co.map(zs=>zs.id)))}}const zt=h.aE(pt.glyphDependencies,nn=>Object.keys(nn).map(Number));this.inFlightDependencies.forEach(nn=>nn==null?void 0:nn.abort()),this.inFlightDependencies=[];let Wt=Promise.resolve({});if(Object.keys(zt).length){const nn=new AbortController;this.inFlightDependencies.push(nn),Wt=nt.sendAsync({type:"GG",data:{stacks:zt,source:this.source,tileID:this.tileID,type:"glyphs"}},nn)}const Xt=Object.keys(pt.iconDependencies);let Te=Promise.resolve({});if(Xt.length){const nn=new AbortController;this.inFlightDependencies.push(nn),Te=nt.sendAsync({type:"GI",data:{icons:Xt,source:this.source,tileID:this.tileID,type:"icons"}},nn)}const Ae=Object.keys(pt.patternDependencies);let Ge=Promise.resolve({});if(Ae.length){const nn=new AbortController;this.inFlightDependencies.push(nn),Ge=nt.sendAsync({type:"GI",data:{icons:Ae,source:this.source,tileID:this.tileID,type:"patterns"}},nn)}const[je,bn,jn]=yield Promise.all([Wt,Te,Ge]),or=new y(je),Zr=new h.bl(bn,jn);for(const nn in wt){const xr=wt[nn];xr instanceof h.a5?(S(xr.layers,this.zoom,K),h.bm({bucket:xr,glyphMap:je,glyphPositions:or.positions,imageMap:bn,imagePositions:Zr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):xr.hasPattern&&(xr instanceof h.bn||xr instanceof h.bo||xr instanceof h.bp)&&(S(xr.layers,this.zoom,K),xr.addFeatures(pt,this.tileID.canonical,Zr.patternPositions))}return this.status="done",{buckets:Object.values(wt).filter(nn=>!nn.isEmpty()),featureIndex:J,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:or.image,imageAtlas:Zr,glyphMap:this.returnDependencies?je:null,iconMap:this.returnDependencies?bn:null,glyphPositions:this.returnDependencies?or.positions:null}})}}function S(st,V,G){const K=new h.a8(V);for(const nt of st)nt.recalculate(K,G)}class I{constructor(V,G,K){this.actor=V,this.layerIndex=G,this.availableImages=K,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(V,G){return h._(this,void 0,void 0,function*(){const K=yield h.l(V.request,G);try{return{vectorTile:new h.bq.VectorTile(new h.br(K.data)),rawData:K.data,cacheControl:K.cacheControl,expires:K.expires}}catch(nt){const xt=new Uint8Array(K.data);let J=`Unable to parse the tile at ${V.request.url}, `;throw J+=xt[0]===31&&xt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${nt.messge}`,new Error(J)}})}loadTile(V){return h._(this,void 0,void 0,function*(){const G=V.uid,K=!!(V&&V.request&&V.request.collectResourceTiming)&&new h.bs(V.request),nt=new w(V);this.loading[G]=nt;const xt=new AbortController;nt.abort=xt;try{const J=yield this.loadVectorTile(V,xt);if(delete this.loading[G],!J)return null;const wt=J.rawData,pt={};J.expires&&(pt.expires=J.expires),J.cacheControl&&(pt.cacheControl=J.cacheControl);const Tt={};if(K){const Wt=K.finish();Wt&&(Tt.resourceTiming=JSON.parse(JSON.stringify(Wt)))}nt.vectorTile=J.vectorTile;const zt=nt.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[G]=nt,this.fetching[G]={rawTileData:wt,cacheControl:pt,resourceTiming:Tt};try{const Wt=yield zt;return h.e({rawTileData:wt.slice(0)},Wt,pt,Tt)}finally{delete this.fetching[G]}}catch(J){throw delete this.loading[G],nt.status="done",this.loaded[G]=nt,J}})}reloadTile(V){return h._(this,void 0,void 0,function*(){const G=V.uid;if(!this.loaded||!this.loaded[G])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const K=this.loaded[G];if(K.showCollisionBoxes=V.showCollisionBoxes,K.status==="parsing"){const nt=yield K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor);let xt;if(this.fetching[G]){const{rawTileData:J,cacheControl:wt,resourceTiming:pt}=this.fetching[G];delete this.fetching[G],xt=h.e({rawTileData:J.slice(0)},nt,wt,pt)}else xt=nt;return xt}if(K.status==="done"&&K.vectorTile)return K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(V){return h._(this,void 0,void 0,function*(){const G=this.loading,K=V.uid;G&&G[K]&&G[K].abort&&(G[K].abort.abort(),delete G[K])})}removeTile(V){return h._(this,void 0,void 0,function*(){this.loaded&&this.loaded[V.uid]&&delete this.loaded[V.uid]})}}class P{constructor(){this.loaded={}}loadTile(V){return h._(this,void 0,void 0,function*(){const{uid:G,encoding:K,rawImageData:nt,redFactor:xt,greenFactor:J,blueFactor:wt,baseShift:pt}=V,Tt=nt.width+2,zt=nt.height+2,Wt=h.b(nt)?new h.R({width:Tt,height:zt},yield h.bt(nt,-1,-1,Tt,zt)):nt,Xt=new h.bu(G,Wt,K,xt,J,wt,pt);return this.loaded=this.loaded||{},this.loaded[G]=Xt,Xt})}removeTile(V){const G=this.loaded,K=V.uid;G&&G[K]&&delete G[K]}}function z(st,V){if(st.length!==0){R(st[0],V);for(var G=1;G=Math.abs(wt)?G-pt+wt:wt-pt+G,G=pt}G+K>=0!=!!V&&st.reverse()}var Z=h.bv(function st(V,G){var K,nt=V&&V.type;if(nt==="FeatureCollection")for(K=0;K>31}function Ut(st,V){for(var G=st.loadGeometry(),K=st.type,nt=0,xt=0,J=G.length,wt=0;wtst},xe=Math.fround||(ln=new Float32Array(1),st=>(ln[0]=+st,ln[0]));var ln;const Ve=3,Pe=5,un=6;class Cn{constructor(V){this.options=Object.assign(Object.create(Re),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:G,minZoom:K,maxZoom:nt}=this.options;G&&console.time("total time");const xt=`prepare ${V.length} points`;G&&console.time(xt),this.points=V;const J=[];for(let pt=0;pt=K;pt--){const Tt=+Date.now();wt=this.trees[pt]=this._createTree(this._cluster(wt,pt)),G&&console.log("z%d: %d clusters in %dms",pt,wt.numItems,+Date.now()-Tt)}return G&&console.timeEnd("total time"),this}getClusters(V,G){let K=((V[0]+180)%360+360)%360-180;const nt=Math.max(-90,Math.min(90,V[1]));let xt=V[2]===180?180:((V[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]>=360)K=-180,xt=180;else if(K>xt){const Wt=this.getClusters([K,nt,180,J],G),Xt=this.getClusters([-180,nt,xt,J],G);return Wt.concat(Xt)}const wt=this.trees[this._limitZoom(G)],pt=wt.range(An(K),vr(J),An(xt),vr(nt)),Tt=wt.data,zt=[];for(const Wt of pt){const Xt=this.stride*Wt;zt.push(Tt[Xt+Pe]>1?mn(Tt,Xt,this.clusterProps):this.points[Tt[Xt+Ve]])}return zt}getChildren(V){const G=this._getOriginId(V),K=this._getOriginZoom(V),nt="No cluster with the specified id.",xt=this.trees[K];if(!xt)throw new Error(nt);const J=xt.data;if(G*this.stride>=J.length)throw new Error(nt);const wt=this.options.radius/(this.options.extent*Math.pow(2,K-1)),pt=xt.within(J[G*this.stride],J[G*this.stride+1],wt),Tt=[];for(const zt of pt){const Wt=zt*this.stride;J[Wt+4]===V&&Tt.push(J[Wt+Pe]>1?mn(J,Wt,this.clusterProps):this.points[J[Wt+Ve]])}if(Tt.length===0)throw new Error(nt);return Tt}getLeaves(V,G,K){const nt=[];return this._appendLeaves(nt,V,G=G||10,K=K||0,0),nt}getTile(V,G,K){const nt=this.trees[this._limitZoom(V)],xt=Math.pow(2,V),{extent:J,radius:wt}=this.options,pt=wt/J,Tt=(K-pt)/xt,zt=(K+1+pt)/xt,Wt={features:[]};return this._addTileFeatures(nt.range((G-pt)/xt,Tt,(G+1+pt)/xt,zt),nt.data,G,K,xt,Wt),G===0&&this._addTileFeatures(nt.range(1-pt/xt,Tt,1,zt),nt.data,xt,K,xt,Wt),G===xt-1&&this._addTileFeatures(nt.range(0,Tt,pt/xt,zt),nt.data,-1,K,xt,Wt),Wt.features.length?Wt:null}getClusterExpansionZoom(V){let G=this._getOriginZoom(V)-1;for(;G<=this.options.maxZoom;){const K=this.getChildren(V);if(G++,K.length!==1)break;V=K[0].properties.cluster_id}return G}_appendLeaves(V,G,K,nt,xt){const J=this.getChildren(G);for(const wt of J){const pt=wt.properties;if(pt&&pt.cluster?xt+pt.point_count<=nt?xt+=pt.point_count:xt=this._appendLeaves(V,pt.cluster_id,K,nt,xt):xt1;let zt,Wt,Xt;if(Tt)zt=gn(G,pt,this.clusterProps),Wt=G[pt],Xt=G[pt+1];else{const Ge=this.points[G[pt+Ve]];zt=Ge.properties;const[je,bn]=Ge.geometry.coordinates;Wt=An(je),Xt=vr(bn)}const Te={type:1,geometry:[[Math.round(this.options.extent*(Wt*xt-K)),Math.round(this.options.extent*(Xt*xt-nt))]],tags:zt};let Ae;Ae=Tt||this.options.generateId?G[pt+Ve]:this.points[G[pt+Ve]].id,Ae!==void 0&&(Te.id=Ae),J.features.push(Te)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,G){const{radius:K,extent:nt,reduce:xt,minPoints:J}=this.options,wt=K/(nt*Math.pow(2,G)),pt=V.data,Tt=[],zt=this.stride;for(let Wt=0;WtG&&(je+=pt[jn+Pe])}if(je>Ge&&je>=J){let bn,jn=Xt*Ge,or=Te*Ge,Zr=-1;const nn=((Wt/zt|0)<<5)+(G+1)+this.points.length;for(const xr of Ae){const ei=xr*zt;if(pt[ei+2]<=G)continue;pt[ei+2]=G;const Ji=pt[ei+Pe];jn+=pt[ei]*Ji,or+=pt[ei+1]*Ji,pt[ei+4]=nn,xt&&(bn||(bn=this._map(pt,Wt,!0),Zr=this.clusterProps.length,this.clusterProps.push(bn)),xt(bn,this._map(pt,ei)))}pt[Wt+4]=nn,Tt.push(jn/je,or/je,1/0,nn,-1,je),xt&&Tt.push(Zr)}else{for(let bn=0;bn1)for(const bn of Ae){const jn=bn*zt;if(!(pt[jn+2]<=G)){pt[jn+2]=G;for(let or=0;or>5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,G,K){if(V[G+Pe]>1){const J=this.clusterProps[V[G+un]];return K?Object.assign({},J):J}const nt=this.points[V[G+Ve]].properties,xt=this.options.map(nt);return K&&xt===nt?Object.assign({},xt):xt}}function mn(st,V,G){return{type:"Feature",id:st[V+Ve],properties:gn(st,V,G),geometry:{type:"Point",coordinates:[(K=st[V],360*(K-.5)),Pr(st[V+1])]}};var K}function gn(st,V,G){const K=st[V+Pe],nt=K>=1e4?`${Math.round(K/1e3)}k`:K>=1e3?Math.round(K/100)/10+"k":K,xt=st[V+un],J=xt===-1?{}:Object.assign({},G[xt]);return Object.assign(J,{cluster:!0,cluster_id:st[V+Ve],point_count:K,point_count_abbreviated:nt})}function An(st){return st/360+.5}function vr(st){const V=Math.sin(st*Math.PI/180),G=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return G<0?0:G>1?1:G}function Pr(st){const V=(180-360*st)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}function br(st,V,G,K){for(var nt,xt=K,J=G-V>>1,wt=G-V,pt=st[V],Tt=st[V+1],zt=st[G],Wt=st[G+1],Xt=V+3;Xtxt)nt=Xt,xt=Te;else if(Te===xt){var Ae=Math.abs(Xt-J);AeK&&(nt-V>3&&br(st,V,nt,K),st[nt+2]=xt,G-nt>3&&br(st,nt,G,K))}function hr(st,V,G,K,nt,xt){var J=nt-G,wt=xt-K;if(J!==0||wt!==0){var pt=((st-G)*J+(V-K)*wt)/(J*J+wt*wt);pt>1?(G=nt,K=xt):pt>0&&(G+=J*pt,K+=wt*pt)}return(J=st-G)*J+(wt=V-K)*wt}function Qt(st,V,G,K){var nt={id:st===void 0?null:st,type:V,geometry:G,tags:K,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(xt){var J=xt.geometry,wt=xt.type;if(wt==="Point"||wt==="MultiPoint"||wt==="LineString")mt(xt,J);else if(wt==="Polygon"||wt==="MultiLineString")for(var pt=0;pt0&&(J+=K?(nt*Tt-pt*xt)/2:Math.sqrt(Math.pow(pt-nt,2)+Math.pow(Tt-xt,2))),nt=pt,xt=Tt}var zt=V.length-3;V[2]=1,br(V,0,zt,G),V[zt+2]=1,V.size=Math.abs(J),V.start=0,V.end=V.size}function At(st,V,G,K){for(var nt=0;nt1?1:G}function on(st,V,G,K,nt,xt,J,wt){if(K/=V,xt>=(G/=V)&&J=K)return null;for(var pt=[],Tt=0;Tt=G&&Ae=K)){var Ge=[];if(Xt==="Point"||Xt==="MultiPoint")Kn(Wt,Ge,G,K,nt);else if(Xt==="LineString")Lo(Wt,Ge,G,K,nt,!1,wt.lineMetrics);else if(Xt==="MultiLineString")Os(Wt,Ge,G,K,nt,!1);else if(Xt==="Polygon")Os(Wt,Ge,G,K,nt,!0);else if(Xt==="MultiPolygon")for(var je=0;je=G&&J<=K&&(V.push(st[xt]),V.push(st[xt+1]),V.push(st[xt+2]))}}function Lo(st,V,G,K,nt,xt,J){for(var wt,pt,Tt=ps(st),zt=nt===0?Li:vl,Wt=st.start,Xt=0;XtG&&(pt=zt(Tt,Te,Ae,je,bn,G),J&&(Tt.start=Wt+wt*pt)):jn>K?or=G&&(pt=zt(Tt,Te,Ae,je,bn,G),Zr=!0),or>K&&jn<=K&&(pt=zt(Tt,Te,Ae,je,bn,K),Zr=!0),!xt&&Zr&&(J&&(Tt.end=Wt+wt*pt),V.push(Tt),Tt=ps(st)),J&&(Wt+=wt)}var nn=st.length-3;Te=st[nn],Ae=st[nn+1],Ge=st[nn+2],(jn=nt===0?Te:Ae)>=G&&jn<=K&&Ba(Tt,Te,Ae,Ge),nn=Tt.length-3,xt&&nn>=3&&(Tt[nn]!==Tt[0]||Tt[nn+1]!==Tt[1])&&Ba(Tt,Tt[0],Tt[1],Tt[2]),Tt.length&&V.push(Tt)}function ps(st){var V=[];return V.size=st.size,V.start=st.start,V.end=st.end,V}function Os(st,V,G,K,nt,xt){for(var J=0;JJ.maxX&&(J.maxX=zt),Wt>J.maxY&&(J.maxY=Wt)}return J}function Hr(st,V,G,K){var nt=V.geometry,xt=V.type,J=[];if(xt==="Point"||xt==="MultiPoint")for(var wt=0;wt0&&V.size<(nt?J:K))G.numPoints+=V.length/3;else{for(var wt=[],pt=0;ptJ)&&(G.numSimplified++,wt.push(V[pt]),wt.push(V[pt+1])),G.numPoints++;nt&&function(Tt,zt){for(var Wt=0,Xt=0,Te=Tt.length,Ae=Te-2;Xt0===zt)for(Xt=0,Te=Tt.length;Xt24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");var K=function(nt,xt){var J=[];if(nt.type==="FeatureCollection")for(var wt=0;wt1&&console.time("creation"),Xt=this.tiles[Wt]=bl(st,V,G,K,pt),this.tileCoords.push({z:V,x:G,y:K}),Tt)){Tt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,G,K,Xt.numFeatures,Xt.numPoints,Xt.numSimplified),console.timeEnd("creation"));var Te="z"+V;this.stats[Te]=(this.stats[Te]||0)+1,this.total++}if(Xt.source=st,nt){if(V===pt.maxZoom||V===nt)continue;var Ae=1<1&&console.time("clipping");var Ge,je,bn,jn,or,Zr,nn=.5*pt.buffer/pt.extent,xr=.5-nn,ei=.5+nn,Ji=1+nn;Ge=je=bn=jn=null,or=on(st,zt,G-nn,G+ei,0,Xt.minX,Xt.maxX,pt),Zr=on(st,zt,G+xr,G+Ji,0,Xt.minX,Xt.maxX,pt),st=null,or&&(Ge=on(or,zt,K-nn,K+ei,1,Xt.minY,Xt.maxY,pt),je=on(or,zt,K+xr,K+Ji,1,Xt.minY,Xt.maxY,pt),or=null),Zr&&(bn=on(Zr,zt,K-nn,K+ei,1,Xt.minY,Xt.maxY,pt),jn=on(Zr,zt,K+xr,K+Ji,1,Xt.minY,Xt.maxY,pt),Zr=null),Tt>1&&console.timeEnd("clipping"),wt.push(Ge||[],V+1,2*G,2*K),wt.push(je||[],V+1,2*G,2*K+1),wt.push(bn||[],V+1,2*G+1,2*K),wt.push(jn||[],V+1,2*G+1,2*K+1)}}},Qe.prototype.getTile=function(st,V,G){var K=this.options,nt=K.extent,xt=K.debug;if(st<0||st>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",st,V,G);for(var pt,Tt=st,zt=V,Wt=G;!pt&&Tt>0;)Tt--,zt=Math.floor(zt/2),Wt=Math.floor(Wt/2),pt=this.tiles[Ke(Tt,zt,Wt)];return pt&&pt.source?(xt>1&&console.log("found parent tile z%d-%d-%d",Tt,zt,Wt),xt>1&&console.time("drilling down"),this.splitTile(pt.source,Tt,zt,Wt,st,V,G),xt>1&&console.timeEnd("drilling down"),this.tiles[wt]?Ko(this.tiles[wt],nt):null):null};class ma extends I{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(V,G){return h._(this,void 0,void 0,function*(){const K=V.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const nt=this._geoJSONIndex.getTile(K.z,K.x,K.y);if(!nt)return null;const xt=new class{constructor(wt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=h.W,this.length=wt.length,this._features=wt}feature(wt){return new class{constructor(pt){this._feature=pt,this.extent=h.W,this.type=pt.type,this.properties=pt.tags,"id"in pt&&!isNaN(pt.id)&&(this.id=parseInt(pt.id,10))}loadGeometry(){if(this._feature.type===1){const pt=[];for(const Tt of this._feature.geometry)pt.push([new h.P(Tt[0],Tt[1])]);return pt}{const pt=[];for(const Tt of this._feature.geometry){const zt=[];for(const Wt of Tt)zt.push(new h.P(Wt[0],Wt[1]));pt.push(zt)}return pt}}toGeoJSON(pt,Tt,zt){return X.call(this,pt,Tt,zt)}}(this._features[wt])}}(nt.features);let J=Gt(xt);return J.byteOffset===0&&J.byteLength===J.buffer.byteLength||(J=new Uint8Array(J)),{vectorTile:xt,rawData:J.buffer}})}loadData(V){return h._(this,void 0,void 0,function*(){var G;(G=this._pendingRequest)===null||G===void 0||G.abort();const K=!!(V&&V.request&&V.request.collectResourceTiming)&&new h.bs(V.request);this._pendingRequest=new AbortController;try{let nt=yield this.loadGeoJSON(V,this._pendingRequest);if(delete this._pendingRequest,typeof nt!="object")throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(Z(nt,!0),V.filter){const J=h.by(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(pt=>`${pt.key}: ${pt.message}`).join(", "));nt={type:"FeatureCollection",features:nt.features.filter(pt=>J.value.evaluate({zoom:0},pt))}}this._geoJSONIndex=V.cluster?new Cn(function({superclusterOptions:J,clusterProperties:wt}){if(!wt||!J)return J;const pt={},Tt={},zt={accumulated:null,zoom:0},Wt={properties:null},Xt=Object.keys(wt);for(const Te of Xt){const[Ae,Ge]=wt[Te],je=h.by(Ge),bn=h.by(typeof Ae=="string"?[Ae,["accumulated"],["get",Te]]:Ae);pt[Te]=je.value,Tt[Te]=bn.value}return J.map=Te=>{Wt.properties=Te;const Ae={};for(const Ge of Xt)Ae[Ge]=pt[Ge].evaluate(zt,Wt);return Ae},J.reduce=(Te,Ae)=>{Wt.properties=Ae;for(const Ge of Xt)zt.accumulated=Te[Ge],Te[Ge]=Tt[Ge].evaluate(zt,Wt)},J}(V)).load(nt.features):function(J,wt){return new Qe(J,wt)}(nt,V.geojsonVtOptions),this.loaded={};const xt={};if(K){const J=K.finish();J&&(xt.resourceTiming={},xt.resourceTiming[V.source]=JSON.parse(JSON.stringify(J)))}return xt}catch(nt){if(delete this._pendingRequest,h.bz(nt))return{abandoned:!0};throw nt}})}reloadTile(V){const G=this.loaded;return G&&G[V.uid]?super.reloadTile(V):this.loadTile(V)}loadGeoJSON(V,G){return h._(this,void 0,void 0,function*(){const{promoteId:K}=V;if(V.request){const nt=yield h.h(V.request,G);return this._dataUpdateable=Jo(nt.data,K)?Xe(nt.data,K):void 0,nt.data}if(typeof V.data=="string")try{const nt=JSON.parse(V.data);return this._dataUpdateable=Jo(nt,K)?Xe(nt,K):void 0,nt}catch{throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`)}if(!V.dataDiff)throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${V.source}`);return function(nt,xt,J){var wt,pt,Tt,zt;if(xt.removeAll&&nt.clear(),xt.remove)for(const Wt of xt.remove)nt.delete(Wt);if(xt.add)for(const Wt of xt.add){const Xt=Ar(Wt,J);Xt!=null&&nt.set(Xt,Wt)}if(xt.update)for(const Wt of xt.update){let Xt=nt.get(Wt.id);if(Xt==null)continue;const Te=!Wt.removeAllProperties&&(((wt=Wt.removeProperties)===null||wt===void 0?void 0:wt.length)>0||((pt=Wt.addOrUpdateProperties)===null||pt===void 0?void 0:pt.length)>0);if((Wt.newGeometry||Wt.removeAllProperties||Te)&&(Xt=Object.assign({},Xt),nt.set(Wt.id,Xt),Te&&(Xt.properties=Object.assign({},Xt.properties))),Wt.newGeometry&&(Xt.geometry=Wt.newGeometry),Wt.removeAllProperties)Xt.properties={};else if(((Tt=Wt.removeProperties)===null||Tt===void 0?void 0:Tt.length)>0)for(const Ae of Wt.removeProperties)Object.prototype.hasOwnProperty.call(Xt.properties,Ae)&&delete Xt.properties[Ae];if(((zt=Wt.addOrUpdateProperties)===null||zt===void 0?void 0:zt.length)>0)for(const{key:Ae,value:Ge}of Wt.addOrUpdateProperties)Xt.properties[Ae]=Ge}}(this._dataUpdateable,V.dataDiff,K),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(V){return h._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(V){return this._geoJSONIndex.getClusterExpansionZoom(V.clusterId)}getClusterChildren(V){return this._geoJSONIndex.getChildren(V.clusterId)}getClusterLeaves(V){return this._geoJSONIndex.getLeaves(V.clusterId,V.limit,V.offset)}}class zr{constructor(V){this.self=V,this.actor=new h.C(V),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(G,K)=>{if(this.externalWorkerSourceTypes[G])throw new Error(`Worker source with name "${G}" already registered.`);this.externalWorkerSourceTypes[G]=K},this.self.addProtocol=h.bf,this.self.removeProtocol=h.bg,this.self.registerRTLTextPlugin=G=>{if(h.bA.isParsed())throw new Error("RTL text plugin already registered.");h.bA.setMethods(G)},this.actor.registerMessageHandler("LDT",(G,K)=>this._getDEMWorkerSource(G,K.source).loadTile(K)),this.actor.registerMessageHandler("RDT",(G,K)=>h._(this,void 0,void 0,function*(){this._getDEMWorkerSource(G,K.source).removeTile(K)})),this.actor.registerMessageHandler("GCEZ",(G,K)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(G,K.type,K.source).getClusterExpansionZoom(K)})),this.actor.registerMessageHandler("GCC",(G,K)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(G,K.type,K.source).getClusterChildren(K)})),this.actor.registerMessageHandler("GCL",(G,K)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(G,K.type,K.source).getClusterLeaves(K)})),this.actor.registerMessageHandler("LD",(G,K)=>this._getWorkerSource(G,K.type,K.source).loadData(K)),this.actor.registerMessageHandler("LT",(G,K)=>this._getWorkerSource(G,K.type,K.source).loadTile(K)),this.actor.registerMessageHandler("RT",(G,K)=>this._getWorkerSource(G,K.type,K.source).reloadTile(K)),this.actor.registerMessageHandler("AT",(G,K)=>this._getWorkerSource(G,K.type,K.source).abortTile(K)),this.actor.registerMessageHandler("RMT",(G,K)=>this._getWorkerSource(G,K.type,K.source).removeTile(K)),this.actor.registerMessageHandler("RS",(G,K)=>h._(this,void 0,void 0,function*(){if(!this.workerSources[G]||!this.workerSources[G][K.type]||!this.workerSources[G][K.type][K.source])return;const nt=this.workerSources[G][K.type][K.source];delete this.workerSources[G][K.type][K.source],nt.removeSource!==void 0&&nt.removeSource(K)})),this.actor.registerMessageHandler("RM",G=>h._(this,void 0,void 0,function*(){delete this.layerIndexes[G],delete this.availableImages[G],delete this.workerSources[G],delete this.demWorkerSources[G]})),this.actor.registerMessageHandler("SR",(G,K)=>h._(this,void 0,void 0,function*(){this.referrer=K})),this.actor.registerMessageHandler("SRPS",(G,K)=>this._syncRTLPluginState(G,K)),this.actor.registerMessageHandler("IS",(G,K)=>h._(this,void 0,void 0,function*(){this.self.importScripts(K)})),this.actor.registerMessageHandler("SI",(G,K)=>this._setImages(G,K)),this.actor.registerMessageHandler("UL",(G,K)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(G).update(K.layers,K.removedIds)})),this.actor.registerMessageHandler("SL",(G,K)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(G).replace(K)}))}_setImages(V,G){return h._(this,void 0,void 0,function*(){this.availableImages[V]=G;for(const K in this.workerSources[V]){const nt=this.workerSources[V][K];for(const xt in nt)nt[xt].availableImages=G}})}_syncRTLPluginState(V,G){return h._(this,void 0,void 0,function*(){if(h.bA.isParsed())return h.bA.getState();if(G.pluginStatus!=="loading")return h.bA.setState(G),G;const K=G.pluginURL;if(this.self.importScripts(K),h.bA.isParsed()){const nt={pluginStatus:"loaded",pluginURL:K};return h.bA.setState(nt),nt}throw h.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${K}`)})}_getAvailableImages(V){let G=this.availableImages[V];return G||(G=[]),G}_getLayerIndex(V){let G=this.layerIndexes[V];return G||(G=this.layerIndexes[V]=new u),G}_getWorkerSource(V,G,K){if(this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][G]||(this.workerSources[V][G]={}),!this.workerSources[V][G][K]){const nt={sendAsync:(xt,J)=>(xt.targetMapId=V,this.actor.sendAsync(xt,J))};switch(G){case"vector":this.workerSources[V][G][K]=new I(nt,this._getLayerIndex(V),this._getAvailableImages(V));break;case"geojson":this.workerSources[V][G][K]=new ma(nt,this._getLayerIndex(V),this._getAvailableImages(V));break;default:this.workerSources[V][G][K]=new this.externalWorkerSourceTypes[G](nt,this._getLayerIndex(V),this._getAvailableImages(V))}}return this.workerSources[V][G][K]}_getDEMWorkerSource(V,G){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][G]||(this.demWorkerSources[V][G]=new P),this.demWorkerSources[V][G]}}return h.i(self)&&(self.worker=new zr(self)),zr}),i("index",["exports","./shared"],function(h,u){var y="4.1.3";let w,S;const I={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((s,f)=>{const d=requestAnimationFrame(s);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),f(u.c())})}),getImageData(_,s=0){return this.getImageCanvasContext(_).getImageData(-s,-s,_.width+2*s,_.height+2*s)},getImageCanvasContext(_){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=_.width,s.height=_.height,f.drawImage(_,0,0,_.width,_.height),f},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class P{static testProp(s){if(!P.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",P.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,d){const m=f.boundingClientRect;return new u.P((d.clientX-m.left)/f.x-s.clientLeft,(d.clientY-m.top)/f.y-s.clientTop)}static mousePos(s,f){const d=P.getScale(s);return P.getPoint(s,d,f)}static touchPos(s,f){const d=[],m=P.getScale(s);for(let v=0;v{s=[],f=0,d=0,m={}},_.addThrottleControl=M=>{const k=d++;return m[k]=M,k},_.removeThrottleControl=M=>{delete m[M],C()},_.getImage=(M,k,O=!0)=>new Promise((F,W)=>{z.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),u.e(M,{type:"image"}),s.push({abortController:k,requestParameters:M,supportImageRefresh:O,state:"queued",onError:it=>{W(it)},onSuccess:it=>{F(it)}}),C()});const v=M=>u._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:k,supportImageRefresh:O,onError:F,onSuccess:W,abortController:it}=M,rt=O===!1&&!u.i(self)&&!u.g(k.url)&&(!k.headers||Object.keys(k.headers).reduce((vt,Rt)=>vt&&Rt==="accept",!0));f++;const at=rt?T(k,it):u.m(k,it);try{const vt=yield at;delete M.abortController,M.state="completed",vt.data instanceof HTMLImageElement||u.b(vt.data)?W(vt):vt.data&&W({data:yield($=vt.data,typeof createImageBitmap=="function"?u.d($):u.f($)),cacheControl:vt.cacheControl,expires:vt.expires})}catch(vt){delete M.abortController,F(vt)}finally{f--,C()}var $}),C=()=>{const M=(()=>{for(const k of Object.keys(m))if(m[k]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let k=f;k0;k++){const O=s.shift();O.abortController.signal.aborted?k--:v(O)}},T=(M,k)=>new Promise((O,F)=>{const W=new Image,it=M.url,rt=M.credentials;rt&&rt==="include"?W.crossOrigin="use-credentials":(rt&&rt==="same-origin"||!u.s(it))&&(W.crossOrigin="anonymous"),k.signal.addEventListener("abort",()=>{W.src="",F(u.c())}),W.fetchPriority="high",W.onload=()=>{W.onerror=W.onload=null,O({data:W})},W.onerror=()=>{W.onerror=W.onload=null,k.signal.aborted||F(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},W.src=it})}(q||(q={})),q.resetRequestQueue();class Y{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,d){const m=function(v){const C=v.match(lt);if(!C)throw new Error(`Unable to parse URL "${v}"`);return{protocol:C[1],authority:C[2],path:C[3]||"/",params:C[4]?C[4].split("&"):[]}}(s);return m.path+=`${f}${d}`,function(v){const C=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${C}`}(m)}setTransformRequest(s){this._transformRequestFn=s}}const lt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function dt(_){var s=new u.A(3);return s[0]=_[0],s[1]=_[1],s[2]=_[2],s}var ut,ft=function(_,s,f){return _[0]=s[0]-f[0],_[1]=s[1]-f[1],_[2]=s[2]-f[2],_};ut=new u.A(3),u.A!=Float32Array&&(ut[0]=0,ut[1]=0,ut[2]=0);var _t=function(_){var s=_[0],f=_[1];return s*s+f*f};function kt(_){const s=[];if(typeof _=="string")s.push({id:"default",url:_});else if(_&&_.length>0){const f=[];for(const{id:d,url:m}of _){const v=`${d}${m}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:d,url:m}))}}return s}(function(){var _=new u.A(2);u.A!=Float32Array&&(_[0]=0,_[1]=0)})();class Q{constructor(s,f,d,m){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(f,m)}update(s,f,d){const{width:m,height:v}=s,C=!(this.size&&this.size[0]===m&&this.size[1]===v||d),{context:T}=this,{gl:M}=T;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),T.pixelStoreUnpackFlipY.set(!1),T.pixelStoreUnpack.set(1),T.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[m,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,m,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:k,y:O}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,k,O,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,k,O,m,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,d){const{context:m}=this,{gl:v}=m;v.bindTexture(v.TEXTURE_2D,this.texture),d!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,d||s),this.filter=s),f!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,f),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,f),this.wrap=f)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function yt(_){const{userImage:s}=_;return!!(s&&s.render&&s.render())&&(_.data.replace(new Uint8Array(s.data.buffer)),!0)}class Kt extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:f,promiseResolve:d}of this.requestors)d(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const d=f.spriteData;f.data=new u.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),f.spriteData=null}return f}addImage(s,f){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,f)&&(this.images[s]=f)}_validate(s,f){let d=!0;const m=f.data||f.spriteData;return this._validateStretch(f.stretchX,m&&m.width)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(f.stretchY,m&&m.height)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(f.content,f)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,f){if(!s)return!0;let d=0;for(const m of s){if(m[0]{let m=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(m=!1);this.isLoaded()||m?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const d of s){let m=this.getImage(d);m||(this.fire(new u.k("styleimagemissing",{id:d})),m=this.getImage(d)),m?f[d]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:u.w(`Image "${d}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return f}getPixelSize(){const{width:s,height:f}=this.atlasImage;return{width:s,height:f}}getPattern(s){const f=this.patterns[s],d=this.getImage(s);if(!d)return null;if(f&&f.position.version===d.version)return f.position;if(f)f.position.version=d.version;else{const m={w:d.data.width+2,h:d.data.height+2,x:0,y:0},v=new u.I(m,d);this.patterns[s]={bin:m,position:v}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const f=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Q(s,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const v in this.patterns)s.push(this.patterns[v].bin);const{w:f,h:d}=u.p(s),m=this.atlasImage;m.resize({width:f||1,height:d||1});for(const v in this.patterns){const{bin:C}=this.patterns[v],T=C.x+1,M=C.y+1,k=this.getImage(v).data,O=k.width,F=k.height;u.R.copy(k,m,{x:0,y:0},{x:T,y:M},{width:O,height:F}),u.R.copy(k,m,{x:0,y:F-1},{x:T,y:M-1},{width:O,height:1}),u.R.copy(k,m,{x:0,y:0},{x:T,y:M+F},{width:O,height:1}),u.R.copy(k,m,{x:O-1,y:0},{x:T-1,y:M},{width:1,height:F}),u.R.copy(k,m,{x:0,y:0},{x:T+O,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const d=this.getImage(f);d||u.w(`Image with ID: "${f}" was not found`),yt(d)&&this.updateImage(f,d)}}}const bt=1e20;function Ut(_,s,f,d,m,v,C,T,M){for(let k=s;k-1);M++,v[M]=T,C[M]=k,C[M+1]=bt}for(let T=0,M=0;T65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[v])return{stack:s,id:f,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[v]){const T=Gt.loadGlyphRange(s,v,this.url,this.requestManager);d.requests[v]=T}const C=yield d.requests[v];for(const T in C)this._doesCharSupportLocalGlyph(+T)||(d.glyphs[+T]=C[+T]);return d.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](s)||u.u["Hangul Syllables"](s)||u.u.Hiragana(s)||u.u.Katakana(s))}_tinySDF(s,f,d){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(d))return;let v=s.tinySDF;if(!v){let T="400";/bold/i.test(f)?T="900":/medium/i.test(f)?T="500":/light/i.test(f)&&(T="200"),v=s.tinySDF=new Gt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:T})}const C=v.draw(String.fromCharCode(d));return{id:d,bitmap:new u.o({width:C.width||60,height:C.height||60},C.data),metrics:{width:C.glyphWidth/2||24,height:C.glyphHeight/2||24,left:C.glyphLeft/2+.5||0,top:C.glyphTop/2-27.5||-8,advance:C.glyphAdvance/2||24,isDoubleResolution:!0}}}}Gt.loadGlyphRange=function(_,s,f,d){return u._(this,void 0,void 0,function*(){const m=256*s,v=m+255,C=d.transformRequest(f.replace("{fontstack}",_).replace("{range}",`${m}-${v}`),"Glyphs"),T=yield u.l(C,new AbortController);if(!T||!T.data)throw new Error(`Could not load glyph range. range: ${s}, ${m}-${v}`);const M={};for(const k of u.n(T.data))M[k.id]=k;return M})},Gt.TinySDF=class{constructor({fontSize:_=24,buffer:s=3,radius:f=8,cutoff:d=.25,fontFamily:m="sans-serif",fontWeight:v="normal",fontStyle:C="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=f;const T=this.size=_+4*s,M=this._createCanvas(T),k=this.ctx=M.getContext("2d",{willReadFrequently:!0});k.font=`${C} ${v} ${_}px ${m}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(T*T),this.gridInner=new Float64Array(T*T),this.f=new Float64Array(T),this.z=new Float64Array(T+1),this.v=new Uint16Array(T)}_createCanvas(_){const s=document.createElement("canvas");return s.width=s.height=_,s}draw(_){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:d,actualBoundingBoxLeft:m,actualBoundingBoxRight:v}=this.ctx.measureText(_),C=Math.ceil(f),T=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-m))),M=Math.min(this.size-this.buffer,C+Math.ceil(d)),k=T+2*this.buffer,O=M+2*this.buffer,F=Math.max(k*O,0),W=new Uint8ClampedArray(F),it={data:W,width:k,height:O,glyphWidth:T,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(T===0||M===0)return it;const{ctx:rt,buffer:at,gridInner:$,gridOuter:vt}=this;rt.clearRect(at,at,T,M),rt.fillText(_,at,at+C);const Rt=rt.getImageData(at,at,T,M);vt.fill(bt,0,F),$.fill(0,0,F);for(let ct=0;ct0?Ht*Ht:0,$[Ft]=Ht<0?Ht*Ht:0}}Ut(vt,0,0,k,O,k,this.f,this.v,this.z),Ut($,at,at,T,M,k,this.f,this.v,this.z);for(let ct=0;ct1&&(M=s[++T]);const O=Math.abs(k-M.left),F=Math.abs(k-M.right),W=Math.min(O,F);let it;const rt=v/d*(m+1);if(M.isDash){const at=m-Math.abs(rt);it=Math.sqrt(W*W+at*at)}else it=m-Math.sqrt(W*W+rt*rt);this.data[C+k]=Math.max(0,Math.min(255,it+128))}}}addRegularDash(s){for(let T=s.length-1;T>=0;--T){const M=s[T],k=s[T+1];M.zeroLength?s.splice(T,1):k&&k.isDash===M.isDash&&(k.left=M.left,s.splice(T,1))}const f=s[0],d=s[s.length-1];f.isDash===d.isDash&&(f.left=d.left-this.width,d.right=f.right+this.width);const m=this.width*this.nextRow;let v=0,C=s[v];for(let T=0;T1&&(C=s[++v]);const M=Math.abs(T-C.left),k=Math.abs(T-C.right),O=Math.min(M,k);this.data[m+T]=Math.max(0,Math.min(255,(C.isDash?O:-O)+128))}}addDash(s,f){const d=f?7:0,m=2*d+1;if(this.nextRow+m>this.height)return u.w("LineAtlas out of space"),null;let v=0;for(let T=0;T{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Pe]}numActive(){return Object.keys(this.active).length}}const Cn=Math.floor(I.hardwareConcurrency/2);let mn,gn;function An(){return mn||(mn=new un),mn}un.workerCount=u.B(globalThis)?Math.max(Math.min(Cn,3),1):1;class vr{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const d=this.workerPool.acquire(f);for(let m=0;m{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const d of this.actors)d.registerMessageHandler(s,f)}}function Pr(){return gn||(gn=new vr(An(),u.G),gn.registerMessageHandler("GR",(_,s,f)=>u.m(s,f))),gn}function br(_,s){const f=u.F();return u.H(f,f,[1,1,0]),u.J(f,f,[.5*_.width,.5*_.height,1]),u.K(f,f,_.calculatePosMatrix(s.toUnwrapped()))}function hr(_,s,f,d,m,v){const C=function(F,W,it){if(F)for(const rt of F){const at=W[rt];if(at&&at.source===it&&at.type==="fill-extrusion")return!0}else for(const rt in W){const at=W[rt];if(at.source===it&&at.type==="fill-extrusion")return!0}return!1}(m&&m.layers,s,_.id),T=v.maxPitchScaleFactor(),M=_.tilesIn(d,T,C);M.sort(Qt);const k=[];for(const F of M)k.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,_._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,m,v,T,br(_.transform,F.tileID))});const O=function(F){const W={},it={};for(const rt of F){const at=rt.queryResults,$=rt.wrappedTileID,vt=it[$]=it[$]||{};for(const Rt in at){const ct=at[Rt],Et=vt[Rt]=vt[Rt]||{},Nt=W[Rt]=W[Rt]||[];for(const Ft of ct)Et[Ft.featureIndex]||(Et[Ft.featureIndex]=!0,Nt.push(Ft))}}return W}(k);for(const F in O)O[F].forEach(W=>{const it=W.feature,rt=_.getFeatureState(it.layer["source-layer"],it.id);it.source=it.layer.source,it.layer["source-layer"]&&(it.sourceLayer=it.layer["source-layer"]),it.state=rt});return O}function Qt(_,s){const f=_.tileID,d=s.tileID;return f.overscaledZ-d.overscaledZ||f.canonical.y-d.canonical.y||f.wrap-d.wrap||f.canonical.x-d.canonical.x}function mt(_,s,f){return u._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield u.h(s.transformRequest(_.url,"Source"),f)).data:yield I.frameAsync(f),!d)return null;const m=u.L(u.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(m.vectorLayerIds=d.vector_layers.map(v=>v.id)),m})}class Ct{constructor(s,f){s&&(f?this.setSouthWest(s).setNorthEast(f):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}extend(s){const f=this._sw,d=this._ne;let m,v;if(s instanceof u.M)m=s,v=s;else{if(!(s instanceof Ct))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Ct.convert(s)):this.extend(u.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(u.M.convert(s)):this;if(m=s._sw,v=s._ne,!m||!v)return this}return f||d?(f.lng=Math.min(m.lng,f.lng),f.lat=Math.min(m.lat,f.lat),d.lng=Math.max(v.lng,d.lng),d.lat=Math.max(v.lat,d.lat)):(this._sw=new u.M(m.lng,m.lat),this._ne=new u.M(v.lng,v.lat)),this}getCenter(){return new u.M((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new u.M(this.getWest(),this.getNorth())}getSouthEast(){return new u.M(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(s){const{lng:f,lat:d}=u.M.convert(s);let m=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&m}static convert(s){return s instanceof Ct?s:s&&new Ct(s)}static fromLngLat(s,f=0){const d=360*f/40075017,m=d/Math.cos(Math.PI/180*s.lat);return new Ct(new u.M(s.lng-m,s.lat-d),new u.M(s.lng+m,s.lat+d))}}class Ie{constructor(s,f,d){this.bounds=Ct.convert(this.validateBounds(s)),this.minzoom=f||0,this.maxzoom=d||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const f=Math.pow(2,s.z),d=Math.floor(u.N(this.bounds.getWest())*f),m=Math.floor(u.O(this.bounds.getNorth())*f),v=Math.ceil(u.N(this.bounds.getEast())*f),C=Math.ceil(u.O(this.bounds.getSouth())*f);return s.x>=d&&s.x=m&&s.y{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(f,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};d.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((v,C)=>{s.reloadPromise={resolve:v,reject:C}})}else s.actor=this.dispatcher.getActor(),m="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:m,data:d},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,v)}catch(v){if(delete s.abortController,s.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,f){if(f&&f.resourceTiming&&(s.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&s.setExpiryData(f),s.loadVectorData(f,this.map.painter),s.reloadPromise){const d=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(d.resolve).catch(d.reject)}}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class At extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},f),u.e(this,u.L(f,["url","scheme","tileSize"]))}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield mt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(u.e(this,s),s.bounds&&(this.tileBounds=new Ie(s.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new u.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return u.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const d=yield q.getImage(this.map._requestManager.transformRequest(f,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&s.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const m=this.map.painter.context,v=m.gl,C=d.data;s.texture=this.map.painter.getTileTexture(C.width),s.texture?s.texture.update(C,{useMipmap:!0}):(s.texture=new Q(m,C,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),s.state="loaded"}}catch(d){if(delete s.abortController,s.aborted)s.state="unloaded";else if(d)throw s.state="errored",d}})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class Ze extends At{constructor(s,f,d,m){super(s,f,d,m),this.type="raster-dem",this.maxzoom=22,this._options=u.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const m=yield q.getImage(d,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){const v=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const C=u.b(v)&&u.S()?v:yield this.readImageNow(v),T={type:this.type,uid:s.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:T});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}readImageNow(s){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.U()){const f=s.width+2,d=s.height+2;try{return new u.R({width:f,height:d},yield u.V(s,-1,-1,f,d))}catch{}}return I.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,d=Math.pow(2,f.z),m=(f.x-1+d)%d,v=f.x===0?s.wrap-1:s.wrap,C=(f.x+1+d)%d,T=f.x+1===d?s.wrap+1:s.wrap,M={};return M[new u.Q(s.overscaledZ,v,f.z,m,f.y).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y).key]={backfilled:!1},f.y>0&&(M[new u.Q(s.overscaledZ,v,f.z,m,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y-1).key]={backfilled:!1}),f.y+10&&u.e(v,{resourceTiming:m}),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new u.k("dataabort",{dataType:"source"}));this.fire(new u.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const d={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;const m=yield this.actor.sendAsync({type:f,data:d},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(m,this.map.painter,f==="RT")})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var on=u.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Kn extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=f}load(s){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield q.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,s&&(this.coordinates=s),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new u.j(f))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const f=s.map(u.Y.fromLngLat);this.tileID=function(m){let v=1/0,C=1/0,T=-1/0,M=-1/0;for(const W of m)v=Math.min(v,W.x),C=Math.min(C,W.y),T=Math.max(T,W.x),M=Math.max(M,W.y);const k=Math.max(T-v,M-C),O=Math.max(0,Math.floor(-Math.log(k)/Math.LN2)),F=Math.pow(2,O);return new u.a0(O,Math.floor((v+T)/2*F),Math.floor((C+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const d=f.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new u.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,u.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,u.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,u.W,u.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Q(s,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Lo extends Kn{constructor(s,f,d,m){super(s,f,d,m),this.roundZoom=!0,this.type="video",this.options=f}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const f of s.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield u.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new u.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const f=this.video.seekable;sf.end(0)?this.fire(new u.j(new u.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new Q(s,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ps extends Kn{constructor(s,f,d,m){super(s,f,d,m),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(C=>typeof C!="number"))||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new u.j(new u.a1(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return u._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new u.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,d=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Q(f,this.canvas,d.RGBA,{premultiply:!0});let m=!1;for(const v in this.tiles){const C=this.tiles[v];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,m=!0)}m&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const Os={},Ba=_=>{switch(_){case"geojson":return Mr;case"image":return Kn;case"raster":return At;case"raster-dem":return Ze;case"vector":return kn;case"video":return Lo;case"canvas":return ps}return Os[_]},Li="RTLPluginLoaded";class vl extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Pr()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return u._(this,arguments,void 0,function*(f,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=I.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!d)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return u._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.k(Li))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ds=null;function re(){return ds||(ds=new vl),ds}class Ko{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=u.a3(),this.uses=0,this.tileSize=f,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(s){const f=s+this.timeAdded;fv.getLayer(k)).filter(Boolean);if(M.length!==0){T.layers=M,T.stateDependentLayerIds&&(T.stateDependentLayers=T.stateDependentLayerIds.map(k=>M.filter(O=>O.id===k)[0]));for(const k of M)C[k.id]=T}}return C}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5){if(this.hasSymbolBuckets=!0,!d)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5&&v.hasRTLText){this.hasRTLText=!0,re().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const v=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(m).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new u.a4}unloadVectorData(){for(const s in this.buckets)this.buckets[s].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(s){return this.buckets[s.id]}upload(s){for(const d in this.buckets){const m=this.buckets[d];m.uploadPending()&&m.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Q(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Q(s,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,f,d,m,v,C,T,M,k,O){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:v,scale:C,tileSize:this.tileSize,pixelPosMatrix:O,transform:M,params:T,queryPadding:this.queryPadding*k},s,f,d):{}}querySourceFeatures(s,f){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const m=d.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",C=m._geojsonTileLayer||m[v];if(!C)return;const T=u.a6(f&&f.filter),{z:M,x:k,y:O}=this.tileID.canonical,F={z:M,x:k,y:O};for(let W=0;Wd)m=!1;else if(f)if(this.expirationTime{this.remove(s,v)},d)),this.data[m].push(v),this.order.push(m),this.order.length>this.max){const C=this._getAndRemoveByKey(this.order[0]);C&&this.onRemove(C)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const f=this.data[s].shift();return f.timeout&&clearTimeout(f.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),f.value}getByKey(s){const f=this.data[s];return f?f[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,f){if(!this.has(s))return this;const d=s.wrapped().key,m=f===void 0?0:this.data[d].indexOf(f),v=this.data[d][m];return this.data[d].splice(m,1),v.timeout&&clearTimeout(v.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(v.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(s){const f=[];for(const d in this.data)for(const m of this.data[d])s(m.value)||f.push(m);for(const d of f)this.remove(d.value.tileID,d)}}class bl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,d){const m=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][m]=this.stateChanges[s][m]||{},u.e(this.stateChanges[s][m],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==m&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][m]===null){this.deletedStates[s][m]={};for(const v in this.state[s][m])d[v]||(this.deletedStates[s][m][v]=null)}else for(const v in d)this.deletedStates[s]&&this.deletedStates[s][m]&&this.deletedStates[s][m][v]===null&&delete this.deletedStates[s][m][v]}removeFeatureState(s,f,d){if(this.deletedStates[s]===null)return;const m=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&f!==void 0)this.deletedStates[s][m]!==null&&(this.deletedStates[s][m]=this.deletedStates[s][m]||{},this.deletedStates[s][m][d]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][m])for(d in this.deletedStates[s][m]={},this.stateChanges[s][m])this.deletedStates[s][m][d]=null;else this.deletedStates[s][m]=null;else this.deletedStates[s]=null}getState(s,f){const d=String(f),m=u.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const v=this.deletedStates[s][f];if(v===null)return{};for(const C in v)delete m[C]}return m}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const d={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const v={};for(const C in this.stateChanges[m])this.state[m][C]||(this.state[m][C]={}),u.e(this.state[m][C],this.stateChanges[m][C]),v[C]=this.state[m][C];d[m]=v}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const v={};if(this.deletedStates[m]===null)for(const C in this.state[m])v[C]={},this.state[m][C]={};else for(const C in this.deletedStates[m]){if(this.deletedStates[m][C]===null)this.state[m][C]={};else for(const T of Object.keys(this.deletedStates[m][C]))delete this.state[m][C][T];v[C]=this.state[m][C]}d[m]=d[m]||{},u.e(d[m],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const m in s)s[m].setFeatureState(d,f)}}class Hr extends u.E{constructor(s,f,d){super(),this.id=s,this.dispatcher=d,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,v,C,T)=>{const M=new(Ba(v.type))(m,v,C,T);if(M.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${M.id}`);return M})(s,f,d,this),this._tiles={},this._cache=new Ki(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new bl,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const s in this._tiles){const f=this._tiles[s];if(f.state!=="loaded"&&f.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,f,d){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,d)}catch(m){s.state="errored",m.status!==404?this._source.fire(new u.j(m,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new u.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const d=this._tiles[f];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(ae).map(s=>s.key)}getRenderableIds(s){const f=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&f.push(this._tiles[d]);return s?f.sort((d,m)=>{const v=d.tileID,C=m.tileID,T=new u.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new u.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-C.overscaledZ||M.y-T.y||M.x-T.x}).map(d=>d.tileID.key):f.map(d=>d.tileID).sort(ae).map(d=>d.key)}hasRenderableParent(s){const f=this.findLoadedParent(s,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(s,f){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(f||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,f){return u._(this,void 0,void 0,function*(){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=f),yield this._loadTile(d,s,f))})}_tileLoaded(s,f,d){s.timeAdded=I.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(f,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new u.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let m=0;m1||(Math.abs(C)>1&&(Math.abs(C+M)===1?C+=M:Math.abs(C-M)===1&&(C-=M)),v.dem&&m.dem&&(m.dem.backfillBorder(v.dem,C,T),m.neighboringTiles&&m.neighboringTiles[k]&&(m.neighboringTiles[k].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,d,m){for(const v in this._tiles){let C=this._tiles[v];if(m[v]||!C.hasData()||C.tileID.overscaledZ<=f||C.tileID.overscaledZ>d)continue;let T=C.tileID;for(;C&&C.tileID.overscaledZ>f+1;){const k=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[k.key],C&&C.hasData()&&(T=k)}let M=T;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){m[T.key]=T;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=f?d:null}for(let d=s.overscaledZ-1;d>=f;d--){const m=s.scaledTo(d),v=this._getLoadedTile(m);if(v)return v}}_getLoadedTile(s){const f=this._tiles[s.key];return f&&f.hasData()?f:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const f=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,m=Math.floor(f*d*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(v)}handleWrapJump(s){const f=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,f){const d={};for(const m in this._tiles){const v=this._tiles[m];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),d[v.tileID.key]=v}this._tiles=d;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}update(s,f){if(!this._sourceLoaded||this._paused)return;let d;this.transform=s,this.terrain=f,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(O=>new u.Q(O.canonical.z,O.wrap,O.canonical.z,O.canonical.x,O.canonical.y)):(d=s.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:f}),this._source.hasTile&&(d=d.filter(O=>this._source.hasTile(O)))):d=[];const m=s.coveringZoomLevel(this._source),v=Math.max(m-Hr.maxOverzooming,this._source.minzoom),C=Math.max(m+Hr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const O={};for(const F of d)if(F.canonical.z>this._source.minzoom){const W=F.scaledTo(F.canonical.z-1);O[W.key]=W;const it=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));O[it.key]=it}d=d.concat(Object.values(O))}const T=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,T&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,m);if(Qe(this._source.type)){const O={},F={},W=Object.keys(M),it=I.now();for(const rt of W){const at=M[rt],$=this._tiles[rt];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=it)continue;const vt=this.findLoadedParent(at,v);vt&&(this._addTile(vt.tileID),O[vt.tileID.key]=vt.tileID),F[rt]=at}this._retainLoadedChildren(F,m,C,M);for(const rt in O)M[rt]||(this._coveredTiles[rt]=!0,M[rt]=O[rt]);if(f){const rt={},at={};for(const $ of d)this._tiles[$.key].hasData()?rt[$.key]=$:at[$.key]=$;for(const $ in at){const vt=at[$].children(this._source.maxzoom);this._tiles[vt[0].key]&&this._tiles[vt[1].key]&&this._tiles[vt[2].key]&&this._tiles[vt[3].key]&&(rt[vt[0].key]=M[vt[0].key]=vt[0],rt[vt[1].key]=M[vt[1].key]=vt[1],rt[vt[2].key]=M[vt[2].key]=vt[2],rt[vt[3].key]=M[vt[3].key]=vt[3],delete at[$])}for(const $ in at){const vt=this.findLoadedParent(at[$],this._source.minzoom);if(vt){rt[vt.tileID.key]=M[vt.tileID.key]=vt.tileID;for(const Rt in rt)rt[Rt].isChildOf(vt.tileID)&&delete rt[Rt]}}for(const $ in this._tiles)rt[$]||(this._coveredTiles[$]=!0)}}for(const O in M)this._tiles[O].clearFadeHold();const k=u.ab(this._tiles,M);for(const O of k){const F=this._tiles[O];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(O)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,f){const d={},m={},v=Math.max(f-Hr.maxOverzooming,this._source.minzoom),C=Math.max(f+Hr.maxUnderzooming,this._source.minzoom),T={};for(const M of s){const k=this._addTile(M);d[M.key]=M,k.hasData()||fthis._source.maxzoom){const F=M.children(this._source.maxzoom)[0],W=this.getTile(F);if(W&&W.hasData()){d[F.key]=F;continue}}else{const F=M.children(this._source.maxzoom);if(d[F[0].key]&&d[F[1].key]&&d[F[2].key]&&d[F[3].key])continue}let O=k.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const W=M.scaledTo(F);if(m[W.key])break;if(m[W.key]=!0,k=this.getTile(W),!k&&O&&(k=this._addTile(W)),k){const it=k.hasData();if((O||it)&&(d[W.key]=W),O=k.wasRequested(),it)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let d,m=this._tiles[s].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){d=this._loadedParentTiles[m.key];break}f.push(m.key);const v=m.scaledTo(m.overscaledZ-1);if(d=this._getLoadedTile(v),d)break;m=v}for(const v of f)this._loadedParentTiles[v]=d}}_addTile(s){let f=this._tiles[s.key];if(f)return f;f=this._cache.getAndRemove(s),f&&(this._setTileReloadTimer(s.key,f),f.tileID=s,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,f)));const d=f;return f||(f=new Ko(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,d||this._source.fire(new u.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(s,f){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=f.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const f=this._tiles[s];f&&(f.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(s){const f=s.sourceDataType;s.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,f,d){const m=[],v=this.transform;if(!v)return m;const C=d?v.getCameraQueryGeometry(s):s,T=s.map(rt=>v.pointCoordinate(rt,this.terrain)),M=C.map(rt=>v.pointCoordinate(rt,this.terrain)),k=this.getIds();let O=1/0,F=1/0,W=-1/0,it=-1/0;for(const rt of M)O=Math.min(O,rt.x),F=Math.min(F,rt.y),W=Math.max(W,rt.x),it=Math.max(it,rt.y);for(let rt=0;rt=0&&ct[1].y+Rt>=0){const Et=T.map(Ft=>$.getTilePoint(Ft)),Nt=M.map(Ft=>$.getTilePoint(Ft));m.push({tile:at,tileID:$,queryGeometry:Et,cameraQueryGeometry:Nt,scale:vt})}}return m}getVisibleCoordinates(s){const f=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of f)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(Qe(this._source.type)){const s=I.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=s)return!0}return!1}setFeatureState(s,f,d){this._state.updateState(s=s||"_geojsonTileLayer",f,d)}removeFeatureState(s,f,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",f,d)}getFeatureState(s,f){return this._state.getState(s=s||"_geojsonTileLayer",f)}setDependencies(s,f,d){const m=this._tiles[s];m&&m.setDependencies(f,d)}reloadTilesForDependencies(s,f){for(const d in this._tiles)this._tiles[d].hasDependency(s,f)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,f))}}function ae(_,s){const f=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return _.overscaledZ-s.overscaledZ||d-f||s.canonical.y-_.canonical.y||s.canonical.x-_.canonical.x}function Qe(_){return _==="raster"||_==="image"||_==="video"}Hr.maxOverzooming=10,Hr.maxUnderzooming=3;class Ke{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let d=1;d0?(m-C)/T:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Ar(_,s){let f=!0;return _==="always"||_!=="never"&&s!=="never"||(f=!1),f}class Jo{constructor(s,f,d){const m=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(f/d);for(let C=0;Cthis.width||m<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=d&&this.height<=m){if(v)return[{key:null,x1:s,y1:f,x2:d,y2:m}];for(let k=0;k0}hitTestCircle(s,f,d,m,v){const C=s-d,T=s+d,M=f-d,k=f+d;if(T<0||C>this.width||k<0||M>this.height)return!1;const O=[];return this._forEachCell(C,M,T,k,this._queryCellCircle,O,{hitTest:!0,overlapMode:m,circle:{x:s,y:f,radius:d},seenUids:{box:{},circle:{}}},v),O.length>0}_queryCell(s,f,d,m,v,C,T,M){const{seenUids:k,hitTest:O,overlapMode:F}=T,W=this.boxCells[v];if(W!==null){const rt=this.bboxes;for(const at of W)if(!k.box[at]){k.box[at]=!0;const $=4*at,vt=this.boxKeys[at];if(s<=rt[$+2]&&f<=rt[$+3]&&d>=rt[$+0]&&m>=rt[$+1]&&(!M||M(vt))&&(!O||!Ar(F,vt.overlapMode))&&(C.push({key:vt,x1:rt[$],y1:rt[$+1],x2:rt[$+2],y2:rt[$+3]}),O))return!0}}const it=this.circleCells[v];if(it!==null){const rt=this.circles;for(const at of it)if(!k.circle[at]){k.circle[at]=!0;const $=3*at,vt=this.circleKeys[at];if(this._circleAndRectCollide(rt[$],rt[$+1],rt[$+2],s,f,d,m)&&(!M||M(vt))&&(!O||!Ar(F,vt.overlapMode))){const Rt=rt[$],ct=rt[$+1],Et=rt[$+2];if(C.push({key:vt,x1:Rt-Et,y1:ct-Et,x2:Rt+Et,y2:ct+Et}),O)return!0}}}return!1}_queryCellCircle(s,f,d,m,v,C,T,M){const{circle:k,seenUids:O,overlapMode:F}=T,W=this.boxCells[v];if(W!==null){const rt=this.bboxes;for(const at of W)if(!O.box[at]){O.box[at]=!0;const $=4*at,vt=this.boxKeys[at];if(this._circleAndRectCollide(k.x,k.y,k.radius,rt[$+0],rt[$+1],rt[$+2],rt[$+3])&&(!M||M(vt))&&!Ar(F,vt.overlapMode))return C.push(!0),!0}}const it=this.circleCells[v];if(it!==null){const rt=this.circles;for(const at of it)if(!O.circle[at]){O.circle[at]=!0;const $=3*at,vt=this.circleKeys[at];if(this._circlesCollide(rt[$],rt[$+1],rt[$+2],k.x,k.y,k.radius)&&(!M||M(vt))&&!Ar(F,vt.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,d,m,v,C,T,M){const k=this._convertToXCellCoord(s),O=this._convertToYCellCoord(f),F=this._convertToXCellCoord(d),W=this._convertToYCellCoord(m);for(let it=k;it<=F;it++)for(let rt=O;rt<=W;rt++)if(v.call(this,s,f,d,m,this.xCellCount*rt+it,C,T,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,f,d,m,v,C){const T=m-s,M=v-f,k=d+C;return k*k>T*T+M*M}_circleAndRectCollide(s,f,d,m,v,C,T){const M=(C-m)/2,k=Math.abs(s-(m+M));if(k>M+d)return!1;const O=(T-v)/2,F=Math.abs(f-(v+O));if(F>O+d)return!1;if(k<=M||F<=O)return!0;const W=k-M,it=F-O;return W*W+it*it<=d*d}}function Xe(_,s,f,d,m){const v=u.F();return s?(u.J(v,v,[1/m,1/m,1]),f||u.ad(v,v,d.angle)):u.K(v,d.labelPlaneMatrix,_),v}function ma(_,s,f,d,m){if(s){const v=u.ae(_);return u.J(v,v,[m,m,1]),f||u.ad(v,v,-d.angle),v}return d.glCoordMatrix}function zr(_,s,f){let d;f?(d=[_.x,_.y,f(_.x,_.y),1],u.af(d,d,s)):(d=[_.x,_.y,0,1],Te(d,d,s));const m=d[3];return{point:new u.P(d[0]/m,d[1]/m),signedDistanceFromCamera:m}}function st(_,s){return .5+_/s*.5}function V(_,s){const f=_[0]/_[3],d=_[1]/_[3];return f>=-s[0]&&f<=s[0]&&d>=-s[1]&&d<=s[1]}function G(_,s,f,d,m,v,C,T,M,k){const O=d?_.textSizeData:_.iconSizeData,F=u.ag(O,f.transform.zoom),W=[256/f.width*2+1,256/f.height*2+1],it=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;it.clear();const rt=_.lineVertexArray,at=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,$=f.transform.width/f.transform.height;let vt=!1;for(let Rt=0;RtMath.abs(f.x-s.x)*d?{useVertical:!0}:(_===u.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function xt(_,s,f,d,m,v,C,T,M,k,O,F,W,it,rt,at){const $=s/24,vt=_.lineOffsetX*$,Rt=_.lineOffsetY*$;let ct;if(_.numGlyphs>1){const Et=_.glyphStartIndex+_.numGlyphs,Nt=_.lineStartIndex,Ft=_.lineStartIndex+_.lineLength,Ht=K($,T,vt,Rt,f,O,F,_,M,v,W,rt,at);if(!Ht)return{notEnoughRoom:!0};const te=zr(Ht.first.point,C,at).point,$t=zr(Ht.last.point,C,at).point;if(d&&!f){const oe=nt(_.writingMode,te,$t,it);if(oe)return oe}ct=[Ht.first];for(let oe=_.glyphStartIndex+1;oe0?te.point:J(F,Ht,Nt,1,m,at),oe=nt(_.writingMode,Nt,$t,it);if(oe)return oe}const Et=zt($*T.getoffsetX(_.glyphStartIndex),vt,Rt,f,O,F,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,M,v,W,rt,at);if(!Et)return{notEnoughRoom:!0};ct=[Et]}for(const Et of ct)u.aj(k,Et.point,Et.angle);return{}}function J(_,s,f,d,m,v){const C=zr(_.add(_.sub(s)._unit()),m,v).point,T=f.sub(C);return f.add(T._mult(d/T.mag()))}function wt(_,s){const{projectionCache:f,lineVertexArray:d,labelPlaneMatrix:m,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:T,previousVertex:M,direction:k,absOffsetX:O}=s;if(f.projections[_])return f.projections[_];const F=new u.P(d.getx(_),d.gety(_)),W=zr(F,m,T);if(W.signedDistanceFromCamera>0)return f.projections[_]=W.point,W.point;const it=_-k;return J(C===0?v:new u.P(d.getx(it),d.gety(it)),F,M,O-C+1,m,T)}function pt(_,s,f){return _._unit()._perp()._mult(s*f)}function Tt(_,s,f,d,m,v,C,T){const{projectionCache:M,direction:k}=T;if(M.offsets[_])return M.offsets[_];const O=f.add(s);if(_+k=m)return M.offsets[_]=O,O;const F=wt(_+k,T),W=pt(F.sub(f),C,k),it=f.add(W),rt=F.add(W);return M.offsets[_]=u.ak(v,O,it,rt)||O,M.offsets[_]}function zt(_,s,f,d,m,v,C,T,M,k,O,F,W,it){const rt=d?_-s:_+s;let at=rt>0?1:-1,$=0;d&&(at*=-1,$=Math.PI),at<0&&($+=Math.PI);let vt,Rt,ct=at>0?T+C:T+C+1,Et=m,Nt=m,Ft=0,Ht=0;const te=Math.abs(rt),$t=[];let oe;for(;Ft+Ht<=te;){if(ct+=at,ct=M)return null;Ft+=Ht,Nt=Et,Rt=vt;const ue={projectionCache:F,lineVertexArray:k,labelPlaneMatrix:O,tileAnchorPoint:v,distanceFromAnchor:Ft,getElevation:it,previousVertex:Nt,direction:at,absOffsetX:te};if(Et=wt(ct,ue),f===0)$t.push(Nt),oe=Et.sub(Nt);else{let ze;const tn=Et.sub(Nt);ze=tn.mag()===0?pt(wt(ct+at,ue).sub(Et),f,at):pt(tn,f,at),Rt||(Rt=Nt.add(ze)),vt=Tt(ct,ze,Et,T,M,Rt,f,ue),$t.push(Rt),oe=vt.sub(Rt)}Ht=oe.mag()}const le=oe._mult((te-Ft)/Ht)._add(Rt||Nt),$e=$+Math.atan2(Et.y-Nt.y,Et.x-Nt.x);return $t.push(le),{point:le,angle:W?$e:0,path:$t}}const Wt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xt(_,s){for(let f=0;f<_;f++){const d=s.length;s.resize(d+4),s.float32.set(Wt,3*d)}}function Te(_,s,f){const d=s[0],m=s[1];return _[0]=f[0]*d+f[4]*m+f[12],_[1]=f[1]*d+f[5]*m+f[13],_[3]=f[3]*d+f[7]*m+f[15],_}const Ae=100;class Ge{constructor(s,f=new Jo(s.width+200,s.height+200,25),d=new Jo(s.width+200,s.height+200,25)){this.transform=s,this.grid=f,this.ignoredGrid=d,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Ae,this.screenBottomBoundary=s.height+Ae,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,f,d,m,v,C){const T=this.projectAndGetPerspectiveRatio(m,s.anchorPointX,s.anchorPointY,C),M=d*T.perspectiveRatio,k=s.x1*M+T.point.x,O=s.y1*M+T.point.y,F=s.x2*M+T.point.x,W=s.y2*M+T.point.y;return!this.isInsideGrid(k,O,F,W)||f!=="always"&&this.grid.hitTest(k,O,F,W,f,v)||T.perspectiveRatio=1;rn--)tn.push(ue.path[rn]);for(let rn=1;rnzr(cn,M,rt));tn=rn.some(cn=>cn.signedDistanceFromCamera<=0)?[]:rn.map(cn=>cn.point)}let Ue=[];if(tn.length>0){const rn=tn[0].clone(),cn=tn[0].clone();for(let Er=1;Er=oe.x&&cn.x<=le.x&&rn.y>=oe.y&&cn.y<=le.y?[tn]:cn.xle.x||cn.yle.y?[]:u.al([tn],oe.x,oe.y,le.x,le.y)}for(const rn of Ue){$e.reset(rn,.25*$t);let cn=0;cn=$e.length<=.5*$t?1:Math.ceil($e.paddedLength/wn)+1;for(let Er=0;Er=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(s,f,d,m){return d>=0&&s=0&&fd.collisionGroupID===f}}return this.collisionGroups[s]}}function ei(_,s,f,d,m){const{horizontalAlign:v,verticalAlign:C}=u.at(_);return new u.P(-(v-.5)*s+d[0]*m,-(C-.5)*f+d[1]*m)}function Ji(_,s,f,d,m,v){const{x1:C,x2:T,y1:M,y2:k,anchorPointX:O,anchorPointY:F}=_,W=new u.P(s,f);return d&&W._rotate(m?v:-v),{x1:C+W.x,y1:M+W.y,x2:T+W.x,y2:k+W.y,anchorPointX:O,anchorPointY:F}}class co{constructor(s,f,d,m,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Ge(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new xr(m),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,d,m){const v=d.getBucket(f),C=d.latestFeatureIndex;if(!v||!C||f.id!==v.layerIds[0])return;const T=d.collisionBoxArray,M=v.layers[0].layout,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),O=d.tileSize/u.W,F=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),W=M.get("text-pitch-alignment")==="map",it=M.get("text-rotation-alignment")==="map",rt=je(d,1,this.transform.zoom),at=Xe(F,W,it,this.transform,rt);let $=null;if(W){const Rt=ma(F,W,it,this.transform,rt);$=u.K([],this.transform.labelPlaneMatrix,Rt)}this.retainedQueryData[v.bucketInstanceId]=new nn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,d.tileID);const vt={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:at,labelToScreenMatrix:$,scale:k,textPixelRatio:O,holdingForFade:d.holdingForFade(),collisionBoxArray:T,partiallyEvaluatedTextSize:u.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(m)for(const Rt of v.sortKeyRanges){const{sortKey:ct,symbolInstanceStart:Et,symbolInstanceEnd:Nt}=Rt;s.push({sortKey:ct,symbolInstanceStart:Et,symbolInstanceEnd:Nt,parameters:vt})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:vt})}attemptAnchorPlacement(s,f,d,m,v,C,T,M,k,O,F,W,it,rt,at,$){const vt=u.ap[s.textAnchor],Rt=[s.textOffset0,s.textOffset1],ct=ei(vt,d,m,Rt,v),Et=this.collisionIndex.placeCollisionBox(Ji(f,ct.x,ct.y,C,T,this.transform.angle),F,M,k,O.predicate,$);if((!at||this.collisionIndex.placeCollisionBox(Ji(at,ct.x,ct.y,C,T,this.transform.angle),F,M,k,O.predicate,$).box.length!==0)&&Et.box.length>0){let Nt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID].text&&(Nt=this.prevPlacement.variableOffsets[W.crossTileID].anchor),W.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[W.crossTileID]={textOffset:Rt,width:d,height:m,anchor:vt,textBoxScale:v,prevAnchor:Nt},this.markUsedJustification(it,vt,W,rt),it.allowVerticalPlacement&&(this.markUsedOrientation(it,rt,W),this.placedOrientations[W.crossTileID]=rt),{shift:ct,placedGlyphBoxes:Et}}}placeLayerBucketPart(s,f,d){const{bucket:m,layout:v,posMatrix:C,textLabelPlaneMatrix:T,labelToScreenMatrix:M,textPixelRatio:k,holdingForFade:O,collisionBoxArray:F,partiallyEvaluatedTextSize:W,collisionGroup:it}=s.parameters,rt=v.get("text-optional"),at=v.get("icon-optional"),$=u.aq(v,"text-overlap","text-allow-overlap"),vt=$==="always",Rt=u.aq(v,"icon-overlap","icon-allow-overlap"),ct=Rt==="always",Et=v.get("text-rotation-alignment")==="map",Nt=v.get("text-pitch-alignment")==="map",Ft=v.get("icon-text-fit")!=="none",Ht=v.get("symbol-z-order")==="viewport-y",te=vt&&(ct||!m.hasIconData()||at),$t=ct&&(vt||!m.hasTextData()||rt);!m.collisionArrays&&F&&m.deserializeCollisionBoxes(F);const oe=this.retainedQueryData[m.bucketInstanceId].tileID,le=this.terrain?(ue,ze)=>this.terrain.getElevation(oe,ue,ze):null,$e=(ue,ze)=>{var tn,wn;if(f[ue.crossTileID])return;if(O)return void(this.placements[ue.crossTileID]=new or(!1,!1,!1));let Ue=!1,rn=!1,cn=!0,Er=null,Gn={box:null,offscreen:null},ko={box:null,offscreen:null},ni=null,pr=null,ri=null,Do=0,Gs=0,Ha=0;ze.textFeatureIndex?Do=ze.textFeatureIndex:ue.useRuntimeCollisionCircles&&(Do=ue.featureIndex),ze.verticalTextFeatureIndex&&(Gs=ze.verticalTextFeatureIndex);const dc=ze.textBox;if(dc){const Yr=Kr=>{let mr=u.ah.horizontal;if(m.allowVerticalPlacement&&!Kr&&this.prevPlacement){const es=this.prevPlacement.placedOrientations[ue.crossTileID];es&&(this.placedOrientations[ue.crossTileID]=es,mr=es,this.markUsedOrientation(m,mr,ue))}return mr},dr=(Kr,mr)=>{if(m.allowVerticalPlacement&&ue.numVerticalGlyphVertices>0&&ze.verticalTextBox){for(const es of m.writingModes)if(es===u.ah.vertical?(Gn=mr(),ko=Gn):Gn=Kr(),Gn&&Gn.box&&Gn.box.length)break}else Gn=Kr()},ar=ue.textAnchorOffsetStartIndex,ts=ue.textAnchorOffsetEndIndex;if(ts===ar){const Kr=(mr,es)=>{const Jr=this.collisionIndex.placeCollisionBox(mr,$,k,C,it.predicate,le);return Jr&&Jr.box&&Jr.box.length&&(this.markUsedOrientation(m,es,ue),this.placedOrientations[ue.crossTileID]=es),Jr};dr(()=>Kr(dc,u.ah.horizontal),()=>{const mr=ze.verticalTextBox;return m.allowVerticalPlacement&&ue.numVerticalGlyphVertices>0&&mr?Kr(mr,u.ah.vertical):{box:null,offscreen:null}}),Yr(Gn&&Gn.box&&Gn.box.length)}else{let Kr=u.ap[(wn=(tn=this.prevPlacement)===null||tn===void 0?void 0:tn.variableOffsets[ue.crossTileID])===null||wn===void 0?void 0:wn.anchor];const mr=(Jr,kr,Ep)=>{const Dm=Jr.x2-Jr.x1,Pl=Jr.y2-Jr.y1,Ml=ue.textBoxScale,kh=Ft&&Rt==="never"?kr:null;let Xa={box:[],offscreen:!1},Ip=$==="never"?1:2,Rm="never";Kr&&Ip++;for(let Cp=0;Cpmr(dc,ze.iconBox,u.ah.horizontal),()=>{const Jr=ze.verticalTextBox;return m.allowVerticalPlacement&&!(Gn&&Gn.box&&Gn.box.length)&&ue.numVerticalGlyphVertices>0&&Jr?mr(Jr,ze.verticalIconBox,u.ah.vertical):{box:null,offscreen:null}}),Gn&&(Ue=Gn.box,cn=Gn.offscreen);const es=Yr(Gn&&Gn.box);if(!Ue&&this.prevPlacement){const Jr=this.prevPlacement.variableOffsets[ue.crossTileID];Jr&&(this.variableOffsets[ue.crossTileID]=Jr,this.markUsedJustification(m,Jr.anchor,ue,es))}}}if(ni=Gn,Ue=ni&&ni.box&&ni.box.length>0,cn=ni&&ni.offscreen,ue.useRuntimeCollisionCircles){const Yr=m.text.placedSymbolArray.get(ue.centerJustifiedTextSymbolIndex),dr=u.ai(m.textSizeData,W,Yr),ar=v.get("text-padding");pr=this.collisionIndex.placeCollisionCircles($,Yr,m.lineVertexArray,m.glyphOffsetArray,dr,C,T,M,d,Nt,it.predicate,ue.collisionCircleDiameter,ar,le),pr.circles.length&&pr.collisionDetected&&!d&&u.w("Collisions detected, but collision boxes are not shown"),Ue=vt||pr.circles.length>0&&!pr.collisionDetected,cn=cn&&pr.offscreen}if(ze.iconFeatureIndex&&(Ha=ze.iconFeatureIndex),ze.iconBox){const Yr=dr=>{const ar=Ft&&Er?Ji(dr,Er.x,Er.y,Et,Nt,this.transform.angle):dr;return this.collisionIndex.placeCollisionBox(ar,Rt,k,C,it.predicate,le)};ko&&ko.box&&ko.box.length&&ze.verticalIconBox?(ri=Yr(ze.verticalIconBox),rn=ri.box.length>0):(ri=Yr(ze.iconBox),rn=ri.box.length>0),cn=cn&&ri.offscreen}const Za=rt||ue.numHorizontalGlyphVertices===0&&ue.numVerticalGlyphVertices===0,qs=at||ue.numIconVertices===0;if(Za||qs?qs?Za||(rn=rn&&Ue):Ue=rn&&Ue:rn=Ue=rn&&Ue,Ue&&ni&&ni.box&&this.collisionIndex.insertCollisionBox(ni.box,$,v.get("text-ignore-placement"),m.bucketInstanceId,ko&&ko.box&&Gs?Gs:Do,it.ID),rn&&ri&&this.collisionIndex.insertCollisionBox(ri.box,Rt,v.get("icon-ignore-placement"),m.bucketInstanceId,Ha,it.ID),pr&&(Ue&&this.collisionIndex.insertCollisionCircles(pr.circles,$,v.get("text-ignore-placement"),m.bucketInstanceId,Do,it.ID),d)){const Yr=m.bucketInstanceId;let dr=this.collisionCircleArrays[Yr];dr===void 0&&(dr=this.collisionCircleArrays[Yr]=new Zr);for(let ar=0;ar=0;--ze){const tn=ue[ze];$e(m.symbolInstances.get(tn),m.collisionArrays[tn])}}else for(let ue=s.symbolInstanceStart;ue=0&&(s.text.placedSymbolArray.get(T).crossTileID=v>=0&&T!==v?0:d.crossTileID)}markUsedOrientation(s,f,d){const m=f===u.ah.horizontal||f===u.ah.horizontalOnly?f:0,v=f===u.ah.vertical?f:0,C=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const T of C)s.text.placedSymbolArray.get(T).placedOrientation=m;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let d=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const m=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},C=f?f.variableOffsets:{},T=f?f.placedOrientations:{};for(const M in this.placements){const k=this.placements[M],O=v[M];O?(this.opacities[M]=new jn(O,m,k.text,k.icon),d=d||k.text!==O.text.placed||k.icon!==O.icon.placed):(this.opacities[M]=new jn(null,m,k.text,k.icon,k.skipFade),d=d||k.text||k.icon)}for(const M in v){const k=v[M];if(!this.opacities[M]){const O=new jn(k,m,!1,!1);O.isHidden()||(this.opacities[M]=O,d=d||k.text.placed||k.icon.placed)}}for(const M in C)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=C[M]);for(const M in T)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=T[M]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const d={};for(const m of f){const v=m.getBucket(s);v&&m.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,d,m.collisionBoxArray)}}updateBucketOpacities(s,f,d){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const m=s.layers[0],v=m.layout,C=new jn(null,0,!1,!1,!0),T=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),k=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),O=v.get("text-rotation-alignment")==="map",F=v.get("text-pitch-alignment")==="map",W=v.get("icon-text-fit")!=="none",it=new jn(null,0,T&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(T||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const rt=(at,$,vt)=>{for(let Rt=0;Rt<$/4;Rt++)at.opacityVertexArray.emplaceBack(vt);at.hasVisibleVertices=at.hasVisibleVertices||vt!==Hu};for(let at=0;at0,Ft=this.placedOrientations[$.crossTileID],Ht=Ft===u.ah.vertical,te=Ft===u.ah.horizontal||Ft===u.ah.horizontalOnly;if(vt>0||Rt>0){const $t=ho(Et.text);rt(s.text,vt,Ht?Hu:$t),rt(s.text,Rt,te?Hu:$t);const oe=Et.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(ue=>{ue>=0&&(s.text.placedSymbolArray.get(ue).hidden=oe||Ht?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=oe||te?1:0);const le=this.variableOffsets[$.crossTileID];le&&this.markUsedJustification(s,le.anchor,$,Ft);const $e=this.placedOrientations[$.crossTileID];$e&&(this.markUsedJustification(s,"left",$,$e),this.markUsedOrientation(s,$e,$))}if(Nt){const $t=ho(Et.icon),oe=!(W&&$.verticalPlacedIconSymbolIndex&&Ht);$.placedIconSymbolIndex>=0&&(rt(s.icon,$.numIconVertices,oe?$t:Hu),s.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=Et.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(rt(s.icon,$.numVerticalIconVertices,oe?Hu:$t),s.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=Et.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const $t=s.collisionArrays[at];if($t){let oe=new u.P(0,0);if($t.textBox||$t.verticalTextBox){let $e=!0;if(k){const ue=this.variableOffsets[ct];ue?(oe=ei(ue.anchor,ue.width,ue.height,ue.textOffset,ue.textBoxScale),O&&oe._rotate(F?this.transform.angle:-this.transform.angle)):$e=!1}$t.textBox&&mi(s.textCollisionBox.collisionVertexArray,Et.text.placed,!$e||Ht,oe.x,oe.y),$t.verticalTextBox&&mi(s.textCollisionBox.collisionVertexArray,Et.text.placed,!$e||te,oe.x,oe.y)}const le=!!(!te&&$t.verticalIconBox);$t.iconBox&&mi(s.iconCollisionBox.collisionVertexArray,Et.icon.placed,le,W?oe.x:0,W?oe.y:0),$t.verticalIconBox&&mi(s.iconCollisionBox.collisionVertexArray,Et.icon.placed,!le,W?oe.x:0,W?oe.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const at=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=at.invProjMatrix,s.placementViewportMatrix=at.viewportMatrix,s.collisionCircleArray=at.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function mi(_,s,f,d,m){_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0)}const zs=Math.pow(2,25),Kd=Math.pow(2,24),Ry=Math.pow(2,17),Vn=Math.pow(2,16),Hf=Math.pow(2,9),Zf=Math.pow(2,8),Po=Math.pow(2,1);function ho(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const s=_.placed?1:0,f=Math.floor(127*_.opacity);return f*zs+s*Kd+f*Ry+s*Vn+f*Hf+s*Zf+f*Po+s}const Hu=0;class Qo{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,f,d,m,v){const C=this._bucketParts;for(;this._currentTileIndexT.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&I.now()-m>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=T)&&(!C.maxzoom||C.maxzoom>T)){if(this._inProgressLayer||(this._inProgressLayer=new Qo(C)),this._inProgressLayer.continuePlacement(d[C.source],this.placement,this._showCollisionBoxes,C,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const nu=512/u.W/2;class Zc{constructor(s,f,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const m=new Map;for(let v=0;v({x:Math.floor(M.anchorX*nu),y:Math.floor(M.anchorY*nu)})),crossTileIDs:C.map(M=>M.crossTileID)};if(T.positions.length>128){const M=new u.au(T.positions.length,16,Uint16Array);for(const{x:k,y:O}of T.positions)M.add(k,O);M.finish(),delete T.positions,T.index=M}this._symbolsByKey[v]=T}}getScaledCoordinates(s,f){const{x:d,y:m,z:v}=this.tileID.canonical,{x:C,y:T,z:M}=f.canonical,k=nu/Math.pow(2,M-v),O=(T*u.W+s.anchorY)*k,F=m*u.W*nu;return{x:Math.floor((C*u.W+s.anchorX)*k-d*u.W*nu),y:Math.floor(O-F)}}findMatches(s,f,d){const m=this.tileID.canonical.zs)}}class Xr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Zu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const f=Math.round((s-this.lng)/360);if(f!==0)for(const d in this.indexes){const m=this.indexes[d],v={};for(const C in m){const T=m[C];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+f),v[T.tileID.key]=T}this.indexes[d]=v}this.lng=s}addBucket(s,f,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const T in C){const M=C[T];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,m)}else{const T=C[s.scaledTo(Number(v)).key];T&&T.findMatches(f.symbolInstances,s,m)}}for(let v=0;v{f[d]=!0});for(const d in this.layerIndexes)f[d]||delete this.layerIndexes[d]}}const fr=(_,s)=>u.t(_,s&&s.filter(f=>f.identifier!=="source.canvas")),Xc=u.av();class Mo extends u.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const d in this.sourceCaches){const m=this.sourceCaches[d].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[d].reload()}},this.map=s,this.dispatcher=new vr(An(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(d,m)=>this.getGlyphs(d,m)),this.dispatcher.registerMessageHandler("GI",(d,m)=>this.getImages(d,m)),this.imageManager=new Kt,this.imageManager.setEventedParent(this),this.glyphManager=new Gt(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Ve(256,512),this.crossTileSymbolIndex=new Va,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",u.ax()),re().on(Li,this._rtlPluginLoaded),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const m=this.sourceCaches[d.sourceId];if(!m)return;const v=m.getSource();if(v&&v.vectorLayerIds)for(const C in this._layers){const T=this._layers[C];T.source===v.id&&this._validateLayer(T)}})}loadURL(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const m=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,u.h(m,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,d)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new u.j(v))})}loadJSON(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,d)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(Xc,{validate:!1})}_load(s,f,d){var m;const v=f.transformStyle?f.transformStyle(d,s):s;if(!f.validate||!fr(this,u.x(v))){this._loaded=!0,this.stylesheet=v;for(const C in v.sources)this.addSource(C,v.sources[C],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new ln(this.stylesheet.light),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const s=u.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of s){const d=u.az(f);d.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=d}}_loadSprite(s,f=!1,d=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,C,T,M){return u._(this,void 0,void 0,function*(){const k=kt(v),O=T>1?"@2x":"",F={},W={};for(const{id:it,url:rt}of k){const at=C.transformRequest(C.normalizeSpriteURL(rt,O,".json"),"SpriteJSON");F[it]=u.h(at,M);const $=C.transformRequest(C.normalizeSpriteURL(rt,O,".png"),"SpriteImage");W[it]=q.getImage($,M)}return yield Promise.all([...Object.values(F),...Object.values(W)]),function(it,rt){return u._(this,void 0,void 0,function*(){const at={};for(const $ in it){at[$]={};const vt=I.getImageCanvasContext((yield rt[$]).data),Rt=(yield it[$]).data;for(const ct in Rt){const{width:Et,height:Nt,x:Ft,y:Ht,sdf:te,pixelRatio:$t,stretchX:oe,stretchY:le,content:$e}=Rt[ct];at[$][ct]={data:null,pixelRatio:$t,sdf:te,stretchX:oe,stretchY:le,content:$e,spriteData:{width:Et,height:Nt,x:Ft,y:Ht,context:vt}}}}return at})}(F,W)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const C in v){this._spritesImagesIds[C]=[];const T=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of T)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const k=C==="default"?M:`${C}:${M}`;this._spritesImagesIds[C].push(k),k in this.imageManager.images?this.imageManager.updateImage(k,v[C][M],!1):this.imageManager.addImage(k,v[C][M]),f&&(this._changedImages[k]=!0)}}}).catch(v=>{this._spriteRequest=null,m=v,this.fire(new u.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),d&&d(m)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const d=s.sourceLayer;if(!d)return;const m=f.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(d)===-1)&&this.fire(new u.j(new Error(`Source layer "${d}" does not exist on source "${m.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const d=[];for(const m of s)f[m]&&d.push(f[m]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const f=Object.keys(this._layers);for(const d of f){const m=this._layers[d];m.type!=="custom"&&(s[d]=m.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const f=this._changed;if(f){const m=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(m.length||v.length)&&this._updateWorkerLayers(m,v);for(const C in this._updatedSources){const T=this._updatedSources[C];if(T==="reload")this._reloadSource(C);else{if(T!=="clear")throw new Error(`Invalid action ${T}`);this._clearSource(C)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const C in this._updatedPaintProps)this._layers[C].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const m in this.sourceCaches){const v=this.sourceCaches[m];d[m]=v.used,v.used=!1}for(const m of this._order){const v=this._layers[m];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const m in d){const v=this.sourceCaches[m];!!d[m]!=!!v.used&&v.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new u.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,f={}){var d;this._checkLoaded();const m=this.serialize();if(s=f.transformStyle?f.transformStyle(m,s):s,((d=f.validate)===null||d===void 0||d)&&fr(this,u.x(s)))return!1;(s=u.aA(s)).layers=u.ay(s.layers);const v=u.aB(m,s),C=this._getOperationsToPerform(v);if(C.unimplemented.length>0)throw new Error(`Unimplemented: ${C.unimplemented.join(", ")}.`);if(C.operations.length===0)return!1;for(const T of C.operations)T();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],d=[];for(const m of s)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":f.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":f.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,m.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":f.push(()=>{});break;default:d.push(m.command)}return{operations:f,unimplemented:d}}addImage(s,f){if(this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,f),this._afterImageUpdated(s)}updateImage(s,f){this.imageManager.updateImage(s,f)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(u.x.source,`sources.${s}`,f,null,d))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const m=this.sourceCaches[s]=new Hr(s,f,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:s})),m.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===s)return this.fire(new u.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new u.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,f){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const d=this.sourceCaches[s].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,d={}){this._checkLoaded();const m=s.id;if(this.getLayer(m))return void this.fire(new u.j(new Error(`Layer "${m}" already exists on this map.`)));let v;if(s.type==="custom"){if(fr(this,u.aC(s)))return;v=u.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(m,s.source),s=u.aA(s),s=u.e(s,{source:m})),this._validate(u.x.layer,`layers.${m}`,s,{arrayIndex:-1},d))return;v=u.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:m}})}const C=f?this._order.indexOf(f):this._order.length;if(f&&C===-1)this.fire(new u.j(new Error(`Cannot add layer "${m}" before non-existing layer "${f}".`)));else{if(this._order.splice(C,0,m),this._layerOrderChanged=!0,this._layers[m]=v,this._removedLayers[m]&&v.source&&v.type!=="custom"){const T=this._removedLayers[m];delete this._removedLayers[m],T.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new u.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const d=this._order.indexOf(s);this._order.splice(d,1);const m=f?this._order.indexOf(f):this._order.length;f&&m===-1?this.fire(new u.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(m,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=f,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],f.onRemove&&f.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,f,d){this._checkLoaded();const m=this.getLayer(s);m?m.minzoom===f&&m.maxzoom===d||(f!=null&&(m.minzoom=f),d!=null&&(m.maxzoom=d),this._updateLayer(m)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,d={}){this._checkLoaded();const m=this.getLayer(s);if(m){if(!u.aD(m.filter,f))return f==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(u.x.filter,`layers.${m.id}.filter`,f,null,d)||(m.filter=u.aA(f),this._updateLayer(m)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return u.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getLayoutProperty(f),d)||(v.setLayoutProperty(f,d,m),this._updateLayer(v)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const d=this.getLayer(s);if(d)return d.getLayoutProperty(f);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getPaintProperty(f),d)||(v.setPaintProperty(f,d,m)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const d=s.source,m=s.sourceLayer,v=this.sourceCaches[d];if(v===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const C=v.getSource().type;C==="geojson"&&m?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||m?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(m,s.id,f)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const d=s.source,m=this.sourceCaches[d];if(m===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const v=m.getSource().type,C=v==="vector"?s.sourceLayer:void 0;v!=="vector"||C?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(C,s.id,f):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,d=s.sourceLayer,m=this.sourceCaches[f];if(m!==void 0)return m.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(d,s.id)):void this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=u.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,m=this.stylesheet;return u.aF({version:m.version,name:m.name,metadata:m.metadata,light:m.light,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:s,layers:f,terrain:d},v=>v!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const f=C=>this._layers[C].type==="fill-extrusion",d={},m=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T)){d[T]=C;for(const M of s){const k=M[T];if(k)for(const O of k)m.push(O)}}}m.sort((C,T)=>T.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T))for(let M=m.length-1;M>=0;M--){const k=m[M].feature;if(d[k.layer.id]{const te=vt.featureSortOrder;if(te){const $t=te.indexOf(Ft.featureIndex);return te.indexOf(Ht.featureIndex)-$t}return Ht.featureIndex-Ft.featureIndex});for(const Ft of Nt)Et.push(Ft)}}for(const vt in rt)rt[vt].forEach(Rt=>{const ct=Rt.feature,Et=k[T[vt].source].getFeatureState(ct.layer["source-layer"],ct.id);ct.source=ct.layer.source,ct.layer["source-layer"]&&(ct.sourceLayer=ct.layer["source-layer"]),ct.state=Et});return rt}(this._layers,C,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",f.filter,null,f);const d=this.sourceCaches[s];return d?function(m,v){const C=m.getRenderableIds().map(k=>m.getTileByID(k)),T=[],M={};for(let k=0;kW.getTileByID(it)).sort((it,rt)=>rt.tileID.overscaledZ-it.tileID.overscaledZ||(it.tileID.isLessThan(rt.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(O,M[O.source],s.center.lng);C=C||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(I.now(),s.zoom))&&(this.pauseablePlacement=new $o(s,this.map.terrain,this._order,v,f,d,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(I.now()),T=!0),C&&this.pauseablePlacement.placement.setStale()),T||C)for(const k of this._order){const O=this._layers[k];O.type==="symbol"&&this.placement.updateLayerOpacities(O,M[O.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(I.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,f.icons),d})}getGlyphs(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(f.stacks),m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(u.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,d={},m){this._checkLoaded();const v=[{id:s,url:f}],C=[...kt(this.stylesheet.sprite),...v];this._validate(u.x.sprite,"sprite",C,null,d)||(this.stylesheet.sprite=C,this._loadSprite(v,!0,m))}removeSprite(s){this._checkLoaded();const f=kt(this.stylesheet.sprite);if(f.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;f.splice(f.findIndex(d=>d.id===s),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return kt(this.stylesheet.sprite)}setSprite(s,f={},d){this._checkLoaded(),s&&this._validate(u.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}var Yc=u.X([{name:"a_pos",type:"Int16",components:2}]),Fs="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Xu={prelude:Un(`#ifdef GL_ES + */(function(e,t){(function(n,r){e.exports=r()})(Nd,function(){var n={},r={};function i(h,u,y){if(r[h]=y,h==="index"){var w="var sharedModule = {}; ("+r.shared+")(sharedModule); ("+r.worker+")(sharedModule);",S={};return r.shared(S),r.index(n,S),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([w],{type:"text/javascript"}))),n}}i("shared",["exports"],function(h){function u(l,o,c,p){return new(c||(c=Promise))(function(g,b){function x(A){try{L(p.next(A))}catch(D){b(D)}}function E(A){try{L(p.throw(A))}catch(D){b(D)}}function L(A){var D;A.done?g(A.value):(D=A.value,D instanceof c?D:new c(function(N){N(D)})).then(x,E)}L((p=p.apply(l,o||[])).next())})}function y(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}typeof SuppressedError=="function"&&SuppressedError;var w=S;function S(l,o){this.x=l,this.y=o}S.prototype={clone:function(){return new S(this.x,this.y)},add:function(l){return this.clone()._add(l)},sub:function(l){return this.clone()._sub(l)},multByPoint:function(l){return this.clone()._multByPoint(l)},divByPoint:function(l){return this.clone()._divByPoint(l)},mult:function(l){return this.clone()._mult(l)},div:function(l){return this.clone()._div(l)},rotate:function(l){return this.clone()._rotate(l)},rotateAround:function(l,o){return this.clone()._rotateAround(l,o)},matMult:function(l){return this.clone()._matMult(l)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(l){return this.x===l.x&&this.y===l.y},dist:function(l){return Math.sqrt(this.distSqr(l))},distSqr:function(l){var o=l.x-this.x,c=l.y-this.y;return o*o+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(l){return Math.atan2(this.y-l.y,this.x-l.x)},angleWith:function(l){return this.angleWithSep(l.x,l.y)},angleWithSep:function(l,o){return Math.atan2(this.x*o-this.y*l,this.x*l+this.y*o)},_matMult:function(l){var o=l[2]*this.x+l[3]*this.y;return this.x=l[0]*this.x+l[1]*this.y,this.y=o,this},_add:function(l){return this.x+=l.x,this.y+=l.y,this},_sub:function(l){return this.x-=l.x,this.y-=l.y,this},_mult:function(l){return this.x*=l,this.y*=l,this},_div:function(l){return this.x/=l,this.y/=l,this},_multByPoint:function(l){return this.x*=l.x,this.y*=l.y,this},_divByPoint:function(l){return this.x/=l.x,this.y/=l.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var l=this.y;return this.y=this.x,this.x=-l,this},_rotate:function(l){var o=Math.cos(l),c=Math.sin(l),p=c*this.x+o*this.y;return this.x=o*this.x-c*this.y,this.y=p,this},_rotateAround:function(l,o){var c=Math.cos(l),p=Math.sin(l),g=o.y+p*(this.x-o.x)+c*(this.y-o.y);return this.x=o.x+c*(this.x-o.x)-p*(this.y-o.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},S.convert=function(l){return l instanceof S?l:Array.isArray(l)?new S(l[0],l[1]):l};var I=y(w),P=z;function z(l,o,c,p){this.cx=3*l,this.bx=3*(c-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=c,this.p2y=p}z.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,o){if(o===void 0&&(o=1e-6),l<0)return 0;if(l>1)return 1;for(var c=l,p=0;p<8;p++){var g=this.sampleCurveX(c)-l;if(Math.abs(g)g?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var R=y(P);let Y,Z;function et(){return Y==null&&(Y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Y}function B(){if(Z==null&&(Z=!1,et())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const g=4*p;o.fillStyle=`rgb(${g},${g+1},${g+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const c=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&c[p]!==p){Z=!0;break}}}return Z||!1}function j(l,o,c,p){const g=new R(l,o,c,p);return function(b){return g.solve(b)}}const q=j(.25,.1,.25,1);function ct(l,o,c){return Math.min(c,Math.max(o,l))}function _t(l,o,c){const p=c-o,g=((l-o)%p+p)%p+o;return g===o?c:g}function lt(l,...o){for(const c of o)for(const p in c)l[p]=c[p];return l}let ht=1;function pt(l,o,c){const p={};for(const g in l)p[g]=o.call(c||this,l[g],g,l);return p}function Tt(l,o,c){const p={};for(const g in l)o.call(c||this,l[g],g,l)&&(p[g]=l[g]);return p}function Q(l){return Array.isArray(l)?l.map(Q):typeof l=="object"&&l?pt(l,Q):l}const gt={};function Kt(l){gt[l]||(typeof console<"u"&&console.warn(l),gt[l]=!0)}function bt(l,o,c){return(c.y-l.y)*(o.x-l.x)>(o.y-l.y)*(c.x-l.x)}function Ut(l){let o=0;for(let c,p,g=0,b=l.length,x=b-1;g"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(l,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const E=x.startsWith("BGR"),L=new Uint8ClampedArray(p*g*4);if(yield b.copyTo(L,function(A,D,N,U,W){const X=4*Math.max(-D,0),tt=(Math.max(0,N)-N)*U*4+X,ot=4*U,ft=Math.max(0,D),Pt=Math.max(0,N);return{rect:{x:ft,y:Pt,width:Math.min(A.width,D+U)-ft,height:Math.min(A.height,N+W)-Pt},layout:[{offset:tt,stride:ot}]}}(l,o,c,p,g)),E)for(let A=0;Aee(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,br=function(l,o){if(/:\/\//.test(l.url)&&!/^https?:|^file:/.test(l.url)){const p=gn(l.url);if(p)return p(l,o);if(ee(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,targetMapId:An},o)}if(!(/^file:/.test(c=l.url)||/^file:/.test(Pr())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,g){return u(this,void 0,void 0,function*(){const b=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:Pr(),signal:g.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new vr(x.status,x.statusText,p.url,A)}let E;E=p.type==="arrayBuffer"||p.type==="image"?x.arrayBuffer():p.type==="json"?x.json():x.text();const L=yield E;if(g.signal.aborted)throw Cn();return{data:L,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(l,o);if(ee(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,mustQueue:!0,targetMapId:An},o)}var c;return function(p,g){return new Promise((b,x)=>{const E=new XMLHttpRequest;E.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(E.responseType="arraybuffer");for(const L in p.headers)E.setRequestHeader(L,p.headers[L]);p.type==="json"&&(E.responseType="text",E.setRequestHeader("Accept","application/json")),E.withCredentials=p.credentials==="include",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if(!g.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let L=E.response;if(p.type==="json")try{L=JSON.parse(E.response)}catch(A){return void x(A)}b({data:L,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const L=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});x(new vr(E.status,E.statusText,p.url,L))}},g.signal.addEventListener("abort",()=>{E.abort(),x(Cn())}),E.send(p.body)})}(l,o)};function hr(l){if(!l||l.indexOf("://")<=0||l.indexOf("data:image/")===0||l.indexOf("blob:")===0)return!0;const o=new URL(l),c=window.location;return o.protocol===c.protocol&&o.host===c.host}function Qt(l,o,c){c[l]&&c[l].indexOf(o)!==-1||(c[l]=c[l]||[],c[l].push(o))}function mt(l,o,c){if(c&&c[l]){const p=c[l].indexOf(o);p!==-1&&c[l].splice(p,1)}}class Ct{constructor(o,c={}){lt(this,c),this.type=o}}class Ie extends Ct{constructor(o,c={}){super("error",lt({error:o},c))}}class kn{on(o,c){return this._listeners=this._listeners||{},Qt(o,c,this._listeners),this}off(o,c){return mt(o,c,this._listeners),mt(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},Qt(o,c,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,c){typeof o=="string"&&(o=new Ct(o,c||{}));const p=o.type;if(this.listens(p)){o.target=this;const g=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of g)E.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of b)mt(p,E,this._oneTimeListeners),E.call(this,o);const x=this._eventedParent;x&&(lt(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(o))}else o instanceof Ie&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,c){return this._eventedParent=o,this._eventedParentData=c,this}}var kt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Xe=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Mr(l,o){const c={};for(const p in l)p!=="ref"&&(c[p]=l[p]);return Xe.forEach(p=>{p in o&&(c[p]=o[p])}),c}function on(l,o){if(Array.isArray(l)){if(!Array.isArray(o)||l.length!==o.length)return!1;for(let c=0;c`:l.itemType.kind==="value"?"array":`array<${o}>`}return l.kind}const xt=[Hr,ae,Qe,Ke,Ar,zr,Jo,K(Ye),st,V,G];function J(l,o){if(o.kind==="error")return null;if(l.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!J(l.itemType,o.itemType))&&(typeof l.N!="number"||l.N===o.N))return null}else{if(l.kind===o.kind)return null;if(l.kind==="value"){for(const c of xt)if(!J(c,o))return null}}return`Expected ${nt(l)} but found ${nt(o)} instead.`}function wt(l,o){return o.some(c=>c.kind===l.kind)}function dt(l,o){return o.some(c=>c==="null"?l===null:c==="array"?Array.isArray(l):c==="object"?l&&!Array.isArray(l)&&typeof l=="object":c===typeof l)}function Lt(l,o){return l.kind==="array"&&o.kind==="array"?l.itemType.kind===o.itemType.kind&&typeof l.N=="number":l.kind===o.kind}const zt=.96422,Wt=.82521,Xt=4/29,Te=6/29,Ae=3*Te*Te,Ge=Te*Te*Te,je=Math.PI/180,bn=180/Math.PI;function jn(l){return(l%=360)<0&&(l+=360),l}function or([l,o,c,p]){let g,b;const x=nn((.2225045*(l=Zr(l))+.7168786*(o=Zr(o))+.0606169*(c=Zr(c)))/1);l===o&&o===c?g=b=x:(g=nn((.4360747*l+.3850649*o+.1430804*c)/zt),b=nn((.0139322*l+.0971045*o+.7141733*c)/Wt));const E=116*x-16;return[E<0?0:E,500*(g-x),200*(x-b),p]}function Zr(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function nn(l){return l>Ge?Math.pow(l,1/3):l/Ae+Xt}function xr([l,o,c,p]){let g=(l+16)/116,b=isNaN(o)?g:g+o/500,x=isNaN(c)?g:g-c/200;return g=1*Ji(g),b=zt*Ji(b),x=Wt*Ji(x),[ei(3.1338561*b-1.6168667*g-.4906146*x),ei(-.9787684*b+1.9161415*g+.033454*x),ei(.0719453*b-.2289914*g+1.4052427*x),p]}function ei(l){return(l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055)<0?0:l>1?1:l}function Ji(l){return l>Te?l*l*l:Ae*(l-Xt)}function co(l){return parseInt(l.padEnd(2,l),16)/255}function mi(l,o){return zs(o?l/100:l,0,1)}function zs(l,o,c){return Math.min(Math.max(o,l),c)}function Kd(l){return!l.some(Number.isNaN)}const Ry={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Vn{constructor(o,c,p,g=1,b=!0){this.r=o,this.g=c,this.b=p,this.a=g,b||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[o,c,p,g]))}static parse(o){if(o instanceof Vn)return o;if(typeof o!="string")return;const c=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=Ry[p];if(g){const[x,E,L]=g;return[x/255,E/255,L/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let E=1;return[co(p.slice(E,E+=x)),co(p.slice(E,E+=x)),co(p.slice(E,E+=x)),co(p.slice(E,E+x)||"ff")]}if(p.startsWith("rgb")){const x=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[E,L,A,D,N,U,W,X,tt,ot,ft,Pt]=x,yt=[D||" ",W||" ",ot].join("");if(yt===" "||yt===" /"||yt===",,"||yt===",,,"){const St=[A,U,tt].join(""),Yt=St==="%%%"?100:St===""?255:0;if(Yt){const Jt=[zs(+L/Yt,0,1),zs(+N/Yt,0,1),zs(+X/Yt,0,1),ft?mi(+ft,Pt):1];if(Kd(Jt))return Jt}}return}}const b=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,E,L,A,D,N,U,W,X]=b,tt=[L||" ",D||" ",U].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const ot=[+E,zs(+A,0,100),zs(+N,0,100),W?mi(+W,X):1];if(Kd(ot))return function([ft,Pt,yt,St]){function Yt(Jt){const ve=(Jt+ft/30)%12,Ce=Pt*Math.min(yt,1-yt);return yt-Ce*Math.max(-1,Math.min(ve-3,9-ve,1))}return ft=jn(ft),Pt/=100,yt/=100,[Yt(0),Yt(8),Yt(4),St]}(ot)}}}(o);return c?new Vn(...c,!1):void 0}get rgb(){const{r:o,g:c,b:p,a:g}=this,b=g||1/0;return this.overwriteGetter("rgb",[o/b,c/b,p/b,g])}get hcl(){return this.overwriteGetter("hcl",function(o){const[c,p,g,b]=or(o),x=Math.sqrt(p*p+g*g);return[Math.round(1e4*x)?jn(Math.atan2(g,p)*bn):NaN,x,c,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",or(this.rgb))}overwriteGetter(o,c){return Object.defineProperty(this,o,{value:c}),c}toString(){const[o,c,p,g]=this.rgb;return`rgba(${[o,c,p].map(b=>Math.round(255*b)).join(",")},${g})`}}Vn.black=new Vn(0,0,0,1),Vn.white=new Vn(1,1,1,1),Vn.transparent=new Vn(0,0,0,0),Vn.red=new Vn(1,0,0,1);class Hf{constructor(o,c,p){this.sensitivity=o?c?"variant":"case":c?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,c){return this.collator.compare(o,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Zf{constructor(o,c,p,g,b){this.text=o,this.image=c,this.scale=p,this.fontStack=g,this.textColor=b}}class Po{constructor(o){this.sections=o}static fromString(o){return new Po([new Zf(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Po?o:Po.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class ho{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof ho)return o;if(typeof o=="number")return new ho([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const c of o)if(typeof c!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new ho(o)}}toString(){return JSON.stringify(this.values)}}const Hu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Qo{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Qo)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let c=0;c=0&&l<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof c=="number"&&c>=0&&c<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[l,o,c,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[l,o,c,p]:[l,o,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Zc(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof Vn||l instanceof Hf||l instanceof Po||l instanceof ho||l instanceof Qo||l instanceof $o)return!0;if(Array.isArray(l)){for(const o of l)if(!Zc(o))return!1;return!0}if(typeof l=="object"){for(const o in l)if(!Zc(l[o]))return!1;return!0}return!1}function Xr(l){if(l===null)return Hr;if(typeof l=="string")return Qe;if(typeof l=="boolean")return Ke;if(typeof l=="number")return ae;if(l instanceof Vn)return Ar;if(l instanceof Hf)return ma;if(l instanceof Po)return zr;if(l instanceof ho)return st;if(l instanceof Qo)return G;if(l instanceof $o)return V;if(Array.isArray(l)){const o=l.length;let c;for(const p of l){const g=Xr(p);if(c){if(c===g)continue;c=Ye;break}c=g}return K(c||Ye,o)}return Jo}function Zu(l){const o=typeof l;return l===null?"":o==="string"||o==="number"||o==="boolean"?String(l):l instanceof Vn||l instanceof Po||l instanceof ho||l instanceof Qo||l instanceof $o?l.toString():JSON.stringify(l)}class Va{constructor(o,c){this.type=o,this.value=c}static parse(o,c){if(o.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!Zc(o[1]))return c.error("invalid value");const p=o[1];let g=Xr(p);const b=c.expectedType;return g.kind!=="array"||g.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(g=b),new Va(g,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class fr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Xc={string:Qe,number:ae,boolean:Ke,object:Jo};class Mo{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let p,g=1;const b=o[0];if(b==="array"){let E,L;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in Xc)||A==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);E=Xc[A],g++}else E=Ye;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return c.error('The length argument to "array" must be a positive integer literal',2);L=o[2],g++}p=K(E,L)}else{if(!Xc[b])throw new Error(`Types doesn't contain name = ${b}`);p=Xc[b]}const x=[];for(;go.outputDefined())}}const Yc={"to-boolean":Ke,"to-color":Ar,"to-number":ae,"to-string":Qe};class Fs{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[0];if(!Yc[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return c.error("Expected one argument.");const g=Yc[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:nu(c[0],c[1],c[2],c[3]),!p))return new Vn(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new fr(p||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(const p of this.args){c=p.evaluate(o);const g=ho.parse(c);if(g)return g}throw new fr(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(const p of this.args){c=p.evaluate(o);const g=Qo.parse(c);if(g)return g}throw new fr(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(const p of this.args){if(c=p.evaluate(o),c===null)return 0;const g=Number(c);if(!isNaN(g))return g}throw new fr(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Po.fromString(Zu(this.args[0].evaluate(o)));case"resolvedImage":return $o.fromString(Zu(this.args[0].evaluate(o)));default:return Zu(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Xu=["Unknown","Point","LineString","Polygon"];class Un{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Xu[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(o){let c=this._parseColorCache[o];return c||(c=this._parseColorCache[o]=Vn.parse(o)),c}}class Kc{constructor(o,c,p=[],g,b=new bl,x=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=g,this._isConstant=c}parse(o,c,p,g,b={}){return c?this.concat(c,p,g)._parse(o,b):this._parse(o,b)}_parse(o,c){function p(g,b,x){return x==="assert"?new Mo(b,[g]):x==="coerce"?new Fs(b,[g]):g}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=o[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[g];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,L=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||L.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string")if(E.kind!=="padding"||L.kind!=="value"&&L.kind!=="number"&&L.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||L.kind!=="value"&&L.kind!=="array"){if(this.checkSubtype(E,L))return null}else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"assert")}if(!(x instanceof Va)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new Un;try{x=new Va(x.type,x.evaluate(E))}catch(L){return this.error(L.message),null}}return x}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,c,p){const g=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new Kc(this.registry,this._isConstant,g,c||null,b,this.errors)}error(o,...c){const p=`${this.key}${c.map(g=>`[${g}]`).join("")}`;this.errors.push(new Ki(p,o))}checkSubtype(o,c){const p=J(o,c);return p&&this.error(p),p}}class ru{constructor(o,c,p){this.type=ma,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=c}static parse(o,c){if(o.length!==2)return c.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return c.error("Collator options argument must be an object.");const g=c.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Ke);if(!g)return null;const b=c.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Ke);if(!b)return null;let x=null;return p.locale&&(x=c.parse(p.locale,1,Qe),!x)?null:new ru(g,b,x)}evaluate(o){return new Hf(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}const Ua=8192;function Jc(l,o){l[0]=Math.min(l[0],o[0]),l[1]=Math.min(l[1],o[1]),l[2]=Math.max(l[2],o[0]),l[3]=Math.max(l[3],o[1])}function Yu(l,o){return!(l[0]<=o[0]||l[2]>=o[2]||l[1]<=o[1]||l[3]>=o[3])}function Ny(l,o){const c=(180+l[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,g=Math.pow(2,o.z);return[Math.round(c*g*Ua),Math.round(p*g*Ua)]}function Jd(l,o,c){const p=l[0]-o[0],g=l[1]-o[1],b=l[0]-c[0],x=l[1]-c[1];return p*x-b*g==0&&p*b<=0&&g*x<=0}function Qc(l,o){let c=!1;for(let x=0,E=o.length;x(p=l)[1]!=(b=L[A+1])[1]>p[1]&&p[0]<(b[0]-g[0])*(p[1]-g[1])/(b[1]-g[1])+g[0]&&(c=!c)}}var p,g,b;return c}function Oy(l,o){for(let c=0;c0&&E<0||x<0&&E>0}function zy(l,o,c){for(const A of c)for(let D=0;Dc[2]){const g=.5*p;let b=l[0]-c[0]>g?-p:c[0]-l[0]>g?p:0;b===0&&(b=l[0]-c[2]>g?-p:c[2]-l[0]>g?p:0),l[0]+=b}Jc(o,l)}function th(l,o,c,p){const g=Math.pow(2,p.z)*Ua,b=[p.x*Ua,p.y*Ua],x=[];for(const E of l)for(const L of E){const A=[L.x+b[0],L.y+b[1]];nm(A,o,c,g),x.push(A)}return x}function rm(l,o,c,p){const g=Math.pow(2,p.z)*Ua,b=[p.x*Ua,p.y*Ua],x=[];for(const L of l){const A=[];for(const D of L){const N=[D.x+b[0],D.y+b[1]];Jc(o,N),A.push(N)}x.push(A)}if(o[2]-o[0]<=g/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const L of x)for(const A of L)nm(A,o,c,g)}var E;return x}class xl{constructor(o,c){this.type=Ke,this.geojson=o,this.geometries=c}static parse(o,c){if(o.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(Zc(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const g=[];for(const b of p.features){const{type:x,coordinates:E}=b.geometry;x==="Polygon"&&g.push(E),x==="MultiPolygon"&&g.push(...E)}if(g.length)return new xl(p,{type:"MultiPolygon",coordinates:g})}else if(p.type==="Feature"){const g=p.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new xl(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new xl(p,p)}return c.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(c,p){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=$c(p.coordinates,b,x),L=th(c.geometry(),g,b,x);if(!Yu(g,b))return!1;for(const A of L)if(!Qc(A,E))return!1}if(p.type==="MultiPolygon"){const E=em(p.coordinates,b,x),L=th(c.geometry(),g,b,x);if(!Yu(g,b))return!1;for(const A of L)if(!Oy(A,E))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(c,p){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=$c(p.coordinates,b,x),L=rm(c.geometry(),g,b,x);if(!Yu(g,b))return!1;for(const A of L)if(!$d(A,E))return!1}if(p.type==="MultiPolygon"){const E=em(p.coordinates,b,x),L=rm(c.geometry(),g,b,x);if(!Yu(g,b))return!1;for(const A of L)if(!tm(A,E))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class eh{constructor(o,c){this.type=c.type,this.name=o,this.boundExpression=c}static parse(o,c){if(o.length!==2||typeof o[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");const p=o[1];return c.scope.has(p)?new eh(p,c.scope.get(p)):c.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Ao{constructor(o,c,p,g){this.name=o,this.type=c,this._evaluate=p,this.args=g}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,c){const p=o[0],g=Ao.definitions[p];if(!g)return c.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(g)?g[0]:g.type,x=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,E=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let L=null;for(const[A,D]of E){L=new Kc(c.registry,Ku,c.path,null,c.scope);const N=[];let U=!1;for(let W=1;W{return U=N,Array.isArray(U)?`(${U.map(nt).join(", ")})`:`(${nt(U.type)}...)`;var U}).join(" | "),D=[];for(let N=1;N{c=o?c&&Ku(p):c&&p instanceof Va}),!!c&&nh(l)&&Qu(l,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function nh(l){if(l instanceof Ao&&(l.name==="get"&&l.args.length===1||l.name==="feature-state"||l.name==="has"&&l.args.length===1||l.name==="properties"||l.name==="geometry-type"||l.name==="id"||/^filter-/.test(l.name))||l instanceof xl)return!1;let o=!0;return l.eachChild(c=>{o&&!nh(c)&&(o=!1)}),o}function Ju(l){if(l instanceof Ao&&l.name==="feature-state")return!1;let o=!0;return l.eachChild(c=>{o&&!Ju(c)&&(o=!1)}),o}function Qu(l,o){if(l instanceof Ao&&o.indexOf(l.name)>=0)return!1;let c=!0;return l.eachChild(p=>{c&&!Qu(p,o)&&(c=!1)}),c}function $u(l,o){const c=l.length-1;let p,g,b=0,x=c,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),p=l[E],g=l[E+1],p<=o){if(E===c||oo))throw new fr("Input is not a number.");x=E-1}return 0}class tc{constructor(o,c,p){this.type=o,this.input=c,this.labels=[],this.outputs=[];for(const[g,b]of p)this.labels.push(g),this.outputs.push(b)}static parse(o,c){if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");const p=c.parse(o[1],1,ae);if(!p)return null;const g=[];let b=null;c.expectedType&&c.expectedType.kind!=="value"&&(b=c.expectedType);for(let x=1;x=E)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const N=c.parse(L,D,b);if(!N)return null;b=b||N.type,g.push([E,N])}return new tc(b,p,g)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const g=this.input.evaluate(o);if(g<=c[0])return p[0].evaluate(o);const b=c.length;return g>=c[b-1]?p[b-1].evaluate(o):p[$u(c,g)].evaluate(o)}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Fy(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var By=im;function im(l,o,c,p){this.cx=3*l,this.bx=3*(c-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=c,this.p2y=p}im.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,o){if(o===void 0&&(o=1e-6),l<0)return 0;if(l>1)return 1;for(var c=l,p=0;p<8;p++){var g=this.sampleCurveX(c)-l;if(Math.abs(g)g?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var Vy=Fy(By);function wl(l,o,c){return l+c*(o-l)}function rh(l,o,c){return l.map((p,g)=>wl(p,o[g],c))}const Qi={number:wl,color:function(l,o,c,p="rgb"){switch(p){case"rgb":{const[g,b,x,E]=rh(l.rgb,o.rgb,c);return new Vn(g,b,x,E,!1)}case"hcl":{const[g,b,x,E]=l.hcl,[L,A,D,N]=o.hcl;let U,W;if(isNaN(g)||isNaN(L))isNaN(g)?isNaN(L)?U=NaN:(U=L,x!==1&&x!==0||(W=A)):(U=g,D!==1&&D!==0||(W=b));else{let Pt=L-g;L>g&&Pt>180?Pt-=360:L180&&(Pt+=360),U=g+c*Pt}const[X,tt,ot,ft]=function([Pt,yt,St,Yt]){return Pt=isNaN(Pt)?0:Pt*je,xr([St,Math.cos(Pt)*yt,Math.sin(Pt)*yt,Yt])}([U,W??wl(b,A,c),wl(x,D,c),wl(E,N,c)]);return new Vn(X,tt,ot,ft,!1)}case"lab":{const[g,b,x,E]=xr(rh(l.lab,o.lab,c));return new Vn(g,b,x,E,!1)}}},array:rh,padding:function(l,o,c){return new ho(rh(l.values,o.values,c))},variableAnchorOffsetCollection:function(l,o,c){const p=l.values,g=o.values;if(p.length!==g.length)throw new fr(`Cannot interpolate values of different length. from: ${l.toString()}, to: ${o.toString()}`);const b=[];for(let x=0;xtypeof D!="number"||D<0||D>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:A}}}if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(b=c.parse(b,2,ae),!b)return null;const E=[];let L=null;p==="interpolate-hcl"||p==="interpolate-lab"?L=Ar:c.expectedType&&c.expectedType.kind!=="value"&&(L=c.expectedType);for(let A=0;A=D)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const X=c.parse(N,W,L);if(!X)return null;L=L||X.type,E.push([D,X])}return Lt(L,ae)||Lt(L,Ar)||Lt(L,st)||Lt(L,G)||Lt(L,K(ae))?new Ni(L,p,g,b,E):c.error(`Type ${nt(L)} is not interpolatable.`)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const g=this.input.evaluate(o);if(g<=c[0])return p[0].evaluate(o);const b=c.length;if(g>=c[b-1])return p[b-1].evaluate(o);const x=$u(c,g),E=Ni.interpolationFactor(this.interpolation,g,c[x],c[x+1]),L=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return Qi[this.type.kind](L,A,E);case"interpolate-hcl":return Qi.color(L,A,E,"hcl");case"interpolate-lab":return Qi.color(L,A,E,"lab")}}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Dn(l,o,c,p){const g=p-c,b=l-c;return g===0?0:o===1?b/g:(Math.pow(o,b)-1)/(Math.pow(o,g)-1)}class ih{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expectected at least one argument.");let p=null;const g=c.expectedType;g&&g.kind!=="value"&&(p=g);const b=[];for(const E of o.slice(1)){const L=c.parse(E,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!L)return null;p=p||L.type,b.push(L)}if(!p)throw new Error("No output type");const x=g&&b.some(E=>J(g,E.type));return new ih(x?Ye:p,b)}evaluate(o){let c,p=null,g=0;for(const b of this.args)if(g++,p=b.evaluate(o),p&&p instanceof $o&&!p.available&&(c||(c=p.name),p=null,g===this.args.length&&(p=c)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class oh{constructor(o,c){this.type=c.type,this.bindings=[].concat(o),this.result=c}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const c of this.bindings)o(c[1]);o(this.result)}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let b=1;b=p.length)throw new fr(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new fr(`Array index must be an integer, but found ${c} instead.`);return p[c]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class Yf{constructor(o,c){this.type=Ke,this.needle=o,this.haystack=c}static parse(o,c){if(o.length!==3)return c.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,Ye),g=c.parse(o[2],2,Ye);return p&&g?wt(p.type,[Ke,Qe,ae,Hr,Ye])?new Yf(p,g):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${nt(p.type)} instead`):null}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!dt(c,["boolean","string","number","null"]))throw new fr(`Expected first argument to be of type boolean, string, number or null, but found ${nt(Xr(c))} instead.`);if(!dt(p,["string","array"]))throw new fr(`Expected second argument to be of type array or string, but found ${nt(Xr(p))} instead.`);return p.indexOf(c)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class sh{constructor(o,c,p){this.type=ae,this.needle=o,this.haystack=c,this.fromIndex=p}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,Ye),g=c.parse(o[2],2,Ye);if(!p||!g)return null;if(!wt(p.type,[Ke,Qe,ae,Hr,Ye]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${nt(p.type)} instead`);if(o.length===4){const b=c.parse(o[3],3,ae);return b?new sh(p,g,b):null}return new sh(p,g)}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!dt(c,["boolean","string","number","null"]))throw new fr(`Expected first argument to be of type boolean, string, number or null, but found ${nt(Xr(c))} instead.`);if(!dt(p,["string","array"]))throw new fr(`Expected second argument to be of type array or string, but found ${nt(Xr(p))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(o);return p.indexOf(c,g)}return p.indexOf(c)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class Kf{constructor(o,c,p,g,b,x){this.inputType=o,this.type=c,this.input=p,this.cases=g,this.outputs=b,this.otherwise=x}static parse(o,c){if(o.length<5)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return c.error("Expected an even number of arguments.");let p,g;c.expectedType&&c.expectedType.kind!=="value"&&(g=c.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof X=="number"&&Math.floor(X)!==X)return U.error("Numeric branch labels must be integer values.");if(p){if(U.checkSubtype(p,Xr(X)))return null}else p=Xr(X);if(b[String(X)]!==void 0)return U.error("Branch labels must be unique.");b[String(X)]=x.length}const W=c.parse(N,A,g);if(!W)return null;g=g||W.type,x.push(W)}const E=c.parse(o[1],1,Ye);if(!E)return null;const L=c.parse(o[o.length-1],o.length-1,g);return L?E.type.kind!=="value"&&c.concat(1).checkSubtype(p,E.type)?null:new Kf(p,g,E,b,x,L):null}evaluate(o){const c=this.input.evaluate(o);return(Xr(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class Jf{constructor(o,c,p){this.type=o,this.branches=c,this.otherwise=p}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return c.error("Expected an odd number of arguments.");let p;c.expectedType&&c.expectedType.kind!=="value"&&(p=c.expectedType);const g=[];for(let x=1;xc.outputDefined())&&this.otherwise.outputDefined()}}class ah{constructor(o,c,p,g){this.type=o,this.input=c,this.beginIndex=p,this.endIndex=g}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,Ye),g=c.parse(o[2],2,ae);if(!p||!g)return null;if(!wt(p.type,[K(Ye),Qe,Ye]))return c.error(`Expected first argument to be of type array or string, but found ${nt(p.type)} instead`);if(o.length===4){const b=c.parse(o[3],3,ae);return b?new ah(p.type,p,g,b):null}return new ah(p.type,p,g)}evaluate(o){const c=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!dt(c,["string","array"]))throw new fr(`Expected first argument to be of type array or string, but found ${nt(Xr(c))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(o);return c.slice(p,g)}return c.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function om(l,o){return l==="=="||l==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function sm(l,o,c,p){return p.compare(o,c)===0}function iu(l,o,c){const p=l!=="=="&&l!=="!=";return class QE{constructor(b,x,E){this.type=Ke,this.lhs=b,this.rhs=x,this.collator=E,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const E=b[0];let L=x.parse(b[1],1,Ye);if(!L)return null;if(!om(E,L.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${nt(L.type)}'.`);let A=x.parse(b[2],2,Ye);if(!A)return null;if(!om(E,A.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${nt(A.type)}'.`);if(L.type.kind!==A.type.kind&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${nt(L.type)}' and '${nt(A.type)}'.`);p&&(L.type.kind==="value"&&A.type.kind!=="value"?L=new Mo(A.type,[L]):L.type.kind!=="value"&&A.type.kind==="value"&&(A=new Mo(L.type,[A])));let D=null;if(b.length===4){if(L.type.kind!=="string"&&A.type.kind!=="string"&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(D=x.parse(b[3],3,ma),!D)return null}return new QE(L,A,D)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const L=Xr(x),A=Xr(E);if(L.kind!==A.kind||L.kind!=="string"&&L.kind!=="number")throw new fr(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${L.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const L=Xr(x),A=Xr(E);if(L.kind!=="string"||A.kind!=="string")return o(b,x,E)}return this.collator?c(b,x,E,this.collator.evaluate(b)):o(b,x,E)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const Uy=iu("==",function(l,o,c){return o===c},sm),Gy=iu("!=",function(l,o,c){return o!==c},function(l,o,c,p){return!sm(0,o,c,p)}),qy=iu("<",function(l,o,c){return o",function(l,o,c){return o>c},function(l,o,c,p){return p.compare(o,c)>0}),Wy=iu("<=",function(l,o,c){return o<=c},function(l,o,c,p){return p.compare(o,c)<=0}),Hy=iu(">=",function(l,o,c){return o>=c},function(l,o,c,p){return p.compare(o,c)>=0});class Qf{constructor(o,c,p,g,b){this.type=Qe,this.number=o,this.locale=c,this.currency=p,this.minFractionDigits=g,this.maxFractionDigits=b}static parse(o,c){if(o.length!==3)return c.error("Expected two arguments.");const p=c.parse(o[1],1,ae);if(!p)return null;const g=o[2];if(typeof g!="object"||Array.isArray(g))return c.error("NumberFormat options argument must be an object.");let b=null;if(g.locale&&(b=c.parse(g.locale,1,Qe),!b))return null;let x=null;if(g.currency&&(x=c.parse(g.currency,1,Qe),!x))return null;let E=null;if(g["min-fraction-digits"]&&(E=c.parse(g["min-fraction-digits"],1,ae),!E))return null;let L=null;return g["max-fraction-digits"]&&(L=c.parse(g["max-fraction-digits"],1,ae),!L)?null:new Qf(p,b,x,E,L)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class lh{constructor(o){this.type=zr,this.sections=o}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return c.error("First argument must be an image or text section.");const g=[];let b=!1;for(let x=1;x<=o.length-1;++x){const E=o[x];if(b&&typeof E=="object"&&!Array.isArray(E)){b=!1;let L=null;if(E["font-scale"]&&(L=c.parse(E["font-scale"],1,ae),!L))return null;let A=null;if(E["text-font"]&&(A=c.parse(E["text-font"],1,K(Qe)),!A))return null;let D=null;if(E["text-color"]&&(D=c.parse(E["text-color"],1,Ar),!D))return null;const N=g[g.length-1];N.scale=L,N.font=A,N.textColor=D}else{const L=c.parse(o[x],1,Ye);if(!L)return null;const A=L.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,g.push({content:L,scale:null,font:null,textColor:null})}}return new lh(g)}evaluate(o){return new Po(this.sections.map(c=>{const p=c.content.evaluate(o);return Xr(p)===V?new Zf("",p,null,null,null):new Zf(Zu(p),null,c.scale?c.scale.evaluate(o):null,c.font?c.font.evaluate(o).join(","):null,c.textColor?c.textColor.evaluate(o):null)}))}eachChild(o){for(const c of this.sections)o(c.content),c.scale&&o(c.scale),c.font&&o(c.font),c.textColor&&o(c.textColor)}outputDefined(){return!1}}class $f{constructor(o){this.type=V,this.input=o}static parse(o,c){if(o.length!==2)return c.error("Expected two arguments.");const p=c.parse(o[1],1,Qe);return p?new $f(p):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),p=$o.fromString(c);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(c)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class tp{constructor(o){this.type=ae,this.input=o}static parse(o,c){if(o.length!==2)return c.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=c.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${nt(p.type)} instead.`):new tp(p):null}evaluate(o){const c=this.input.evaluate(o);if(typeof c=="string"||Array.isArray(c))return c.length;throw new fr(`Expected value to be of type string or array, but found ${nt(Xr(c))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const ou={"==":Uy,"!=":Gy,">":jy,"<":qy,">=":Hy,"<=":Wy,array:Mo,at:Xf,boolean:Mo,case:Jf,coalesce:ih,collator:ru,format:lh,image:$f,in:Yf,"index-of":sh,interpolate:Ni,"interpolate-hcl":Ni,"interpolate-lab":Ni,length:tp,let:oh,literal:Va,match:Kf,number:Mo,"number-format":Qf,object:Mo,slice:ah,step:tc,string:Mo,"to-boolean":Fs,"to-color":Fs,"to-number":Fs,"to-string":Fs,var:eh,within:xl};function am(l,[o,c,p,g]){o=o.evaluate(l),c=c.evaluate(l),p=p.evaluate(l);const b=g?g.evaluate(l):1,x=nu(o,c,p,b);if(x)throw new fr(x);return new Vn(o/255,c/255,p/255,b,!1)}function lm(l,o){return l in o}function ep(l,o){const c=o[l];return c===void 0?null:c}function Sl(l){return{type:l}}function um(l){return{result:"success",value:l}}function su(l){return{result:"error",value:l}}function au(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function cm(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function np(l){return!!l.expression&&l.expression.interpolated}function In(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function uh(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function Zy(l){return l}function hm(l,o){const c=o.type==="color",p=l.stops&&typeof l.stops[0][0]=="object",g=p||!(p||l.property!==void 0),b=l.type||(np(o)?"exponential":"interval");if(c||o.type==="padding"){const D=c?Vn.parse:ho.parse;(l=Ko({},l)).stops&&(l.stops=l.stops.map(N=>[N[0],D(N[1])])),l.default=D(l.default?l.default:o.default)}if(l.colorSpace&&(x=l.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${l.colorSpace}"`);var x;let E,L,A;if(b==="exponential")E=xn;else if(b==="interval")E=Xy;else if(b==="categorical"){E=Fr,L=Object.create(null);for(const D of l.stops)L[D[0]]=D[1];A=typeof l.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=rp}if(p){const D={},N=[];for(let X=0;XX[0]),evaluate:({zoom:X},tt)=>xn({stops:U,base:l.base},o,X).evaluate(X,tt)}}if(g){const D=b==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:Ni.interpolationFactor.bind(void 0,D),zoomStops:l.stops.map(N=>N[0]),evaluate:({zoom:N})=>E(l,o,N,L,A)}}return{kind:"source",evaluate(D,N){const U=N&&N.properties?N.properties[l.property]:void 0;return U===void 0?ec(l.default,o.default):E(l,o,U,L,A)}}}function ec(l,o,c){return l!==void 0?l:o!==void 0?o:c!==void 0?c:void 0}function Fr(l,o,c,p,g){return ec(typeof c===g?p[c]:void 0,l.default,o.default)}function Xy(l,o,c){if(In(c)!=="number")return ec(l.default,o.default);const p=l.stops.length;if(p===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[p-1][0])return l.stops[p-1][1];const g=$u(l.stops.map(b=>b[0]),c);return l.stops[g][1]}function xn(l,o,c){const p=l.base!==void 0?l.base:1;if(In(c)!=="number")return ec(l.default,o.default);const g=l.stops.length;if(g===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[g-1][0])return l.stops[g-1][1];const b=$u(l.stops.map(D=>D[0]),c),x=function(D,N,U,W){const X=W-U,tt=D-U;return X===0?0:N===1?tt/X:(Math.pow(N,tt)-1)/(Math.pow(N,X)-1)}(c,p,l.stops[b][0],l.stops[b+1][0]),E=l.stops[b][1],L=l.stops[b+1][1],A=Qi[o.type]||Zy;return typeof E.evaluate=="function"?{evaluate(...D){const N=E.evaluate.apply(void 0,D),U=L.evaluate.apply(void 0,D);if(N!==void 0&&U!==void 0)return A(N,U,x,l.colorSpace)}}:A(E,L,x,l.colorSpace)}function rp(l,o,c){switch(o.type){case"color":c=Vn.parse(c);break;case"formatted":c=Po.fromString(c.toString());break;case"resolvedImage":c=$o.fromString(c.toString());break;case"padding":c=ho.parse(c);break;default:In(c)===o.type||o.type==="enum"&&o.values[c]||(c=void 0)}return ec(c,l.default,o.default)}Ao.register(ou,{error:[{kind:"error"},[Qe],(l,[o])=>{throw new fr(o.evaluate(l))}],typeof:[Qe,[Ye],(l,[o])=>nt(Xr(o.evaluate(l)))],"to-rgba":[K(ae,4),[Ar],(l,[o])=>{const[c,p,g,b]=o.evaluate(l).rgb;return[255*c,255*p,255*g,b]}],rgb:[Ar,[ae,ae,ae],am],rgba:[Ar,[ae,ae,ae,ae],am],has:{type:Ke,overloads:[[[Qe],(l,[o])=>lm(o.evaluate(l),l.properties())],[[Qe,Jo],(l,[o,c])=>lm(o.evaluate(l),c.evaluate(l))]]},get:{type:Ye,overloads:[[[Qe],(l,[o])=>ep(o.evaluate(l),l.properties())],[[Qe,Jo],(l,[o,c])=>ep(o.evaluate(l),c.evaluate(l))]]},"feature-state":[Ye,[Qe],(l,[o])=>ep(o.evaluate(l),l.featureState||{})],properties:[Jo,[],l=>l.properties()],"geometry-type":[Qe,[],l=>l.geometryType()],id:[Ye,[],l=>l.id()],zoom:[ae,[],l=>l.globals.zoom],"heatmap-density":[ae,[],l=>l.globals.heatmapDensity||0],"line-progress":[ae,[],l=>l.globals.lineProgress||0],accumulated:[Ye,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[ae,Sl(ae),(l,o)=>{let c=0;for(const p of o)c+=p.evaluate(l);return c}],"*":[ae,Sl(ae),(l,o)=>{let c=1;for(const p of o)c*=p.evaluate(l);return c}],"-":{type:ae,overloads:[[[ae,ae],(l,[o,c])=>o.evaluate(l)-c.evaluate(l)],[[ae],(l,[o])=>-o.evaluate(l)]]},"/":[ae,[ae,ae],(l,[o,c])=>o.evaluate(l)/c.evaluate(l)],"%":[ae,[ae,ae],(l,[o,c])=>o.evaluate(l)%c.evaluate(l)],ln2:[ae,[],()=>Math.LN2],pi:[ae,[],()=>Math.PI],e:[ae,[],()=>Math.E],"^":[ae,[ae,ae],(l,[o,c])=>Math.pow(o.evaluate(l),c.evaluate(l))],sqrt:[ae,[ae],(l,[o])=>Math.sqrt(o.evaluate(l))],log10:[ae,[ae],(l,[o])=>Math.log(o.evaluate(l))/Math.LN10],ln:[ae,[ae],(l,[o])=>Math.log(o.evaluate(l))],log2:[ae,[ae],(l,[o])=>Math.log(o.evaluate(l))/Math.LN2],sin:[ae,[ae],(l,[o])=>Math.sin(o.evaluate(l))],cos:[ae,[ae],(l,[o])=>Math.cos(o.evaluate(l))],tan:[ae,[ae],(l,[o])=>Math.tan(o.evaluate(l))],asin:[ae,[ae],(l,[o])=>Math.asin(o.evaluate(l))],acos:[ae,[ae],(l,[o])=>Math.acos(o.evaluate(l))],atan:[ae,[ae],(l,[o])=>Math.atan(o.evaluate(l))],min:[ae,Sl(ae),(l,o)=>Math.min(...o.map(c=>c.evaluate(l)))],max:[ae,Sl(ae),(l,o)=>Math.max(...o.map(c=>c.evaluate(l)))],abs:[ae,[ae],(l,[o])=>Math.abs(o.evaluate(l))],round:[ae,[ae],(l,[o])=>{const c=o.evaluate(l);return c<0?-Math.round(-c):Math.round(c)}],floor:[ae,[ae],(l,[o])=>Math.floor(o.evaluate(l))],ceil:[ae,[ae],(l,[o])=>Math.ceil(o.evaluate(l))],"filter-==":[Ke,[Qe,Ye],(l,[o,c])=>l.properties()[o.value]===c.value],"filter-id-==":[Ke,[Ye],(l,[o])=>l.id()===o.value],"filter-type-==":[Ke,[Qe],(l,[o])=>l.geometryType()===o.value],"filter-<":[Ke,[Qe,Ye],(l,[o,c])=>{const p=l.properties()[o.value],g=c.value;return typeof p==typeof g&&p{const c=l.id(),p=o.value;return typeof c==typeof p&&c":[Ke,[Qe,Ye],(l,[o,c])=>{const p=l.properties()[o.value],g=c.value;return typeof p==typeof g&&p>g}],"filter-id->":[Ke,[Ye],(l,[o])=>{const c=l.id(),p=o.value;return typeof c==typeof p&&c>p}],"filter-<=":[Ke,[Qe,Ye],(l,[o,c])=>{const p=l.properties()[o.value],g=c.value;return typeof p==typeof g&&p<=g}],"filter-id-<=":[Ke,[Ye],(l,[o])=>{const c=l.id(),p=o.value;return typeof c==typeof p&&c<=p}],"filter->=":[Ke,[Qe,Ye],(l,[o,c])=>{const p=l.properties()[o.value],g=c.value;return typeof p==typeof g&&p>=g}],"filter-id->=":[Ke,[Ye],(l,[o])=>{const c=l.id(),p=o.value;return typeof c==typeof p&&c>=p}],"filter-has":[Ke,[Ye],(l,[o])=>o.value in l.properties()],"filter-has-id":[Ke,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[Ke,[K(Qe)],(l,[o])=>o.value.indexOf(l.geometryType())>=0],"filter-id-in":[Ke,[K(Ye)],(l,[o])=>o.value.indexOf(l.id())>=0],"filter-in-small":[Ke,[Qe,K(Ye)],(l,[o,c])=>c.value.indexOf(l.properties()[o.value])>=0],"filter-in-large":[Ke,[Qe,K(Ye)],(l,[o,c])=>function(p,g,b,x){for(;b<=x;){const E=b+x>>1;if(g[E]===p)return!0;g[E]>p?x=E-1:b=E+1}return!1}(l.properties()[o.value],c.value,0,c.value.length-1)],all:{type:Ke,overloads:[[[Ke,Ke],(l,[o,c])=>o.evaluate(l)&&c.evaluate(l)],[Sl(Ke),(l,o)=>{for(const c of o)if(!c.evaluate(l))return!1;return!0}]]},any:{type:Ke,overloads:[[[Ke,Ke],(l,[o,c])=>o.evaluate(l)||c.evaluate(l)],[Sl(Ke),(l,o)=>{for(const c of o)if(c.evaluate(l))return!0;return!1}]]},"!":[Ke,[Ke],(l,[o])=>!o.evaluate(l)],"is-supported-script":[Ke,[Qe],(l,[o])=>{const c=l.globals&&l.globals.isSupportedScript;return!c||c(o.evaluate(l))}],upcase:[Qe,[Qe],(l,[o])=>o.evaluate(l).toUpperCase()],downcase:[Qe,[Qe],(l,[o])=>o.evaluate(l).toLowerCase()],concat:[Qe,Sl(Ye),(l,o)=>o.map(c=>Zu(c.evaluate(l))).join("")],"resolved-locale":[Qe,[ma],(l,[o])=>o.evaluate(l).resolvedLocale()]});class tr{constructor(o,c){var p;this.expression=o,this._warningHistory={},this._evaluator=new Un,this._defaultValue=c?(p=c).type==="color"&&uh(p.default)?new Vn(0,0,0,0):p.type==="color"?Vn.parse(p.default)||null:p.type==="padding"?ho.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Qo.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(o,c,p,g,b,x){return this._evaluator.globals=o,this._evaluator.feature=c,this._evaluator.featureState=p,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,c,p,g,b,x){this._evaluator.globals=o,this._evaluator.feature=c||null,this._evaluator.featureState=p||null,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new fr(`Expected value to be one of ${Object.keys(this._enumValues).map(L=>JSON.stringify(L)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function Yn(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in ou}function El(l,o){const c=new Kc(ou,Ku,[],o?function(g){const b={color:Ar,string:Qe,number:ae,enum:Qe,boolean:Ke,formatted:zr,padding:st,resolvedImage:V,variableAnchorOffsetCollection:G};return g.type==="array"?K(b[g.value]||Ye,g.length):b[g.type]}(o):void 0),p=c.parse(l,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?um(new tr(p,o)):su(c.errors)}class ch{constructor(o,c){this.kind=o,this._styleExpression=c,this.isStateDependent=o!=="constant"&&!Ju(c.expression)}evaluateWithoutErrorHandling(o,c,p,g,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,g,b,x)}evaluate(o,c,p,g,b,x){return this._styleExpression.evaluate(o,c,p,g,b,x)}}class ip{constructor(o,c,p,g){this.kind=o,this.zoomStops=p,this._styleExpression=c,this.isStateDependent=o!=="camera"&&!Ju(c.expression),this.interpolationType=g}evaluateWithoutErrorHandling(o,c,p,g,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,g,b,x)}evaluate(o,c,p,g,b,x){return this._styleExpression.evaluate(o,c,p,g,b,x)}interpolationFactor(o,c,p){return this.interpolationType?Ni.interpolationFactor(this.interpolationType,o,c,p):0}}function fm(l,o){const c=El(l,o);if(c.result==="error")return c;const p=c.value.expression,g=nh(p);if(!g&&!au(o))return su([new Ki("","data expressions not supported")]);const b=Qu(p,["zoom"]);if(!b&&!cm(o))return su([new Ki("","zoom expressions not supported")]);const x=fh(p);return x||b?x instanceof Ki?su([x]):x instanceof Ni&&!np(o)?su([new Ki("",'"interpolate" expressions cannot be used with this property')]):um(x?new ip(g?"camera":"composite",c.value,x.labels,x instanceof Ni?x.interpolation:void 0):new ch(g?"constant":"source",c.value)):su([new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class hh{constructor(o,c){this._parameters=o,this._specification=c,Ko(this,hm(this._parameters,this._specification))}static deserialize(o){return new hh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function fh(l){let o=null;if(l instanceof oh)o=fh(l.result);else if(l instanceof ih){for(const c of l.args)if(o=fh(c),o)break}else(l instanceof tc||l instanceof Ni)&&l.input instanceof Ao&&l.input.name==="zoom"&&(o=l);return o instanceof Ki||l.eachChild(c=>{const p=fh(c);p instanceof Ki?o=p:!o&&p?o=new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new Ki("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function ph(l){if(l===!0||l===!1)return!0;if(!Array.isArray(l)||l.length===0)return!1;switch(l[0]){case"has":return l.length>=2&&l[1]!=="$id"&&l[1]!=="$type";case"in":return l.length>=3&&(typeof l[1]!="string"||Array.isArray(l[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return l.length!==3||Array.isArray(l[1])||Array.isArray(l[2]);case"any":case"all":for(const o of l.slice(1))if(!ph(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const pm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function dh(l){if(l==null)return{filter:()=>!0,needGeometry:!1};ph(l)||(l=gh(l));const o=El(l,pm);if(o.result==="error")throw new Error(o.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,p,g)=>o.value.evaluate(c,p,{},g),needGeometry:mh(l)}}function dm(l,o){return lo?1:0}function mh(l){if(!Array.isArray(l))return!1;if(l[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?op(l[1],l[2],o):o==="any"?(c=l.slice(1),["any"].concat(c.map(gh))):o==="all"?["all"].concat(l.slice(1).map(gh)):o==="none"?["all"].concat(l.slice(1).map(gh).map(yh)):o==="in"?mm(l[1],l.slice(2)):o==="!in"?yh(mm(l[1],l.slice(2))):o==="has"?gm(l[1]):o==="!has"?yh(gm(l[1])):o!=="within"||l;var c}function op(l,o,c){switch(l){case"$type":return[`filter-type-${c}`,o];case"$id":return[`filter-id-${c}`,o];default:return[`filter-${c}`,l,o]}}function mm(l,o){if(o.length===0)return!1;switch(l){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(c=>typeof c!=typeof o[0])?["filter-in-large",l,["literal",o.sort(dm)]]:["filter-in-small",l,["literal",o]]}}function gm(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function yh(l){return["!",l]}function sp(l){const o=typeof l;if(o==="number"||o==="boolean"||o==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let g="[";for(const b of l)g+=`${sp(b)},`;return`${g}]`}const c=Object.keys(l).sort();let p="{";for(let g=0;gp.maximum?[new re(o,c,`${c} is greater than the maximum value ${p.maximum}`)]:[]}function _m(l){const o=l.valueSpec,c=wr(l.value.type);let p,g,b,x={};const E=c!=="categorical"&&l.value.property===void 0,L=!E,A=In(l.value.stops)==="array"&&In(l.value.stops[0])==="array"&&In(l.value.stops[0][0])==="object",D=$i({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(W){if(c==="identity")return[new re(W.key,W.value,'identity function may not have a "stops" property')];let X=[];const tt=W.value;return X=X.concat(ap({key:W.key,value:tt,valueSpec:W.valueSpec,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,arrayElementValidator:N})),In(tt)==="array"&&tt.length===0&&X.push(new re(W.key,tt,"array must have at least one stop")),X},default:function(W){return W.validateSpec({key:W.key,value:W.value,valueSpec:o,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec})}}});return c==="identity"&&E&&D.push(new re(l.key,l.value,'missing required property "property"')),c==="identity"||l.value.stops||D.push(new re(l.key,l.value,'missing required property "stops"')),c==="exponential"&&l.valueSpec.expression&&!np(l.valueSpec)&&D.push(new re(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(L&&!au(l.valueSpec)?D.push(new re(l.key,l.value,"property functions not supported")):E&&!cm(l.valueSpec)&&D.push(new re(l.key,l.value,"zoom functions not supported"))),c!=="categorical"&&!A||l.value.property!==void 0||D.push(new re(l.key,l.value,'"property" property is required')),D;function N(W){let X=[];const tt=W.value,ot=W.key;if(In(tt)!=="array")return[new re(ot,tt,`array expected, ${In(tt)} found`)];if(tt.length!==2)return[new re(ot,tt,`array length 2 expected, length ${tt.length} found`)];if(A){if(In(tt[0])!=="object")return[new re(ot,tt,`object expected, ${In(tt[0])} found`)];if(tt[0].zoom===void 0)return[new re(ot,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new re(ot,tt,"object stop key must have value")];if(b&&b>wr(tt[0].zoom))return[new re(ot,tt[0].zoom,"stop zoom values must appear in ascending order")];wr(tt[0].zoom)!==b&&(b=wr(tt[0].zoom),g=void 0,x={}),X=X.concat($i({key:`${ot}[0]`,value:tt[0],valueSpec:{zoom:{}},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,objectElementValidators:{zoom:_h,value:U}}))}else X=X.concat(U({key:`${ot}[0]`,value:tt[0],valueSpec:{},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec},tt));return Yn(Ga(tt[1]))?X.concat([new re(`${ot}[1]`,tt[1],"expressions are not allowed in function stops.")]):X.concat(W.validateSpec({key:`${ot}[1]`,value:tt[1],valueSpec:o,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec}))}function U(W,X){const tt=In(W.value),ot=wr(W.value),ft=W.value!==null?W.value:X;if(p){if(tt!==p)return[new re(W.key,ft,`${tt} stop domain type must match previous stop domain type ${p}`)]}else p=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new re(W.key,ft,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&c!=="categorical"){let Pt=`number expected, ${tt} found`;return au(o)&&c===void 0&&(Pt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new re(W.key,ft,Pt)]}return c!=="categorical"||tt!=="number"||isFinite(ot)&&Math.floor(ot)===ot?c!=="categorical"&&tt==="number"&&g!==void 0&&otnew re(`${l.key}${p.key}`,l.value,p.message));const c=o.value.expression||o.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!c.outputDefined())return[new re(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!Ju(c))return[new re(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!Ju(c))return[new re(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!Qu(c,["zoom","feature-state"]))return[new re(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!nh(c))return[new re(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ja(l){const o=l.key,c=l.value,p=l.valueSpec,g=[];return Array.isArray(p.values)?p.values.indexOf(wr(c))===-1&&g.push(new re(o,c,`expected one of [${p.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(p.values).indexOf(wr(c))===-1&&g.push(new re(o,c,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(c)} found`)),g}function lu(l){return ph(Ga(l.value))?qa(Ko({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):lp(l)}function lp(l){const o=l.value,c=l.key;if(In(o)!=="array")return[new re(c,o,`array expected, ${In(o)} found`)];const p=l.styleSpec;let g,b=[];if(o.length<1)return[new re(c,o,"filter array must have at least 1 element")];switch(b=b.concat(ja({key:`${c}[0]`,value:o[0],valueSpec:p.filter_operator,style:l.style,styleSpec:l.styleSpec})),wr(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&wr(o[1])==="$type"&&b.push(new re(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new re(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(g=In(o[1]),g!=="string"&&b.push(new re(`${c}[1]`,o[1],`string expected, ${g} found`)));for(let x=2;x{A in c&&o.push(new re(p,c[A],`"${A}" is prohibited for ref layers`))}),g.layers.forEach(A=>{wr(A.id)===E&&(L=A)}),L?L.ref?o.push(new re(p,c.ref,"ref cannot reference another ref layer")):x=wr(L.type):o.push(new re(p,c.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(c.source){const L=g.sources&&g.sources[c.source],A=L&&wr(L.type);L?A==="vector"&&x==="raster"?o.push(new re(p,c.source,`layer "${c.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new re(p,c.source,`layer "${c.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new re(p,c.source,`layer "${c.id}" requires a vector source`)):A!=="vector"||c["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new re(p,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!c.paint||!c.paint["line-gradient"]||A==="geojson"&&L.lineMetrics||o.push(new re(p,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new re(p,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new re(p,c.source,`source "${c.source}" not found`))}else o.push(new re(p,c,'missing required property "source"'));return o=o.concat($i({key:p,value:c,valueSpec:b.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${p}.type`,value:c.type,valueSpec:b.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:c,objectKey:"type"}),filter:lu,layout:L=>$i({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>cp(Ko({layerType:x},A))}}),paint:L=>$i({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>up(Ko({layerType:x},A))}})}})),o}function Il(l){const o=l.value,c=l.key,p=In(o);return p!=="string"?[new re(c,o,`string expected, ${p} found`)]:[]}const vm={promoteId:function({key:l,value:o}){if(In(o)==="string")return Il({key:l,value:o});{const c=[];for(const p in o)c.push(...Il({key:`${l}.${p}`,value:o[p]}));return c}}};function bm(l){const o=l.value,c=l.key,p=l.styleSpec,g=l.style,b=l.validateSpec;if(!o.type)return[new re(c,o,'"type" is required')];const x=wr(o.type);let E;switch(x){case"vector":case"raster":return E=$i({key:c,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:l.style,styleSpec:p,objectElementValidators:vm,validateSpec:b}),E;case"raster-dem":return E=function(L){var A;const D=(A=L.sourceName)!==null&&A!==void 0?A:"",N=L.value,U=L.styleSpec,W=U.source_raster_dem,X=L.style;let tt=[];const ot=In(N);if(N===void 0)return tt;if(ot!=="object")return tt.push(new re("source_raster_dem",N,`object expected, ${ot} found`)),tt;const ft=wr(N.encoding)==="custom",Pt=["redFactor","greenFactor","blueFactor","baseShift"],yt=L.value.encoding?`"${L.value.encoding}"`:"Default";for(const St in N)!ft&&Pt.includes(St)?tt.push(new re(St,N[St],`In "${D}": "${St}" is only valid when "encoding" is set to "custom". ${yt} encoding found`)):W[St]?tt=tt.concat(L.validateSpec({key:St,value:N[St],valueSpec:W[St],validateSpec:L.validateSpec,style:X,styleSpec:U})):tt.push(new re(St,N[St],`unknown property "${St}"`));return tt}({sourceName:c,value:o,style:l.style,styleSpec:p,validateSpec:b}),E;case"geojson":if(E=$i({key:c,value:o,valueSpec:p.source_geojson,style:g,styleSpec:p,validateSpec:b,objectElementValidators:vm}),o.cluster)for(const L in o.clusterProperties){const[A,D]=o.clusterProperties[L],N=typeof A=="string"?[A,["accumulated"],["get",L]]:A;E.push(...qa({key:`${c}.${L}.map`,value:D,validateSpec:b,expressionContext:"cluster-map"})),E.push(...qa({key:`${c}.${L}.reduce`,value:N,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return $i({key:c,value:o,valueSpec:p.source_video,style:g,validateSpec:b,styleSpec:p});case"image":return $i({key:c,value:o,valueSpec:p.source_image,style:g,validateSpec:b,styleSpec:p});case"canvas":return[new re(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ja({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:b,styleSpec:p})}}function xm(l){const o=l.value,c=l.styleSpec,p=c.light,g=l.style;let b=[];const x=In(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new re("light",o,`object expected, ${x} found`)]),b;for(const E in o){const L=E.match(/^(.*)-transition$/);b=b.concat(L&&p[L[1]]&&p[L[1]].transition?l.validateSpec({key:E,value:o[E],valueSpec:c.transition,validateSpec:l.validateSpec,style:g,styleSpec:c}):p[E]?l.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:l.validateSpec,style:g,styleSpec:c}):[new re(E,o[E],`unknown property "${E}"`)])}return b}function wm(l){const o=l.value,c=l.styleSpec,p=c.sky,g=l.style,b=In(o);if(o===void 0)return[];if(b!=="object")return[new re("sky",o,`object expected, ${b} found`)];let x=[];for(const E in o)x=x.concat(p[E]?Bs({key:E,value:o[E],valueSpec:p[E],style:g,styleSpec:c}):[new re(E,o[E],`unknown property "${E}"`)]);return x}function rc(l){const o=l.value,c=l.styleSpec,p=c.terrain,g=l.style;let b=[];const x=In(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new re("terrain",o,`object expected, ${x} found`)]),b;for(const E in o)b=b.concat(p[E]?l.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:l.validateSpec,style:g,styleSpec:c}):[new re(E,o[E],`unknown property "${E}"`)]);return b}function ic(l){let o=[];const c=l.value,p=l.key;if(Array.isArray(c)){const g=[],b=[];for(const x in c)c[x].id&&g.includes(c[x].id)&&o.push(new re(p,c,`all the sprites' ids must be unique, but ${c[x].id} is duplicated`)),g.push(c[x].id),c[x].url&&b.includes(c[x].url)&&o.push(new re(p,c,`all the sprites' URLs must be unique, but ${c[x].url} is duplicated`)),b.push(c[x].url),o=o.concat($i({key:`${p}[${x}]`,value:c[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return o}return Il({key:p,value:c})}const fo={"*":()=>[],array:ap,boolean:function(l){const o=l.value,c=l.key,p=In(o);return p!=="boolean"?[new re(c,o,`boolean expected, ${p} found`)]:[]},number:_h,color:function(l){const o=l.key,c=l.value,p=In(c);return p!=="string"?[new re(o,c,`color expected, ${p} found`)]:Vn.parse(String(c))?[]:[new re(o,c,`color expected, "${c}" found`)]},constants:ym,enum:ja,filter:lu,function:_m,layer:nc,object:$i,source:bm,light:xm,sky:wm,terrain:rc,string:Il,formatted:function(l){return Il(l).length===0?[]:qa(l)},resolvedImage:function(l){return Il(l).length===0?[]:qa(l)},padding:function(l){const o=l.key,c=l.value;if(In(c)==="array"){if(c.length<1||c.length>4)return[new re(o,c,`padding requires 1 to 4 values; ${c.length} values found`)];const p={type:"number"};let g=[];for(let b=0;b[]}})),l.constants&&(c=c.concat(ym({key:"constants",value:l.constants,style:l,styleSpec:o,validateSpec:Bs}))),uu(c)}function Vs(l){return function(o){return l({...o,validateSpec:Bs})}}function uu(l){return[].concat(l).sort((o,c)=>o.line-c.line)}function gs(l){return function(...o){return uu(l.apply(this,o))}}ms.source=gs(Vs(bm)),ms.sprite=gs(Vs(ic)),ms.glyphs=gs(Vs(hp)),ms.light=gs(Vs(xm)),ms.sky=gs(Vs(wm)),ms.terrain=gs(Vs(rc)),ms.layer=gs(Vs(nc)),ms.filter=gs(Vs(lu)),ms.paintProperty=gs(Vs(up)),ms.layoutProperty=gs(Vs(cp));const Cl=ms,Ky=Cl.light,fp=Cl.paintProperty,Jy=Cl.layoutProperty;function cu(l,o){let c=!1;if(o&&o.length)for(const p of o)l.fire(new Ie(new Error(p.message))),c=!0;return c}class oc{constructor(o,c,p){const g=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const x=new Int32Array(this.arrayBuffer);o=x[0],this.d=(c=x[1])+2*(p=x[2]);for(let L=0;L=N[X+0]&&g>=N[X+1])?(E[W]=!0,x.push(D[W])):E[W]=!1}}}}_forEachCell(o,c,p,g,b,x,E,L){const A=this._convertToCellCoord(o),D=this._convertToCellCoord(c),N=this._convertToCellCoord(p),U=this._convertToCellCoord(g);for(let W=A;W<=N;W++)for(let X=D;X<=U;X++){const tt=this.d*X+W;if((!L||L(this._convertFromCellCoord(W),this._convertFromCellCoord(X),this._convertFromCellCoord(W+1),this._convertFromCellCoord(X+1)))&&b.call(this,o,c,p,g,tt,x,E,L))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,c=3+this.cells.length+1+1;let p=0;for(let x=0;x=0)continue;const x=l[b];g[b]=Us[p].shallow.indexOf(b)>=0?x:hu(x,o)}l instanceof Error&&(g.message=l.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(g.$name=p),g}throw new Error("can't serialize object of type "+typeof l)}function fu(l){if(l==null||typeof l=="boolean"||typeof l=="number"||typeof l=="string"||l instanceof Boolean||l instanceof Number||l instanceof String||l instanceof Date||l instanceof RegExp||l instanceof Blob||l instanceof Error||bh(l)||Re(l)||ArrayBuffer.isView(l)||l instanceof ImageData)return l;if(Array.isArray(l))return l.map(fu);if(typeof l=="object"){const o=l.$name||"Object";if(!Us[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:c}=Us[o];if(!c)throw new Error(`can't deserialize unregistered class ${o}`);if(c.deserialize)return c.deserialize(l);const p=Object.create(c.prototype);for(const g of Object.keys(l)){if(g==="$name")continue;const b=l[g];p[g]=Us[o].shallow.indexOf(g)>=0?b:fu(b)}return p}throw new Error("can't deserialize object of type "+typeof l)}class Sm{constructor(){this.first=!0}update(o,c){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=c):this.lastFloorZooml>=128&&l<=255,Arabic:l=>l>=1536&&l<=1791,"Arabic Supplement":l=>l>=1872&&l<=1919,"Arabic Extended-A":l=>l>=2208&&l<=2303,"Hangul Jamo":l=>l>=4352&&l<=4607,"Unified Canadian Aboriginal Syllabics":l=>l>=5120&&l<=5759,Khmer:l=>l>=6016&&l<=6143,"Unified Canadian Aboriginal Syllabics Extended":l=>l>=6320&&l<=6399,"General Punctuation":l=>l>=8192&&l<=8303,"Letterlike Symbols":l=>l>=8448&&l<=8527,"Number Forms":l=>l>=8528&&l<=8591,"Miscellaneous Technical":l=>l>=8960&&l<=9215,"Control Pictures":l=>l>=9216&&l<=9279,"Optical Character Recognition":l=>l>=9280&&l<=9311,"Enclosed Alphanumerics":l=>l>=9312&&l<=9471,"Geometric Shapes":l=>l>=9632&&l<=9727,"Miscellaneous Symbols":l=>l>=9728&&l<=9983,"Miscellaneous Symbols and Arrows":l=>l>=11008&&l<=11263,"CJK Radicals Supplement":l=>l>=11904&&l<=12031,"Kangxi Radicals":l=>l>=12032&&l<=12255,"Ideographic Description Characters":l=>l>=12272&&l<=12287,"CJK Symbols and Punctuation":l=>l>=12288&&l<=12351,Hiragana:l=>l>=12352&&l<=12447,Katakana:l=>l>=12448&&l<=12543,Bopomofo:l=>l>=12544&&l<=12591,"Hangul Compatibility Jamo":l=>l>=12592&&l<=12687,Kanbun:l=>l>=12688&&l<=12703,"Bopomofo Extended":l=>l>=12704&&l<=12735,"CJK Strokes":l=>l>=12736&&l<=12783,"Katakana Phonetic Extensions":l=>l>=12784&&l<=12799,"Enclosed CJK Letters and Months":l=>l>=12800&&l<=13055,"CJK Compatibility":l=>l>=13056&&l<=13311,"CJK Unified Ideographs Extension A":l=>l>=13312&&l<=19903,"Yijing Hexagram Symbols":l=>l>=19904&&l<=19967,"CJK Unified Ideographs":l=>l>=19968&&l<=40959,"Yi Syllables":l=>l>=40960&&l<=42127,"Yi Radicals":l=>l>=42128&&l<=42191,"Hangul Jamo Extended-A":l=>l>=43360&&l<=43391,"Hangul Syllables":l=>l>=44032&&l<=55215,"Hangul Jamo Extended-B":l=>l>=55216&&l<=55295,"Private Use Area":l=>l>=57344&&l<=63743,"CJK Compatibility Ideographs":l=>l>=63744&&l<=64255,"Arabic Presentation Forms-A":l=>l>=64336&&l<=65023,"Vertical Forms":l=>l>=65040&&l<=65055,"CJK Compatibility Forms":l=>l>=65072&&l<=65103,"Small Form Variants":l=>l>=65104&&l<=65135,"Arabic Presentation Forms-B":l=>l>=65136&&l<=65279,"Halfwidth and Fullwidth Forms":l=>l>=65280&&l<=65519};function pu(l){for(const o of l)if(xh(o.charCodeAt(0)))return!0;return!1}function Em(l){for(const o of l)if(!Im(o.charCodeAt(0)))return!1;return!0}function Im(l){return!(ge.Arabic(l)||ge["Arabic Supplement"](l)||ge["Arabic Extended-A"](l)||ge["Arabic Presentation Forms-A"](l)||ge["Arabic Presentation Forms-B"](l))}function xh(l){return!(l!==746&&l!==747&&(l<4352||!(ge["Bopomofo Extended"](l)||ge.Bopomofo(l)||ge["CJK Compatibility Forms"](l)&&!(l>=65097&&l<=65103)||ge["CJK Compatibility Ideographs"](l)||ge["CJK Compatibility"](l)||ge["CJK Radicals Supplement"](l)||ge["CJK Strokes"](l)||!(!ge["CJK Symbols and Punctuation"](l)||l>=12296&&l<=12305||l>=12308&&l<=12319||l===12336)||ge["CJK Unified Ideographs Extension A"](l)||ge["CJK Unified Ideographs"](l)||ge["Enclosed CJK Letters and Months"](l)||ge["Hangul Compatibility Jamo"](l)||ge["Hangul Jamo Extended-A"](l)||ge["Hangul Jamo Extended-B"](l)||ge["Hangul Jamo"](l)||ge["Hangul Syllables"](l)||ge.Hiragana(l)||ge["Ideographic Description Characters"](l)||ge.Kanbun(l)||ge["Kangxi Radicals"](l)||ge["Katakana Phonetic Extensions"](l)||ge.Katakana(l)&&l!==12540||!(!ge["Halfwidth and Fullwidth Forms"](l)||l===65288||l===65289||l===65293||l>=65306&&l<=65310||l===65339||l===65341||l===65343||l>=65371&&l<=65503||l===65507||l>=65512&&l<=65519)||!(!ge["Small Form Variants"](l)||l>=65112&&l<=65118||l>=65123&&l<=65126)||ge["Unified Canadian Aboriginal Syllabics"](l)||ge["Unified Canadian Aboriginal Syllabics Extended"](l)||ge["Vertical Forms"](l)||ge["Yijing Hexagram Symbols"](l)||ge["Yi Syllables"](l)||ge["Yi Radicals"](l))))}function pp(l){return!(xh(l)||function(o){return!!(ge["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||ge["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||ge["Letterlike Symbols"](o)||ge["Number Forms"](o)||ge["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||ge["Control Pictures"](o)&&o!==9251||ge["Optical Character Recognition"](o)||ge["Enclosed Alphanumerics"](o)||ge["Geometric Shapes"](o)||ge["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||ge["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||ge["CJK Symbols and Punctuation"](o)||ge.Katakana(o)||ge["Private Use Area"](o)||ge["CJK Compatibility Forms"](o)||ge["Small Form Variants"](o)||ge["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(l))}function wh(l){return l>=1424&&l<=2303||ge["Arabic Presentation Forms-A"](l)||ge["Arabic Presentation Forms-B"](l)}function Cm(l,o){return!(!o&&wh(l)||l>=2304&&l<=3583||l>=3840&&l<=4255||ge.Khmer(l))}function Qy(l){for(const o of l)if(wh(o.charCodeAt(0)))return!0;return!1}const Wa=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(l){this.pluginStatus=l.pluginStatus,this.pluginURL=l.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(l){this.applyArabicShaping=l.applyArabicShaping,this.processBidirectionalText=l.processBidirectionalText,this.processStyledBidirectionalText=l.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class sr{constructor(o,c){this.zoom=o,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Sm,this.transition={})}isSupportedScript(o){return function(c,p){for(const g of c)if(!Cm(g.charCodeAt(0),p))return!1;return!0}(o,Wa.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,c=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*c}}}class sc{constructor(o,c){this.property=o,this.value=c,this.expression=function(p,g){if(uh(p))return new hh(p,g);if(Yn(p)){const b=fm(p,g);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return g.type==="color"&&typeof p=="string"?b=Vn.parse(p):g.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=Qo.parse(p)):b=ho.parse(p),{kind:"constant",evaluate:()=>b}}}(c===void 0?o.specification.default:c,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,c,p){return this.property.possiblyEvaluate(this,o,c,p)}}class Sh{constructor(o){this.property=o,this.value=new sc(o,void 0)}transitioned(o,c){return new Tm(this.property,this.value,c,lt({},o.transition,this.transition),o.now)}untransitioned(){return new Tm(this.property,this.value,null,{},0)}}class dp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return Q(this._values[o].value.value)}setValue(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Sh(this._values[o].property)),this._values[o].value=new sc(this._values[o].property,c===null?void 0:Q(c))}getTransition(o){return Q(this._values[o].transition)}setTransition(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Sh(this._values[o].property)),this._values[o].transition=Q(c)||void 0}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p);const g=this.getTransition(c);g!==void 0&&(o[`${c}-transition`]=g)}return o}transitioned(o,c){const p=new Lm(this._properties);for(const g of Object.keys(this._values))p._values[g]=this._values[g].transitioned(o,c._values[g]);return p}untransitioned(){const o=new Lm(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].untransitioned();return o}}class Tm{constructor(o,c,p,g,b){this.property=o,this.value=c,this.begin=b+g.delay||0,this.end=this.begin+g.duration||0,o.specification.transition&&(g.delay||g.duration)&&(this.prior=p)}possiblyEvaluate(o,c,p){const g=o.now||0,b=this.value.possiblyEvaluate(o,c,p),x=this.prior;if(x){if(g>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(g=1)return 1;const A=L*L,D=A*L;return 4*(L<.5?D:3*(L-A)+D-.75)}(E))}}return b}}class Lm{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,c,p){const g=new ac(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(o,c,p);return g}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Pm{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return Q(this._values[o].value)}setValue(o,c){this._values[o]=new sc(this._values[o].property,c===null?void 0:Q(c))}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p)}return o}possiblyEvaluate(o,c,p){const g=new ac(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(o,c,p);return g}}class ys{constructor(o,c,p){this.property=o,this.value=c,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,c,p,g){return this.property.evaluate(this.value,this.parameters,o,c,p,g)}}class ac{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Me{constructor(o){this.specification=o}possiblyEvaluate(o,c){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(c)}interpolate(o,c,p){const g=Qi[this.specification.type];return g?g(o,c,p):o}}class Oe{constructor(o,c){this.specification=o,this.overrides=c}possiblyEvaluate(o,c,p,g){return new ys(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(c,null,{},p,g)}:o.expression,c)}interpolate(o,c,p){if(o.value.kind!=="constant"||c.value.kind!=="constant")return o;if(o.value.value===void 0||c.value.value===void 0)return new ys(this,{kind:"constant",value:void 0},o.parameters);const g=Qi[this.specification.type];if(g){const b=g(o.value.value,c.value.value,p);return new ys(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,c,p,g,b,x){return o.kind==="constant"?o.value:o.evaluate(c,p,g,b,x)}}class Eh extends Oe{possiblyEvaluate(o,c,p,g){if(o.value===void 0)return new ys(this,{kind:"constant",value:void 0},c);if(o.expression.kind==="constant"){const b=o.expression.evaluate(c,null,{},p,g),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,c);return new ys(this,{kind:"constant",value:E},c)}if(o.expression.kind==="camera"){const b=this._calculate(o.expression.evaluate({zoom:c.zoom-1}),o.expression.evaluate({zoom:c.zoom}),o.expression.evaluate({zoom:c.zoom+1}),c);return new ys(this,{kind:"constant",value:b},c)}return new ys(this,o.expression,c)}evaluate(o,c,p,g,b,x){if(o.kind==="source"){const E=o.evaluate(c,p,g,b,x);return this._calculate(E,E,E,c)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(c.zoom)-1},p,g),o.evaluate({zoom:Math.floor(c.zoom)},p,g),o.evaluate({zoom:Math.floor(c.zoom)+1},p,g),c):o.value}_calculate(o,c,p,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class lc{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,g){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(c,null,{},p,g);return this._calculate(b,b,b,c)}return this._calculate(o.expression.evaluate(new sr(Math.floor(c.zoom-1),c)),o.expression.evaluate(new sr(Math.floor(c.zoom),c)),o.expression.evaluate(new sr(Math.floor(c.zoom+1),c)),c)}}_calculate(o,c,p,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class mp{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,g){return!!o.expression.evaluate(c,null,{},p,g)}interpolate(){return!1}}class po{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in o){const p=o[c];p.specification.overridable&&this.overridableProperties.push(c);const g=this.defaultPropertyValues[c]=new sc(p,void 0),b=this.defaultTransitionablePropertyValues[c]=new Sh(p);this.defaultTransitioningPropertyValues[c]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=g.possiblyEvaluate({})}}}we("DataDrivenProperty",Oe),we("DataConstantProperty",Me),we("CrossFadedDataDrivenProperty",Eh),we("CrossFadedProperty",lc),we("ColorRampProperty",mp);const gp="-transition";class _s extends kn{constructor(o,c){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),c.layout&&(this._unevaluatedLayout=new Pm(c.layout)),c.paint)){this._transitionablePaint=new dp(c.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ac(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,c,p={}){c!=null&&this._validate(Jy,`layers.${this.id}.layout.${o}`,o,c,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,c):this.visibility=c)}getPaintProperty(o){return o.endsWith(gp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,c,p={}){if(c!=null&&this._validate(fp,`layers.${this.id}.paint.${o}`,o,c,p))return!1;if(o.endsWith(gp))return this._transitionablePaint.setTransition(o.slice(0,-11),c||void 0),!1;{const g=this._transitionablePaint._values[o],b=g.property.specification["property-type"]==="cross-faded-data-driven",x=g.value.isDataDriven(),E=g.value;this._transitionablePaint.setValue(o,c),this._handleSpecialPaintPropertyUpdate(o);const L=this._transitionablePaint._values[o].value;return L.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,E,L)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,c,p){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,c){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,c)}serialize(){const o={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),Tt(o,(c,p)=>!(c===void 0||p==="layout"&&!Object.keys(c).length||p==="paint"&&!Object.keys(c).length))}_validate(o,c,p,g,b={}){return(!b||b.validate!==!1)&&cu(this,o.call(Cl,{key:c,layerType:this.type,objectKey:p,value:g,styleSpec:kt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const c=this.paint.get(o);if(c instanceof ys&&au(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const Mm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class uc{constructor(o,c){this._structArray=o,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Sr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,c){return o._trim(),c&&(o.isTransferred=!0,c.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const c=Object.create(this.prototype);return c.arrayBuffer=o.arrayBuffer,c.length=o.length,c.capacity=o.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Br(l,o=1){let c=0,p=0;return{members:l.map(g=>{const b=Mm[g.type].BYTES_PER_ELEMENT,x=c=Am(c,Math.max(o,b)),E=g.components||1;return p=Math.max(p,b),c+=b*E,{name:g.name,type:g.type,components:E,offset:x}}),size:Am(c,Math.max(p,o)),alignment:o}}function Am(l,o){return Math.ceil(l/o)*o}class cc extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const g=2*o;return this.int16[g+0]=c,this.int16[g+1]=p,o}}cc.prototype.bytesPerElement=4,we("StructArrayLayout2i4",cc);class ga extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.int16[b+0]=c,this.int16[b+1]=p,this.int16[b+2]=g,o}}ga.prototype.bytesPerElement=6,we("StructArrayLayout3i6",ga);class yp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,g)}emplace(o,c,p,g,b){const x=4*o;return this.int16[x+0]=c,this.int16[x+1]=p,this.int16[x+2]=g,this.int16[x+3]=b,o}}yp.prototype.bytesPerElement=8,we("StructArrayLayout4i8",yp);class _p extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,g,b,x)}emplace(o,c,p,g,b,x,E){const L=6*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=g,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}_p.prototype.bytesPerElement=12,we("StructArrayLayout2i4i12",_p);class vp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,g,b,x)}emplace(o,c,p,g,b,x,E){const L=4*o,A=8*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.uint8[A+4]=g,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=E,o}}vp.prototype.bytesPerElement=8,we("StructArrayLayout2i4ub8",vp);class hc extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const g=2*o;return this.float32[g+0]=c,this.float32[g+1]=p,o}}hc.prototype.bytesPerElement=8,we("StructArrayLayout2f8",hc);class Ih extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,D){const N=this.length;return this.resize(N+1),this.emplace(N,o,c,p,g,b,x,E,L,A,D)}emplace(o,c,p,g,b,x,E,L,A,D,N){const U=10*o;return this.uint16[U+0]=c,this.uint16[U+1]=p,this.uint16[U+2]=g,this.uint16[U+3]=b,this.uint16[U+4]=x,this.uint16[U+5]=E,this.uint16[U+6]=L,this.uint16[U+7]=A,this.uint16[U+8]=D,this.uint16[U+9]=N,o}}Ih.prototype.bytesPerElement=20,we("StructArrayLayout10ui20",Ih);class bp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,D,N,U){const W=this.length;return this.resize(W+1),this.emplace(W,o,c,p,g,b,x,E,L,A,D,N,U)}emplace(o,c,p,g,b,x,E,L,A,D,N,U,W){const X=12*o;return this.int16[X+0]=c,this.int16[X+1]=p,this.int16[X+2]=g,this.int16[X+3]=b,this.uint16[X+4]=x,this.uint16[X+5]=E,this.uint16[X+6]=L,this.uint16[X+7]=A,this.int16[X+8]=D,this.int16[X+9]=N,this.int16[X+10]=U,this.int16[X+11]=W,o}}bp.prototype.bytesPerElement=24,we("StructArrayLayout4i4ui4i24",bp);class xp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.float32[b+0]=c,this.float32[b+1]=p,this.float32[b+2]=g,o}}xp.prototype.bytesPerElement=12,we("StructArrayLayout3f12",xp);class ya extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint32[1*o+0]=c,o}}ya.prototype.bytesPerElement=4,we("StructArrayLayout1ul4",ya);class Ch extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A){const D=this.length;return this.resize(D+1),this.emplace(D,o,c,p,g,b,x,E,L,A)}emplace(o,c,p,g,b,x,E,L,A,D){const N=10*o,U=5*o;return this.int16[N+0]=c,this.int16[N+1]=p,this.int16[N+2]=g,this.int16[N+3]=b,this.int16[N+4]=x,this.int16[N+5]=E,this.uint32[U+3]=L,this.uint16[N+8]=A,this.uint16[N+9]=D,o}}Ch.prototype.bytesPerElement=20,we("StructArrayLayout6i1ul2ui20",Ch);class fc extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,g,b,x)}emplace(o,c,p,g,b,x,E){const L=6*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=g,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}fc.prototype.bytesPerElement=12,we("StructArrayLayout2i2i2i12",fc);class Th extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,c,p,g,b)}emplace(o,c,p,g,b,x){const E=4*o,L=8*o;return this.float32[E+0]=c,this.float32[E+1]=p,this.float32[E+2]=g,this.int16[L+6]=b,this.int16[L+7]=x,o}}Th.prototype.bytesPerElement=16,we("StructArrayLayout2f1f2i16",Th);class pc extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,g)}emplace(o,c,p,g,b){const x=12*o,E=3*o;return this.uint8[x+0]=c,this.uint8[x+1]=p,this.float32[E+1]=g,this.float32[E+2]=b,o}}pc.prototype.bytesPerElement=12,we("StructArrayLayout2ub2f12",pc);class Lh extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.uint16[b+0]=c,this.uint16[b+1]=p,this.uint16[b+2]=g,o}}Lh.prototype.bytesPerElement=6,we("StructArrayLayout3ui6",Lh);class du extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,D,N,U,W,X,tt,ot,ft){const Pt=this.length;return this.resize(Pt+1),this.emplace(Pt,o,c,p,g,b,x,E,L,A,D,N,U,W,X,tt,ot,ft)}emplace(o,c,p,g,b,x,E,L,A,D,N,U,W,X,tt,ot,ft,Pt){const yt=24*o,St=12*o,Yt=48*o;return this.int16[yt+0]=c,this.int16[yt+1]=p,this.uint16[yt+2]=g,this.uint16[yt+3]=b,this.uint32[St+2]=x,this.uint32[St+3]=E,this.uint32[St+4]=L,this.uint16[yt+10]=A,this.uint16[yt+11]=D,this.uint16[yt+12]=N,this.float32[St+7]=U,this.float32[St+8]=W,this.uint8[Yt+36]=X,this.uint8[Yt+37]=tt,this.uint8[Yt+38]=ot,this.uint32[St+10]=ft,this.int16[yt+22]=Pt,o}}du.prototype.bytesPerElement=48,we("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",du);class Tl extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,D,N,U,W,X,tt,ot,ft,Pt,yt,St,Yt,Jt,ve,Ce,ye,pe,se,Ee){const ce=this.length;return this.resize(ce+1),this.emplace(ce,o,c,p,g,b,x,E,L,A,D,N,U,W,X,tt,ot,ft,Pt,yt,St,Yt,Jt,ve,Ce,ye,pe,se,Ee)}emplace(o,c,p,g,b,x,E,L,A,D,N,U,W,X,tt,ot,ft,Pt,yt,St,Yt,Jt,ve,Ce,ye,pe,se,Ee,ce){const ne=32*o,Ne=16*o;return this.int16[ne+0]=c,this.int16[ne+1]=p,this.int16[ne+2]=g,this.int16[ne+3]=b,this.int16[ne+4]=x,this.int16[ne+5]=E,this.int16[ne+6]=L,this.int16[ne+7]=A,this.uint16[ne+8]=D,this.uint16[ne+9]=N,this.uint16[ne+10]=U,this.uint16[ne+11]=W,this.uint16[ne+12]=X,this.uint16[ne+13]=tt,this.uint16[ne+14]=ot,this.uint16[ne+15]=ft,this.uint16[ne+16]=Pt,this.uint16[ne+17]=yt,this.uint16[ne+18]=St,this.uint16[ne+19]=Yt,this.uint16[ne+20]=Jt,this.uint16[ne+21]=ve,this.uint16[ne+22]=Ce,this.uint32[Ne+12]=ye,this.float32[Ne+13]=pe,this.float32[Ne+14]=se,this.uint16[ne+30]=Ee,this.uint16[ne+31]=ce,o}}Tl.prototype.bytesPerElement=64,we("StructArrayLayout8i15ui1ul2f2ui64",Tl);class Ph extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.float32[1*o+0]=c,o}}Ph.prototype.bytesPerElement=4,we("StructArrayLayout1f4",Ph);class Mh extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.uint16[6*o+0]=c,this.float32[b+1]=p,this.float32[b+2]=g,o}}Mh.prototype.bytesPerElement=12,we("StructArrayLayout1ui2f12",Mh);class Ll extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=4*o;return this.uint32[2*o+0]=c,this.uint16[b+2]=p,this.uint16[b+3]=g,o}}Ll.prototype.bytesPerElement=8,we("StructArrayLayout1ul2ui8",Ll);class wp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const g=2*o;return this.uint16[g+0]=c,this.uint16[g+1]=p,o}}wp.prototype.bytesPerElement=4,we("StructArrayLayout2ui4",wp);class Sp extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint16[1*o+0]=c,o}}Sp.prototype.bytesPerElement=2,we("StructArrayLayout1ui2",Sp);class Ah extends Sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,g)}emplace(o,c,p,g,b){const x=4*o;return this.float32[x+0]=c,this.float32[x+1]=p,this.float32[x+2]=g,this.float32[x+3]=b,o}}Ah.prototype.bytesPerElement=16,we("StructArrayLayout4f16",Ah);class km extends uc{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new I(this.anchorPointX,this.anchorPointY)}}km.prototype.size=20;class _ extends Ch{get(o){return new km(this,o)}}we("CollisionBoxArray",_);class s extends uc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}s.prototype.size=48;class f extends du{get(o){return new s(this,o)}}we("PlacedSymbolArray",f);class d extends uc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(o){this._structArray.uint32[this._pos4+12]=o}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}d.prototype.size=64;class m extends Tl{get(o){return new d(this,o)}}we("SymbolInstanceArray",m);class v extends Ph{getoffsetX(o){return this.float32[1*o+0]}}we("GlyphOffsetArray",v);class C extends ga{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}we("SymbolLineVertexArray",C);class T extends uc{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}T.prototype.size=12;class M extends Mh{get(o){return new T(this,o)}}we("TextAnchorOffsetArray",M);class k extends uc{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}k.prototype.size=8;class O extends Ll{get(o){return new k(this,o)}}we("FeatureIndexArray",O);class F extends cc{}class H extends cc{}class it extends cc{}class rt extends _p{}class at extends vp{}class $ extends hc{}class vt extends Ih{}class Rt extends bp{}class ut extends xp{}class Et extends ya{}class Nt extends fc{}class Ft extends pc{}class Ht extends Lh{}class te extends wp{}const $t=Br([{name:"a_pos",components:2,type:"Int16"}],4),{members:oe}=$t;class le{constructor(o=[]){this.segments=o}prepareSegment(o,c,p,g){let b=this.segments[this.segments.length-1];return o>le.MAX_VERTEX_ARRAY_LENGTH&&Kt(`Max vertices per segment is ${le.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>le.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==g)&&(b={vertexOffset:c.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},g!==void 0&&(b.sortKey=g),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const o of this.segments)for(const c in o.vaos)o.vaos[c].destroy()}static simpleSegment(o,c,p,g){return new le([{vertexOffset:o,primitiveOffset:c,vertexLength:p,primitiveLength:g,vaos:{},sortKey:0}])}}function $e(l,o){return 256*(l=ct(Math.floor(l),0,255))+ct(Math.floor(o),0,255)}le.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,we("SegmentVector",le);const ue=Br([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ze={exports:{}},tn={exports:{}};tn.exports=function(l,o){var c,p,g,b,x,E,L,A;for(p=l.length-(c=3&l.length),g=o,x=3432918353,E=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(L=0,c){case 3:L^=(255&l.charCodeAt(A+2))<<16;case 2:L^=(255&l.charCodeAt(A+1))<<8;case 1:g^=L=(65535&(L=(L=(65535&(L^=255&l.charCodeAt(A)))*x+(((L>>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295}return g^=l.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var wn=tn.exports,Ue={exports:{}};Ue.exports=function(l,o){for(var c,p=l.length,g=o^p,b=0;p>=4;)c=1540483477*(65535&(c=255&l.charCodeAt(b)|(255&l.charCodeAt(++b))<<8|(255&l.charCodeAt(++b))<<16|(255&l.charCodeAt(++b))<<24))+((1540483477*(c>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:g^=(255&l.charCodeAt(b+2))<<16;case 2:g^=(255&l.charCodeAt(b+1))<<8;case 1:g=1540483477*(65535&(g^=255&l.charCodeAt(b)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var rn=wn,hn=Ue.exports;ze.exports=rn,ze.exports.murmur3=rn,ze.exports.murmur2=hn;var Er=y(ze.exports);class Gn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,c,p,g){this.ids.push(ko(o)),this.positions.push(c,p,g)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=ko(o);let p=0,g=this.ids.length-1;for(;p>1;this.ids[x]>=c?g=x:p=x+1}const b=[];for(;this.ids[p]===c;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(o,c){const p=new Float64Array(o.ids),g=new Uint32Array(o.positions);return ni(p,g,0,p.length-1),c&&c.push(p.buffer,g.buffer),{ids:p,positions:g}}static deserialize(o){const c=new Gn;return c.ids=o.ids,c.positions=o.positions,c.indexed=!0,c}}function ko(l){const o=+l;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Er(String(l))}function ni(l,o,c,p){for(;c>1];let b=c-1,x=p+1;for(;;){do b++;while(l[b]g);if(b>=x)break;pr(l,b,x),pr(o,3*b,3*x),pr(o,3*b+1,3*x+1),pr(o,3*b+2,3*x+2)}x-c`u_${g}`),this.type=p}setUniform(o,c,p){o.set(p.constantOr(this.value))}getBinding(o,c,p){return this.type==="color"?new Ha(o,c):new Do(o,c)}}class Yr{constructor(o,c){this.uniformNames=c.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=o.tlbr}setUniform(o,c,p,g){const b=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,c,p){return p.substr(0,9)==="u_pattern"?new Gs(o,c):new Do(o,c)}}class dr{constructor(o,c,p,g){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=c.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(o,c,p,g,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new sr(0),c,{},g,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,E)}updatePaintArray(o,c,p,g){const b=this.expression.evaluate({zoom:0},p,g);this._setPaintValue(o,c,b)}_setPaintValue(o,c,p){if(this.type==="color"){const g=Za(p);for(let b=o;b`u_${E}_t`),this.type=p,this.useIntegerZoom=g,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=c.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(o,c,p,g,b){const x=this.expression.evaluate(new sr(this.zoom),c,{},g,[],b),E=this.expression.evaluate(new sr(this.zoom+1),c,{},g,[],b),L=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(L,o,x,E)}updatePaintArray(o,c,p,g){const b=this.expression.evaluate({zoom:this.zoom},p,g),x=this.expression.evaluate({zoom:this.zoom+1},p,g);this._setPaintValue(o,c,b,x)}_setPaintValue(o,c,p,g){if(this.type==="color"){const b=Za(p),x=Za(g);for(let E=o;E`#define HAS_UNIFORM_${g}`))}return o}getBinderAttributes(){const o=[];for(const c in this.binders){const p=this.binders[c];if(p instanceof dr||p instanceof ar)for(let g=0;g!0){this.programConfigurations={};for(const g of o)this.programConfigurations[g.id]=new Kr(g,c,p);this.needsUpload=!1,this._featureMap=new Gn,this._bufferOffset=0}populatePaintArrays(o,c,p,g,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,c,g,b,x);c.id!==void 0&&this._featureMap.add(c.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,c,p,g){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,c,b,g)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function es(l,o){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[l]||[l.replace(`${o}-`,"").replace(/-/g,"_")]}function Jr(l,o,c){const p={color:{source:hc,composite:Ah},number:{source:Ph,composite:hc}},g=function(b){return{"line-pattern":{source:vt,composite:vt},"fill-pattern":{source:vt,composite:vt},"fill-extrusion-pattern":{source:vt,composite:vt}}[b]}(l);return g&&g[c]||p[o][c]}we("ConstantBinder",qs),we("CrossFadedConstantBinder",Yr),we("SourceExpressionBinder",dr),we("CrossFadedCompositeBinder",ts),we("CompositeExpressionBinder",ar),we("ProgramConfiguration",Kr,{omit:["_buffers"]}),we("ProgramConfigurationSet",mr);const kr=8192,Ep=Math.pow(2,14)-1,Dm=-Ep-1;function Pl(l){const o=kr/l.extent,c=l.loadGeometry();for(let p=0;px.x+1||Lx.y+1)&&Kt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function Ml(l,o){return{type:l.type,id:l.id,properties:l.properties,geometry:o?Pl(l):[]}}function kh(l,o,c,p,g){l.emplaceBack(2*o+(p+1)/2,2*c+(g+1)/2)}class Xa{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new H,this.indexArray=new Ht,this.segments=new le,this.programConfigurations=new mr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){const g=this.layers[0],b=[];let x=null,E=!1;g.type==="circle"&&(x=g.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:L,id:A,index:D,sourceLayerIndex:N}of o){const U=this.layers[0]._featureFilter.needGeometry,W=Ml(L,U);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),W,p))continue;const X=E?x.evaluate(W,{},p):void 0,tt={id:A,properties:L.properties,type:L.type,sourceLayerIndex:N,index:D,geometry:U?W.geometry:Pl(L),patterns:{},sortKey:X};b.push(tt)}E&&b.sort((L,A)=>L.sortKey-A.sortKey);for(const L of b){const{geometry:A,index:D,sourceLayerIndex:N}=L,U=o[D].feature;this.addFeature(L,A,D,p),c.featureIndex.insert(U,A,D,N,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,oe),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,c,p,g){for(const b of c)for(const x of b){const E=x.x,L=x.y;if(E<0||E>=kr||L<0||L>=kr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),D=A.vertexLength;kh(this.layoutVertexArray,E,L,-1,-1),kh(this.layoutVertexArray,E,L,1,-1),kh(this.layoutVertexArray,E,L,1,1),kh(this.layoutVertexArray,E,L,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},g)}}function Ip(l,o){for(let c=0;c1){if(Dh(l,o))return!0;for(let p=0;p1?c:c.sub(o)._mult(g)._add(o))}function y1(l,o){let c,p,g,b=!1;for(let x=0;xo.y!=g.y>o.y&&o.x<(g.x-p.x)*(o.y-p.y)/(g.y-p.y)+p.x&&(b=!b)}return b}function Rh(l,o){let c=!1;for(let p=0,g=l.length-1;po.y!=x.y>o.y&&o.x<(x.x-b.x)*(o.y-b.y)/(x.y-b.y)+b.x&&(c=!c)}return c}function DC(l,o,c){const p=c[0],g=c[2];if(l.xg.x&&o.x>g.x||l.yg.y&&o.y>g.y)return!1;const b=bt(l,o,c[0]);return b!==bt(l,o,c[1])||b!==bt(l,o,c[2])||b!==bt(l,o,c[3])}function Pp(l,o,c){const p=o.paint.get(l).value;return p.kind==="constant"?p.value:c.programConfigurations.get(o.id).getMaxValue(l)}function Nm(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}function Om(l,o,c,p,g){if(!o[0]&&!o[1])return l;const b=I.convert(o)._mult(g);c==="viewport"&&b._rotate(-p);const x=[];for(let E=0;Ex1(ot,tt))}(A,L),W=N?D*E:D;for(const X of g)for(const tt of X){const ot=N?tt:x1(tt,L);let ft=W;const Pt=zm([],[tt.x,tt.y,0,1],L);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ft*=Pt[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ft*=x.cameraToCenterDistance/Pt[3]),Rm(U,ot,ft))return!0}return!1}}function x1(l,o){const c=zm([],[l.x,l.y,0,1],o);return new I(c[0]/c[3],c[1]/c[3])}class w1 extends Xa{}let S1;we("HeatmapBucket",w1,{omit:["layers"]});var zC={get paint(){return S1=S1||new po({"heatmap-radius":new Oe(kt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Oe(kt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Me(kt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new mp(kt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Me(kt.paint_heatmap["heatmap-opacity"])})}};function e_(l,{width:o,height:c},p,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==o*c*p)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${o*c*p}`)}else g=new Uint8Array(o*c*p);return l.width=o,l.height=c,l.data=g,l}function E1(l,{width:o,height:c},p){if(o===l.width&&c===l.height)return;const g=e_({},{width:o,height:c},p);n_(l,g,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,o),height:Math.min(l.height,c)},p),l.width=o,l.height=c,l.data=g.data}function n_(l,o,c,p,g,b){if(g.width===0||g.height===0)return o;if(g.width>l.width||g.height>l.height||c.x>l.width-g.width||c.y>l.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>o.width||g.height>o.height||p.x>o.width-g.width||p.y>o.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const x=l.data,E=o.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let L=0;L{o[l.evaluationKey]=L;const A=l.expression.evaluate(o);g.data[x+E+0]=Math.floor(255*A.r/A.a),g.data[x+E+1]=Math.floor(255*A.g/A.a),g.data[x+E+2]=Math.floor(255*A.b/A.a),g.data[x+E+3]=Math.floor(255*A.a)};if(l.clips)for(let x=0,E=0;x80*c){p=b=l[0],g=x=l[1];for(var X=c;Xb&&(b=E),L>x&&(x=L);A=(A=Math.max(b-p,x-g))!==0?32767/A:0}return kp(U,W,c,p,g,A,0),W}function T1(l,o,c,p,g){var b,x;if(g===s_(l,o,c,p)>0)for(b=o;b=o;b-=p)x=M1(b,l[b],l[b+1],x);return x&&Bm(x,x.next)&&(Rp(x),x=x.next),x}function mc(l,o){if(!l)return l;o||(o=l);var c,p=l;do if(c=!1,p.steiner||!Bm(p,p.next)&&Vr(p.prev,p,p.next)!==0)p=p.next;else{if(Rp(p),(p=o=p.prev)===p.next)break;c=!0}while(c||p!==o);return o}function kp(l,o,c,p,g,b,x){if(l){!x&&b&&function(D,N,U,W){var X=D;do X.z===0&&(X.z=i_(X.x,X.y,N,U,W)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==D);X.prevZ.nextZ=null,X.prevZ=null,function(tt){var ot,ft,Pt,yt,St,Yt,Jt,ve,Ce=1;do{for(ft=tt,tt=null,St=null,Yt=0;ft;){for(Yt++,Pt=ft,Jt=0,ot=0;ot0||ve>0&&Pt;)Jt!==0&&(ve===0||!Pt||ft.z<=Pt.z)?(yt=ft,ft=ft.nextZ,Jt--):(yt=Pt,Pt=Pt.nextZ,ve--),St?St.nextZ=yt:tt=yt,yt.prevZ=St,St=yt;ft=Pt}St.nextZ=null,Ce*=2}while(Yt>1)}(X)}(l,p,g,b);for(var E,L,A=l;l.prev!==l.next;)if(E=l.prev,L=l.next,b?jC(l,p,g,b):qC(l))o.push(E.i/c|0),o.push(l.i/c|0),o.push(L.i/c|0),Rp(l),l=L.next,A=L.next;else if((l=L)===A){x?x===1?kp(l=WC(mc(l),o,c),o,c,p,g,b,2):x===2&&HC(l,o,c,p,g,b):kp(mc(l),o,c,p,g,b,1);break}}}function qC(l){var o=l.prev,c=l,p=l.next;if(Vr(o,c,p)>=0)return!1;for(var g=o.x,b=c.x,x=p.x,E=o.y,L=c.y,A=p.y,D=gb?g>x?g:x:b>x?b:x,W=E>L?E>A?E:A:L>A?L:A,X=p.next;X!==o;){if(X.x>=D&&X.x<=U&&X.y>=N&&X.y<=W&&Oh(g,E,b,L,x,A,X.x,X.y)&&Vr(X.prev,X,X.next)>=0)return!1;X=X.next}return!0}function jC(l,o,c,p){var g=l.prev,b=l,x=l.next;if(Vr(g,b,x)>=0)return!1;for(var E=g.x,L=b.x,A=x.x,D=g.y,N=b.y,U=x.y,W=EL?E>A?E:A:L>A?L:A,ot=D>N?D>U?D:U:N>U?N:U,ft=i_(W,X,o,c,p),Pt=i_(tt,ot,o,c,p),yt=l.prevZ,St=l.nextZ;yt&&yt.z>=ft&&St&&St.z<=Pt;){if(yt.x>=W&&yt.x<=tt&&yt.y>=X&&yt.y<=ot&&yt!==g&&yt!==x&&Oh(E,D,L,N,A,U,yt.x,yt.y)&&Vr(yt.prev,yt,yt.next)>=0||(yt=yt.prevZ,St.x>=W&&St.x<=tt&&St.y>=X&&St.y<=ot&&St!==g&&St!==x&&Oh(E,D,L,N,A,U,St.x,St.y)&&Vr(St.prev,St,St.next)>=0))return!1;St=St.nextZ}for(;yt&&yt.z>=ft;){if(yt.x>=W&&yt.x<=tt&&yt.y>=X&&yt.y<=ot&&yt!==g&&yt!==x&&Oh(E,D,L,N,A,U,yt.x,yt.y)&&Vr(yt.prev,yt,yt.next)>=0)return!1;yt=yt.prevZ}for(;St&&St.z<=Pt;){if(St.x>=W&&St.x<=tt&&St.y>=X&&St.y<=ot&&St!==g&&St!==x&&Oh(E,D,L,N,A,U,St.x,St.y)&&Vr(St.prev,St,St.next)>=0)return!1;St=St.nextZ}return!0}function WC(l,o,c){var p=l;do{var g=p.prev,b=p.next.next;!Bm(g,b)&&L1(g,p,p.next,b)&&Dp(g,b)&&Dp(b,g)&&(o.push(g.i/c|0),o.push(p.i/c|0),o.push(b.i/c|0),Rp(p),Rp(p.next),p=l=b),p=p.next}while(p!==l);return mc(p)}function HC(l,o,c,p,g,b){var x=l;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&JC(x,E)){var L=P1(x,E);return x=mc(x,x.next),L=mc(L,L.next),kp(x,o,c,p,g,b,0),void kp(L,o,c,p,g,b,0)}E=E.next}x=x.next}while(x!==l)}function ZC(l,o){return l.x-o.x}function XC(l,o){var c=function(g,b){var x,E=b,L=g.x,A=g.y,D=-1/0;do{if(A<=E.y&&A>=E.next.y&&E.next.y!==E.y){var N=E.x+(A-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(N<=L&&N>D&&(D=N,x=E.x=E.x&&E.x>=X&&L!==E.x&&Oh(Ax.x||E.x===x.x&&YC(x,E)))&&(x=E,ot=U)),E=E.next;while(E!==W);return x}(l,o);if(!c)return o;var p=P1(c,l);return mc(p,p.next),mc(c,c.next)}function YC(l,o){return Vr(l.prev,l,o.prev)<0&&Vr(o.next,l,l.next)<0}function i_(l,o,c,p,g){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-c)*g|0)|l<<8))|l<<4))|l<<2))|l<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*g|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function KC(l){var o=l,c=l;do(o.x=(l-x)*(b-E)&&(l-x)*(p-E)>=(c-x)*(o-E)&&(c-x)*(b-E)>=(g-x)*(p-E)}function JC(l,o){return l.next.i!==o.i&&l.prev.i!==o.i&&!function(c,p){var g=c;do{if(g.i!==c.i&&g.next.i!==c.i&&g.i!==p.i&&g.next.i!==p.i&&L1(g,g.next,c,p))return!0;g=g.next}while(g!==c);return!1}(l,o)&&(Dp(l,o)&&Dp(o,l)&&function(c,p){var g=c,b=!1,x=(c.x+p.x)/2,E=(c.y+p.y)/2;do g.y>E!=g.next.y>E&&g.next.y!==g.y&&x<(g.next.x-g.x)*(E-g.y)/(g.next.y-g.y)+g.x&&(b=!b),g=g.next;while(g!==c);return b}(l,o)&&(Vr(l.prev,l,o.prev)||Vr(l,o.prev,o))||Bm(l,o)&&Vr(l.prev,l,l.next)>0&&Vr(o.prev,o,o.next)>0)}function Vr(l,o,c){return(o.y-l.y)*(c.x-o.x)-(o.x-l.x)*(c.y-o.y)}function Bm(l,o){return l.x===o.x&&l.y===o.y}function L1(l,o,c,p){var g=Um(Vr(l,o,c)),b=Um(Vr(l,o,p)),x=Um(Vr(c,p,l)),E=Um(Vr(c,p,o));return g!==b&&x!==E||!(g!==0||!Vm(l,c,o))||!(b!==0||!Vm(l,p,o))||!(x!==0||!Vm(c,l,p))||!(E!==0||!Vm(c,o,p))}function Vm(l,o,c){return o.x<=Math.max(l.x,c.x)&&o.x>=Math.min(l.x,c.x)&&o.y<=Math.max(l.y,c.y)&&o.y>=Math.min(l.y,c.y)}function Um(l){return l>0?1:l<0?-1:0}function Dp(l,o){return Vr(l.prev,l,l.next)<0?Vr(l,o,l.next)>=0&&Vr(l,l.prev,o)>=0:Vr(l,o,l.prev)<0||Vr(l,l.next,o)<0}function P1(l,o){var c=new o_(l.i,l.x,l.y),p=new o_(o.i,o.x,o.y),g=l.next,b=o.prev;return l.next=o,o.prev=l,c.next=g,g.prev=c,p.next=c,c.prev=p,b.next=p,p.prev=b,p}function M1(l,o,c,p){var g=new o_(l,o,c);return p?(g.next=p.next,g.prev=p,p.next.prev=g,p.next=g):(g.prev=g,g.next=g),g}function Rp(l){l.next.prev=l.prev,l.prev.next=l.next,l.prevZ&&(l.prevZ.nextZ=l.nextZ),l.nextZ&&(l.nextZ.prevZ=l.prevZ)}function o_(l,o,c){this.i=l,this.x=o,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function s_(l,o,c,p){for(var g=0,b=o,x=c-p;b0&&c.holes.push(p+=l[g-1].length)}return c};var A1=y(r_.exports);function QC(l,o,c,p,g){k1(l,o,c||0,p||l.length-1,g||$C)}function k1(l,o,c,p,g){for(;p>c;){if(p-c>600){var b=p-c+1,x=o-c+1,E=Math.log(b),L=.5*Math.exp(2*E/3),A=.5*Math.sqrt(E*L*(b-L)/b)*(x-b/2<0?-1:1);k1(l,o,Math.max(c,Math.floor(o-x*L/b+A)),Math.min(p,Math.floor(o+(b-x)*L/b+A)),g)}var D=l[o],N=c,U=p;for(Np(l,c,o),g(l[p],D)>0&&Np(l,c,p);N0;)U--}g(l[c],D)===0?Np(l,c,U):Np(l,++U,p),U<=o&&(c=U+1),o<=U&&(p=U-1)}}function Np(l,o,c){var p=l[o];l[o]=l[c],l[c]=p}function $C(l,o){return lo?1:0}function a_(l,o){const c=l.length;if(c<=1)return[l];const p=[];let g,b;for(let x=0;x1)for(let x=0;xc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new it,this.indexArray=new Ht,this.indexArray2=new te,this.programConfigurations=new mr(o.layers,o.zoom),this.segments=new le,this.segments2=new le,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=l_("fill",this.layers,c);const g=this.layers[0].layout.get("fill-sort-key"),b=!g.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:D}of o){const N=this.layers[0]._featureFilter.needGeometry,U=Ml(E,N);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),U,p))continue;const W=b?g.evaluate(U,{},p,c.availableImages):void 0,X={id:L,properties:E.properties,type:E.type,sourceLayerIndex:D,index:A,geometry:N?U.geometry:Pl(E),patterns:{},sortKey:W};x.push(X)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:D}=E;if(this.hasPattern){const N=u_("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(N)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(o[A].feature,L,A,D,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,GC),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(o,c,p,g,b){for(const x of a_(c,500)){let E=0;for(const W of x)E+=W.length;const L=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),A=L.vertexLength,D=[],N=[];for(const W of x){if(W.length===0)continue;W!==x[0]&&N.push(D.length/2);const X=this.segments2.prepareSegment(W.length,this.layoutVertexArray,this.indexArray2),tt=X.vertexLength;this.layoutVertexArray.emplaceBack(W[0].x,W[0].y),this.indexArray2.emplaceBack(tt+W.length-1,tt),D.push(W[0].x),D.push(W[0].y);for(let ot=1;ot>3}if(g--,p===1||p===2)b+=l.readSVarint(),x+=l.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new sT(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},zh.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var o=l.readVarint()+l.pos,c=1,p=0,g=0,b=0,x=1/0,E=-1/0,L=1/0,A=-1/0;l.pos>3}if(p--,c===1||c===2)(g+=l.readSVarint())E&&(E=g),(b+=l.readSVarint())A&&(A=b);else if(c!==7)throw new Error("unknown command "+c)}return[x,L,E,A]},zh.prototype.toGeoJSON=function(l,o,c){var p,g,b=this.extent*Math.pow(2,c),x=this.extent*l,E=this.extent*o,L=this.loadGeometry(),A=zh.types[this.type];function D(W){for(var X=0;X>3;g=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return g}(c))}z1.prototype.feature=function(l){if(l<0||l>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];var o=this._pbf.readVarint()+this._pbf.pos;return new uT(this._pbf,o,this.extent,this._keys,this._values)};var hT=O1;function fT(l,o,c){if(l===3){var p=new hT(c,c.readVarint()+c.pos);p.length&&(o[p.name]=p)}}mu.VectorTile=function(l,o){this.layers=l.readFields(fT,{},o)},mu.VectorTileFeature=N1,mu.VectorTileLayer=O1;const pT=mu.VectorTileFeature.types,h_=Math.pow(2,13);function Op(l,o,c,p,g,b,x,E){l.emplaceBack(o,c,2*Math.floor(p*h_)+x,g*h_*2,b*h_*2,Math.round(E))}class f_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new rt,this.centroidVertexArray=new F,this.indexArray=new Ht,this.programConfigurations=new mr(o.layers,o.zoom),this.segments=new le,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.features=[],this.hasPattern=l_("fill-extrusion",this.layers,c);for(const{feature:g,id:b,index:x,sourceLayerIndex:E}of o){const L=this.layers[0]._featureFilter.needGeometry,A=Ml(g,L);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),A,p))continue;const D={id:b,sourceLayerIndex:E,index:x,geometry:L?A.geometry:Pl(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(u_("fill-extrusion",this.layers,D,this.zoom,c)):this.addFeature(D,D.geometry,x,p,{}),c.featureIndex.insert(g,D.geometry,x,E,this.index,!0)}}addFeatures(o,c,p){for(const g of this.features){const{geometry:b}=g;this.addFeature(g,b,g.index,c,p)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,oT),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,iT.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,c,p,g,b){const x={x:0,y:0,vertexCount:0};for(const E of a_(c,500)){let L=0;for(const X of E)L+=X.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const X of E){if(X.length===0||mT(X))continue;let tt=0;for(let ot=0;ot=1){const Pt=X[ot-1];if(!dT(ft,Pt)){A.vertexLength+4>le.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const yt=ft.sub(Pt)._perp()._unit(),St=Pt.dist(ft);tt+St>32768&&(tt=0),Op(this.layoutVertexArray,ft.x,ft.y,yt.x,yt.y,0,0,tt),Op(this.layoutVertexArray,ft.x,ft.y,yt.x,yt.y,0,1,tt),x.x+=2*ft.x,x.y+=2*ft.y,x.vertexCount+=2,tt+=St,Op(this.layoutVertexArray,Pt.x,Pt.y,yt.x,yt.y,0,0,tt),Op(this.layoutVertexArray,Pt.x,Pt.y,yt.x,yt.y,0,1,tt),x.x+=2*Pt.x,x.y+=2*Pt.y,x.vertexCount+=2;const Yt=A.vertexLength;this.indexArray.emplaceBack(Yt,Yt+2,Yt+1),this.indexArray.emplaceBack(Yt+1,Yt+2,Yt+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+L>le.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(L,this.layoutVertexArray,this.indexArray)),pT[o.type]!=="Polygon")continue;const D=[],N=[],U=A.vertexLength;for(const X of E)if(X.length!==0){X!==E[0]&&N.push(D.length/2);for(let tt=0;ttkr)||l.y===o.y&&(l.y<0||l.y>kr)}function mT(l){return l.every(o=>o.x<0)||l.every(o=>o.x>kr)||l.every(o=>o.y<0)||l.every(o=>o.y>kr)}let F1;we("FillExtrusionBucket",f_,{omit:["layers","features"]});var gT={get paint(){return F1=F1||new po({"fill-extrusion-opacity":new Me(kt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Oe(kt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Me(kt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Me(kt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Eh(kt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Oe(kt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Oe(kt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Me(kt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class yT extends _s{constructor(o){super(o,gT)}createBucket(o){return new f_(o)}queryRadius(){return Nm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,c,p,g,b,x,E,L){const A=Om(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),D=this.paint.get("fill-extrusion-height").evaluate(c,p),N=this.paint.get("fill-extrusion-base").evaluate(c,p),U=function(X,tt,ot,ft){const Pt=[];for(const yt of X){const St=[yt.x,yt.y,0,1];zm(St,St,tt),Pt.push(new I(St[0]/St[3],St[1]/St[3]))}return Pt}(A,L),W=function(X,tt,ot,ft){const Pt=[],yt=[],St=ft[8]*tt,Yt=ft[9]*tt,Jt=ft[10]*tt,ve=ft[11]*tt,Ce=ft[8]*ot,ye=ft[9]*ot,pe=ft[10]*ot,se=ft[11]*ot;for(const Ee of X){const ce=[],ne=[];for(const Ne of Ee){const Le=Ne.x,fn=Ne.y,er=ft[0]*Le+ft[4]*fn+ft[12],lr=ft[1]*Le+ft[5]*fn+ft[13],oi=ft[2]*Le+ft[6]*fn+ft[14],ns=ft[3]*Le+ft[7]*fn+ft[15],go=oi+Jt,Qr=ns+ve,Pi=er+Ce,zi=lr+ye,yo=oi+pe,_o=ns+se,si=new I((er+St)/Qr,(lr+Yt)/Qr);si.z=go/Qr,ce.push(si);const ai=new I(Pi/_o,zi/_o);ai.z=yo/_o,ne.push(ai)}Pt.push(ce),yt.push(ne)}return[Pt,yt]}(g,N,D,L);return function(X,tt,ot){let ft=1/0;Cp(ot,tt)&&(ft=B1(ot,tt[0]));for(let Pt=0;Ptc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new at,this.layoutVertexArray2=new $,this.indexArray=new Ht,this.programConfigurations=new mr(o.layers,o.zoom),this.segments=new le,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=l_("line",this.layers,c);const g=this.layers[0].layout.get("line-sort-key"),b=!g.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:D}of o){const N=this.layers[0]._featureFilter.needGeometry,U=Ml(E,N);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),U,p))continue;const W=b?g.evaluate(U,{},p):void 0,X={id:L,properties:E.properties,type:E.type,sourceLayerIndex:D,index:A,geometry:N?U.geometry:Pl(E),patterns:{},sortKey:W};x.push(X)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:D}=E;if(this.hasPattern){const N=u_("line",this.layers,E,this.zoom,c);this.patternFeatures.push(N)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(o[A].feature,L,A,D,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,xT)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,vT),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,c,p,g,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(o,{}),L=x.get("line-cap"),A=x.get("line-miter-limit"),D=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const N of c)this.addLine(N,o,E,L,A,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,g)}addLine(o,c,p,g,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ft=0;ft=2&&o[L-1].equals(o[L-2]);)L--;let A=0;for(;A0;if(ve&&ft>A){const se=U.dist(W);if(se>2*D){const Ee=U.sub(U.sub(W)._mult(D/se)._round());this.updateDistance(W,Ee),this.addCurrentVertex(Ee,tt,0,0,N),W=Ee}}const ye=W&&X;let pe=ye?p:E?"butt":g;if(ye&&pe==="round"&&(Ytb&&(pe="bevel"),pe==="bevel"&&(Yt>2&&(pe="flipbevel"),Yt100)Pt=ot.mult(-1);else{const se=Yt*tt.add(ot).mag()/tt.sub(ot).mag();Pt._perp()._mult(se*(Ce?-1:1))}this.addCurrentVertex(U,Pt,0,0,N),this.addCurrentVertex(U,Pt.mult(-1),0,0,N)}else if(pe==="bevel"||pe==="fakeround"){const se=-Math.sqrt(Yt*Yt-1),Ee=Ce?se:0,ce=Ce?0:se;if(W&&this.addCurrentVertex(U,tt,Ee,ce,N),pe==="fakeround"){const ne=Math.round(180*Jt/Math.PI/20);for(let Ne=1;Ne2*D){const Ee=U.add(X.sub(U)._mult(D/se)._round());this.updateDistance(U,Ee),this.addCurrentVertex(Ee,ot,0,0,N),U=Ee}}}}addCurrentVertex(o,c,p,g,b,x=!1){const E=c.y*g-c.x,L=-c.y-c.x*g;this.addHalfVertex(o,c.x+c.y*p,c.y-c.x*p,x,!1,p,b),this.addHalfVertex(o,E,L,x,!0,-g,b),this.distance>V1/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,c,p,g,b,x))}addHalfVertex({x:o,y:c},p,g,b,x,E,L){const A=.5*(this.lineClips?this.scaledDistance*(V1-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(c<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*g)+128,1+(E===0?0:E<0?-1:1)|(63&A)<<2,A>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=L.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),L.primitiveLength++),x?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,c){this.distance+=o.dist(c),this.updateScaledDistance()}}let U1,G1;we("LineBucket",p_,{omit:["layers","patternFeatures"]});var q1={get paint(){return G1=G1||new po({"line-opacity":new Oe(kt.paint_line["line-opacity"]),"line-color":new Oe(kt.paint_line["line-color"]),"line-translate":new Me(kt.paint_line["line-translate"]),"line-translate-anchor":new Me(kt.paint_line["line-translate-anchor"]),"line-width":new Oe(kt.paint_line["line-width"]),"line-gap-width":new Oe(kt.paint_line["line-gap-width"]),"line-offset":new Oe(kt.paint_line["line-offset"]),"line-blur":new Oe(kt.paint_line["line-blur"]),"line-dasharray":new lc(kt.paint_line["line-dasharray"]),"line-pattern":new Eh(kt.paint_line["line-pattern"]),"line-gradient":new mp(kt.paint_line["line-gradient"])})},get layout(){return U1=U1||new po({"line-cap":new Me(kt.layout_line["line-cap"]),"line-join":new Oe(kt.layout_line["line-join"]),"line-miter-limit":new Me(kt.layout_line["line-miter-limit"]),"line-round-limit":new Me(kt.layout_line["line-round-limit"]),"line-sort-key":new Oe(kt.layout_line["line-sort-key"])})}};class ET extends Oe{possiblyEvaluate(o,c){return c=new sr(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(o,c)}evaluate(o,c,p,g){return c=lt({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(o,c,p,g)}}let Gm;class IT extends _s{constructor(o){super(o,q1),this.gradientVersion=0,Gm||(Gm=new ET(q1.paint.properties["line-width"].specification),Gm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof tc,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,c){super.recalculate(o,c),this.paint._values["line-floorwidth"]=Gm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new p_(o)}queryRadius(o){const c=o,p=j1(Pp("line-width",this,c),Pp("line-gap-width",this,c)),g=Pp("line-offset",this,c);return p/2+Math.abs(g)+Nm(this.paint.get("line-translate"))}queryIntersectsFeature(o,c,p,g,b,x,E){const L=Om(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),A=E/2*j1(this.paint.get("line-width").evaluate(c,p),this.paint.get("line-gap-width").evaluate(c,p)),D=this.paint.get("line-offset").evaluate(c,p);return D&&(g=function(N,U){const W=[];for(let X=0;X=3){for(let ot=0;ot0?o+2*l:l}const CT=Br([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),TT=Br([{name:"a_projected_pos",components:3,type:"Float32"}],4);Br([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const LT=Br([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Br([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const W1=Br([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),PT=Br([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function MT(l,o,c){return l.sections.forEach(p=>{p.text=function(g,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?g=g.toLocaleUpperCase():E==="lowercase"&&(g=g.toLocaleLowerCase()),Wa.applyArabicShaping&&(g=Wa.applyArabicShaping(g)),g}(p.text,o,c)}),l}Br([{name:"triangle",components:3,type:"Uint16"}]),Br([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Br([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Br([{type:"Float32",name:"offsetX"}]),Br([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Br([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Fp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ii=24,H1=Wn,Z1=function(l,o,c,p,g){var b,x,E=8*g-p-1,L=(1<>1,D=-7,N=c?g-1:0,U=c?-1:1,W=l[o+N];for(N+=U,b=W&(1<<-D)-1,W>>=-D,D+=E;D>0;b=256*b+l[o+N],N+=U,D-=8);for(x=b&(1<<-D)-1,b>>=-D,D+=p;D>0;x=256*x+l[o+N],N+=U,D-=8);if(b===0)b=1-A;else{if(b===L)return x?NaN:1/0*(W?-1:1);x+=Math.pow(2,p),b-=A}return(W?-1:1)*x*Math.pow(2,b-p)},X1=function(l,o,c,p,g,b){var x,E,L,A=8*b-g-1,D=(1<>1,U=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,W=p?0:b-1,X=p?1:-1,tt=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,x=D):(x=Math.floor(Math.log(o)/Math.LN2),o*(L=Math.pow(2,-x))<1&&(x--,L*=2),(o+=x+N>=1?U/L:U*Math.pow(2,1-N))*L>=2&&(x++,L/=2),x+N>=D?(E=0,x=D):x+N>=1?(E=(o*L-1)*Math.pow(2,g),x+=N):(E=o*Math.pow(2,N-1)*Math.pow(2,g),x=0));g>=8;l[c+W]=255&E,W+=X,E/=256,g-=8);for(x=x<0;l[c+W]=255&x,W+=X,x/=256,A-=8);l[c+W-X]|=128*tt};function Wn(l){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(l)?l:new Uint8Array(l||0),this.pos=0,this.type=0,this.length=this.buf.length}Wn.Varint=0,Wn.Fixed64=1,Wn.Bytes=2,Wn.Fixed32=5;var d_=4294967296,Y1=1/d_,K1=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Al(l){return l.type===Wn.Bytes?l.readVarint()+l.pos:l.pos+1}function Fh(l,o,c){return c?4294967296*o+(l>>>0):4294967296*(o>>>0)+(l>>>0)}function J1(l,o,c){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));c.realloc(p);for(var g=c.pos-1;g>=l;g--)c.buf[g+p]=c.buf[g]}function AT(l,o){for(var c=0;c>>8,l[c+2]=o>>>16,l[c+3]=o>>>24}function Q1(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16)+(l[o+3]<<24)}Wn.prototype={destroy:function(){this.buf=null},readFields:function(l,o,c){for(c=c||this.length;this.pos>3,b=this.pos;this.type=7&p,l(g,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(l,o){return this.readFields(l,o,this.readVarint()+this.pos)},readFixed32:function(){var l=qm(this.buf,this.pos);return this.pos+=4,l},readSFixed32:function(){var l=Q1(this.buf,this.pos);return this.pos+=4,l},readFixed64:function(){var l=qm(this.buf,this.pos)+qm(this.buf,this.pos+4)*d_;return this.pos+=8,l},readSFixed64:function(){var l=qm(this.buf,this.pos)+Q1(this.buf,this.pos+4)*d_;return this.pos+=8,l},readFloat:function(){var l=Z1(this.buf,this.pos,!0,23,4);return this.pos+=4,l},readDouble:function(){var l=Z1(this.buf,this.pos,!0,52,8);return this.pos+=8,l},readVarint:function(l){var o,c,p=this.buf;return o=127&(c=p[this.pos++]),c<128?o:(o|=(127&(c=p[this.pos++]))<<7,c<128?o:(o|=(127&(c=p[this.pos++]))<<14,c<128?o:(o|=(127&(c=p[this.pos++]))<<21,c<128?o:function(g,b,x){var E,L,A=x.buf;if(E=(112&(L=A[x.pos++]))>>4,L<128||(E|=(127&(L=A[x.pos++]))<<3,L<128)||(E|=(127&(L=A[x.pos++]))<<10,L<128)||(E|=(127&(L=A[x.pos++]))<<17,L<128)||(E|=(127&(L=A[x.pos++]))<<24,L<128)||(E|=(1&(L=A[x.pos++]))<<31,L<128))return Fh(g,E,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(c=p[this.pos]))<<28,l,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var l=this.readVarint();return l%2==1?(l+1)/-2:l/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var l=this.readVarint()+this.pos,o=this.pos;return this.pos=l,l-o>=12&&K1?function(c,p,g){return K1.decode(c.subarray(p,g))}(this.buf,o,l):function(c,p,g){for(var b="",x=p;x239?4:D>223?3:D>191?2:1;if(x+U>g)break;U===1?D<128&&(N=D):U===2?(192&(E=c[x+1]))==128&&(N=(31&D)<<6|63&E)<=127&&(N=null):U===3?(L=c[x+2],(192&(E=c[x+1]))==128&&(192&L)==128&&((N=(15&D)<<12|(63&E)<<6|63&L)<=2047||N>=55296&&N<=57343)&&(N=null)):U===4&&(L=c[x+2],A=c[x+3],(192&(E=c[x+1]))==128&&(192&L)==128&&(192&A)==128&&((N=(15&D)<<18|(63&E)<<12|(63&L)<<6|63&A)<=65535||N>=1114112)&&(N=null)),N===null?(N=65533,U=1):N>65535&&(N-=65536,b+=String.fromCharCode(N>>>10&1023|55296),N=56320|1023&N),b+=String.fromCharCode(N),x+=U}return b}(this.buf,o,l)},readBytes:function(){var l=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,l);return this.pos=l,o},readPackedVarint:function(l,o){if(this.type!==Wn.Bytes)return l.push(this.readVarint(o));var c=Al(this);for(l=l||[];this.pos127;);else if(o===Wn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Wn.Fixed32)this.pos+=4;else{if(o!==Wn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(l,o){this.writeVarint(l<<3|o)},realloc:function(l){for(var o=this.length||16;o268435455||l<0?function(o,c){var p,g;if(o>=0?(p=o%4294967296|0,g=o/4294967296|0):(g=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,g=g+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(b,x,E){E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,E.buf[E.pos]=127&(b>>>=7)}(p,0,c),function(b,x){var E=(7&b)<<4;x.buf[x.pos++]|=E|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(g,c)}(l,this):(this.realloc(4),this.buf[this.pos++]=127&l|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=l>>>7&127))))},writeSVarint:function(l){this.writeVarint(l<0?2*-l-1:2*l)},writeBoolean:function(l){this.writeVarint(!!l)},writeString:function(l){l=String(l),this.realloc(4*l.length),this.pos++;var o=this.pos;this.pos=function(p,g,b){for(var x,E,L=0;L55295&&x<57344){if(!E){x>56319||L+1===g.length?(p[b++]=239,p[b++]=191,p[b++]=189):E=x;continue}if(x<56320){p[b++]=239,p[b++]=191,p[b++]=189,E=x;continue}x=E-55296<<10|x-56320|65536,E=null}else E&&(p[b++]=239,p[b++]=191,p[b++]=189,E=null);x<128?p[b++]=x:(x<2048?p[b++]=x>>6|192:(x<65536?p[b++]=x>>12|224:(p[b++]=x>>18|240,p[b++]=x>>12&63|128),p[b++]=x>>6&63|128),p[b++]=63&x|128)}return b}(this.buf,l,this.pos);var c=this.pos-o;c>=128&&J1(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeFloat:function(l){this.realloc(4),X1(this.buf,l,this.pos,!0,23,4),this.pos+=4},writeDouble:function(l){this.realloc(8),X1(this.buf,l,this.pos,!0,52,8),this.pos+=8},writeBytes:function(l){var o=l.length;this.writeVarint(o),this.realloc(o);for(var c=0;c=128&&J1(c,p,this),this.pos=c-1,this.writeVarint(p),this.pos+=p},writeMessage:function(l,o,c){this.writeTag(l,Wn.Bytes),this.writeRawMessage(o,c)},writePackedVarint:function(l,o){o.length&&this.writeMessage(l,AT,o)},writePackedSVarint:function(l,o){o.length&&this.writeMessage(l,kT,o)},writePackedBoolean:function(l,o){o.length&&this.writeMessage(l,NT,o)},writePackedFloat:function(l,o){o.length&&this.writeMessage(l,DT,o)},writePackedDouble:function(l,o){o.length&&this.writeMessage(l,RT,o)},writePackedFixed32:function(l,o){o.length&&this.writeMessage(l,OT,o)},writePackedSFixed32:function(l,o){o.length&&this.writeMessage(l,zT,o)},writePackedFixed64:function(l,o){o.length&&this.writeMessage(l,FT,o)},writePackedSFixed64:function(l,o){o.length&&this.writeMessage(l,BT,o)},writeBytesField:function(l,o){this.writeTag(l,Wn.Bytes),this.writeBytes(o)},writeFixed32Field:function(l,o){this.writeTag(l,Wn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(l,o){this.writeTag(l,Wn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(l,o){this.writeTag(l,Wn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(l,o){this.writeTag(l,Wn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(l,o){this.writeTag(l,Wn.Varint),this.writeVarint(o)},writeSVarintField:function(l,o){this.writeTag(l,Wn.Varint),this.writeSVarint(o)},writeStringField:function(l,o){this.writeTag(l,Wn.Bytes),this.writeString(o)},writeFloatField:function(l,o){this.writeTag(l,Wn.Fixed32),this.writeFloat(o)},writeDoubleField:function(l,o){this.writeTag(l,Wn.Fixed64),this.writeDouble(o)},writeBooleanField:function(l,o){this.writeVarintField(l,!!o)}};var m_=y(H1);const g_=3;function VT(l,o,c){l===1&&c.readMessage(UT,o)}function UT(l,o,c){if(l===3){const{id:p,bitmap:g,width:b,height:x,left:E,top:L,advance:A}=c.readMessage(GT,{});o.push({id:p,bitmap:new Ap({width:b+2*g_,height:x+2*g_},g),metrics:{width:b,height:x,left:E,top:L,advance:A}})}}function GT(l,o,c){l===1?o.id=c.readVarint():l===2?o.bitmap=c.readBytes():l===3?o.width=c.readVarint():l===4?o.height=c.readVarint():l===5?o.left=c.readSVarint():l===6?o.top=c.readSVarint():l===7&&(o.advance=c.readVarint())}const $1=g_;function tb(l){let o=0,c=0;for(const x of l)o+=x.w*x.h,c=Math.max(c,x.w);l.sort((x,E)=>E.h-x.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),c),h:1/0}];let g=0,b=0;for(const x of l)for(let E=p.length-1;E>=0;E--){const L=p[E];if(!(x.w>L.w||x.h>L.h)){if(x.x=L.x,x.y=L.y,b=Math.max(b,x.y+x.h),g=Math.max(g,x.x+x.w),x.w===L.w&&x.h===L.h){const A=p.pop();E=0&&p>=o&&Wm[this.text.charCodeAt(p)];p--)c--;this.text=this.text.substring(o,c),this.sectionIndex=this.sectionIndex.slice(o,c)}substring(o,c){const p=new Vh;return p.text=this.text.substring(o,c),p.sectionIndex=this.sectionIndex.slice(o,c),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,c)=>Math.max(o,this.sections[c].scale),0)}addTextSection(o,c){this.text+=o.text,this.sections.push(Vp.forText(o.scale,o.fontStack||c));const p=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function jm(l,o,c,p,g,b,x,E,L,A,D,N,U,W,X,tt){const ot=Vh.fromFeature(l,g);let ft;N===h.ah.vertical&&ot.verticalizePunctuation();const{processBidirectionalText:Pt,processStyledBidirectionalText:yt}=Wa;if(Pt&&ot.sections.length===1){ft=[];const Jt=Pt(ot.toString(),__(ot,A,b,o,p,W,X));for(const ve of Jt){const Ce=new Vh;Ce.text=ve,Ce.sections=ot.sections;for(let ye=0;ye0&&Dl>No&&(No=Dl)}else{const xs=Ce[_n.fontStack],zo=xs&&xs[Fi];if(zo&&zo.rect)_a=zo.rect,js=zo.metrics;else{const Dl=ve[_n.fontStack],Wp=Dl&&Dl[Fi];if(!Wp)continue;js=Wp.metrics}ui=(ai-_n.scale)*ii}Ws?(Jt.verticalizable=!0,eo.push({glyph:Fi,imageName:va,x:er,y:lr+ui,vertical:Ws,scale:_n.scale,fontStack:_n.fontStack,sectionIndex:no,metrics:js,rect:_a}),er+=kl*_n.scale+Ne):(eo.push({glyph:Fi,imageName:va,x:er,y:lr+ui,vertical:Ws,scale:_n.scale,fontStack:_n.fontStack,sectionIndex:no,metrics:js,rect:_a}),er+=js.advance*_n.scale+Ne)}eo.length!==0&&(oi=Math.max(er-Ne,oi),WT(eo,0,eo.length-1,go,No)),er=0;const Oo=se*ai+No;vo.lineOffset=Math.max(No,to),lr+=Oo,ns=Math.max(Oo,ns),++Qr}var Pi;const zi=lr-Bp,{horizontalAlign:yo,verticalAlign:_o}=v_(Ee);(function(si,ai,to,vo,eo,No,Oo,li,_n){const no=(ai-to)*eo;let Fi=0;Fi=No!==Oo?-li*vo-Bp:(-vo*_n+.5)*Oo;for(const ui of si)for(const js of ui.positionedGlyphs)js.x+=no,js.y+=Fi})(Jt.positionedLines,go,yo,_o,oi,ns,se,zi,pe.length),Jt.top+=-_o*zi,Jt.bottom=Jt.top+zi,Jt.left+=-yo*oi,Jt.right=Jt.left+oi}(Yt,o,c,p,ft,x,E,L,N,A,U,tt),!function(Jt){for(const ve of Jt)if(ve.positionedGlyphs.length!==0)return!1;return!0}(St)&&Yt}const Wm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},qT={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function nb(l,o,c,p,g,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*ii/b+g:0}{const x=c[o.fontStack],E=x&&x[l];return E?E.metrics.advance*o.scale+g:0}}function rb(l,o,c,p){const g=Math.pow(l-o,2);return p?l=0;let D=0;for(let U=0;Ux.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=t_([]),this.placementViewportMatrix=t_([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ab(this.zoom,c["text-size"]),this.iconSizeData=ab(this.zoom,c["icon-size"]);const p=this.layers[0].layout,g=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=b_(p,"text-overlap","text-allow-overlap")!=="never"||b_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>h.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=o.sourceID}createArrays(){this.text=new w_(new mr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new w_(new mr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new v,this.lineVertexArray=new C,this.symbolInstances=new m,this.textAnchorOffsets=new M}calculateGlyphDependencies(o,c,p,g,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),D=L.value.kind!=="constant"||!!L.value.value||Object.keys(L.parameters).length>0,N=b.get("symbol-sort-key");if(this.features=[],!A&&!D)return;const U=c.iconDependencies,W=c.glyphDependencies,X=c.availableImages,tt=new sr(this.zoom);for(const{feature:ot,id:ft,index:Pt,sourceLayerIndex:yt}of o){const St=g._featureFilter.needGeometry,Yt=Ml(ot,St);if(!g._featureFilter.filter(tt,Yt,p))continue;let Jt,ve;if(St||(Yt.geometry=Pl(ot)),A){const ye=g.getValueAndResolveTokens("text-field",Yt,p,X),pe=Po.factory(ye),se=this.hasRTLText=this.hasRTLText||YT(pe);(!se||Wa.getRTLTextPluginStatus()==="unavailable"||se&&Wa.isParsed())&&(Jt=MT(pe,g,Yt))}if(D){const ye=g.getValueAndResolveTokens("icon-image",Yt,p,X);ve=ye instanceof $o?ye:$o.fromString(ye)}if(!Jt&&!ve)continue;const Ce=this.sortFeaturesByKey?N.evaluate(Yt,{},p):void 0;if(this.features.push({id:ft,text:Jt,icon:ve,index:Pt,sourceLayerIndex:yt,geometry:Yt.geometry,properties:ot.properties,type:ZT[ot.type],sortKey:Ce}),ve&&(U[ve.name]=!0),Jt){const ye=x.evaluate(Yt,{},p).join(","),pe=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.ah.vertical)>=0;for(const se of Jt.sections)if(se.image)U[se.image.name]=!0;else{const Ee=pu(Jt.toString()),ce=se.fontStack||ye,ne=W[ce]=W[ce]||{};this.calculateGlyphDependencies(se.text,ne,pe,this.allowVerticalPlacement,Ee)}}}b.get("symbol-placement")==="line"&&(this.features=function(ot){const ft={},Pt={},yt=[];let St=0;function Yt(ye){yt.push(ot[ye]),St++}function Jt(ye,pe,se){const Ee=Pt[ye];return delete Pt[ye],Pt[pe]=Ee,yt[Ee].geometry[0].pop(),yt[Ee].geometry[0]=yt[Ee].geometry[0].concat(se[0]),Ee}function ve(ye,pe,se){const Ee=ft[pe];return delete ft[pe],ft[ye]=Ee,yt[Ee].geometry[0].shift(),yt[Ee].geometry[0]=se[0].concat(yt[Ee].geometry[0]),Ee}function Ce(ye,pe,se){const Ee=se?pe[0][pe[0].length-1]:pe[0][0];return`${ye}:${Ee.x}:${Ee.y}`}for(let ye=0;yeye.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ot,ft)=>ot.sortKey-ft.sortKey)}update(o,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,c,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,c,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(o,c){const p=this.lineVertexArray.length;if(o.segment!==void 0){let g=o.dist(c[o.segment+1]),b=o.dist(c[o.segment]);const x={};for(let E=o.segment+1;E=0;E--)x[E]={x:c[E].x,y:c[E].y,tileUnitDistanceFromAnchor:b},E>0&&(b+=c[E-1].dist(c[E]));for(let E=0;E0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(o,c){const p=o.placedSymbolArray.get(c),g=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;bg[E]-g[L]||b[L]-b[E]),x}addToSortKeyRanges(o,c){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===c?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const c of this.symbolInstanceIndexes){const p=this.symbolInstances.get(c);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((g,b,x)=>{g>=0&&x.indexOf(g)===b&&this.addIndicesForPlacedSymbol(this.text,g)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let lb,ub;we("SymbolBucket",Uh,{omit:["layers","collisionBoxArray","features","compareText"]}),Uh.MAX_GLYPHS=65535,Uh.addDynamicAttributes=x_;var E_={get paint(){return ub=ub||new po({"icon-opacity":new Oe(kt.paint_symbol["icon-opacity"]),"icon-color":new Oe(kt.paint_symbol["icon-color"]),"icon-halo-color":new Oe(kt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Oe(kt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Oe(kt.paint_symbol["icon-halo-blur"]),"icon-translate":new Me(kt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Me(kt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Oe(kt.paint_symbol["text-opacity"]),"text-color":new Oe(kt.paint_symbol["text-color"],{runtimeType:Ar,getOverride:l=>l.textColor,hasOverride:l=>!!l.textColor}),"text-halo-color":new Oe(kt.paint_symbol["text-halo-color"]),"text-halo-width":new Oe(kt.paint_symbol["text-halo-width"]),"text-halo-blur":new Oe(kt.paint_symbol["text-halo-blur"]),"text-translate":new Me(kt.paint_symbol["text-translate"]),"text-translate-anchor":new Me(kt.paint_symbol["text-translate-anchor"])})},get layout(){return lb=lb||new po({"symbol-placement":new Me(kt.layout_symbol["symbol-placement"]),"symbol-spacing":new Me(kt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Me(kt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Oe(kt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Me(kt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Me(kt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Me(kt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Me(kt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Me(kt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Me(kt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Oe(kt.layout_symbol["icon-size"]),"icon-text-fit":new Me(kt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Me(kt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Oe(kt.layout_symbol["icon-image"]),"icon-rotate":new Oe(kt.layout_symbol["icon-rotate"]),"icon-padding":new Oe(kt.layout_symbol["icon-padding"]),"icon-keep-upright":new Me(kt.layout_symbol["icon-keep-upright"]),"icon-offset":new Oe(kt.layout_symbol["icon-offset"]),"icon-anchor":new Oe(kt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Me(kt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Me(kt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Me(kt.layout_symbol["text-rotation-alignment"]),"text-field":new Oe(kt.layout_symbol["text-field"]),"text-font":new Oe(kt.layout_symbol["text-font"]),"text-size":new Oe(kt.layout_symbol["text-size"]),"text-max-width":new Oe(kt.layout_symbol["text-max-width"]),"text-line-height":new Me(kt.layout_symbol["text-line-height"]),"text-letter-spacing":new Oe(kt.layout_symbol["text-letter-spacing"]),"text-justify":new Oe(kt.layout_symbol["text-justify"]),"text-radial-offset":new Oe(kt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Me(kt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Oe(kt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Oe(kt.layout_symbol["text-anchor"]),"text-max-angle":new Me(kt.layout_symbol["text-max-angle"]),"text-writing-mode":new Me(kt.layout_symbol["text-writing-mode"]),"text-rotate":new Oe(kt.layout_symbol["text-rotate"]),"text-padding":new Me(kt.layout_symbol["text-padding"]),"text-keep-upright":new Me(kt.layout_symbol["text-keep-upright"]),"text-transform":new Oe(kt.layout_symbol["text-transform"]),"text-offset":new Oe(kt.layout_symbol["text-offset"]),"text-allow-overlap":new Me(kt.layout_symbol["text-allow-overlap"]),"text-overlap":new Me(kt.layout_symbol["text-overlap"]),"text-ignore-placement":new Me(kt.layout_symbol["text-ignore-placement"]),"text-optional":new Me(kt.layout_symbol["text-optional"])})}};class cb{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:Hr,this.defaultValue=o}evaluate(o){if(o.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(o.formattedSection))return c.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}we("FormatSectionOverride",cb,{omit:["defaultValue"]});class Zm extends _s{constructor(o){super(o,E_)}recalculate(o,c){if(super.recalculate(o,c),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const g=[];for(const b of p)g.indexOf(b)<0&&g.push(b);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,c,p,g){const b=this.layout.get(o).evaluate(c,{},p,g),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||Yn(x.value)||!b?b:function(E,L){return L.replace(/{([^{}]+)}/g,(A,D)=>E&&D in E?String(E[D]):"")}(c.properties,b)}createBucket(o){return new Uh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of E_.paint.overridableProperties){if(!Zm.hasPaintOverride(this.layout,o))continue;const c=this.paint.get(o),p=new cb(c),g=new tr(p,c.property.specification);let b=null;b=c.value.kind==="constant"||c.value.kind==="source"?new ch("source",g):new ip("composite",g,c.value.zoomStops),this.paint._values[o]=new ys(c.property,b,c.parameters)}}_handleOverridablePaintPropertyUpdate(o,c,p){return!(!this.layout||c.isDataDriven()||p.isDataDriven())&&Zm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,c){const p=o.get("text-field"),g=E_.paint.properties[c];let b=!1;const x=E=>{for(const L of E)if(g.overrides&&g.overrides.hasOverride(L))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Po)x(p.value.value.sections);else if(p.value.kind==="source"){const E=A=>{b||(A instanceof Va&&Xr(A.value)===zr?x(A.value.sections):A instanceof lh?x(A.sections):A.eachChild(E))},L=p.value;L._styleExpression&&E(L._styleExpression.expression)}return b}}let hb;var KT={get paint(){return hb=hb||new po({"background-color":new Me(kt.paint_background["background-color"]),"background-pattern":new lc(kt.paint_background["background-pattern"]),"background-opacity":new Me(kt.paint_background["background-opacity"])})}};class JT extends _s{constructor(o){super(o,KT)}}let fb;var QT={get paint(){return fb=fb||new po({"raster-opacity":new Me(kt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Me(kt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Me(kt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Me(kt.paint_raster["raster-brightness-max"]),"raster-saturation":new Me(kt.paint_raster["raster-saturation"]),"raster-contrast":new Me(kt.paint_raster["raster-contrast"]),"raster-resampling":new Me(kt.paint_raster["raster-resampling"]),"raster-fade-duration":new Me(kt.paint_raster["raster-fade-duration"])})}};class $T extends _s{constructor(o){super(o,QT)}}class tL extends _s{constructor(o){super(o,{}),this.onAdd=c=>{this.implementation.onAdd&&this.implementation.onAdd(c,c.painter.context.gl)},this.onRemove=c=>{this.implementation.onRemove&&this.implementation.onRemove(c,c.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class eL{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const I_=63710088e-1;class _u{constructor(o,c){if(isNaN(o)||isNaN(c))throw new Error(`Invalid LngLat object: (${o}, ${c})`);if(this.lng=+o,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new _u(_t(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const c=Math.PI/180,p=this.lat*c,g=o.lat*c,b=Math.sin(p)*Math.sin(g)+Math.cos(p)*Math.cos(g)*Math.cos((o.lng-this.lng)*c);return I_*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof _u)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new _u(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new _u(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const pb=2*Math.PI*I_;function db(l){return pb*Math.cos(l*Math.PI/180)}function mb(l){return(180+l)/360}function gb(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function yb(l,o){return l/db(o)}function C_(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90}class Xm{constructor(o,c,p=0){this.x=+o,this.y=+c,this.z=+p}static fromLngLat(o,c=0){const p=_u.convert(o);return new Xm(mb(p.lng),gb(p.lat),yb(c,p.lat))}toLngLat(){return new _u(360*this.x-180,C_(this.y))}toAltitude(){return this.z*db(C_(this.y))}meterInMercatorCoordinateUnits(){return 1/pb*(o=C_(this.y),1/Math.cos(o*Math.PI/180));var o}}function _b(l,o,c){var p=2*Math.PI*6378137/256/Math.pow(2,c);return[l*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class T_{constructor(o,c,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||c<0||c>=Math.pow(2,o))throw new Error(`x=${c}, y=${p}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=c,this.y=p,this.key=Gp(0,o,o,c,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,c,p){const g=(x=this.y,E=this.z,L=_b(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),A=_b(256*(b+1),256*(x+1),E),L[0]+","+L[1]+","+A[0]+","+A[1]);var b,x,E,L,A;const D=function(N,U,W){let X,tt="";for(let ot=N;ot>0;ot--)X=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,g)}isChildOf(o){const c=this.z-o.z;return c>0&&o.x===this.x>>c&&o.y===this.y>>c}getTilePoint(o){const c=Math.pow(2,this.z);return new I((o.x*c-this.x)*kr,(o.y*c-this.y)*kr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class vb{constructor(o,c){this.wrap=o,this.canonical=c,this.key=Gp(o,c.z,c.z,c.x,c.y)}}class bs{constructor(o,c,p,g,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=c,this.canonical=new T_(p,+g,+b),this.key=Gp(c,o,p,g,b)}clone(){return new bs(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-o;return o>this.canonical.z?new bs(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bs(o,this.wrap,o,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(o,c){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?Gp(this.wrap*+c,o,this.canonical.z,this.canonical.x,this.canonical.y):Gp(this.wrap*+c,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const c=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>c&&o.canonical.y===this.canonical.y>>c}children(o){if(this.overscaledZ>=o)return[new bs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const c=this.canonical.z+1,p=2*this.canonical.x,g=2*this.canonical.y;return[new bs(c,this.wrap,c,p,g),new bs(c,this.wrap,c,p+1,g),new bs(c,this.wrap,c,p,g+1),new bs(c,this.wrap,c,p+1,g+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=N),N=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(o+1)}unpack(o,c,p){return o*this.redFactor+c*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new vs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,c,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let g=c*this.dim,b=c*this.dim+this.dim,x=p*this.dim,E=p*this.dim+this.dim;switch(c){case-1:g=b-1;break;case 1:b=g+1}switch(p){case-1:x=E-1;break;case 1:E=x+1}const L=-c*this.dim,A=-p*this.dim;for(let D=x;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class wb{constructor(o,c,p,g,b){this.type="Feature",this._vectorTileFeature=o,o._z=c,o._x=p,o._y=g,this.properties=o.properties,this.id=b}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(o[c]=this[c]);return o}}class Sb{constructor(o,c){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new oc(kr,16,0),this.grid3D=new oc(kr,16,0),this.featureIndexArray=new O,this.promoteId=c}insert(o,c,p,g,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,g,b);const L=x?this.grid3D:this.grid;for(let A=0;A=0&&N[3]>=0&&L.insert(E,N[0],N[1],N[2],N[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new mu.VectorTile(new m_(this.rawTileData)).layers,this.sourceLayerCoder=new xb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,c,p,g){this.loadVTLayers();const b=o.params||{},x=kr/o.tileSize/o.scale,E=dh(b.filter),L=o.queryGeometry,A=o.queryPadding*x,D=Ib(L),N=this.grid.query(D.minX-A,D.minY-A,D.maxX+A,D.maxY+A),U=Ib(o.cameraQueryGeometry),W=this.grid3D.query(U.minX-A,U.minY-A,U.maxX+A,U.maxY+A,(ot,ft,Pt,yt)=>function(St,Yt,Jt,ve,Ce){for(const pe of St)if(Yt<=pe.x&&Jt<=pe.y&&ve>=pe.x&&Ce>=pe.y)return!0;const ye=[new I(Yt,Jt),new I(Yt,Ce),new I(ve,Ce),new I(ve,Jt)];if(St.length>2){for(const pe of ye)if(Rh(St,pe))return!0}for(let pe=0;pe(yt||(yt=Pl(St)),Yt.queryIntersectsFeature(L,St,Jt,yt,this.z,o.transform,x,o.pixelPosMatrix)))}return X}loadMatchingFeature(o,c,p,g,b,x,E,L,A,D,N){const U=this.bucketLayerIDs[c];if(x&&!function(ot,ft){for(let Pt=0;Pt=0)return!0;return!1}(x,U))return;const W=this.sourceLayerCoder.decode(p),X=this.vtLayers[W].feature(g);if(b.needGeometry){const ot=Ml(X,!0);if(!b.filter(new sr(this.tileID.overscaledZ),ot,this.tileID.canonical))return}else if(!b.filter(new sr(this.tileID.overscaledZ),X))return;const tt=this.getId(X,W);for(let ot=0;ot{const E=o instanceof ac?o.get(x):null;return E&&E.evaluate?E.evaluate(c,p,g):E})}function Ib(l){let o=1/0,c=1/0,p=-1/0,g=-1/0;for(const b of l)o=Math.min(o,b.x),c=Math.min(c,b.y),p=Math.max(p,b.x),g=Math.max(g,b.y);return{minX:o,minY:c,maxX:p,maxY:g}}function nL(l,o){return o-l}function Cb(l,o,c,p,g){const b=[];for(let x=0;x=p&&N.x>=p||(D.x>=p?D=new I(p,D.y+(p-D.x)/(N.x-D.x)*(N.y-D.y))._round():N.x>=p&&(N=new I(p,D.y+(p-D.x)/(N.x-D.x)*(N.y-D.y))._round()),D.y>=g&&N.y>=g||(D.y>=g?D=new I(D.x+(g-D.y)/(N.y-D.y)*(N.x-D.x),g)._round():N.y>=g&&(N=new I(D.x+(g-D.y)/(N.y-D.y)*(N.x-D.x),g)._round()),L&&D.equals(L[L.length-1])||(L=[D],b.push(L)),L.push(N)))))}}return b}we("FeatureIndex",Sb,{omit:["rawTileData","sourceLayerCoder"]});class vu extends I{constructor(o,c,p,g){super(o,c),this.angle=p,g!==void 0&&(this.segment=g)}clone(){return new vu(this.x,this.y,this.angle,this.segment)}}function Tb(l,o,c,p,g){if(o.segment===void 0||c===0)return!0;let b=o,x=o.segment+1,E=0;for(;E>-c/2;){if(x--,x<0)return!1;E-=l[x].dist(b),b=l[x]}E+=l[x].dist(l[x+1]),x++;const L=[];let A=0;for(;Ep;)A-=L.shift().angleDelta;if(A>g)return!1;x++,E+=D.dist(N)}return!0}function Lb(l){let o=0;for(let c=0;cA){const X=(A-L)/W,tt=Qi.number(N.x,U.x,X),ot=Qi.number(N.y,U.y,X),ft=new vu(tt,ot,U.angleTo(N),D);return ft._round(),!x||Tb(l,ft,E,x,o)?ft:void 0}L+=W}}function iL(l,o,c,p,g,b,x,E,L){const A=Pb(p,b,x),D=Mb(p,g),N=D*x,U=l[0].x===0||l[0].x===L||l[0].y===0||l[0].y===L;return o-N=0&&St=0&&Yt=0&&U+A<=D){const Jt=new vu(St,Yt,Pt,X);Jt._round(),p&&!Tb(l,Jt,b,p,g)||W.push(Jt)}}N+=ft}return E||W.length||x||(W=Ab(l,N/2,c,p,g,b,x,!0,L)),W}we("Anchor",vu);const Gh=Ro;function kb(l,o,c,p){const g=[],b=l.image,x=b.pixelRatio,E=b.paddedRect.w-2*Gh,L=b.paddedRect.h-2*Gh,A=l.right-l.left,D=l.bottom-l.top,N=b.stretchX||[[0,E]],U=b.stretchY||[[0,L]],W=(se,Ee)=>se+Ee[1]-Ee[0],X=N.reduce(W,0),tt=U.reduce(W,0),ot=E-X,ft=L-tt;let Pt=0,yt=X,St=0,Yt=tt,Jt=0,ve=ot,Ce=0,ye=ft;if(b.content&&p){const se=b.content;Pt=Ym(N,0,se[0]),St=Ym(U,0,se[1]),yt=Ym(N,se[0],se[2]),Yt=Ym(U,se[1],se[3]),Jt=se[0]-Pt,Ce=se[1]-St,ve=se[2]-se[0]-yt,ye=se[3]-se[1]-Yt}const pe=(se,Ee,ce,ne)=>{const Ne=Km(se.stretch-Pt,yt,A,l.left),Le=Jm(se.fixed-Jt,ve,se.stretch,X),fn=Km(Ee.stretch-St,Yt,D,l.top),er=Jm(Ee.fixed-Ce,ye,Ee.stretch,tt),lr=Km(ce.stretch-Pt,yt,A,l.left),oi=Jm(ce.fixed-Jt,ve,ce.stretch,X),ns=Km(ne.stretch-St,Yt,D,l.top),go=Jm(ne.fixed-Ce,ye,ne.stretch,tt),Qr=new I(Ne,fn),Pi=new I(lr,fn),zi=new I(lr,ns),yo=new I(Ne,ns),_o=new I(Le/x,er/x),si=new I(oi/x,go/x),ai=o*Math.PI/180;if(ai){const eo=Math.sin(ai),No=Math.cos(ai),Oo=[No,-eo,eo,No];Qr._matMult(Oo),Pi._matMult(Oo),yo._matMult(Oo),zi._matMult(Oo)}const to=se.stretch+se.fixed,vo=Ee.stretch+Ee.fixed;return{tl:Qr,tr:Pi,bl:yo,br:zi,tex:{x:b.paddedRect.x+Gh+to,y:b.paddedRect.y+Gh+vo,w:ce.stretch+ce.fixed-to,h:ne.stretch+ne.fixed-vo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:_o,pixelOffsetBR:si,minFontScaleX:ve/x/A,minFontScaleY:ye/x/D,isSDF:c}};if(p&&(b.stretchX||b.stretchY)){const se=Db(N,ot,X),Ee=Db(U,ft,tt);for(let ce=0;ce0&&(X=Math.max(10,X),this.circleDiameter=X)}else{let N=x.top*E-L[0],U=x.bottom*E+L[2],W=x.left*E-L[3],X=x.right*E+L[1];const tt=x.collisionPadding;if(tt&&(W-=tt[0]*E,N-=tt[1]*E,X+=tt[2]*E,U+=tt[3]*E),D){const ot=new I(W,N),ft=new I(X,N),Pt=new I(W,U),yt=new I(X,U),St=D*Math.PI/180;ot._rotate(St),ft._rotate(St),Pt._rotate(St),yt._rotate(St),W=Math.min(ot.x,ft.x,Pt.x,yt.x),X=Math.max(ot.x,ft.x,Pt.x,yt.x),N=Math.min(ot.y,ft.y,Pt.y,yt.y),U=Math.max(ot.y,ft.y,Pt.y,yt.y)}o.emplaceBack(c.x,c.y,W,N,X,U,p,g,b)}this.boxEndIndex=o.length}}class oL{constructor(o=[],c=sL){if(this.data=o,this.length=this.data.length,this.compare=c,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:c,compare:p}=this,g=c[o];for(;o>0;){const b=o-1>>1,x=c[b];if(p(g,x)>=0)break;c[o]=x,o=b}c[o]=g}_down(o){const{data:c,compare:p}=this,g=this.length>>1,b=c[o];for(;o=0)break;c[o]=E,o=x}c[o]=b}}function sL(l,o){return lo?1:0}function aL(l,o=1,c=!1){let p=1/0,g=1/0,b=-1/0,x=-1/0;const E=l[0];for(let W=0;Wb)&&(b=X.x),(!W||X.y>x)&&(x=X.y)}const L=Math.min(b-p,x-g);let A=L/2;const D=new oL([],lL);if(L===0)return new I(p,g);for(let W=p;WN.d||!N.d)&&(N=W,c&&console.log("found best %d after %d probes",Math.round(1e4*W.d)/1e4,U)),W.max-N.d<=o||(A=W.h/2,D.push(new qh(W.p.x-A,W.p.y-A,A,l)),D.push(new qh(W.p.x+A,W.p.y-A,A,l)),D.push(new qh(W.p.x-A,W.p.y+A,A,l)),D.push(new qh(W.p.x+A,W.p.y+A,A,l)),U+=4)}return c&&(console.log(`num probes: ${U}`),console.log(`best distance: ${N.d}`)),N.p}function lL(l,o){return o.max-l.max}function qh(l,o,c,p){this.p=new I(l,o),this.h=c,this.d=function(g,b){let x=!1,E=1/0;for(let L=0;Lg.y!=X.y>g.y&&g.x<(X.x-W.x)*(g.y-W.y)/(X.y-W.y)+W.x&&(x=!x),E=Math.min(E,g1(g,W,X))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Oi;h.ap=void 0,(Oi=h.ap||(h.ap={}))[Oi.center=1]="center",Oi[Oi.left=2]="left",Oi[Oi.right=3]="right",Oi[Oi.top=4]="top",Oi[Oi.bottom=5]="bottom",Oi[Oi["top-left"]=6]="top-left",Oi[Oi["top-right"]=7]="top-right",Oi[Oi["bottom-left"]=8]="bottom-left",Oi[Oi["bottom-right"]=9]="bottom-right";const bu=7,L_=Number.POSITIVE_INFINITY;function Rb(l,o){return o[1]!==L_?function(c,p,g){let b=0,x=0;switch(p=Math.abs(p),g=Math.abs(g),c){case"top-right":case"top-left":case"top":x=g-bu;break;case"bottom-right":case"bottom-left":case"bottom":x=-g+bu}switch(c){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(l,o[0],o[1]):function(c,p){let g=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(c){case"top-right":case"top-left":b=x-bu;break;case"bottom-right":case"bottom-left":b=-x+bu;break;case"bottom":b=-p+bu;break;case"top":b=p-bu}switch(c){case"top-right":case"bottom-right":g=-x;break;case"top-left":case"bottom-left":g=x;break;case"left":g=p;break;case"right":g=-p}return[g,b]}(l,o[0])}function Nb(l,o,c){var p;const g=l.layout,b=(p=g.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},c);if(b){const E=b.values,L=[];for(let A=0;AU*ii);D.startsWith("top")?N[1]-=bu:D.startsWith("bottom")&&(N[1]+=bu),L[A+1]=N}return new Qo(L)}const x=g.get("text-variable-anchor");if(x){let E;E=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(o,{},c)*ii,L_]:g.get("text-offset").evaluate(o,{},c).map(A=>A*ii);const L=[];for(const A of x)L.push(A,Rb(A,E));return new Qo(L)}return null}function P_(l){switch(l){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function uL(l,o,c,p,g,b,x,E,L,A,D){let N=b.textMaxSize.evaluate(o,{});N===void 0&&(N=x);const U=l.layers[0].layout,W=U.get("icon-offset").evaluate(o,{},D),X=zb(c.horizontal),tt=x/24,ot=l.tilePixelRatio*tt,ft=l.tilePixelRatio*N/24,Pt=l.tilePixelRatio*E,yt=l.tilePixelRatio*U.get("symbol-spacing"),St=U.get("text-padding")*l.tilePixelRatio,Yt=function(ne,Ne,Le,fn=1){const er=ne.get("icon-padding").evaluate(Ne,{},Le),lr=er&&er.values;return[lr[0]*fn,lr[1]*fn,lr[2]*fn,lr[3]*fn]}(U,o,D,l.tilePixelRatio),Jt=U.get("text-max-angle")/180*Math.PI,ve=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",Ce=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",ye=U.get("symbol-placement"),pe=yt/2,se=U.get("icon-text-fit");let Ee;p&&se!=="none"&&(l.allowVerticalPlacement&&c.vertical&&(Ee=sb(p,c.vertical,se,U.get("icon-text-fit-padding"),W,tt)),X&&(p=sb(p,X,se,U.get("icon-text-fit-padding"),W,tt)));const ce=(ne,Ne)=>{Ne.x<0||Ne.x>=kr||Ne.y<0||Ne.y>=kr||function(Le,fn,er,lr,oi,ns,go,Qr,Pi,zi,yo,_o,si,ai,to,vo,eo,No,Oo,li,_n,no,Fi,ui,js){const _a=Le.addToLineVertexArray(fn,er);let va,kl,Ws,xs,zo=0,Dl=0,Wp=0,Ub=0,z_=-1,F_=-1;const Rl={};let Gb=Er("");if(Le.allowVerticalPlacement&&lr.vertical){const ro=Qr.layout.get("text-rotate").evaluate(_n,{},ui)+90;Ws=new Qm(Pi,fn,zi,yo,_o,lr.vertical,si,ai,to,ro),go&&(xs=new Qm(Pi,fn,zi,yo,_o,go,eo,No,to,ro))}if(oi){const ro=Qr.layout.get("icon-rotate").evaluate(_n,{}),ws=Qr.layout.get("icon-text-fit")!=="none",gc=kb(oi,ro,Fi,ws),xa=go?kb(go,ro,Fi,ws):void 0;kl=new Qm(Pi,fn,zi,yo,_o,oi,eo,No,!1,ro),zo=4*gc.length;const yc=Le.iconSizeData;let Ka=null;yc.kind==="source"?(Ka=[Ya*Qr.layout.get("icon-size").evaluate(_n,{})],Ka[0]>yu&&Kt(`${Le.layerIds[0]}: Value for "icon-size" is >= ${Up}. Reduce your "icon-size".`)):yc.kind==="composite"&&(Ka=[Ya*no.compositeIconSizes[0].evaluate(_n,{},ui),Ya*no.compositeIconSizes[1].evaluate(_n,{},ui)],(Ka[0]>yu||Ka[1]>yu)&&Kt(`${Le.layerIds[0]}: Value for "icon-size" is >= ${Up}. Reduce your "icon-size".`)),Le.addSymbols(Le.icon,gc,Ka,li,Oo,_n,h.ah.none,fn,_a.lineStartIndex,_a.lineLength,-1,ui),z_=Le.icon.placedSymbolArray.length-1,xa&&(Dl=4*xa.length,Le.addSymbols(Le.icon,xa,Ka,li,Oo,_n,h.ah.vertical,fn,_a.lineStartIndex,_a.lineLength,-1,ui),F_=Le.icon.placedSymbolArray.length-1)}const qb=Object.keys(lr.horizontal);for(const ro of qb){const ws=lr.horizontal[ro];if(!va){Gb=Er(ws.text);const xa=Qr.layout.get("text-rotate").evaluate(_n,{},ui);va=new Qm(Pi,fn,zi,yo,_o,ws,si,ai,to,xa)}const gc=ws.positionedLines.length===1;if(Wp+=Ob(Le,fn,ws,ns,Qr,to,_n,vo,_a,lr.vertical?h.ah.horizontal:h.ah.horizontalOnly,gc?qb:[ro],Rl,z_,no,ui),gc)break}lr.vertical&&(Ub+=Ob(Le,fn,lr.vertical,ns,Qr,to,_n,vo,_a,h.ah.vertical,["vertical"],Rl,F_,no,ui));const fL=va?va.boxStartIndex:Le.collisionBoxArray.length,pL=va?va.boxEndIndex:Le.collisionBoxArray.length,dL=Ws?Ws.boxStartIndex:Le.collisionBoxArray.length,mL=Ws?Ws.boxEndIndex:Le.collisionBoxArray.length,gL=kl?kl.boxStartIndex:Le.collisionBoxArray.length,yL=kl?kl.boxEndIndex:Le.collisionBoxArray.length,_L=xs?xs.boxStartIndex:Le.collisionBoxArray.length,vL=xs?xs.boxEndIndex:Le.collisionBoxArray.length;let ba=-1;const tg=(ro,ws)=>ro&&ro.circleDiameter?Math.max(ro.circleDiameter,ws):ws;ba=tg(va,ba),ba=tg(Ws,ba),ba=tg(kl,ba),ba=tg(xs,ba);const jb=ba>-1?1:0;jb&&(ba*=js/ii),Le.glyphOffsetArray.length>=Uh.MAX_GLYPHS&&Kt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_n.sortKey!==void 0&&Le.addToSortKeyRanges(Le.symbolInstances.length,_n.sortKey);const bL=Nb(Qr,_n,ui),[xL,wL]=function(ro,ws){const gc=ro.length,xa=ws==null?void 0:ws.values;if((xa==null?void 0:xa.length)>0)for(let yc=0;yc=0?Rl.right:-1,Rl.center>=0?Rl.center:-1,Rl.left>=0?Rl.left:-1,Rl.vertical||-1,z_,F_,Gb,fL,pL,dL,mL,gL,yL,_L,vL,zi,Wp,Ub,zo,Dl,jb,0,si,ba,xL,wL)}(l,Ne,ne,c,p,g,Ee,l.layers[0],l.collisionBoxArray,o.index,o.sourceLayerIndex,l.index,ot,[St,St,St,St],ve,L,Pt,Yt,Ce,W,o,b,A,D,x)};if(ye==="line")for(const ne of Cb(o.geometry,0,0,kr,kr)){const Ne=iL(ne,yt,Jt,c.vertical||X,p,24,ft,l.overscaling,kr);for(const Le of Ne)X&&cL(l,X.text,pe,Le)||ce(ne,Le)}else if(ye==="line-center"){for(const ne of o.geometry)if(ne.length>1){const Ne=rL(ne,Jt,c.vertical||X,p,24,ft);Ne&&ce(ne,Ne)}}else if(o.type==="Polygon")for(const ne of a_(o.geometry,0)){const Ne=aL(ne,16);ce(ne[0],new vu(Ne.x,Ne.y,0))}else if(o.type==="LineString")for(const ne of o.geometry)ce(ne,new vu(ne[0].x,ne[0].y,0));else if(o.type==="Point")for(const ne of o.geometry)for(const Ne of ne)ce([Ne],new vu(Ne.x,Ne.y,0))}function Ob(l,o,c,p,g,b,x,E,L,A,D,N,U,W,X){const tt=function(Pt,yt,St,Yt,Jt,ve,Ce,ye){const pe=Yt.layout.get("text-rotate").evaluate(ve,{})*Math.PI/180,se=[];for(const Ee of yt.positionedLines)for(const ce of Ee.positionedGlyphs){if(!ce.rect)continue;const ne=ce.rect||{};let Ne=$1+1,Le=!0,fn=1,er=0;const lr=(Jt||ye)&&ce.vertical,oi=ce.metrics.advance*ce.scale/2;if(ye&&yt.verticalizable&&(er=Ee.lineOffset/2-(ce.imageName?-(ii-ce.metrics.width*ce.scale)/2:(ce.scale-1)*ii)),ce.imageName){const li=Ce[ce.imageName];Le=li.sdf,fn=li.pixelRatio,Ne=Ro/fn}const ns=Jt?[ce.x+oi,ce.y]:[0,0];let go=Jt?[0,0]:[ce.x+oi+St[0],ce.y+St[1]-er],Qr=[0,0];lr&&(Qr=go,go=[0,0]);const Pi=ce.metrics.isDoubleResolution?2:1,zi=(ce.metrics.left-Ne)*ce.scale-oi+go[0],yo=(-ce.metrics.top-Ne)*ce.scale+go[1],_o=zi+ne.w/Pi*ce.scale/fn,si=yo+ne.h/Pi*ce.scale/fn,ai=new I(zi,yo),to=new I(_o,yo),vo=new I(zi,si),eo=new I(_o,si);if(lr){const li=new I(-oi,oi-Bp),_n=-Math.PI/2,no=ii/2-oi,Fi=new I(5-Bp-no,-(ce.imageName?no:0)),ui=new I(...Qr);ai._rotateAround(_n,li)._add(Fi)._add(ui),to._rotateAround(_n,li)._add(Fi)._add(ui),vo._rotateAround(_n,li)._add(Fi)._add(ui),eo._rotateAround(_n,li)._add(Fi)._add(ui)}if(pe){const li=Math.sin(pe),_n=Math.cos(pe),no=[_n,-li,li,_n];ai._matMult(no),to._matMult(no),vo._matMult(no),eo._matMult(no)}const No=new I(0,0),Oo=new I(0,0);se.push({tl:ai,tr:to,bl:vo,br:eo,tex:ne,writingMode:yt.writingMode,glyphOffset:ns,sectionIndex:ce.sectionIndex,isSDF:Le,pixelOffsetTL:No,pixelOffsetBR:Oo,minFontScaleX:0,minFontScaleY:0})}return se}(0,c,E,g,b,x,p,l.allowVerticalPlacement),ot=l.textSizeData;let ft=null;ot.kind==="source"?(ft=[Ya*g.layout.get("text-size").evaluate(x,{})],ft[0]>yu&&Kt(`${l.layerIds[0]}: Value for "text-size" is >= ${Up}. Reduce your "text-size".`)):ot.kind==="composite"&&(ft=[Ya*W.compositeTextSizes[0].evaluate(x,{},X),Ya*W.compositeTextSizes[1].evaluate(x,{},X)],(ft[0]>yu||ft[1]>yu)&&Kt(`${l.layerIds[0]}: Value for "text-size" is >= ${Up}. Reduce your "text-size".`)),l.addSymbols(l.text,tt,ft,E,b,x,A,o,L.lineStartIndex,L.lineLength,U,X);for(const Pt of D)N[Pt]=l.text.placedSymbolArray.length-1;return 4*tt.length}function zb(l){for(const o in l)return l[o];return null}function cL(l,o,c,p){const g=l.compareText;if(o in g){const b=g[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const b=Fb[15&p];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new M_(E,x,b,o)}constructor(o,c=64,p=Float64Array,g){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const b=Fb.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,L=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+L),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=o)}add(o,c){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=c,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return A_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,c,p,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,L=[0,b.length-1,0],A=[];for(;L.length;){const D=L.pop()||0,N=L.pop()||0,U=L.pop()||0;if(N-U<=E){for(let ot=U;ot<=N;ot++){const ft=x[2*ot],Pt=x[2*ot+1];ft>=o&&ft<=p&&Pt>=c&&Pt<=g&&A.push(b[ot])}continue}const W=U+N>>1,X=x[2*W],tt=x[2*W+1];X>=o&&X<=p&&tt>=c&&tt<=g&&A.push(b[W]),(D===0?o<=X:c<=tt)&&(L.push(U),L.push(W-1),L.push(1-D)),(D===0?p>=X:g>=tt)&&(L.push(W+1),L.push(N),L.push(1-D))}return A}within(o,c,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:b,nodeSize:x}=this,E=[0,g.length-1,0],L=[],A=p*p;for(;E.length;){const D=E.pop()||0,N=E.pop()||0,U=E.pop()||0;if(N-U<=x){for(let ot=U;ot<=N;ot++)Vb(b[2*ot],b[2*ot+1],o,c)<=A&&L.push(g[ot]);continue}const W=U+N>>1,X=b[2*W],tt=b[2*W+1];Vb(X,tt,o,c)<=A&&L.push(g[W]),(D===0?o-p<=X:c-p<=tt)&&(E.push(U),E.push(W-1),E.push(1-D)),(D===0?o+p>=X:c+p>=tt)&&(E.push(W+1),E.push(N),E.push(1-D))}return L}}function A_(l,o,c,p,g,b){if(g-p<=c)return;const x=p+g>>1;Bb(l,o,x,p,g,b),A_(l,o,c,p,x-1,1-b),A_(l,o,c,x+1,g,1-b)}function Bb(l,o,c,p,g,b){for(;g>p;){if(g-p>600){const A=g-p+1,D=c-p+1,N=Math.log(A),U=.5*Math.exp(2*N/3),W=.5*Math.sqrt(N*U*(A-U)/A)*(D-A/2<0?-1:1);Bb(l,o,c,Math.max(p,Math.floor(c-D*U/A+W)),Math.min(g,Math.floor(c+(A-D)*U/A+W)),b)}const x=o[2*c+b];let E=p,L=g;for(qp(l,o,p,c),o[2*g+b]>x&&qp(l,o,p,g);Ex;)L--}o[2*p+b]===x?qp(l,o,p,L):(L++,qp(l,o,L,g)),L<=c&&(p=L+1),c<=L&&(g=L-1)}}function qp(l,o,c,p){k_(l,c,p),k_(o,2*c,2*p),k_(o,2*c+1,2*p+1)}function k_(l,o,c){const p=l[o];l[o]=l[c],l[c]=p}function Vb(l,o,c,p){const g=l-c,b=o-p;return g*g+b*b}var D_;h.bd=void 0,(D_=h.bd||(h.bd={})).create="create",D_.load="load",D_.fullLoad="fullLoad";let $m=null,jp=[];const R_=1e3/60,N_="loadTime",O_="fullLoadTime",hL={mark(l){performance.mark(l)},frame(l){const o=l;$m!=null&&jp.push(o-$m),$m=o},clearMetrics(){$m=null,jp=[],performance.clearMeasures(N_),performance.clearMeasures(O_);for(const l in h.bd)performance.clearMarks(h.bd[l])},getPerformanceMetrics(){performance.measure(N_,h.bd.create,h.bd.load),performance.measure(O_,h.bd.create,h.bd.fullLoad);const l=performance.getEntriesByName(N_)[0].duration,o=performance.getEntriesByName(O_)[0].duration,c=jp.length,p=1/(jp.reduce((b,x)=>b+x,0)/c/1e3),g=jp.filter(b=>b>R_).reduce((b,x)=>b+(x-R_)/R_,0);return{loadTime:l,fullLoadTime:o,fps:p,percentDroppedFrames:g/(c+g)*100,totalFrames:c}}};h.$=le,h.A=Nh,h.B=function(l){if(Gt==null){const o=l.navigator?l.navigator.userAgent:null;Gt=!!l.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Gt},h.C=class{constructor(l,o){this.target=l,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new eL(()=>this.process()),this.subscription=function(c,p,g,b){return c.addEventListener(p,g,!1),{unsubscribe:()=>{c.removeEventListener(p,g,!1)}}}(this.target,"message",c=>this.receive(c)),this.globalScope=ee(self)?l:window}registerMessageHandler(l,o){this.messageHandlers[l]=o}sendAsync(l,o){return new Promise((c,p)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:c,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const E={id:g,type:"",origin:location.origin,targetMapId:l.targetMapId,sourceMapId:this.mapId};this.target.postMessage(E)},{once:!0});const b=[],x=Object.assign(Object.assign({},l),{id:g,sourceMapId:this.mapId,origin:location.origin,data:hu(l.data,b)});this.target.postMessage(x,{transfer:b})})}receive(l){const o=l.data,c=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type===""){delete this.tasks[c];const p=this.abortControllers[c];return delete this.abortControllers[c],void(p&&p.abort())}if(ee(self)||o.mustQueue)return this.tasks[c]=o,this.taskQueue.push(c),void this.invoker.trigger();this.processTask(c,o)}}process(){if(this.taskQueue.length===0)return;const l=this.taskQueue.shift(),o=this.tasks[l];delete this.tasks[l],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(l,o)}processTask(l,o){return u(this,void 0,void 0,function*(){if(o.type===""){const g=this.resolveRejects[l];return delete this.resolveRejects[l],g?void(o.error?g.reject(fu(o.error)):g.resolve(fu(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(l,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const c=fu(o.data),p=new AbortController;this.abortControllers[l]=p;try{const g=yield this.messageHandlers[o.type](o.sourceMapId,c,p);this.completeTask(l,null,g)}catch(g){this.completeTask(l,g)}})}completeTask(l,o,c){const p=[];delete this.abortControllers[l];const g={id:l,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?hu(o):null,data:hu(c,p)};this.target.postMessage(g,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},h.D=Me,h.E=kn,h.F=function(){var l=new Nh(16);return Nh!=Float32Array&&(l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0),l[0]=1,l[5]=1,l[10]=1,l[15]=1,l},h.G=An,h.H=function(l,o,c){var p,g,b,x,E,L,A,D,N,U,W,X,tt=c[0],ot=c[1],ft=c[2];return o===l?(l[12]=o[0]*tt+o[4]*ot+o[8]*ft+o[12],l[13]=o[1]*tt+o[5]*ot+o[9]*ft+o[13],l[14]=o[2]*tt+o[6]*ot+o[10]*ft+o[14],l[15]=o[3]*tt+o[7]*ot+o[11]*ft+o[15]):(g=o[1],b=o[2],x=o[3],E=o[4],L=o[5],A=o[6],D=o[7],N=o[8],U=o[9],W=o[10],X=o[11],l[0]=p=o[0],l[1]=g,l[2]=b,l[3]=x,l[4]=E,l[5]=L,l[6]=A,l[7]=D,l[8]=N,l[9]=U,l[10]=W,l[11]=X,l[12]=p*tt+E*ot+N*ft+o[12],l[13]=g*tt+L*ot+U*ft+o[13],l[14]=b*tt+A*ot+W*ft+o[14],l[15]=x*tt+D*ot+X*ft+o[15]),l},h.I=y_,h.J=function(l,o,c){var p=c[0],g=c[1],b=c[2];return l[0]=o[0]*p,l[1]=o[1]*p,l[2]=o[2]*p,l[3]=o[3]*p,l[4]=o[4]*g,l[5]=o[5]*g,l[6]=o[6]*g,l[7]=o[7]*g,l[8]=o[8]*b,l[9]=o[9]*b,l[10]=o[10]*b,l[11]=o[11]*b,l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},h.K=b1,h.L=function(l,o){const c={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(c=>{o.onloadstart=()=>{c(o)};for(const p of l){const g=window.document.createElement("source");hr(p)||(o.crossOrigin="Anonymous"),g.src=p,o.appendChild(g)}})},h.a3=function(){return ht++},h.a4=_,h.a5=Uh,h.a6=dh,h.a7=Ml,h.a8=sr,h.a9=wb,h.aA=Q,h.aB=function(l,o){if(!l)return[{command:"setStyle",args:[o]}];let c=[];try{if(!on(l.version,o.version))return[{command:"setStyle",args:[o]}];on(l.center,o.center)||c.push({command:"setCenter",args:[o.center]}),on(l.zoom,o.zoom)||c.push({command:"setZoom",args:[o.zoom]}),on(l.bearing,o.bearing)||c.push({command:"setBearing",args:[o.bearing]}),on(l.pitch,o.pitch)||c.push({command:"setPitch",args:[o.pitch]}),on(l.sprite,o.sprite)||c.push({command:"setSprite",args:[o.sprite]}),on(l.glyphs,o.glyphs)||c.push({command:"setGlyphs",args:[o.glyphs]}),on(l.transition,o.transition)||c.push({command:"setTransition",args:[o.transition]}),on(l.light,o.light)||c.push({command:"setLight",args:[o.light]}),on(l.terrain,o.terrain)||c.push({command:"setTerrain",args:[o.terrain]}),on(l.sky,o.sky)||c.push({command:"setSky",args:[o.sky]});const p={},g=[];(function(x,E,L,A){let D;for(D in E=E||{},x=x||{})Object.prototype.hasOwnProperty.call(x,D)&&(Object.prototype.hasOwnProperty.call(E,D)||ps(D,L,A));for(D in E)Object.prototype.hasOwnProperty.call(E,D)&&(Object.prototype.hasOwnProperty.call(x,D)?on(x[D],E[D])||(x[D].type==="geojson"&&E[D].type==="geojson"&&Ba(x,E,D)?Kn(L,{command:"setGeoJSONSourceData",args:[D,E[D].data]}):Os(D,E,L,A)):Lo(D,E,L))})(l.sources,o.sources,g,p);const b=[];l.layers&&l.layers.forEach(x=>{"source"in x&&p[x.source]?c.push({command:"removeLayer",args:[x.id]}):b.push(x)}),c=c.concat(g),function(x,E,L){E=E||[];const A=(x=x||[]).map(vl),D=E.map(vl),N=x.reduce(ds,{}),U=E.reduce(ds,{}),W=A.slice(),X=Object.create(null);let tt,ot,ft,Pt,yt;for(let St=0,Yt=0;St@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,p,g,b)=>{const x=g||b;return o[p]=!x||x.toLowerCase(),""}),o["max-age"]){const c=parseInt(o["max-age"],10);isNaN(c)?delete o["max-age"]:o["max-age"]=c}return o},h.ab=function(l,o){const c=[];for(const p in l)p in o||c.push(p);return c},h.ac=ct,h.ad=function(l,o,c){var p=Math.sin(c),g=Math.cos(c),b=o[0],x=o[1],E=o[2],L=o[3],A=o[4],D=o[5],N=o[6],U=o[7];return o!==l&&(l[8]=o[8],l[9]=o[9],l[10]=o[10],l[11]=o[11],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15]),l[0]=b*g+A*p,l[1]=x*g+D*p,l[2]=E*g+N*p,l[3]=L*g+U*p,l[4]=A*g-b*p,l[5]=D*g-x*p,l[6]=N*g-E*p,l[7]=U*g-L*p,l},h.ae=function(l){var o=new Nh(16);return o[0]=l[0],o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=l[6],o[7]=l[7],o[8]=l[8],o[9]=l[9],o[10]=l[10],o[11]=l[11],o[12]=l[12],o[13]=l[13],o[14]=l[14],o[15]=l[15],o},h.af=zm,h.ag=function(l,o){let c=0,p=0;if(l.kind==="constant")p=l.layoutSize;else if(l.kind!=="source"){const{interpolationType:g,minZoom:b,maxZoom:x}=l,E=g?ct(Ni.interpolationFactor(g,o,b,x),0,1):0;l.kind==="camera"?p=Qi.number(l.minSize,l.maxSize,E):c=E}return{uSizeT:c,uSize:p}},h.ai=function(l,{uSize:o,uSizeT:c},{lowerSize:p,upperSize:g}){return l.kind==="source"?p/Ya:l.kind==="composite"?Qi.number(p/Ya,g/Ya,c):o},h.aj=x_,h.ak=function(l,o,c,p){const g=o.y-l.y,b=o.x-l.x,x=p.y-c.y,E=p.x-c.x,L=x*b-E*g;if(L===0)return null;const A=(E*(l.y-c.y)-x*(l.x-c.x))/L;return new I(l.x+A*b,l.y+A*g)},h.al=Cb,h.am=Ip,h.an=t_,h.ao=ii,h.aq=b_,h.ar=function(l,o){var c=o[0],p=o[1],g=o[2],b=o[3],x=o[4],E=o[5],L=o[6],A=o[7],D=o[8],N=o[9],U=o[10],W=o[11],X=o[12],tt=o[13],ot=o[14],ft=o[15],Pt=c*E-p*x,yt=c*L-g*x,St=c*A-b*x,Yt=p*L-g*E,Jt=p*A-b*E,ve=g*A-b*L,Ce=D*tt-N*X,ye=D*ot-U*X,pe=D*ft-W*X,se=N*ot-U*tt,Ee=N*ft-W*tt,ce=U*ft-W*ot,ne=Pt*ce-yt*Ee+St*se+Yt*pe-Jt*ye+ve*Ce;return ne?(l[0]=(E*ce-L*Ee+A*se)*(ne=1/ne),l[1]=(g*Ee-p*ce-b*se)*ne,l[2]=(tt*ve-ot*Jt+ft*Yt)*ne,l[3]=(U*Jt-N*ve-W*Yt)*ne,l[4]=(L*pe-x*ce-A*ye)*ne,l[5]=(c*ce-g*pe+b*ye)*ne,l[6]=(ot*St-X*ve-ft*yt)*ne,l[7]=(D*ve-U*St+W*yt)*ne,l[8]=(x*Ee-E*pe+A*Ce)*ne,l[9]=(p*pe-c*Ee-b*Ce)*ne,l[10]=(X*Jt-tt*St+ft*Pt)*ne,l[11]=(N*St-D*Jt-W*Pt)*ne,l[12]=(E*ye-x*se-L*Ce)*ne,l[13]=(c*se-p*ye+g*Ce)*ne,l[14]=(tt*yt-X*Yt-ot*Pt)*ne,l[15]=(D*Yt-N*yt+U*Pt)*ne,l):null},h.as=P_,h.at=v_,h.au=M_,h.av=function(){const l={},o=kt.$version;for(const c in kt.$root){const p=kt.$root[c];if(p.required){let g=null;g=c==="version"?o:p.type==="array"?[]:{},g!=null&&(l[c]=g)}}return l},h.aw=Sm,h.ax=Pr,h.ay=function(l){l=l.slice();const o=Object.create(null);for(let c=0;cne*ii)}let ye=x?"center":c.get("text-justify").evaluate(A,{},l.canonical);const pe=c.get("symbol-placement"),se=pe==="point"?c.get("text-max-width").evaluate(A,{},l.canonical)*ii:0,Ee=()=>{l.bucket.allowVerticalPlacement&&pu(St)&&(X.vertical=jm(tt,l.glyphMap,l.glyphPositions,l.imagePositions,D,se,b,ve,"left",Jt,ft,h.ah.vertical,!0,pe,U,N))};if(!x&&Ce){const ce=new Set;if(ye==="auto")for(let Ne=0;Neu(void 0,void 0,void 0,function*(){if(l.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(l)],{type:"image/png"});try{return createImageBitmap(o)}catch(c){throw new Error(`Could not load image because of ${c.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),h.e=lt,h.f=l=>new Promise((o,c)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=xe})},p.onerror=()=>c(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const g=new Blob([new Uint8Array(l)],{type:"image/png"});p.src=l.byteLength?URL.createObjectURL(g):xe}),h.g=gn,h.h=(l,o)=>br(lt(l,{type:"json"}),o),h.i=ee,h.j=Ie,h.k=Ct,h.l=(l,o)=>br(lt(l,{type:"arrayBuffer"}),o),h.m=br,h.n=function(l){return new m_(l).readFields(VT,[])},h.o=Ap,h.p=tb,h.q=po,h.r=Ky,h.s=hr,h.t=cu,h.u=ge,h.v=kt,h.w=Kt,h.x=Cl,h.y=function([l,o,c]){return o+=90,o*=Math.PI/180,c*=Math.PI/180,{x:l*Math.cos(o)*Math.sin(c),y:l*Math.sin(o)*Math.sin(c),z:l*Math.cos(c)}},h.z=Qi}),i("worker",["./shared"],function(h){class u{constructor(V){this.keyCache={},V&&this.replace(V)}replace(V){this._layerConfigs={},this._layers={},this.update(V,[])}update(V,G){for(const nt of V){this._layerConfigs[nt.id]=nt;const xt=this._layers[nt.id]=h.az(nt);xt._featureFilter=h.a6(xt.filter),this.keyCache[nt.id]&&delete this.keyCache[nt.id]}for(const nt of G)delete this.keyCache[nt],delete this._layerConfigs[nt],delete this._layers[nt];this.familiesBySource={};const K=h.bh(Object.values(this._layerConfigs),this.keyCache);for(const nt of K){const xt=nt.map(Wt=>this._layers[Wt.id]),J=xt[0];if(J.visibility==="none")continue;const wt=J.source||"";let dt=this.familiesBySource[wt];dt||(dt=this.familiesBySource[wt]={});const Lt=J.sourceLayer||"_geojsonTileLayer";let zt=dt[Lt];zt||(zt=dt[Lt]=[]),zt.push(xt)}}}class y{constructor(V){const G={},K=[];for(const wt in V){const dt=V[wt],Lt=G[wt]={};for(const zt in dt){const Wt=dt[+zt];if(!Wt||Wt.bitmap.width===0||Wt.bitmap.height===0)continue;const Xt={x:0,y:0,w:Wt.bitmap.width+2,h:Wt.bitmap.height+2};K.push(Xt),Lt[zt]={rect:Xt,metrics:Wt.metrics}}}const{w:nt,h:xt}=h.p(K),J=new h.o({width:nt||1,height:xt||1});for(const wt in V){const dt=V[wt];for(const Lt in dt){const zt=dt[+Lt];if(!zt||zt.bitmap.width===0||zt.bitmap.height===0)continue;const Wt=G[wt][Lt].rect;h.o.copy(zt.bitmap,J,{x:0,y:0},{x:Wt.x+1,y:Wt.y+1},zt.bitmap)}}this.image=J,this.positions=G}}h.bi("GlyphAtlas",y);class w{constructor(V){this.tileID=new h.Q(V.tileID.overscaledZ,V.tileID.wrap,V.tileID.canonical.z,V.tileID.canonical.x,V.tileID.canonical.y),this.uid=V.uid,this.zoom=V.zoom,this.pixelRatio=V.pixelRatio,this.tileSize=V.tileSize,this.source=V.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=V.showCollisionBoxes,this.collectResourceTiming=!!V.collectResourceTiming,this.returnDependencies=!!V.returnDependencies,this.promoteId=V.promoteId,this.inFlightDependencies=[]}parse(V,G,K,nt){return h._(this,void 0,void 0,function*(){this.status="parsing",this.data=V,this.collisionBoxArray=new h.a4;const xt=new h.bj(Object.keys(V.layers).sort()),J=new h.bk(this.tileID,this.promoteId);J.bucketLayerIDs=[];const wt={},dt={featureIndex:J,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:K},Lt=G.familiesBySource[this.source];for(const nn in Lt){const xr=V.layers[nn];if(!xr)continue;xr.version===1&&h.w(`Vector tile source "${this.source}" layer "${nn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ei=xt.encode(nn),Ji=[];for(let co=0;co=mi.maxzoom||mi.visibility!=="none"&&(S(co,this.zoom,K),(wt[mi.id]=mi.createBucket({index:J.bucketLayerIDs.length,layers:co,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ei,sourceID:this.source})).populate(Ji,dt,this.tileID.canonical),J.bucketLayerIDs.push(co.map(zs=>zs.id)))}}const zt=h.aE(dt.glyphDependencies,nn=>Object.keys(nn).map(Number));this.inFlightDependencies.forEach(nn=>nn==null?void 0:nn.abort()),this.inFlightDependencies=[];let Wt=Promise.resolve({});if(Object.keys(zt).length){const nn=new AbortController;this.inFlightDependencies.push(nn),Wt=nt.sendAsync({type:"GG",data:{stacks:zt,source:this.source,tileID:this.tileID,type:"glyphs"}},nn)}const Xt=Object.keys(dt.iconDependencies);let Te=Promise.resolve({});if(Xt.length){const nn=new AbortController;this.inFlightDependencies.push(nn),Te=nt.sendAsync({type:"GI",data:{icons:Xt,source:this.source,tileID:this.tileID,type:"icons"}},nn)}const Ae=Object.keys(dt.patternDependencies);let Ge=Promise.resolve({});if(Ae.length){const nn=new AbortController;this.inFlightDependencies.push(nn),Ge=nt.sendAsync({type:"GI",data:{icons:Ae,source:this.source,tileID:this.tileID,type:"patterns"}},nn)}const[je,bn,jn]=yield Promise.all([Wt,Te,Ge]),or=new y(je),Zr=new h.bl(bn,jn);for(const nn in wt){const xr=wt[nn];xr instanceof h.a5?(S(xr.layers,this.zoom,K),h.bm({bucket:xr,glyphMap:je,glyphPositions:or.positions,imageMap:bn,imagePositions:Zr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):xr.hasPattern&&(xr instanceof h.bn||xr instanceof h.bo||xr instanceof h.bp)&&(S(xr.layers,this.zoom,K),xr.addFeatures(dt,this.tileID.canonical,Zr.patternPositions))}return this.status="done",{buckets:Object.values(wt).filter(nn=>!nn.isEmpty()),featureIndex:J,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:or.image,imageAtlas:Zr,glyphMap:this.returnDependencies?je:null,iconMap:this.returnDependencies?bn:null,glyphPositions:this.returnDependencies?or.positions:null}})}}function S(st,V,G){const K=new h.a8(V);for(const nt of st)nt.recalculate(K,G)}class I{constructor(V,G,K){this.actor=V,this.layerIndex=G,this.availableImages=K,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(V,G){return h._(this,void 0,void 0,function*(){const K=yield h.l(V.request,G);try{return{vectorTile:new h.bq.VectorTile(new h.br(K.data)),rawData:K.data,cacheControl:K.cacheControl,expires:K.expires}}catch(nt){const xt=new Uint8Array(K.data);let J=`Unable to parse the tile at ${V.request.url}, `;throw J+=xt[0]===31&&xt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${nt.messge}`,new Error(J)}})}loadTile(V){return h._(this,void 0,void 0,function*(){const G=V.uid,K=!!(V&&V.request&&V.request.collectResourceTiming)&&new h.bs(V.request),nt=new w(V);this.loading[G]=nt;const xt=new AbortController;nt.abort=xt;try{const J=yield this.loadVectorTile(V,xt);if(delete this.loading[G],!J)return null;const wt=J.rawData,dt={};J.expires&&(dt.expires=J.expires),J.cacheControl&&(dt.cacheControl=J.cacheControl);const Lt={};if(K){const Wt=K.finish();Wt&&(Lt.resourceTiming=JSON.parse(JSON.stringify(Wt)))}nt.vectorTile=J.vectorTile;const zt=nt.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[G]=nt,this.fetching[G]={rawTileData:wt,cacheControl:dt,resourceTiming:Lt};try{const Wt=yield zt;return h.e({rawTileData:wt.slice(0)},Wt,dt,Lt)}finally{delete this.fetching[G]}}catch(J){throw delete this.loading[G],nt.status="done",this.loaded[G]=nt,J}})}reloadTile(V){return h._(this,void 0,void 0,function*(){const G=V.uid;if(!this.loaded||!this.loaded[G])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const K=this.loaded[G];if(K.showCollisionBoxes=V.showCollisionBoxes,K.status==="parsing"){const nt=yield K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor);let xt;if(this.fetching[G]){const{rawTileData:J,cacheControl:wt,resourceTiming:dt}=this.fetching[G];delete this.fetching[G],xt=h.e({rawTileData:J.slice(0)},nt,wt,dt)}else xt=nt;return xt}if(K.status==="done"&&K.vectorTile)return K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(V){return h._(this,void 0,void 0,function*(){const G=this.loading,K=V.uid;G&&G[K]&&G[K].abort&&(G[K].abort.abort(),delete G[K])})}removeTile(V){return h._(this,void 0,void 0,function*(){this.loaded&&this.loaded[V.uid]&&delete this.loaded[V.uid]})}}class P{constructor(){this.loaded={}}loadTile(V){return h._(this,void 0,void 0,function*(){const{uid:G,encoding:K,rawImageData:nt,redFactor:xt,greenFactor:J,blueFactor:wt,baseShift:dt}=V,Lt=nt.width+2,zt=nt.height+2,Wt=h.b(nt)?new h.R({width:Lt,height:zt},yield h.bt(nt,-1,-1,Lt,zt)):nt,Xt=new h.bu(G,Wt,K,xt,J,wt,dt);return this.loaded=this.loaded||{},this.loaded[G]=Xt,Xt})}removeTile(V){const G=this.loaded,K=V.uid;G&&G[K]&&delete G[K]}}function z(st,V){if(st.length!==0){R(st[0],V);for(var G=1;G=Math.abs(wt)?G-dt+wt:wt-dt+G,G=dt}G+K>=0!=!!V&&st.reverse()}var Y=h.bv(function st(V,G){var K,nt=V&&V.type;if(nt==="FeatureCollection")for(K=0;K>31}function Ut(st,V){for(var G=st.loadGeometry(),K=st.type,nt=0,xt=0,J=G.length,wt=0;wtst},xe=Math.fround||(ln=new Float32Array(1),st=>(ln[0]=+st,ln[0]));var ln;const Ve=3,Pe=5,cn=6;class Cn{constructor(V){this.options=Object.assign(Object.create(Re),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:G,minZoom:K,maxZoom:nt}=this.options;G&&console.time("total time");const xt=`prepare ${V.length} points`;G&&console.time(xt),this.points=V;const J=[];for(let dt=0;dt=K;dt--){const Lt=+Date.now();wt=this.trees[dt]=this._createTree(this._cluster(wt,dt)),G&&console.log("z%d: %d clusters in %dms",dt,wt.numItems,+Date.now()-Lt)}return G&&console.timeEnd("total time"),this}getClusters(V,G){let K=((V[0]+180)%360+360)%360-180;const nt=Math.max(-90,Math.min(90,V[1]));let xt=V[2]===180?180:((V[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]>=360)K=-180,xt=180;else if(K>xt){const Wt=this.getClusters([K,nt,180,J],G),Xt=this.getClusters([-180,nt,xt,J],G);return Wt.concat(Xt)}const wt=this.trees[this._limitZoom(G)],dt=wt.range(An(K),vr(J),An(xt),vr(nt)),Lt=wt.data,zt=[];for(const Wt of dt){const Xt=this.stride*Wt;zt.push(Lt[Xt+Pe]>1?mn(Lt,Xt,this.clusterProps):this.points[Lt[Xt+Ve]])}return zt}getChildren(V){const G=this._getOriginId(V),K=this._getOriginZoom(V),nt="No cluster with the specified id.",xt=this.trees[K];if(!xt)throw new Error(nt);const J=xt.data;if(G*this.stride>=J.length)throw new Error(nt);const wt=this.options.radius/(this.options.extent*Math.pow(2,K-1)),dt=xt.within(J[G*this.stride],J[G*this.stride+1],wt),Lt=[];for(const zt of dt){const Wt=zt*this.stride;J[Wt+4]===V&&Lt.push(J[Wt+Pe]>1?mn(J,Wt,this.clusterProps):this.points[J[Wt+Ve]])}if(Lt.length===0)throw new Error(nt);return Lt}getLeaves(V,G,K){const nt=[];return this._appendLeaves(nt,V,G=G||10,K=K||0,0),nt}getTile(V,G,K){const nt=this.trees[this._limitZoom(V)],xt=Math.pow(2,V),{extent:J,radius:wt}=this.options,dt=wt/J,Lt=(K-dt)/xt,zt=(K+1+dt)/xt,Wt={features:[]};return this._addTileFeatures(nt.range((G-dt)/xt,Lt,(G+1+dt)/xt,zt),nt.data,G,K,xt,Wt),G===0&&this._addTileFeatures(nt.range(1-dt/xt,Lt,1,zt),nt.data,xt,K,xt,Wt),G===xt-1&&this._addTileFeatures(nt.range(0,Lt,dt/xt,zt),nt.data,-1,K,xt,Wt),Wt.features.length?Wt:null}getClusterExpansionZoom(V){let G=this._getOriginZoom(V)-1;for(;G<=this.options.maxZoom;){const K=this.getChildren(V);if(G++,K.length!==1)break;V=K[0].properties.cluster_id}return G}_appendLeaves(V,G,K,nt,xt){const J=this.getChildren(G);for(const wt of J){const dt=wt.properties;if(dt&&dt.cluster?xt+dt.point_count<=nt?xt+=dt.point_count:xt=this._appendLeaves(V,dt.cluster_id,K,nt,xt):xt1;let zt,Wt,Xt;if(Lt)zt=gn(G,dt,this.clusterProps),Wt=G[dt],Xt=G[dt+1];else{const Ge=this.points[G[dt+Ve]];zt=Ge.properties;const[je,bn]=Ge.geometry.coordinates;Wt=An(je),Xt=vr(bn)}const Te={type:1,geometry:[[Math.round(this.options.extent*(Wt*xt-K)),Math.round(this.options.extent*(Xt*xt-nt))]],tags:zt};let Ae;Ae=Lt||this.options.generateId?G[dt+Ve]:this.points[G[dt+Ve]].id,Ae!==void 0&&(Te.id=Ae),J.features.push(Te)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,G){const{radius:K,extent:nt,reduce:xt,minPoints:J}=this.options,wt=K/(nt*Math.pow(2,G)),dt=V.data,Lt=[],zt=this.stride;for(let Wt=0;WtG&&(je+=dt[jn+Pe])}if(je>Ge&&je>=J){let bn,jn=Xt*Ge,or=Te*Ge,Zr=-1;const nn=((Wt/zt|0)<<5)+(G+1)+this.points.length;for(const xr of Ae){const ei=xr*zt;if(dt[ei+2]<=G)continue;dt[ei+2]=G;const Ji=dt[ei+Pe];jn+=dt[ei]*Ji,or+=dt[ei+1]*Ji,dt[ei+4]=nn,xt&&(bn||(bn=this._map(dt,Wt,!0),Zr=this.clusterProps.length,this.clusterProps.push(bn)),xt(bn,this._map(dt,ei)))}dt[Wt+4]=nn,Lt.push(jn/je,or/je,1/0,nn,-1,je),xt&&Lt.push(Zr)}else{for(let bn=0;bn1)for(const bn of Ae){const jn=bn*zt;if(!(dt[jn+2]<=G)){dt[jn+2]=G;for(let or=0;or>5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,G,K){if(V[G+Pe]>1){const J=this.clusterProps[V[G+cn]];return K?Object.assign({},J):J}const nt=this.points[V[G+Ve]].properties,xt=this.options.map(nt);return K&&xt===nt?Object.assign({},xt):xt}}function mn(st,V,G){return{type:"Feature",id:st[V+Ve],properties:gn(st,V,G),geometry:{type:"Point",coordinates:[(K=st[V],360*(K-.5)),Pr(st[V+1])]}};var K}function gn(st,V,G){const K=st[V+Pe],nt=K>=1e4?`${Math.round(K/1e3)}k`:K>=1e3?Math.round(K/100)/10+"k":K,xt=st[V+cn],J=xt===-1?{}:Object.assign({},G[xt]);return Object.assign(J,{cluster:!0,cluster_id:st[V+Ve],point_count:K,point_count_abbreviated:nt})}function An(st){return st/360+.5}function vr(st){const V=Math.sin(st*Math.PI/180),G=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return G<0?0:G>1?1:G}function Pr(st){const V=(180-360*st)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}function br(st,V,G,K){for(var nt,xt=K,J=G-V>>1,wt=G-V,dt=st[V],Lt=st[V+1],zt=st[G],Wt=st[G+1],Xt=V+3;Xtxt)nt=Xt,xt=Te;else if(Te===xt){var Ae=Math.abs(Xt-J);AeK&&(nt-V>3&&br(st,V,nt,K),st[nt+2]=xt,G-nt>3&&br(st,nt,G,K))}function hr(st,V,G,K,nt,xt){var J=nt-G,wt=xt-K;if(J!==0||wt!==0){var dt=((st-G)*J+(V-K)*wt)/(J*J+wt*wt);dt>1?(G=nt,K=xt):dt>0&&(G+=J*dt,K+=wt*dt)}return(J=st-G)*J+(wt=V-K)*wt}function Qt(st,V,G,K){var nt={id:st===void 0?null:st,type:V,geometry:G,tags:K,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(xt){var J=xt.geometry,wt=xt.type;if(wt==="Point"||wt==="MultiPoint"||wt==="LineString")mt(xt,J);else if(wt==="Polygon"||wt==="MultiLineString")for(var dt=0;dt0&&(J+=K?(nt*Lt-dt*xt)/2:Math.sqrt(Math.pow(dt-nt,2)+Math.pow(Lt-xt,2))),nt=dt,xt=Lt}var zt=V.length-3;V[2]=1,br(V,0,zt,G),V[zt+2]=1,V.size=Math.abs(J),V.start=0,V.end=V.size}function kt(st,V,G,K){for(var nt=0;nt1?1:G}function on(st,V,G,K,nt,xt,J,wt){if(K/=V,xt>=(G/=V)&&J=K)return null;for(var dt=[],Lt=0;Lt=G&&Ae=K)){var Ge=[];if(Xt==="Point"||Xt==="MultiPoint")Kn(Wt,Ge,G,K,nt);else if(Xt==="LineString")Lo(Wt,Ge,G,K,nt,!1,wt.lineMetrics);else if(Xt==="MultiLineString")Os(Wt,Ge,G,K,nt,!1);else if(Xt==="Polygon")Os(Wt,Ge,G,K,nt,!0);else if(Xt==="MultiPolygon")for(var je=0;je=G&&J<=K&&(V.push(st[xt]),V.push(st[xt+1]),V.push(st[xt+2]))}}function Lo(st,V,G,K,nt,xt,J){for(var wt,dt,Lt=ps(st),zt=nt===0?Li:vl,Wt=st.start,Xt=0;XtG&&(dt=zt(Lt,Te,Ae,je,bn,G),J&&(Lt.start=Wt+wt*dt)):jn>K?or=G&&(dt=zt(Lt,Te,Ae,je,bn,G),Zr=!0),or>K&&jn<=K&&(dt=zt(Lt,Te,Ae,je,bn,K),Zr=!0),!xt&&Zr&&(J&&(Lt.end=Wt+wt*dt),V.push(Lt),Lt=ps(st)),J&&(Wt+=wt)}var nn=st.length-3;Te=st[nn],Ae=st[nn+1],Ge=st[nn+2],(jn=nt===0?Te:Ae)>=G&&jn<=K&&Ba(Lt,Te,Ae,Ge),nn=Lt.length-3,xt&&nn>=3&&(Lt[nn]!==Lt[0]||Lt[nn+1]!==Lt[1])&&Ba(Lt,Lt[0],Lt[1],Lt[2]),Lt.length&&V.push(Lt)}function ps(st){var V=[];return V.size=st.size,V.start=st.start,V.end=st.end,V}function Os(st,V,G,K,nt,xt){for(var J=0;JJ.maxX&&(J.maxX=zt),Wt>J.maxY&&(J.maxY=Wt)}return J}function Hr(st,V,G,K){var nt=V.geometry,xt=V.type,J=[];if(xt==="Point"||xt==="MultiPoint")for(var wt=0;wt0&&V.size<(nt?J:K))G.numPoints+=V.length/3;else{for(var wt=[],dt=0;dtJ)&&(G.numSimplified++,wt.push(V[dt]),wt.push(V[dt+1])),G.numPoints++;nt&&function(Lt,zt){for(var Wt=0,Xt=0,Te=Lt.length,Ae=Te-2;Xt0===zt)for(Xt=0,Te=Lt.length;Xt24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");var K=function(nt,xt){var J=[];if(nt.type==="FeatureCollection")for(var wt=0;wt1&&console.time("creation"),Xt=this.tiles[Wt]=bl(st,V,G,K,dt),this.tileCoords.push({z:V,x:G,y:K}),Lt)){Lt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,G,K,Xt.numFeatures,Xt.numPoints,Xt.numSimplified),console.timeEnd("creation"));var Te="z"+V;this.stats[Te]=(this.stats[Te]||0)+1,this.total++}if(Xt.source=st,nt){if(V===dt.maxZoom||V===nt)continue;var Ae=1<1&&console.time("clipping");var Ge,je,bn,jn,or,Zr,nn=.5*dt.buffer/dt.extent,xr=.5-nn,ei=.5+nn,Ji=1+nn;Ge=je=bn=jn=null,or=on(st,zt,G-nn,G+ei,0,Xt.minX,Xt.maxX,dt),Zr=on(st,zt,G+xr,G+Ji,0,Xt.minX,Xt.maxX,dt),st=null,or&&(Ge=on(or,zt,K-nn,K+ei,1,Xt.minY,Xt.maxY,dt),je=on(or,zt,K+xr,K+Ji,1,Xt.minY,Xt.maxY,dt),or=null),Zr&&(bn=on(Zr,zt,K-nn,K+ei,1,Xt.minY,Xt.maxY,dt),jn=on(Zr,zt,K+xr,K+Ji,1,Xt.minY,Xt.maxY,dt),Zr=null),Lt>1&&console.timeEnd("clipping"),wt.push(Ge||[],V+1,2*G,2*K),wt.push(je||[],V+1,2*G,2*K+1),wt.push(bn||[],V+1,2*G+1,2*K),wt.push(jn||[],V+1,2*G+1,2*K+1)}}},Qe.prototype.getTile=function(st,V,G){var K=this.options,nt=K.extent,xt=K.debug;if(st<0||st>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",st,V,G);for(var dt,Lt=st,zt=V,Wt=G;!dt&&Lt>0;)Lt--,zt=Math.floor(zt/2),Wt=Math.floor(Wt/2),dt=this.tiles[Ke(Lt,zt,Wt)];return dt&&dt.source?(xt>1&&console.log("found parent tile z%d-%d-%d",Lt,zt,Wt),xt>1&&console.time("drilling down"),this.splitTile(dt.source,Lt,zt,Wt,st,V,G),xt>1&&console.timeEnd("drilling down"),this.tiles[wt]?Ko(this.tiles[wt],nt):null):null};class ma extends I{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(V,G){return h._(this,void 0,void 0,function*(){const K=V.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const nt=this._geoJSONIndex.getTile(K.z,K.x,K.y);if(!nt)return null;const xt=new class{constructor(wt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=h.W,this.length=wt.length,this._features=wt}feature(wt){return new class{constructor(dt){this._feature=dt,this.extent=h.W,this.type=dt.type,this.properties=dt.tags,"id"in dt&&!isNaN(dt.id)&&(this.id=parseInt(dt.id,10))}loadGeometry(){if(this._feature.type===1){const dt=[];for(const Lt of this._feature.geometry)dt.push([new h.P(Lt[0],Lt[1])]);return dt}{const dt=[];for(const Lt of this._feature.geometry){const zt=[];for(const Wt of Lt)zt.push(new h.P(Wt[0],Wt[1]));dt.push(zt)}return dt}}toGeoJSON(dt,Lt,zt){return Z.call(this,dt,Lt,zt)}}(this._features[wt])}}(nt.features);let J=Gt(xt);return J.byteOffset===0&&J.byteLength===J.buffer.byteLength||(J=new Uint8Array(J)),{vectorTile:xt,rawData:J.buffer}})}loadData(V){return h._(this,void 0,void 0,function*(){var G;(G=this._pendingRequest)===null||G===void 0||G.abort();const K=!!(V&&V.request&&V.request.collectResourceTiming)&&new h.bs(V.request);this._pendingRequest=new AbortController;try{let nt=yield this.loadGeoJSON(V,this._pendingRequest);if(delete this._pendingRequest,typeof nt!="object")throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(Y(nt,!0),V.filter){const J=h.by(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(dt=>`${dt.key}: ${dt.message}`).join(", "));nt={type:"FeatureCollection",features:nt.features.filter(dt=>J.value.evaluate({zoom:0},dt))}}this._geoJSONIndex=V.cluster?new Cn(function({superclusterOptions:J,clusterProperties:wt}){if(!wt||!J)return J;const dt={},Lt={},zt={accumulated:null,zoom:0},Wt={properties:null},Xt=Object.keys(wt);for(const Te of Xt){const[Ae,Ge]=wt[Te],je=h.by(Ge),bn=h.by(typeof Ae=="string"?[Ae,["accumulated"],["get",Te]]:Ae);dt[Te]=je.value,Lt[Te]=bn.value}return J.map=Te=>{Wt.properties=Te;const Ae={};for(const Ge of Xt)Ae[Ge]=dt[Ge].evaluate(zt,Wt);return Ae},J.reduce=(Te,Ae)=>{Wt.properties=Ae;for(const Ge of Xt)zt.accumulated=Te[Ge],Te[Ge]=Lt[Ge].evaluate(zt,Wt)},J}(V)).load(nt.features):function(J,wt){return new Qe(J,wt)}(nt,V.geojsonVtOptions),this.loaded={};const xt={};if(K){const J=K.finish();J&&(xt.resourceTiming={},xt.resourceTiming[V.source]=JSON.parse(JSON.stringify(J)))}return xt}catch(nt){if(delete this._pendingRequest,h.bz(nt))return{abandoned:!0};throw nt}})}reloadTile(V){const G=this.loaded;return G&&G[V.uid]?super.reloadTile(V):this.loadTile(V)}loadGeoJSON(V,G){return h._(this,void 0,void 0,function*(){const{promoteId:K}=V;if(V.request){const nt=yield h.h(V.request,G);return this._dataUpdateable=Jo(nt.data,K)?Ye(nt.data,K):void 0,nt.data}if(typeof V.data=="string")try{const nt=JSON.parse(V.data);return this._dataUpdateable=Jo(nt,K)?Ye(nt,K):void 0,nt}catch{throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`)}if(!V.dataDiff)throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${V.source}`);return function(nt,xt,J){var wt,dt,Lt,zt;if(xt.removeAll&&nt.clear(),xt.remove)for(const Wt of xt.remove)nt.delete(Wt);if(xt.add)for(const Wt of xt.add){const Xt=Ar(Wt,J);Xt!=null&&nt.set(Xt,Wt)}if(xt.update)for(const Wt of xt.update){let Xt=nt.get(Wt.id);if(Xt==null)continue;const Te=!Wt.removeAllProperties&&(((wt=Wt.removeProperties)===null||wt===void 0?void 0:wt.length)>0||((dt=Wt.addOrUpdateProperties)===null||dt===void 0?void 0:dt.length)>0);if((Wt.newGeometry||Wt.removeAllProperties||Te)&&(Xt=Object.assign({},Xt),nt.set(Wt.id,Xt),Te&&(Xt.properties=Object.assign({},Xt.properties))),Wt.newGeometry&&(Xt.geometry=Wt.newGeometry),Wt.removeAllProperties)Xt.properties={};else if(((Lt=Wt.removeProperties)===null||Lt===void 0?void 0:Lt.length)>0)for(const Ae of Wt.removeProperties)Object.prototype.hasOwnProperty.call(Xt.properties,Ae)&&delete Xt.properties[Ae];if(((zt=Wt.addOrUpdateProperties)===null||zt===void 0?void 0:zt.length)>0)for(const{key:Ae,value:Ge}of Wt.addOrUpdateProperties)Xt.properties[Ae]=Ge}}(this._dataUpdateable,V.dataDiff,K),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(V){return h._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(V){return this._geoJSONIndex.getClusterExpansionZoom(V.clusterId)}getClusterChildren(V){return this._geoJSONIndex.getChildren(V.clusterId)}getClusterLeaves(V){return this._geoJSONIndex.getLeaves(V.clusterId,V.limit,V.offset)}}class zr{constructor(V){this.self=V,this.actor=new h.C(V),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(G,K)=>{if(this.externalWorkerSourceTypes[G])throw new Error(`Worker source with name "${G}" already registered.`);this.externalWorkerSourceTypes[G]=K},this.self.addProtocol=h.bf,this.self.removeProtocol=h.bg,this.self.registerRTLTextPlugin=G=>{if(h.bA.isParsed())throw new Error("RTL text plugin already registered.");h.bA.setMethods(G)},this.actor.registerMessageHandler("LDT",(G,K)=>this._getDEMWorkerSource(G,K.source).loadTile(K)),this.actor.registerMessageHandler("RDT",(G,K)=>h._(this,void 0,void 0,function*(){this._getDEMWorkerSource(G,K.source).removeTile(K)})),this.actor.registerMessageHandler("GCEZ",(G,K)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(G,K.type,K.source).getClusterExpansionZoom(K)})),this.actor.registerMessageHandler("GCC",(G,K)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(G,K.type,K.source).getClusterChildren(K)})),this.actor.registerMessageHandler("GCL",(G,K)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(G,K.type,K.source).getClusterLeaves(K)})),this.actor.registerMessageHandler("LD",(G,K)=>this._getWorkerSource(G,K.type,K.source).loadData(K)),this.actor.registerMessageHandler("LT",(G,K)=>this._getWorkerSource(G,K.type,K.source).loadTile(K)),this.actor.registerMessageHandler("RT",(G,K)=>this._getWorkerSource(G,K.type,K.source).reloadTile(K)),this.actor.registerMessageHandler("AT",(G,K)=>this._getWorkerSource(G,K.type,K.source).abortTile(K)),this.actor.registerMessageHandler("RMT",(G,K)=>this._getWorkerSource(G,K.type,K.source).removeTile(K)),this.actor.registerMessageHandler("RS",(G,K)=>h._(this,void 0,void 0,function*(){if(!this.workerSources[G]||!this.workerSources[G][K.type]||!this.workerSources[G][K.type][K.source])return;const nt=this.workerSources[G][K.type][K.source];delete this.workerSources[G][K.type][K.source],nt.removeSource!==void 0&&nt.removeSource(K)})),this.actor.registerMessageHandler("RM",G=>h._(this,void 0,void 0,function*(){delete this.layerIndexes[G],delete this.availableImages[G],delete this.workerSources[G],delete this.demWorkerSources[G]})),this.actor.registerMessageHandler("SR",(G,K)=>h._(this,void 0,void 0,function*(){this.referrer=K})),this.actor.registerMessageHandler("SRPS",(G,K)=>this._syncRTLPluginState(G,K)),this.actor.registerMessageHandler("IS",(G,K)=>h._(this,void 0,void 0,function*(){this.self.importScripts(K)})),this.actor.registerMessageHandler("SI",(G,K)=>this._setImages(G,K)),this.actor.registerMessageHandler("UL",(G,K)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(G).update(K.layers,K.removedIds)})),this.actor.registerMessageHandler("SL",(G,K)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(G).replace(K)}))}_setImages(V,G){return h._(this,void 0,void 0,function*(){this.availableImages[V]=G;for(const K in this.workerSources[V]){const nt=this.workerSources[V][K];for(const xt in nt)nt[xt].availableImages=G}})}_syncRTLPluginState(V,G){return h._(this,void 0,void 0,function*(){if(h.bA.isParsed())return h.bA.getState();if(G.pluginStatus!=="loading")return h.bA.setState(G),G;const K=G.pluginURL;if(this.self.importScripts(K),h.bA.isParsed()){const nt={pluginStatus:"loaded",pluginURL:K};return h.bA.setState(nt),nt}throw h.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${K}`)})}_getAvailableImages(V){let G=this.availableImages[V];return G||(G=[]),G}_getLayerIndex(V){let G=this.layerIndexes[V];return G||(G=this.layerIndexes[V]=new u),G}_getWorkerSource(V,G,K){if(this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][G]||(this.workerSources[V][G]={}),!this.workerSources[V][G][K]){const nt={sendAsync:(xt,J)=>(xt.targetMapId=V,this.actor.sendAsync(xt,J))};switch(G){case"vector":this.workerSources[V][G][K]=new I(nt,this._getLayerIndex(V),this._getAvailableImages(V));break;case"geojson":this.workerSources[V][G][K]=new ma(nt,this._getLayerIndex(V),this._getAvailableImages(V));break;default:this.workerSources[V][G][K]=new this.externalWorkerSourceTypes[G](nt,this._getLayerIndex(V),this._getAvailableImages(V))}}return this.workerSources[V][G][K]}_getDEMWorkerSource(V,G){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][G]||(this.demWorkerSources[V][G]=new P),this.demWorkerSources[V][G]}}return h.i(self)&&(self.worker=new zr(self)),zr}),i("index",["exports","./shared"],function(h,u){var y="4.1.3";let w,S;const I={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((s,f)=>{const d=requestAnimationFrame(s);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),f(u.c())})}),getImageData(_,s=0){return this.getImageCanvasContext(_).getImageData(-s,-s,_.width+2*s,_.height+2*s)},getImageCanvasContext(_){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=_.width,s.height=_.height,f.drawImage(_,0,0,_.width,_.height),f},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class P{static testProp(s){if(!P.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",P.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,d){const m=f.boundingClientRect;return new u.P((d.clientX-m.left)/f.x-s.clientLeft,(d.clientY-m.top)/f.y-s.clientTop)}static mousePos(s,f){const d=P.getScale(s);return P.getPoint(s,d,f)}static touchPos(s,f){const d=[],m=P.getScale(s);for(let v=0;v{s=[],f=0,d=0,m={}},_.addThrottleControl=M=>{const k=d++;return m[k]=M,k},_.removeThrottleControl=M=>{delete m[M],C()},_.getImage=(M,k,O=!0)=>new Promise((F,H)=>{z.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),u.e(M,{type:"image"}),s.push({abortController:k,requestParameters:M,supportImageRefresh:O,state:"queued",onError:it=>{H(it)},onSuccess:it=>{F(it)}}),C()});const v=M=>u._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:k,supportImageRefresh:O,onError:F,onSuccess:H,abortController:it}=M,rt=O===!1&&!u.i(self)&&!u.g(k.url)&&(!k.headers||Object.keys(k.headers).reduce((vt,Rt)=>vt&&Rt==="accept",!0));f++;const at=rt?T(k,it):u.m(k,it);try{const vt=yield at;delete M.abortController,M.state="completed",vt.data instanceof HTMLImageElement||u.b(vt.data)?H(vt):vt.data&&H({data:yield($=vt.data,typeof createImageBitmap=="function"?u.d($):u.f($)),cacheControl:vt.cacheControl,expires:vt.expires})}catch(vt){delete M.abortController,F(vt)}finally{f--,C()}var $}),C=()=>{const M=(()=>{for(const k of Object.keys(m))if(m[k]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let k=f;k0;k++){const O=s.shift();O.abortController.signal.aborted?k--:v(O)}},T=(M,k)=>new Promise((O,F)=>{const H=new Image,it=M.url,rt=M.credentials;rt&&rt==="include"?H.crossOrigin="use-credentials":(rt&&rt==="same-origin"||!u.s(it))&&(H.crossOrigin="anonymous"),k.signal.addEventListener("abort",()=>{H.src="",F(u.c())}),H.fetchPriority="high",H.onload=()=>{H.onerror=H.onload=null,O({data:H})},H.onerror=()=>{H.onerror=H.onload=null,k.signal.aborted||F(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},H.src=it})}(j||(j={})),j.resetRequestQueue();class q{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,d){const m=function(v){const C=v.match(ct);if(!C)throw new Error(`Unable to parse URL "${v}"`);return{protocol:C[1],authority:C[2],path:C[3]||"/",params:C[4]?C[4].split("&"):[]}}(s);return m.path+=`${f}${d}`,function(v){const C=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${C}`}(m)}setTransformRequest(s){this._transformRequestFn=s}}const ct=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function _t(_){var s=new u.A(3);return s[0]=_[0],s[1]=_[1],s[2]=_[2],s}var lt,ht=function(_,s,f){return _[0]=s[0]-f[0],_[1]=s[1]-f[1],_[2]=s[2]-f[2],_};lt=new u.A(3),u.A!=Float32Array&&(lt[0]=0,lt[1]=0,lt[2]=0);var pt=function(_){var s=_[0],f=_[1];return s*s+f*f};function Tt(_){const s=[];if(typeof _=="string")s.push({id:"default",url:_});else if(_&&_.length>0){const f=[];for(const{id:d,url:m}of _){const v=`${d}${m}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:d,url:m}))}}return s}(function(){var _=new u.A(2);u.A!=Float32Array&&(_[0]=0,_[1]=0)})();class Q{constructor(s,f,d,m){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(f,m)}update(s,f,d){const{width:m,height:v}=s,C=!(this.size&&this.size[0]===m&&this.size[1]===v||d),{context:T}=this,{gl:M}=T;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),T.pixelStoreUnpackFlipY.set(!1),T.pixelStoreUnpack.set(1),T.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[m,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,m,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:k,y:O}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,k,O,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,k,O,m,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,d){const{context:m}=this,{gl:v}=m;v.bindTexture(v.TEXTURE_2D,this.texture),d!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,d||s),this.filter=s),f!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,f),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,f),this.wrap=f)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function gt(_){const{userImage:s}=_;return!!(s&&s.render&&s.render())&&(_.data.replace(new Uint8Array(s.data.buffer)),!0)}class Kt extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:f,promiseResolve:d}of this.requestors)d(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const d=f.spriteData;f.data=new u.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),f.spriteData=null}return f}addImage(s,f){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,f)&&(this.images[s]=f)}_validate(s,f){let d=!0;const m=f.data||f.spriteData;return this._validateStretch(f.stretchX,m&&m.width)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(f.stretchY,m&&m.height)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(f.content,f)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,f){if(!s)return!0;let d=0;for(const m of s){if(m[0]{let m=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(m=!1);this.isLoaded()||m?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const d of s){let m=this.getImage(d);m||(this.fire(new u.k("styleimagemissing",{id:d})),m=this.getImage(d)),m?f[d]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:u.w(`Image "${d}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return f}getPixelSize(){const{width:s,height:f}=this.atlasImage;return{width:s,height:f}}getPattern(s){const f=this.patterns[s],d=this.getImage(s);if(!d)return null;if(f&&f.position.version===d.version)return f.position;if(f)f.position.version=d.version;else{const m={w:d.data.width+2,h:d.data.height+2,x:0,y:0},v=new u.I(m,d);this.patterns[s]={bin:m,position:v}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const f=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Q(s,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const v in this.patterns)s.push(this.patterns[v].bin);const{w:f,h:d}=u.p(s),m=this.atlasImage;m.resize({width:f||1,height:d||1});for(const v in this.patterns){const{bin:C}=this.patterns[v],T=C.x+1,M=C.y+1,k=this.getImage(v).data,O=k.width,F=k.height;u.R.copy(k,m,{x:0,y:0},{x:T,y:M},{width:O,height:F}),u.R.copy(k,m,{x:0,y:F-1},{x:T,y:M-1},{width:O,height:1}),u.R.copy(k,m,{x:0,y:0},{x:T,y:M+F},{width:O,height:1}),u.R.copy(k,m,{x:O-1,y:0},{x:T-1,y:M},{width:1,height:F}),u.R.copy(k,m,{x:0,y:0},{x:T+O,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const d=this.getImage(f);d||u.w(`Image with ID: "${f}" was not found`),gt(d)&&this.updateImage(f,d)}}}const bt=1e20;function Ut(_,s,f,d,m,v,C,T,M){for(let k=s;k-1);M++,v[M]=T,C[M]=k,C[M+1]=bt}for(let T=0,M=0;T65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[v])return{stack:s,id:f,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[v]){const T=Gt.loadGlyphRange(s,v,this.url,this.requestManager);d.requests[v]=T}const C=yield d.requests[v];for(const T in C)this._doesCharSupportLocalGlyph(+T)||(d.glyphs[+T]=C[+T]);return d.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](s)||u.u["Hangul Syllables"](s)||u.u.Hiragana(s)||u.u.Katakana(s))}_tinySDF(s,f,d){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(d))return;let v=s.tinySDF;if(!v){let T="400";/bold/i.test(f)?T="900":/medium/i.test(f)?T="500":/light/i.test(f)&&(T="200"),v=s.tinySDF=new Gt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:T})}const C=v.draw(String.fromCharCode(d));return{id:d,bitmap:new u.o({width:C.width||60,height:C.height||60},C.data),metrics:{width:C.glyphWidth/2||24,height:C.glyphHeight/2||24,left:C.glyphLeft/2+.5||0,top:C.glyphTop/2-27.5||-8,advance:C.glyphAdvance/2||24,isDoubleResolution:!0}}}}Gt.loadGlyphRange=function(_,s,f,d){return u._(this,void 0,void 0,function*(){const m=256*s,v=m+255,C=d.transformRequest(f.replace("{fontstack}",_).replace("{range}",`${m}-${v}`),"Glyphs"),T=yield u.l(C,new AbortController);if(!T||!T.data)throw new Error(`Could not load glyph range. range: ${s}, ${m}-${v}`);const M={};for(const k of u.n(T.data))M[k.id]=k;return M})},Gt.TinySDF=class{constructor({fontSize:_=24,buffer:s=3,radius:f=8,cutoff:d=.25,fontFamily:m="sans-serif",fontWeight:v="normal",fontStyle:C="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=f;const T=this.size=_+4*s,M=this._createCanvas(T),k=this.ctx=M.getContext("2d",{willReadFrequently:!0});k.font=`${C} ${v} ${_}px ${m}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(T*T),this.gridInner=new Float64Array(T*T),this.f=new Float64Array(T),this.z=new Float64Array(T+1),this.v=new Uint16Array(T)}_createCanvas(_){const s=document.createElement("canvas");return s.width=s.height=_,s}draw(_){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:d,actualBoundingBoxLeft:m,actualBoundingBoxRight:v}=this.ctx.measureText(_),C=Math.ceil(f),T=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-m))),M=Math.min(this.size-this.buffer,C+Math.ceil(d)),k=T+2*this.buffer,O=M+2*this.buffer,F=Math.max(k*O,0),H=new Uint8ClampedArray(F),it={data:H,width:k,height:O,glyphWidth:T,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(T===0||M===0)return it;const{ctx:rt,buffer:at,gridInner:$,gridOuter:vt}=this;rt.clearRect(at,at,T,M),rt.fillText(_,at,at+C);const Rt=rt.getImageData(at,at,T,M);vt.fill(bt,0,F),$.fill(0,0,F);for(let ut=0;ut0?Ht*Ht:0,$[Ft]=Ht<0?Ht*Ht:0}}Ut(vt,0,0,k,O,k,this.f,this.v,this.z),Ut($,at,at,T,M,k,this.f,this.v,this.z);for(let ut=0;ut1&&(M=s[++T]);const O=Math.abs(k-M.left),F=Math.abs(k-M.right),H=Math.min(O,F);let it;const rt=v/d*(m+1);if(M.isDash){const at=m-Math.abs(rt);it=Math.sqrt(H*H+at*at)}else it=m-Math.sqrt(H*H+rt*rt);this.data[C+k]=Math.max(0,Math.min(255,it+128))}}}addRegularDash(s){for(let T=s.length-1;T>=0;--T){const M=s[T],k=s[T+1];M.zeroLength?s.splice(T,1):k&&k.isDash===M.isDash&&(k.left=M.left,s.splice(T,1))}const f=s[0],d=s[s.length-1];f.isDash===d.isDash&&(f.left=d.left-this.width,d.right=f.right+this.width);const m=this.width*this.nextRow;let v=0,C=s[v];for(let T=0;T1&&(C=s[++v]);const M=Math.abs(T-C.left),k=Math.abs(T-C.right),O=Math.min(M,k);this.data[m+T]=Math.max(0,Math.min(255,(C.isDash?O:-O)+128))}}addDash(s,f){const d=f?7:0,m=2*d+1;if(this.nextRow+m>this.height)return u.w("LineAtlas out of space"),null;let v=0;for(let T=0;T{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Pe]}numActive(){return Object.keys(this.active).length}}const Cn=Math.floor(I.hardwareConcurrency/2);let mn,gn;function An(){return mn||(mn=new cn),mn}cn.workerCount=u.B(globalThis)?Math.max(Math.min(Cn,3),1):1;class vr{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const d=this.workerPool.acquire(f);for(let m=0;m{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const d of this.actors)d.registerMessageHandler(s,f)}}function Pr(){return gn||(gn=new vr(An(),u.G),gn.registerMessageHandler("GR",(_,s,f)=>u.m(s,f))),gn}function br(_,s){const f=u.F();return u.H(f,f,[1,1,0]),u.J(f,f,[.5*_.width,.5*_.height,1]),u.K(f,f,_.calculatePosMatrix(s.toUnwrapped()))}function hr(_,s,f,d,m,v){const C=function(F,H,it){if(F)for(const rt of F){const at=H[rt];if(at&&at.source===it&&at.type==="fill-extrusion")return!0}else for(const rt in H){const at=H[rt];if(at.source===it&&at.type==="fill-extrusion")return!0}return!1}(m&&m.layers,s,_.id),T=v.maxPitchScaleFactor(),M=_.tilesIn(d,T,C);M.sort(Qt);const k=[];for(const F of M)k.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,_._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,m,v,T,br(_.transform,F.tileID))});const O=function(F){const H={},it={};for(const rt of F){const at=rt.queryResults,$=rt.wrappedTileID,vt=it[$]=it[$]||{};for(const Rt in at){const ut=at[Rt],Et=vt[Rt]=vt[Rt]||{},Nt=H[Rt]=H[Rt]||[];for(const Ft of ut)Et[Ft.featureIndex]||(Et[Ft.featureIndex]=!0,Nt.push(Ft))}}return H}(k);for(const F in O)O[F].forEach(H=>{const it=H.feature,rt=_.getFeatureState(it.layer["source-layer"],it.id);it.source=it.layer.source,it.layer["source-layer"]&&(it.sourceLayer=it.layer["source-layer"]),it.state=rt});return O}function Qt(_,s){const f=_.tileID,d=s.tileID;return f.overscaledZ-d.overscaledZ||f.canonical.y-d.canonical.y||f.wrap-d.wrap||f.canonical.x-d.canonical.x}function mt(_,s,f){return u._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield u.h(s.transformRequest(_.url,"Source"),f)).data:yield I.frameAsync(f),!d)return null;const m=u.L(u.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(m.vectorLayerIds=d.vector_layers.map(v=>v.id)),m})}class Ct{constructor(s,f){s&&(f?this.setSouthWest(s).setNorthEast(f):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}extend(s){const f=this._sw,d=this._ne;let m,v;if(s instanceof u.M)m=s,v=s;else{if(!(s instanceof Ct))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Ct.convert(s)):this.extend(u.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(u.M.convert(s)):this;if(m=s._sw,v=s._ne,!m||!v)return this}return f||d?(f.lng=Math.min(m.lng,f.lng),f.lat=Math.min(m.lat,f.lat),d.lng=Math.max(v.lng,d.lng),d.lat=Math.max(v.lat,d.lat)):(this._sw=new u.M(m.lng,m.lat),this._ne=new u.M(v.lng,v.lat)),this}getCenter(){return new u.M((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new u.M(this.getWest(),this.getNorth())}getSouthEast(){return new u.M(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(s){const{lng:f,lat:d}=u.M.convert(s);let m=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&m}static convert(s){return s instanceof Ct?s:s&&new Ct(s)}static fromLngLat(s,f=0){const d=360*f/40075017,m=d/Math.cos(Math.PI/180*s.lat);return new Ct(new u.M(s.lng-m,s.lat-d),new u.M(s.lng+m,s.lat+d))}}class Ie{constructor(s,f,d){this.bounds=Ct.convert(this.validateBounds(s)),this.minzoom=f||0,this.maxzoom=d||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const f=Math.pow(2,s.z),d=Math.floor(u.N(this.bounds.getWest())*f),m=Math.floor(u.O(this.bounds.getNorth())*f),v=Math.ceil(u.N(this.bounds.getEast())*f),C=Math.ceil(u.O(this.bounds.getSouth())*f);return s.x>=d&&s.x=m&&s.y{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(f,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};d.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((v,C)=>{s.reloadPromise={resolve:v,reject:C}})}else s.actor=this.dispatcher.getActor(),m="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:m,data:d},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,v)}catch(v){if(delete s.abortController,s.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,f){if(f&&f.resourceTiming&&(s.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&s.setExpiryData(f),s.loadVectorData(f,this.map.painter),s.reloadPromise){const d=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(d.resolve).catch(d.reject)}}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class kt extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},f),u.e(this,u.L(f,["url","scheme","tileSize"]))}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield mt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(u.e(this,s),s.bounds&&(this.tileBounds=new Ie(s.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new u.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return u.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const d=yield j.getImage(this.map._requestManager.transformRequest(f,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&s.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const m=this.map.painter.context,v=m.gl,C=d.data;s.texture=this.map.painter.getTileTexture(C.width),s.texture?s.texture.update(C,{useMipmap:!0}):(s.texture=new Q(m,C,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),s.state="loaded"}}catch(d){if(delete s.abortController,s.aborted)s.state="unloaded";else if(d)throw s.state="errored",d}})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class Xe extends kt{constructor(s,f,d,m){super(s,f,d,m),this.type="raster-dem",this.maxzoom=22,this._options=u.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const m=yield j.getImage(d,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){const v=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const C=u.b(v)&&u.S()?v:yield this.readImageNow(v),T={type:this.type,uid:s.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:T});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}readImageNow(s){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.U()){const f=s.width+2,d=s.height+2;try{return new u.R({width:f,height:d},yield u.V(s,-1,-1,f,d))}catch{}}return I.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,d=Math.pow(2,f.z),m=(f.x-1+d)%d,v=f.x===0?s.wrap-1:s.wrap,C=(f.x+1+d)%d,T=f.x+1===d?s.wrap+1:s.wrap,M={};return M[new u.Q(s.overscaledZ,v,f.z,m,f.y).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y).key]={backfilled:!1},f.y>0&&(M[new u.Q(s.overscaledZ,v,f.z,m,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y-1).key]={backfilled:!1}),f.y+10&&u.e(v,{resourceTiming:m}),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new u.k("dataabort",{dataType:"source"}));this.fire(new u.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const d={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;const m=yield this.actor.sendAsync({type:f,data:d},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(m,this.map.painter,f==="RT")})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var on=u.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Kn extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=f}load(s){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield j.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,s&&(this.coordinates=s),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new u.j(f))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const f=s.map(u.Y.fromLngLat);this.tileID=function(m){let v=1/0,C=1/0,T=-1/0,M=-1/0;for(const H of m)v=Math.min(v,H.x),C=Math.min(C,H.y),T=Math.max(T,H.x),M=Math.max(M,H.y);const k=Math.max(T-v,M-C),O=Math.max(0,Math.floor(-Math.log(k)/Math.LN2)),F=Math.pow(2,O);return new u.a0(O,Math.floor((v+T)/2*F),Math.floor((C+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const d=f.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new u.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,u.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,u.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,u.W,u.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Q(s,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Lo extends Kn{constructor(s,f,d,m){super(s,f,d,m),this.roundZoom=!0,this.type="video",this.options=f}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const f of s.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield u.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new u.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const f=this.video.seekable;sf.end(0)?this.fire(new u.j(new u.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new Q(s,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ps extends Kn{constructor(s,f,d,m){super(s,f,d,m),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(C=>typeof C!="number"))||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new u.j(new u.a1(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return u._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new u.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,d=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Q(f,this.canvas,d.RGBA,{premultiply:!0});let m=!1;for(const v in this.tiles){const C=this.tiles[v];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,m=!0)}m&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const Os={},Ba=_=>{switch(_){case"geojson":return Mr;case"image":return Kn;case"raster":return kt;case"raster-dem":return Xe;case"vector":return kn;case"video":return Lo;case"canvas":return ps}return Os[_]},Li="RTLPluginLoaded";class vl extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Pr()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return u._(this,arguments,void 0,function*(f,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=I.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!d)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return u._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.k(Li))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ds=null;function re(){return ds||(ds=new vl),ds}class Ko{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=u.a3(),this.uses=0,this.tileSize=f,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(s){const f=s+this.timeAdded;fv.getLayer(k)).filter(Boolean);if(M.length!==0){T.layers=M,T.stateDependentLayerIds&&(T.stateDependentLayers=T.stateDependentLayerIds.map(k=>M.filter(O=>O.id===k)[0]));for(const k of M)C[k.id]=T}}return C}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5){if(this.hasSymbolBuckets=!0,!d)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5&&v.hasRTLText){this.hasRTLText=!0,re().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const v=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(m).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new u.a4}unloadVectorData(){for(const s in this.buckets)this.buckets[s].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(s){return this.buckets[s.id]}upload(s){for(const d in this.buckets){const m=this.buckets[d];m.uploadPending()&&m.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Q(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Q(s,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,f,d,m,v,C,T,M,k,O){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:v,scale:C,tileSize:this.tileSize,pixelPosMatrix:O,transform:M,params:T,queryPadding:this.queryPadding*k},s,f,d):{}}querySourceFeatures(s,f){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const m=d.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",C=m._geojsonTileLayer||m[v];if(!C)return;const T=u.a6(f&&f.filter),{z:M,x:k,y:O}=this.tileID.canonical,F={z:M,x:k,y:O};for(let H=0;Hd)m=!1;else if(f)if(this.expirationTime{this.remove(s,v)},d)),this.data[m].push(v),this.order.push(m),this.order.length>this.max){const C=this._getAndRemoveByKey(this.order[0]);C&&this.onRemove(C)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const f=this.data[s].shift();return f.timeout&&clearTimeout(f.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),f.value}getByKey(s){const f=this.data[s];return f?f[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,f){if(!this.has(s))return this;const d=s.wrapped().key,m=f===void 0?0:this.data[d].indexOf(f),v=this.data[d][m];return this.data[d].splice(m,1),v.timeout&&clearTimeout(v.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(v.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(s){const f=[];for(const d in this.data)for(const m of this.data[d])s(m.value)||f.push(m);for(const d of f)this.remove(d.value.tileID,d)}}class bl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,d){const m=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][m]=this.stateChanges[s][m]||{},u.e(this.stateChanges[s][m],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==m&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][m]===null){this.deletedStates[s][m]={};for(const v in this.state[s][m])d[v]||(this.deletedStates[s][m][v]=null)}else for(const v in d)this.deletedStates[s]&&this.deletedStates[s][m]&&this.deletedStates[s][m][v]===null&&delete this.deletedStates[s][m][v]}removeFeatureState(s,f,d){if(this.deletedStates[s]===null)return;const m=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&f!==void 0)this.deletedStates[s][m]!==null&&(this.deletedStates[s][m]=this.deletedStates[s][m]||{},this.deletedStates[s][m][d]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][m])for(d in this.deletedStates[s][m]={},this.stateChanges[s][m])this.deletedStates[s][m][d]=null;else this.deletedStates[s][m]=null;else this.deletedStates[s]=null}getState(s,f){const d=String(f),m=u.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const v=this.deletedStates[s][f];if(v===null)return{};for(const C in v)delete m[C]}return m}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const d={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const v={};for(const C in this.stateChanges[m])this.state[m][C]||(this.state[m][C]={}),u.e(this.state[m][C],this.stateChanges[m][C]),v[C]=this.state[m][C];d[m]=v}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const v={};if(this.deletedStates[m]===null)for(const C in this.state[m])v[C]={},this.state[m][C]={};else for(const C in this.deletedStates[m]){if(this.deletedStates[m][C]===null)this.state[m][C]={};else for(const T of Object.keys(this.deletedStates[m][C]))delete this.state[m][C][T];v[C]=this.state[m][C]}d[m]=d[m]||{},u.e(d[m],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const m in s)s[m].setFeatureState(d,f)}}class Hr extends u.E{constructor(s,f,d){super(),this.id=s,this.dispatcher=d,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,v,C,T)=>{const M=new(Ba(v.type))(m,v,C,T);if(M.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${M.id}`);return M})(s,f,d,this),this._tiles={},this._cache=new Ki(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new bl,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const s in this._tiles){const f=this._tiles[s];if(f.state!=="loaded"&&f.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,f,d){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,d)}catch(m){s.state="errored",m.status!==404?this._source.fire(new u.j(m,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new u.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const d=this._tiles[f];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(ae).map(s=>s.key)}getRenderableIds(s){const f=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&f.push(this._tiles[d]);return s?f.sort((d,m)=>{const v=d.tileID,C=m.tileID,T=new u.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new u.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-C.overscaledZ||M.y-T.y||M.x-T.x}).map(d=>d.tileID.key):f.map(d=>d.tileID).sort(ae).map(d=>d.key)}hasRenderableParent(s){const f=this.findLoadedParent(s,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(s,f){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(f||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,f){return u._(this,void 0,void 0,function*(){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=f),yield this._loadTile(d,s,f))})}_tileLoaded(s,f,d){s.timeAdded=I.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(f,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new u.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let m=0;m1||(Math.abs(C)>1&&(Math.abs(C+M)===1?C+=M:Math.abs(C-M)===1&&(C-=M)),v.dem&&m.dem&&(m.dem.backfillBorder(v.dem,C,T),m.neighboringTiles&&m.neighboringTiles[k]&&(m.neighboringTiles[k].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,d,m){for(const v in this._tiles){let C=this._tiles[v];if(m[v]||!C.hasData()||C.tileID.overscaledZ<=f||C.tileID.overscaledZ>d)continue;let T=C.tileID;for(;C&&C.tileID.overscaledZ>f+1;){const k=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[k.key],C&&C.hasData()&&(T=k)}let M=T;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){m[T.key]=T;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=f?d:null}for(let d=s.overscaledZ-1;d>=f;d--){const m=s.scaledTo(d),v=this._getLoadedTile(m);if(v)return v}}_getLoadedTile(s){const f=this._tiles[s.key];return f&&f.hasData()?f:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const f=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,m=Math.floor(f*d*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(v)}handleWrapJump(s){const f=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,f){const d={};for(const m in this._tiles){const v=this._tiles[m];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),d[v.tileID.key]=v}this._tiles=d;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}update(s,f){if(!this._sourceLoaded||this._paused)return;let d;this.transform=s,this.terrain=f,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(O=>new u.Q(O.canonical.z,O.wrap,O.canonical.z,O.canonical.x,O.canonical.y)):(d=s.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:f}),this._source.hasTile&&(d=d.filter(O=>this._source.hasTile(O)))):d=[];const m=s.coveringZoomLevel(this._source),v=Math.max(m-Hr.maxOverzooming,this._source.minzoom),C=Math.max(m+Hr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const O={};for(const F of d)if(F.canonical.z>this._source.minzoom){const H=F.scaledTo(F.canonical.z-1);O[H.key]=H;const it=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));O[it.key]=it}d=d.concat(Object.values(O))}const T=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,T&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,m);if(Qe(this._source.type)){const O={},F={},H=Object.keys(M),it=I.now();for(const rt of H){const at=M[rt],$=this._tiles[rt];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=it)continue;const vt=this.findLoadedParent(at,v);vt&&(this._addTile(vt.tileID),O[vt.tileID.key]=vt.tileID),F[rt]=at}this._retainLoadedChildren(F,m,C,M);for(const rt in O)M[rt]||(this._coveredTiles[rt]=!0,M[rt]=O[rt]);if(f){const rt={},at={};for(const $ of d)this._tiles[$.key].hasData()?rt[$.key]=$:at[$.key]=$;for(const $ in at){const vt=at[$].children(this._source.maxzoom);this._tiles[vt[0].key]&&this._tiles[vt[1].key]&&this._tiles[vt[2].key]&&this._tiles[vt[3].key]&&(rt[vt[0].key]=M[vt[0].key]=vt[0],rt[vt[1].key]=M[vt[1].key]=vt[1],rt[vt[2].key]=M[vt[2].key]=vt[2],rt[vt[3].key]=M[vt[3].key]=vt[3],delete at[$])}for(const $ in at){const vt=this.findLoadedParent(at[$],this._source.minzoom);if(vt){rt[vt.tileID.key]=M[vt.tileID.key]=vt.tileID;for(const Rt in rt)rt[Rt].isChildOf(vt.tileID)&&delete rt[Rt]}}for(const $ in this._tiles)rt[$]||(this._coveredTiles[$]=!0)}}for(const O in M)this._tiles[O].clearFadeHold();const k=u.ab(this._tiles,M);for(const O of k){const F=this._tiles[O];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(O)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,f){const d={},m={},v=Math.max(f-Hr.maxOverzooming,this._source.minzoom),C=Math.max(f+Hr.maxUnderzooming,this._source.minzoom),T={};for(const M of s){const k=this._addTile(M);d[M.key]=M,k.hasData()||fthis._source.maxzoom){const F=M.children(this._source.maxzoom)[0],H=this.getTile(F);if(H&&H.hasData()){d[F.key]=F;continue}}else{const F=M.children(this._source.maxzoom);if(d[F[0].key]&&d[F[1].key]&&d[F[2].key]&&d[F[3].key])continue}let O=k.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const H=M.scaledTo(F);if(m[H.key])break;if(m[H.key]=!0,k=this.getTile(H),!k&&O&&(k=this._addTile(H)),k){const it=k.hasData();if((O||it)&&(d[H.key]=H),O=k.wasRequested(),it)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let d,m=this._tiles[s].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){d=this._loadedParentTiles[m.key];break}f.push(m.key);const v=m.scaledTo(m.overscaledZ-1);if(d=this._getLoadedTile(v),d)break;m=v}for(const v of f)this._loadedParentTiles[v]=d}}_addTile(s){let f=this._tiles[s.key];if(f)return f;f=this._cache.getAndRemove(s),f&&(this._setTileReloadTimer(s.key,f),f.tileID=s,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,f)));const d=f;return f||(f=new Ko(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,d||this._source.fire(new u.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(s,f){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=f.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const f=this._tiles[s];f&&(f.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(s){const f=s.sourceDataType;s.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,f,d){const m=[],v=this.transform;if(!v)return m;const C=d?v.getCameraQueryGeometry(s):s,T=s.map(rt=>v.pointCoordinate(rt,this.terrain)),M=C.map(rt=>v.pointCoordinate(rt,this.terrain)),k=this.getIds();let O=1/0,F=1/0,H=-1/0,it=-1/0;for(const rt of M)O=Math.min(O,rt.x),F=Math.min(F,rt.y),H=Math.max(H,rt.x),it=Math.max(it,rt.y);for(let rt=0;rt=0&&ut[1].y+Rt>=0){const Et=T.map(Ft=>$.getTilePoint(Ft)),Nt=M.map(Ft=>$.getTilePoint(Ft));m.push({tile:at,tileID:$,queryGeometry:Et,cameraQueryGeometry:Nt,scale:vt})}}return m}getVisibleCoordinates(s){const f=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of f)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(Qe(this._source.type)){const s=I.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=s)return!0}return!1}setFeatureState(s,f,d){this._state.updateState(s=s||"_geojsonTileLayer",f,d)}removeFeatureState(s,f,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",f,d)}getFeatureState(s,f){return this._state.getState(s=s||"_geojsonTileLayer",f)}setDependencies(s,f,d){const m=this._tiles[s];m&&m.setDependencies(f,d)}reloadTilesForDependencies(s,f){for(const d in this._tiles)this._tiles[d].hasDependency(s,f)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,f))}}function ae(_,s){const f=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return _.overscaledZ-s.overscaledZ||d-f||s.canonical.y-_.canonical.y||s.canonical.x-_.canonical.x}function Qe(_){return _==="raster"||_==="image"||_==="video"}Hr.maxOverzooming=10,Hr.maxUnderzooming=3;class Ke{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let d=1;d0?(m-C)/T:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Ar(_,s){let f=!0;return _==="always"||_!=="never"&&s!=="never"||(f=!1),f}class Jo{constructor(s,f,d){const m=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(f/d);for(let C=0;Cthis.width||m<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=d&&this.height<=m){if(v)return[{key:null,x1:s,y1:f,x2:d,y2:m}];for(let k=0;k0}hitTestCircle(s,f,d,m,v){const C=s-d,T=s+d,M=f-d,k=f+d;if(T<0||C>this.width||k<0||M>this.height)return!1;const O=[];return this._forEachCell(C,M,T,k,this._queryCellCircle,O,{hitTest:!0,overlapMode:m,circle:{x:s,y:f,radius:d},seenUids:{box:{},circle:{}}},v),O.length>0}_queryCell(s,f,d,m,v,C,T,M){const{seenUids:k,hitTest:O,overlapMode:F}=T,H=this.boxCells[v];if(H!==null){const rt=this.bboxes;for(const at of H)if(!k.box[at]){k.box[at]=!0;const $=4*at,vt=this.boxKeys[at];if(s<=rt[$+2]&&f<=rt[$+3]&&d>=rt[$+0]&&m>=rt[$+1]&&(!M||M(vt))&&(!O||!Ar(F,vt.overlapMode))&&(C.push({key:vt,x1:rt[$],y1:rt[$+1],x2:rt[$+2],y2:rt[$+3]}),O))return!0}}const it=this.circleCells[v];if(it!==null){const rt=this.circles;for(const at of it)if(!k.circle[at]){k.circle[at]=!0;const $=3*at,vt=this.circleKeys[at];if(this._circleAndRectCollide(rt[$],rt[$+1],rt[$+2],s,f,d,m)&&(!M||M(vt))&&(!O||!Ar(F,vt.overlapMode))){const Rt=rt[$],ut=rt[$+1],Et=rt[$+2];if(C.push({key:vt,x1:Rt-Et,y1:ut-Et,x2:Rt+Et,y2:ut+Et}),O)return!0}}}return!1}_queryCellCircle(s,f,d,m,v,C,T,M){const{circle:k,seenUids:O,overlapMode:F}=T,H=this.boxCells[v];if(H!==null){const rt=this.bboxes;for(const at of H)if(!O.box[at]){O.box[at]=!0;const $=4*at,vt=this.boxKeys[at];if(this._circleAndRectCollide(k.x,k.y,k.radius,rt[$+0],rt[$+1],rt[$+2],rt[$+3])&&(!M||M(vt))&&!Ar(F,vt.overlapMode))return C.push(!0),!0}}const it=this.circleCells[v];if(it!==null){const rt=this.circles;for(const at of it)if(!O.circle[at]){O.circle[at]=!0;const $=3*at,vt=this.circleKeys[at];if(this._circlesCollide(rt[$],rt[$+1],rt[$+2],k.x,k.y,k.radius)&&(!M||M(vt))&&!Ar(F,vt.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,d,m,v,C,T,M){const k=this._convertToXCellCoord(s),O=this._convertToYCellCoord(f),F=this._convertToXCellCoord(d),H=this._convertToYCellCoord(m);for(let it=k;it<=F;it++)for(let rt=O;rt<=H;rt++)if(v.call(this,s,f,d,m,this.xCellCount*rt+it,C,T,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,f,d,m,v,C){const T=m-s,M=v-f,k=d+C;return k*k>T*T+M*M}_circleAndRectCollide(s,f,d,m,v,C,T){const M=(C-m)/2,k=Math.abs(s-(m+M));if(k>M+d)return!1;const O=(T-v)/2,F=Math.abs(f-(v+O));if(F>O+d)return!1;if(k<=M||F<=O)return!0;const H=k-M,it=F-O;return H*H+it*it<=d*d}}function Ye(_,s,f,d,m){const v=u.F();return s?(u.J(v,v,[1/m,1/m,1]),f||u.ad(v,v,d.angle)):u.K(v,d.labelPlaneMatrix,_),v}function ma(_,s,f,d,m){if(s){const v=u.ae(_);return u.J(v,v,[m,m,1]),f||u.ad(v,v,-d.angle),v}return d.glCoordMatrix}function zr(_,s,f){let d;f?(d=[_.x,_.y,f(_.x,_.y),1],u.af(d,d,s)):(d=[_.x,_.y,0,1],Te(d,d,s));const m=d[3];return{point:new u.P(d[0]/m,d[1]/m),signedDistanceFromCamera:m}}function st(_,s){return .5+_/s*.5}function V(_,s){const f=_[0]/_[3],d=_[1]/_[3];return f>=-s[0]&&f<=s[0]&&d>=-s[1]&&d<=s[1]}function G(_,s,f,d,m,v,C,T,M,k){const O=d?_.textSizeData:_.iconSizeData,F=u.ag(O,f.transform.zoom),H=[256/f.width*2+1,256/f.height*2+1],it=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;it.clear();const rt=_.lineVertexArray,at=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,$=f.transform.width/f.transform.height;let vt=!1;for(let Rt=0;RtMath.abs(f.x-s.x)*d?{useVertical:!0}:(_===u.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function xt(_,s,f,d,m,v,C,T,M,k,O,F,H,it,rt,at){const $=s/24,vt=_.lineOffsetX*$,Rt=_.lineOffsetY*$;let ut;if(_.numGlyphs>1){const Et=_.glyphStartIndex+_.numGlyphs,Nt=_.lineStartIndex,Ft=_.lineStartIndex+_.lineLength,Ht=K($,T,vt,Rt,f,O,F,_,M,v,H,rt,at);if(!Ht)return{notEnoughRoom:!0};const te=zr(Ht.first.point,C,at).point,$t=zr(Ht.last.point,C,at).point;if(d&&!f){const oe=nt(_.writingMode,te,$t,it);if(oe)return oe}ut=[Ht.first];for(let oe=_.glyphStartIndex+1;oe0?te.point:J(F,Ht,Nt,1,m,at),oe=nt(_.writingMode,Nt,$t,it);if(oe)return oe}const Et=zt($*T.getoffsetX(_.glyphStartIndex),vt,Rt,f,O,F,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,M,v,H,rt,at);if(!Et)return{notEnoughRoom:!0};ut=[Et]}for(const Et of ut)u.aj(k,Et.point,Et.angle);return{}}function J(_,s,f,d,m,v){const C=zr(_.add(_.sub(s)._unit()),m,v).point,T=f.sub(C);return f.add(T._mult(d/T.mag()))}function wt(_,s){const{projectionCache:f,lineVertexArray:d,labelPlaneMatrix:m,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:T,previousVertex:M,direction:k,absOffsetX:O}=s;if(f.projections[_])return f.projections[_];const F=new u.P(d.getx(_),d.gety(_)),H=zr(F,m,T);if(H.signedDistanceFromCamera>0)return f.projections[_]=H.point,H.point;const it=_-k;return J(C===0?v:new u.P(d.getx(it),d.gety(it)),F,M,O-C+1,m,T)}function dt(_,s,f){return _._unit()._perp()._mult(s*f)}function Lt(_,s,f,d,m,v,C,T){const{projectionCache:M,direction:k}=T;if(M.offsets[_])return M.offsets[_];const O=f.add(s);if(_+k=m)return M.offsets[_]=O,O;const F=wt(_+k,T),H=dt(F.sub(f),C,k),it=f.add(H),rt=F.add(H);return M.offsets[_]=u.ak(v,O,it,rt)||O,M.offsets[_]}function zt(_,s,f,d,m,v,C,T,M,k,O,F,H,it){const rt=d?_-s:_+s;let at=rt>0?1:-1,$=0;d&&(at*=-1,$=Math.PI),at<0&&($+=Math.PI);let vt,Rt,ut=at>0?T+C:T+C+1,Et=m,Nt=m,Ft=0,Ht=0;const te=Math.abs(rt),$t=[];let oe;for(;Ft+Ht<=te;){if(ut+=at,ut=M)return null;Ft+=Ht,Nt=Et,Rt=vt;const ue={projectionCache:F,lineVertexArray:k,labelPlaneMatrix:O,tileAnchorPoint:v,distanceFromAnchor:Ft,getElevation:it,previousVertex:Nt,direction:at,absOffsetX:te};if(Et=wt(ut,ue),f===0)$t.push(Nt),oe=Et.sub(Nt);else{let ze;const tn=Et.sub(Nt);ze=tn.mag()===0?dt(wt(ut+at,ue).sub(Et),f,at):dt(tn,f,at),Rt||(Rt=Nt.add(ze)),vt=Lt(ut,ze,Et,T,M,Rt,f,ue),$t.push(Rt),oe=vt.sub(Rt)}Ht=oe.mag()}const le=oe._mult((te-Ft)/Ht)._add(Rt||Nt),$e=$+Math.atan2(Et.y-Nt.y,Et.x-Nt.x);return $t.push(le),{point:le,angle:H?$e:0,path:$t}}const Wt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xt(_,s){for(let f=0;f<_;f++){const d=s.length;s.resize(d+4),s.float32.set(Wt,3*d)}}function Te(_,s,f){const d=s[0],m=s[1];return _[0]=f[0]*d+f[4]*m+f[12],_[1]=f[1]*d+f[5]*m+f[13],_[3]=f[3]*d+f[7]*m+f[15],_}const Ae=100;class Ge{constructor(s,f=new Jo(s.width+200,s.height+200,25),d=new Jo(s.width+200,s.height+200,25)){this.transform=s,this.grid=f,this.ignoredGrid=d,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Ae,this.screenBottomBoundary=s.height+Ae,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,f,d,m,v,C){const T=this.projectAndGetPerspectiveRatio(m,s.anchorPointX,s.anchorPointY,C),M=d*T.perspectiveRatio,k=s.x1*M+T.point.x,O=s.y1*M+T.point.y,F=s.x2*M+T.point.x,H=s.y2*M+T.point.y;return!this.isInsideGrid(k,O,F,H)||f!=="always"&&this.grid.hitTest(k,O,F,H,f,v)||T.perspectiveRatio=1;rn--)tn.push(ue.path[rn]);for(let rn=1;rnzr(hn,M,rt));tn=rn.some(hn=>hn.signedDistanceFromCamera<=0)?[]:rn.map(hn=>hn.point)}let Ue=[];if(tn.length>0){const rn=tn[0].clone(),hn=tn[0].clone();for(let Er=1;Er=oe.x&&hn.x<=le.x&&rn.y>=oe.y&&hn.y<=le.y?[tn]:hn.xle.x||hn.yle.y?[]:u.al([tn],oe.x,oe.y,le.x,le.y)}for(const rn of Ue){$e.reset(rn,.25*$t);let hn=0;hn=$e.length<=.5*$t?1:Math.ceil($e.paddedLength/wn)+1;for(let Er=0;Er=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(s,f,d,m){return d>=0&&s=0&&fd.collisionGroupID===f}}return this.collisionGroups[s]}}function ei(_,s,f,d,m){const{horizontalAlign:v,verticalAlign:C}=u.at(_);return new u.P(-(v-.5)*s+d[0]*m,-(C-.5)*f+d[1]*m)}function Ji(_,s,f,d,m,v){const{x1:C,x2:T,y1:M,y2:k,anchorPointX:O,anchorPointY:F}=_,H=new u.P(s,f);return d&&H._rotate(m?v:-v),{x1:C+H.x,y1:M+H.y,x2:T+H.x,y2:k+H.y,anchorPointX:O,anchorPointY:F}}class co{constructor(s,f,d,m,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Ge(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new xr(m),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,d,m){const v=d.getBucket(f),C=d.latestFeatureIndex;if(!v||!C||f.id!==v.layerIds[0])return;const T=d.collisionBoxArray,M=v.layers[0].layout,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),O=d.tileSize/u.W,F=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),H=M.get("text-pitch-alignment")==="map",it=M.get("text-rotation-alignment")==="map",rt=je(d,1,this.transform.zoom),at=Ye(F,H,it,this.transform,rt);let $=null;if(H){const Rt=ma(F,H,it,this.transform,rt);$=u.K([],this.transform.labelPlaneMatrix,Rt)}this.retainedQueryData[v.bucketInstanceId]=new nn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,d.tileID);const vt={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:at,labelToScreenMatrix:$,scale:k,textPixelRatio:O,holdingForFade:d.holdingForFade(),collisionBoxArray:T,partiallyEvaluatedTextSize:u.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(m)for(const Rt of v.sortKeyRanges){const{sortKey:ut,symbolInstanceStart:Et,symbolInstanceEnd:Nt}=Rt;s.push({sortKey:ut,symbolInstanceStart:Et,symbolInstanceEnd:Nt,parameters:vt})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:vt})}attemptAnchorPlacement(s,f,d,m,v,C,T,M,k,O,F,H,it,rt,at,$){const vt=u.ap[s.textAnchor],Rt=[s.textOffset0,s.textOffset1],ut=ei(vt,d,m,Rt,v),Et=this.collisionIndex.placeCollisionBox(Ji(f,ut.x,ut.y,C,T,this.transform.angle),F,M,k,O.predicate,$);if((!at||this.collisionIndex.placeCollisionBox(Ji(at,ut.x,ut.y,C,T,this.transform.angle),F,M,k,O.predicate,$).box.length!==0)&&Et.box.length>0){let Nt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[H.crossTileID]&&this.prevPlacement.placements[H.crossTileID]&&this.prevPlacement.placements[H.crossTileID].text&&(Nt=this.prevPlacement.variableOffsets[H.crossTileID].anchor),H.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[H.crossTileID]={textOffset:Rt,width:d,height:m,anchor:vt,textBoxScale:v,prevAnchor:Nt},this.markUsedJustification(it,vt,H,rt),it.allowVerticalPlacement&&(this.markUsedOrientation(it,rt,H),this.placedOrientations[H.crossTileID]=rt),{shift:ut,placedGlyphBoxes:Et}}}placeLayerBucketPart(s,f,d){const{bucket:m,layout:v,posMatrix:C,textLabelPlaneMatrix:T,labelToScreenMatrix:M,textPixelRatio:k,holdingForFade:O,collisionBoxArray:F,partiallyEvaluatedTextSize:H,collisionGroup:it}=s.parameters,rt=v.get("text-optional"),at=v.get("icon-optional"),$=u.aq(v,"text-overlap","text-allow-overlap"),vt=$==="always",Rt=u.aq(v,"icon-overlap","icon-allow-overlap"),ut=Rt==="always",Et=v.get("text-rotation-alignment")==="map",Nt=v.get("text-pitch-alignment")==="map",Ft=v.get("icon-text-fit")!=="none",Ht=v.get("symbol-z-order")==="viewport-y",te=vt&&(ut||!m.hasIconData()||at),$t=ut&&(vt||!m.hasTextData()||rt);!m.collisionArrays&&F&&m.deserializeCollisionBoxes(F);const oe=this.retainedQueryData[m.bucketInstanceId].tileID,le=this.terrain?(ue,ze)=>this.terrain.getElevation(oe,ue,ze):null,$e=(ue,ze)=>{var tn,wn;if(f[ue.crossTileID])return;if(O)return void(this.placements[ue.crossTileID]=new or(!1,!1,!1));let Ue=!1,rn=!1,hn=!0,Er=null,Gn={box:null,offscreen:null},ko={box:null,offscreen:null},ni=null,pr=null,ri=null,Do=0,Gs=0,Ha=0;ze.textFeatureIndex?Do=ze.textFeatureIndex:ue.useRuntimeCollisionCircles&&(Do=ue.featureIndex),ze.verticalTextFeatureIndex&&(Gs=ze.verticalTextFeatureIndex);const dc=ze.textBox;if(dc){const Yr=Kr=>{let mr=u.ah.horizontal;if(m.allowVerticalPlacement&&!Kr&&this.prevPlacement){const es=this.prevPlacement.placedOrientations[ue.crossTileID];es&&(this.placedOrientations[ue.crossTileID]=es,mr=es,this.markUsedOrientation(m,mr,ue))}return mr},dr=(Kr,mr)=>{if(m.allowVerticalPlacement&&ue.numVerticalGlyphVertices>0&&ze.verticalTextBox){for(const es of m.writingModes)if(es===u.ah.vertical?(Gn=mr(),ko=Gn):Gn=Kr(),Gn&&Gn.box&&Gn.box.length)break}else Gn=Kr()},ar=ue.textAnchorOffsetStartIndex,ts=ue.textAnchorOffsetEndIndex;if(ts===ar){const Kr=(mr,es)=>{const Jr=this.collisionIndex.placeCollisionBox(mr,$,k,C,it.predicate,le);return Jr&&Jr.box&&Jr.box.length&&(this.markUsedOrientation(m,es,ue),this.placedOrientations[ue.crossTileID]=es),Jr};dr(()=>Kr(dc,u.ah.horizontal),()=>{const mr=ze.verticalTextBox;return m.allowVerticalPlacement&&ue.numVerticalGlyphVertices>0&&mr?Kr(mr,u.ah.vertical):{box:null,offscreen:null}}),Yr(Gn&&Gn.box&&Gn.box.length)}else{let Kr=u.ap[(wn=(tn=this.prevPlacement)===null||tn===void 0?void 0:tn.variableOffsets[ue.crossTileID])===null||wn===void 0?void 0:wn.anchor];const mr=(Jr,kr,Ep)=>{const Dm=Jr.x2-Jr.x1,Pl=Jr.y2-Jr.y1,Ml=ue.textBoxScale,kh=Ft&&Rt==="never"?kr:null;let Xa={box:[],offscreen:!1},Ip=$==="never"?1:2,Rm="never";Kr&&Ip++;for(let Cp=0;Cpmr(dc,ze.iconBox,u.ah.horizontal),()=>{const Jr=ze.verticalTextBox;return m.allowVerticalPlacement&&!(Gn&&Gn.box&&Gn.box.length)&&ue.numVerticalGlyphVertices>0&&Jr?mr(Jr,ze.verticalIconBox,u.ah.vertical):{box:null,offscreen:null}}),Gn&&(Ue=Gn.box,hn=Gn.offscreen);const es=Yr(Gn&&Gn.box);if(!Ue&&this.prevPlacement){const Jr=this.prevPlacement.variableOffsets[ue.crossTileID];Jr&&(this.variableOffsets[ue.crossTileID]=Jr,this.markUsedJustification(m,Jr.anchor,ue,es))}}}if(ni=Gn,Ue=ni&&ni.box&&ni.box.length>0,hn=ni&&ni.offscreen,ue.useRuntimeCollisionCircles){const Yr=m.text.placedSymbolArray.get(ue.centerJustifiedTextSymbolIndex),dr=u.ai(m.textSizeData,H,Yr),ar=v.get("text-padding");pr=this.collisionIndex.placeCollisionCircles($,Yr,m.lineVertexArray,m.glyphOffsetArray,dr,C,T,M,d,Nt,it.predicate,ue.collisionCircleDiameter,ar,le),pr.circles.length&&pr.collisionDetected&&!d&&u.w("Collisions detected, but collision boxes are not shown"),Ue=vt||pr.circles.length>0&&!pr.collisionDetected,hn=hn&&pr.offscreen}if(ze.iconFeatureIndex&&(Ha=ze.iconFeatureIndex),ze.iconBox){const Yr=dr=>{const ar=Ft&&Er?Ji(dr,Er.x,Er.y,Et,Nt,this.transform.angle):dr;return this.collisionIndex.placeCollisionBox(ar,Rt,k,C,it.predicate,le)};ko&&ko.box&&ko.box.length&&ze.verticalIconBox?(ri=Yr(ze.verticalIconBox),rn=ri.box.length>0):(ri=Yr(ze.iconBox),rn=ri.box.length>0),hn=hn&&ri.offscreen}const Za=rt||ue.numHorizontalGlyphVertices===0&&ue.numVerticalGlyphVertices===0,qs=at||ue.numIconVertices===0;if(Za||qs?qs?Za||(rn=rn&&Ue):Ue=rn&&Ue:rn=Ue=rn&&Ue,Ue&&ni&&ni.box&&this.collisionIndex.insertCollisionBox(ni.box,$,v.get("text-ignore-placement"),m.bucketInstanceId,ko&&ko.box&&Gs?Gs:Do,it.ID),rn&&ri&&this.collisionIndex.insertCollisionBox(ri.box,Rt,v.get("icon-ignore-placement"),m.bucketInstanceId,Ha,it.ID),pr&&(Ue&&this.collisionIndex.insertCollisionCircles(pr.circles,$,v.get("text-ignore-placement"),m.bucketInstanceId,Do,it.ID),d)){const Yr=m.bucketInstanceId;let dr=this.collisionCircleArrays[Yr];dr===void 0&&(dr=this.collisionCircleArrays[Yr]=new Zr);for(let ar=0;ar=0;--ze){const tn=ue[ze];$e(m.symbolInstances.get(tn),m.collisionArrays[tn])}}else for(let ue=s.symbolInstanceStart;ue=0&&(s.text.placedSymbolArray.get(T).crossTileID=v>=0&&T!==v?0:d.crossTileID)}markUsedOrientation(s,f,d){const m=f===u.ah.horizontal||f===u.ah.horizontalOnly?f:0,v=f===u.ah.vertical?f:0,C=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const T of C)s.text.placedSymbolArray.get(T).placedOrientation=m;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let d=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const m=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},C=f?f.variableOffsets:{},T=f?f.placedOrientations:{};for(const M in this.placements){const k=this.placements[M],O=v[M];O?(this.opacities[M]=new jn(O,m,k.text,k.icon),d=d||k.text!==O.text.placed||k.icon!==O.icon.placed):(this.opacities[M]=new jn(null,m,k.text,k.icon,k.skipFade),d=d||k.text||k.icon)}for(const M in v){const k=v[M];if(!this.opacities[M]){const O=new jn(k,m,!1,!1);O.isHidden()||(this.opacities[M]=O,d=d||k.text.placed||k.icon.placed)}}for(const M in C)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=C[M]);for(const M in T)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=T[M]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const d={};for(const m of f){const v=m.getBucket(s);v&&m.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,d,m.collisionBoxArray)}}updateBucketOpacities(s,f,d){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const m=s.layers[0],v=m.layout,C=new jn(null,0,!1,!1,!0),T=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),k=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),O=v.get("text-rotation-alignment")==="map",F=v.get("text-pitch-alignment")==="map",H=v.get("icon-text-fit")!=="none",it=new jn(null,0,T&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(T||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const rt=(at,$,vt)=>{for(let Rt=0;Rt<$/4;Rt++)at.opacityVertexArray.emplaceBack(vt);at.hasVisibleVertices=at.hasVisibleVertices||vt!==Hu};for(let at=0;at0,Ft=this.placedOrientations[$.crossTileID],Ht=Ft===u.ah.vertical,te=Ft===u.ah.horizontal||Ft===u.ah.horizontalOnly;if(vt>0||Rt>0){const $t=ho(Et.text);rt(s.text,vt,Ht?Hu:$t),rt(s.text,Rt,te?Hu:$t);const oe=Et.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(ue=>{ue>=0&&(s.text.placedSymbolArray.get(ue).hidden=oe||Ht?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=oe||te?1:0);const le=this.variableOffsets[$.crossTileID];le&&this.markUsedJustification(s,le.anchor,$,Ft);const $e=this.placedOrientations[$.crossTileID];$e&&(this.markUsedJustification(s,"left",$,$e),this.markUsedOrientation(s,$e,$))}if(Nt){const $t=ho(Et.icon),oe=!(H&&$.verticalPlacedIconSymbolIndex&&Ht);$.placedIconSymbolIndex>=0&&(rt(s.icon,$.numIconVertices,oe?$t:Hu),s.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=Et.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(rt(s.icon,$.numVerticalIconVertices,oe?Hu:$t),s.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=Et.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const $t=s.collisionArrays[at];if($t){let oe=new u.P(0,0);if($t.textBox||$t.verticalTextBox){let $e=!0;if(k){const ue=this.variableOffsets[ut];ue?(oe=ei(ue.anchor,ue.width,ue.height,ue.textOffset,ue.textBoxScale),O&&oe._rotate(F?this.transform.angle:-this.transform.angle)):$e=!1}$t.textBox&&mi(s.textCollisionBox.collisionVertexArray,Et.text.placed,!$e||Ht,oe.x,oe.y),$t.verticalTextBox&&mi(s.textCollisionBox.collisionVertexArray,Et.text.placed,!$e||te,oe.x,oe.y)}const le=!!(!te&&$t.verticalIconBox);$t.iconBox&&mi(s.iconCollisionBox.collisionVertexArray,Et.icon.placed,le,H?oe.x:0,H?oe.y:0),$t.verticalIconBox&&mi(s.iconCollisionBox.collisionVertexArray,Et.icon.placed,!le,H?oe.x:0,H?oe.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const at=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=at.invProjMatrix,s.placementViewportMatrix=at.viewportMatrix,s.collisionCircleArray=at.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function mi(_,s,f,d,m){_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0)}const zs=Math.pow(2,25),Kd=Math.pow(2,24),Ry=Math.pow(2,17),Vn=Math.pow(2,16),Hf=Math.pow(2,9),Zf=Math.pow(2,8),Po=Math.pow(2,1);function ho(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const s=_.placed?1:0,f=Math.floor(127*_.opacity);return f*zs+s*Kd+f*Ry+s*Vn+f*Hf+s*Zf+f*Po+s}const Hu=0;class Qo{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,f,d,m,v){const C=this._bucketParts;for(;this._currentTileIndexT.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&I.now()-m>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=T)&&(!C.maxzoom||C.maxzoom>T)){if(this._inProgressLayer||(this._inProgressLayer=new Qo(C)),this._inProgressLayer.continuePlacement(d[C.source],this.placement,this._showCollisionBoxes,C,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const nu=512/u.W/2;class Zc{constructor(s,f,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const m=new Map;for(let v=0;v({x:Math.floor(M.anchorX*nu),y:Math.floor(M.anchorY*nu)})),crossTileIDs:C.map(M=>M.crossTileID)};if(T.positions.length>128){const M=new u.au(T.positions.length,16,Uint16Array);for(const{x:k,y:O}of T.positions)M.add(k,O);M.finish(),delete T.positions,T.index=M}this._symbolsByKey[v]=T}}getScaledCoordinates(s,f){const{x:d,y:m,z:v}=this.tileID.canonical,{x:C,y:T,z:M}=f.canonical,k=nu/Math.pow(2,M-v),O=(T*u.W+s.anchorY)*k,F=m*u.W*nu;return{x:Math.floor((C*u.W+s.anchorX)*k-d*u.W*nu),y:Math.floor(O-F)}}findMatches(s,f,d){const m=this.tileID.canonical.zs)}}class Xr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Zu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const f=Math.round((s-this.lng)/360);if(f!==0)for(const d in this.indexes){const m=this.indexes[d],v={};for(const C in m){const T=m[C];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+f),v[T.tileID.key]=T}this.indexes[d]=v}this.lng=s}addBucket(s,f,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const T in C){const M=C[T];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,m)}else{const T=C[s.scaledTo(Number(v)).key];T&&T.findMatches(f.symbolInstances,s,m)}}for(let v=0;v{f[d]=!0});for(const d in this.layerIndexes)f[d]||delete this.layerIndexes[d]}}const fr=(_,s)=>u.t(_,s&&s.filter(f=>f.identifier!=="source.canvas")),Xc=u.av();class Mo extends u.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const d in this.sourceCaches){const m=this.sourceCaches[d].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[d].reload()}},this.map=s,this.dispatcher=new vr(An(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(d,m)=>this.getGlyphs(d,m)),this.dispatcher.registerMessageHandler("GI",(d,m)=>this.getImages(d,m)),this.imageManager=new Kt,this.imageManager.setEventedParent(this),this.glyphManager=new Gt(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Ve(256,512),this.crossTileSymbolIndex=new Va,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",u.ax()),re().on(Li,this._rtlPluginLoaded),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const m=this.sourceCaches[d.sourceId];if(!m)return;const v=m.getSource();if(v&&v.vectorLayerIds)for(const C in this._layers){const T=this._layers[C];T.source===v.id&&this._validateLayer(T)}})}loadURL(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const m=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,u.h(m,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,d)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new u.j(v))})}loadJSON(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,d)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(Xc,{validate:!1})}_load(s,f,d){var m;const v=f.transformStyle?f.transformStyle(d,s):s;if(!f.validate||!fr(this,u.x(v))){this._loaded=!0,this.stylesheet=v;for(const C in v.sources)this.addSource(C,v.sources[C],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new ln(this.stylesheet.light),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const s=u.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of s){const d=u.az(f);d.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=d}}_loadSprite(s,f=!1,d=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,C,T,M){return u._(this,void 0,void 0,function*(){const k=Tt(v),O=T>1?"@2x":"",F={},H={};for(const{id:it,url:rt}of k){const at=C.transformRequest(C.normalizeSpriteURL(rt,O,".json"),"SpriteJSON");F[it]=u.h(at,M);const $=C.transformRequest(C.normalizeSpriteURL(rt,O,".png"),"SpriteImage");H[it]=j.getImage($,M)}return yield Promise.all([...Object.values(F),...Object.values(H)]),function(it,rt){return u._(this,void 0,void 0,function*(){const at={};for(const $ in it){at[$]={};const vt=I.getImageCanvasContext((yield rt[$]).data),Rt=(yield it[$]).data;for(const ut in Rt){const{width:Et,height:Nt,x:Ft,y:Ht,sdf:te,pixelRatio:$t,stretchX:oe,stretchY:le,content:$e}=Rt[ut];at[$][ut]={data:null,pixelRatio:$t,sdf:te,stretchX:oe,stretchY:le,content:$e,spriteData:{width:Et,height:Nt,x:Ft,y:Ht,context:vt}}}}return at})}(F,H)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const C in v){this._spritesImagesIds[C]=[];const T=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of T)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const k=C==="default"?M:`${C}:${M}`;this._spritesImagesIds[C].push(k),k in this.imageManager.images?this.imageManager.updateImage(k,v[C][M],!1):this.imageManager.addImage(k,v[C][M]),f&&(this._changedImages[k]=!0)}}}).catch(v=>{this._spriteRequest=null,m=v,this.fire(new u.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),d&&d(m)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const d=s.sourceLayer;if(!d)return;const m=f.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(d)===-1)&&this.fire(new u.j(new Error(`Source layer "${d}" does not exist on source "${m.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const d=[];for(const m of s)f[m]&&d.push(f[m]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const f=Object.keys(this._layers);for(const d of f){const m=this._layers[d];m.type!=="custom"&&(s[d]=m.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const f=this._changed;if(f){const m=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(m.length||v.length)&&this._updateWorkerLayers(m,v);for(const C in this._updatedSources){const T=this._updatedSources[C];if(T==="reload")this._reloadSource(C);else{if(T!=="clear")throw new Error(`Invalid action ${T}`);this._clearSource(C)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const C in this._updatedPaintProps)this._layers[C].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const m in this.sourceCaches){const v=this.sourceCaches[m];d[m]=v.used,v.used=!1}for(const m of this._order){const v=this._layers[m];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const m in d){const v=this.sourceCaches[m];!!d[m]!=!!v.used&&v.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new u.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,f={}){var d;this._checkLoaded();const m=this.serialize();if(s=f.transformStyle?f.transformStyle(m,s):s,((d=f.validate)===null||d===void 0||d)&&fr(this,u.x(s)))return!1;(s=u.aA(s)).layers=u.ay(s.layers);const v=u.aB(m,s),C=this._getOperationsToPerform(v);if(C.unimplemented.length>0)throw new Error(`Unimplemented: ${C.unimplemented.join(", ")}.`);if(C.operations.length===0)return!1;for(const T of C.operations)T();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],d=[];for(const m of s)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":f.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":f.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,m.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":f.push(()=>{});break;default:d.push(m.command)}return{operations:f,unimplemented:d}}addImage(s,f){if(this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,f),this._afterImageUpdated(s)}updateImage(s,f){this.imageManager.updateImage(s,f)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(u.x.source,`sources.${s}`,f,null,d))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const m=this.sourceCaches[s]=new Hr(s,f,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:s})),m.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===s)return this.fire(new u.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new u.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,f){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const d=this.sourceCaches[s].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,d={}){this._checkLoaded();const m=s.id;if(this.getLayer(m))return void this.fire(new u.j(new Error(`Layer "${m}" already exists on this map.`)));let v;if(s.type==="custom"){if(fr(this,u.aC(s)))return;v=u.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(m,s.source),s=u.aA(s),s=u.e(s,{source:m})),this._validate(u.x.layer,`layers.${m}`,s,{arrayIndex:-1},d))return;v=u.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:m}})}const C=f?this._order.indexOf(f):this._order.length;if(f&&C===-1)this.fire(new u.j(new Error(`Cannot add layer "${m}" before non-existing layer "${f}".`)));else{if(this._order.splice(C,0,m),this._layerOrderChanged=!0,this._layers[m]=v,this._removedLayers[m]&&v.source&&v.type!=="custom"){const T=this._removedLayers[m];delete this._removedLayers[m],T.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new u.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const d=this._order.indexOf(s);this._order.splice(d,1);const m=f?this._order.indexOf(f):this._order.length;f&&m===-1?this.fire(new u.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(m,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=f,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],f.onRemove&&f.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,f,d){this._checkLoaded();const m=this.getLayer(s);m?m.minzoom===f&&m.maxzoom===d||(f!=null&&(m.minzoom=f),d!=null&&(m.maxzoom=d),this._updateLayer(m)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,d={}){this._checkLoaded();const m=this.getLayer(s);if(m){if(!u.aD(m.filter,f))return f==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(u.x.filter,`layers.${m.id}.filter`,f,null,d)||(m.filter=u.aA(f),this._updateLayer(m)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return u.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getLayoutProperty(f),d)||(v.setLayoutProperty(f,d,m),this._updateLayer(v)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const d=this.getLayer(s);if(d)return d.getLayoutProperty(f);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getPaintProperty(f),d)||(v.setPaintProperty(f,d,m)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const d=s.source,m=s.sourceLayer,v=this.sourceCaches[d];if(v===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const C=v.getSource().type;C==="geojson"&&m?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||m?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(m,s.id,f)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const d=s.source,m=this.sourceCaches[d];if(m===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const v=m.getSource().type,C=v==="vector"?s.sourceLayer:void 0;v!=="vector"||C?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(C,s.id,f):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,d=s.sourceLayer,m=this.sourceCaches[f];if(m!==void 0)return m.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(d,s.id)):void this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=u.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,m=this.stylesheet;return u.aF({version:m.version,name:m.name,metadata:m.metadata,light:m.light,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:s,layers:f,terrain:d},v=>v!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const f=C=>this._layers[C].type==="fill-extrusion",d={},m=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T)){d[T]=C;for(const M of s){const k=M[T];if(k)for(const O of k)m.push(O)}}}m.sort((C,T)=>T.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T))for(let M=m.length-1;M>=0;M--){const k=m[M].feature;if(d[k.layer.id]{const te=vt.featureSortOrder;if(te){const $t=te.indexOf(Ft.featureIndex);return te.indexOf(Ht.featureIndex)-$t}return Ht.featureIndex-Ft.featureIndex});for(const Ft of Nt)Et.push(Ft)}}for(const vt in rt)rt[vt].forEach(Rt=>{const ut=Rt.feature,Et=k[T[vt].source].getFeatureState(ut.layer["source-layer"],ut.id);ut.source=ut.layer.source,ut.layer["source-layer"]&&(ut.sourceLayer=ut.layer["source-layer"]),ut.state=Et});return rt}(this._layers,C,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",f.filter,null,f);const d=this.sourceCaches[s];return d?function(m,v){const C=m.getRenderableIds().map(k=>m.getTileByID(k)),T=[],M={};for(let k=0;kH.getTileByID(it)).sort((it,rt)=>rt.tileID.overscaledZ-it.tileID.overscaledZ||(it.tileID.isLessThan(rt.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(O,M[O.source],s.center.lng);C=C||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(I.now(),s.zoom))&&(this.pauseablePlacement=new $o(s,this.map.terrain,this._order,v,f,d,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(I.now()),T=!0),C&&this.pauseablePlacement.placement.setStale()),T||C)for(const k of this._order){const O=this._layers[k];O.type==="symbol"&&this.placement.updateLayerOpacities(O,M[O.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(I.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,f.icons),d})}getGlyphs(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(f.stacks),m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(u.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,d={},m){this._checkLoaded();const v=[{id:s,url:f}],C=[...Tt(this.stylesheet.sprite),...v];this._validate(u.x.sprite,"sprite",C,null,d)||(this.stylesheet.sprite=C,this._loadSprite(v,!0,m))}removeSprite(s){this._checkLoaded();const f=Tt(this.stylesheet.sprite);if(f.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;f.splice(f.findIndex(d=>d.id===s),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Tt(this.stylesheet.sprite)}setSprite(s,f={},d){this._checkLoaded(),s&&this._validate(u.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}var Yc=u.X([{name:"a_pos",type:"Int16",components:2}]),Fs="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Xu={prelude:Un(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -530,58 +530,58 @@ void main() { #pragma mapbox: initialize lowp float halo_blur vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Un("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Fs),terrainDepth:Un("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Fs),terrainCoords:Un("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Fs)};function Un(_,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),m=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(m):m,T={};return{fragmentSource:_=_.replace(f,(M,k,O,F,W)=>(T[W]=!0,k==="define"?` -#ifndef HAS_UNIFORM_u_${W} -varying ${O} ${F} ${W}; +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Un("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Fs),terrainDepth:Un("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Fs),terrainCoords:Un("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Fs)};function Un(_,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),m=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(m):m,T={};return{fragmentSource:_=_.replace(f,(M,k,O,F,H)=>(T[H]=!0,k==="define"?` +#ifndef HAS_UNIFORM_u_${H} +varying ${O} ${F} ${H}; #else -uniform ${O} ${F} u_${W}; +uniform ${O} ${F} u_${H}; #endif `:` -#ifdef HAS_UNIFORM_u_${W} - ${O} ${F} ${W} = u_${W}; -#endif -`)),vertexSource:s=s.replace(f,(M,k,O,F,W)=>{const it=F==="float"?"vec2":"vec4",rt=W.match(/color/)?"color":it;return T[W]?k==="define"?` -#ifndef HAS_UNIFORM_u_${W} -uniform lowp float u_${W}_t; -attribute ${O} ${it} a_${W}; -varying ${O} ${F} ${W}; +#ifdef HAS_UNIFORM_u_${H} + ${O} ${F} ${H} = u_${H}; +#endif +`)),vertexSource:s=s.replace(f,(M,k,O,F,H)=>{const it=F==="float"?"vec2":"vec4",rt=H.match(/color/)?"color":it;return T[H]?k==="define"?` +#ifndef HAS_UNIFORM_u_${H} +uniform lowp float u_${H}_t; +attribute ${O} ${it} a_${H}; +varying ${O} ${F} ${H}; #else -uniform ${O} ${F} u_${W}; +uniform ${O} ${F} u_${H}; #endif `:rt==="vec4"?` -#ifndef HAS_UNIFORM_u_${W} - ${W} = a_${W}; +#ifndef HAS_UNIFORM_u_${H} + ${H} = a_${H}; #else - ${O} ${F} ${W} = u_${W}; + ${O} ${F} ${H} = u_${H}; #endif `:` -#ifndef HAS_UNIFORM_u_${W} - ${W} = unpack_mix_${rt}(a_${W}, u_${W}_t); +#ifndef HAS_UNIFORM_u_${H} + ${H} = unpack_mix_${rt}(a_${H}, u_${H}_t); #else - ${O} ${F} ${W} = u_${W}; + ${O} ${F} ${H} = u_${H}; #endif `:k==="define"?` -#ifndef HAS_UNIFORM_u_${W} -uniform lowp float u_${W}_t; -attribute ${O} ${it} a_${W}; +#ifndef HAS_UNIFORM_u_${H} +uniform lowp float u_${H}_t; +attribute ${O} ${it} a_${H}; #else -uniform ${O} ${F} u_${W}; +uniform ${O} ${F} u_${H}; #endif `:rt==="vec4"?` -#ifndef HAS_UNIFORM_u_${W} - ${O} ${F} ${W} = a_${W}; +#ifndef HAS_UNIFORM_u_${H} + ${O} ${F} ${H} = a_${H}; #else - ${O} ${F} ${W} = u_${W}; + ${O} ${F} ${H} = u_${H}; #endif `:` -#ifndef HAS_UNIFORM_u_${W} - ${O} ${F} ${W} = unpack_mix_${rt}(a_${W}, u_${W}_t); +#ifndef HAS_UNIFORM_u_${H} + ${O} ${F} ${H} = unpack_mix_${rt}(a_${H}, u_${H}_t); #else - ${O} ${F} ${W} = u_${W}; + ${O} ${F} ${H} = u_${H}; #endif -`}),staticAttributes:d,staticUniforms:C}}class Kc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,f,d,m,v,C,T,M,k){this.context=s;let O=this.boundPaintVertexBuffers.length!==m.length;for(let F=0;!O&&F({u_depth:new u.aG(Ft,Ht.u_depth),u_terrain:new u.aG(Ft,Ht.u_terrain),u_terrain_dim:new u.aH(Ft,Ht.u_terrain_dim),u_terrain_matrix:new u.aI(Ft,Ht.u_terrain_matrix),u_terrain_unpack:new u.aJ(Ft,Ht.u_terrain_unpack),u_terrain_exaggeration:new u.aH(Ft,Ht.u_terrain_exaggeration)}))(s,Nt),this.binderUniforms=d?d.getUniforms(s,Nt):[]}draw(s,f,d,m,v,C,T,M,k,O,F,W,it,rt,at,$,vt,Rt){const ct=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(m),s.setColorMode(v),s.setCullFace(C),M){s.activeTexture.set(ct.TEXTURE2),ct.bindTexture(ct.TEXTURE_2D,M.depthTexture),s.activeTexture.set(ct.TEXTURE3),ct.bindTexture(ct.TEXTURE_2D,M.texture);for(const Nt in this.terrainUniforms)this.terrainUniforms[Nt].set(M[Nt])}for(const Nt in this.fixedUniforms)this.fixedUniforms[Nt].set(T[Nt]);at&&at.setUniforms(s,this.binderUniforms,it,{zoom:rt});let Et=0;switch(f){case ct.LINES:Et=2;break;case ct.TRIANGLES:Et=3;break;case ct.LINE_STRIP:Et=1}for(const Nt of W.get()){const Ft=Nt.vaos||(Nt.vaos={});(Ft[k]||(Ft[k]=new Kc)).bind(s,this,O,at?at.getPaintVertexBuffers():[],F,Nt.vertexOffset,$,vt,Rt),ct.drawElements(f,Nt.primitiveLength*Et,ct.UNSIGNED_SHORT,Nt.primitiveOffset*Et*2)}}}function Jc(_,s,f){const d=1/je(f,1,s.transform.tileZoom),m=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/m,C=v*(f.tileID.canonical.x+f.tileID.wrap*m),T=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[C>>16,T>>16],u_pixel_coord_lower:[65535&C,65535&T]}}const Yu=(_,s,f,d)=>{const m=s.style.light,v=m.properties.get("position"),C=[v.x,v.y,v.z],T=function(){var k=new u.A(9);return u.A!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0),k[0]=1,k[4]=1,k[8]=1,k}();m.properties.get("anchor")==="viewport"&&function(k,O){var F=Math.sin(O),W=Math.cos(O);k[0]=W,k[1]=F,k[2]=0,k[3]=-F,k[4]=W,k[5]=0,k[6]=0,k[7]=0,k[8]=1}(T,-s.transform.angle),function(k,O,F){var W=O[0],it=O[1],rt=O[2];k[0]=W*F[0]+it*F[3]+rt*F[6],k[1]=W*F[1]+it*F[4]+rt*F[7],k[2]=W*F[2]+it*F[5]+rt*F[8]}(C,C,T);const M=m.properties.get("color");return{u_matrix:_,u_lightpos:C,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:d}},Ny=(_,s,f,d,m,v,C)=>u.e(Yu(_,s,f,d),Jc(v,s,C),{u_height_factor:-Math.pow(2,m.overscaledZ)/C.tileSize/8}),Jd=_=>({u_matrix:_}),Qc=(_,s,f,d)=>u.e(Jd(_),Jc(f,s,d)),Oy=(_,s)=>({u_matrix:_,u_world:s}),Qd=(_,s,f,d,m)=>u.e(Qc(_,s,f,d),{u_world:m}),zy=(_,s,f,d)=>{const m=_.transform;let v,C;if(d.paint.get("circle-pitch-alignment")==="map"){const T=je(f,1,m.zoom);v=!0,C=[T,T]}else v=!1,C=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(s.posMatrix,f,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:C}},$d=(_,s,f)=>{const d=je(f,1,s.zoom),m=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*m),s.pixelsToGLUnits[1]/(d*m)],u_overscale_factor:v}},tm=(_,s,f=1)=>({u_matrix:_,u_color:s,u_overlay:0,u_overlay_scale:f}),$c=_=>({u_matrix:_}),em=(_,s,f,d)=>({u_matrix:_,u_extrude_scale:je(s,1,f),u_intensity:d});function nm(_,s){const f=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new u.Y(0,d/f).toLngLat().lat,new u.Y(0,(d+1)/f).toLngLat().lat]}const th=(_,s,f,d)=>{const m=_.transform;return{u_matrix:Ku(_,s,f,d),u_ratio:1/je(s,1,m.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},rm=(_,s,f,d,m)=>u.e(th(_,s,f,m),{u_image:0,u_image_height:d}),xl=(_,s,f,d,m)=>{const v=_.transform,C=Ao(s,v);return{u_matrix:Ku(_,s,f,m),u_texsize:s.imageAtlasTexture.size,u_ratio:1/je(s,1,v.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[C,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},eh=(_,s,f,d,m,v)=>{const C=_.lineAtlas,T=Ao(s,_.transform),M=f.layout.get("line-cap")==="round",k=C.getDash(d.from,M),O=C.getDash(d.to,M),F=k.width*m.fromScale,W=O.width*m.toScale;return u.e(th(_,s,f,v),{u_patternscale_a:[T/F,-k.height/2],u_patternscale_b:[T/W,-O.height/2],u_sdfgamma:C.width/(256*Math.min(F,W)*_.pixelRatio)/2,u_image:0,u_tex_y_a:k.y,u_tex_y_b:O.y,u_mix:m.t})};function Ao(_,s){return 1/je(_,1,s.tileZoom)}function Ku(_,s,f,d){return _.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const nh=(_,s,f,d,m)=>{return{u_matrix:_,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(C=m.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(v=m.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:Ju(m.paint.get("raster-hue-rotate"))};var v,C};function Ju(_){_*=Math.PI/180;const s=Math.sin(_),f=Math.cos(_);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const Qu=(_,s,f,d,m,v,C,T,M,k)=>{const O=m.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:O.cameraToCenterDistance,u_pitch:O.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:O.width/O.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:T,u_is_text:+M,u_pitch_with_map:+d,u_texsize:k,u_texture:0}},$u=(_,s,f,d,m,v,C,T,M,k,O)=>{const F=m.transform;return u.e(Qu(_,s,f,d,m,v,C,T,M,k),{u_gamma_scale:d?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+O})},tc=(_,s,f,d,m,v,C,T,M,k)=>u.e($u(_,s,f,d,m,v,C,T,!0,M,!0),{u_texsize_icon:k,u_texture_icon:1}),Fy=(_,s,f)=>({u_matrix:_,u_opacity:s,u_color:f}),By=(_,s,f,d,m,v)=>u.e(function(C,T,M,k){const O=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:W,height:it}=M.imageManager.getPixelSize(),rt=Math.pow(2,k.tileID.overscaledZ),at=k.tileSize*Math.pow(2,M.transform.tileZoom)/rt,$=at*(k.tileID.canonical.x+k.tileID.wrap*rt),vt=at*k.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:O.tl,u_pattern_br_a:O.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[W,it],u_mix:T.t,u_pattern_size_a:O.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/je(k,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,vt>>16],u_pixel_coord_lower:[65535&$,65535&vt]}}(d,v,f,m),{u_matrix:_,u_opacity:s}),im={fillExtrusion:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_opacity:new u.aH(_,s.u_opacity)}),fillExtrusionPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_height_factor:new u.aH(_,s.u_height_factor),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade),u_opacity:new u.aH(_,s.u_opacity)}),fill:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),fillPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),fillOutline:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world)}),fillOutlinePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),circle:(_,s)=>({u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_scale_with_map:new u.aG(_,s.u_scale_with_map),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_matrix:new u.aI(_,s.u_matrix)}),collisionBox:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aH(_,s.u_pixels_to_tile_units),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_overscale_factor:new u.aH(_,s.u_overscale_factor)}),collisionCircle:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_inv_matrix:new u.aI(_,s.u_inv_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_viewport_size:new u.aL(_,s.u_viewport_size)}),debug:(_,s)=>({u_color:new u.aM(_,s.u_color),u_matrix:new u.aI(_,s.u_matrix),u_overlay:new u.aG(_,s.u_overlay),u_overlay_scale:new u.aH(_,s.u_overlay_scale)}),clippingMask:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),heatmap:(_,s)=>({u_extrude_scale:new u.aH(_,s.u_extrude_scale),u_intensity:new u.aH(_,s.u_intensity),u_matrix:new u.aI(_,s.u_matrix)}),heatmapTexture:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_color_ramp:new u.aG(_,s.u_color_ramp),u_opacity:new u.aH(_,s.u_opacity)}),hillshade:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_latrange:new u.aL(_,s.u_latrange),u_light:new u.aL(_,s.u_light),u_shadow:new u.aM(_,s.u_shadow),u_highlight:new u.aM(_,s.u_highlight),u_accent:new u.aM(_,s.u_accent)}),hillshadePrepare:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_dimension:new u.aL(_,s.u_dimension),u_zoom:new u.aH(_,s.u_zoom),u_unpack:new u.aJ(_,s.u_unpack)}),line:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels)}),lineGradient:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_image:new u.aG(_,s.u_image),u_image_height:new u.aH(_,s.u_image_height)}),linePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texsize:new u.aL(_,s.u_texsize),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_image:new u.aG(_,s.u_image),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),lineSDF:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_patternscale_a:new u.aL(_,s.u_patternscale_a),u_patternscale_b:new u.aL(_,s.u_patternscale_b),u_sdfgamma:new u.aH(_,s.u_sdfgamma),u_image:new u.aG(_,s.u_image),u_tex_y_a:new u.aH(_,s.u_tex_y_a),u_tex_y_b:new u.aH(_,s.u_tex_y_b),u_mix:new u.aH(_,s.u_mix)}),raster:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_tl_parent:new u.aL(_,s.u_tl_parent),u_scale_parent:new u.aH(_,s.u_scale_parent),u_buffer_scale:new u.aH(_,s.u_buffer_scale),u_fade_t:new u.aH(_,s.u_fade_t),u_opacity:new u.aH(_,s.u_opacity),u_image0:new u.aG(_,s.u_image0),u_image1:new u.aG(_,s.u_image1),u_brightness_low:new u.aH(_,s.u_brightness_low),u_brightness_high:new u.aH(_,s.u_brightness_high),u_saturation_factor:new u.aH(_,s.u_saturation_factor),u_contrast_factor:new u.aH(_,s.u_contrast_factor),u_spin_weights:new u.aK(_,s.u_spin_weights)}),symbolIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture)}),symbolSDF:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),symbolTextAndIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texsize_icon:new u.aL(_,s.u_texsize_icon),u_texture:new u.aG(_,s.u_texture),u_texture_icon:new u.aG(_,s.u_texture_icon),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),background:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_color:new u.aM(_,s.u_color)}),backgroundPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_image:new u.aG(_,s.u_image),u_pattern_tl_a:new u.aL(_,s.u_pattern_tl_a),u_pattern_br_a:new u.aL(_,s.u_pattern_br_a),u_pattern_tl_b:new u.aL(_,s.u_pattern_tl_b),u_pattern_br_b:new u.aL(_,s.u_pattern_br_b),u_texsize:new u.aL(_,s.u_texsize),u_mix:new u.aH(_,s.u_mix),u_pattern_size_a:new u.aL(_,s.u_pattern_size_a),u_pattern_size_b:new u.aL(_,s.u_pattern_size_b),u_scale_a:new u.aH(_,s.u_scale_a),u_scale_b:new u.aH(_,s.u_scale_b),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aH(_,s.u_tile_units_to_pixels)}),terrain:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainDepth:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainCoords:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_terrain_coords_id:new u.aH(_,s.u_terrain_coords_id),u_ele_delta:new u.aH(_,s.u_ele_delta)})};class Vy{constructor(s,f,d){this.context=s;const m=s.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const f=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const wl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class rh{constructor(s,f,d,m){this.length=f.length,this.attributes=d,this.itemSize=f.bytesPerElement,this.dynamicDraw=m,this.context=s;const v=s.gl;this.buffer=v.createBuffer(),s.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,f){for(let d=0;d0){const oe=u.F(),le=Ht;u.aP(oe,Ft.placementInvProjMatrix,_.transform.glCoordMatrix),u.aP(oe,oe,Ft.placementViewportMatrix),O.push({circleArray:$t,circleOffset:W,transform:le,invTransform:oe,coord:Et}),F+=$t.length/4,W=F}te&&k.draw(T,M.LINES,xn.disabled,tr.disabled,_.colorModeForRenderPass(),Yn.disabled,$d(Ht,_.transform,Nt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(Et),f.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,_.transform.zoom,null,null,te.collisionVertexBuffer)}if(!C||!O.length)return;const it=_.useProgram("collisionCircle"),rt=new u.aQ;rt.resize(4*F),rt._trim();let at=0;for(const ct of O)for(let Et=0;Et=0&&(rt[$.associatedIconIndex]={shiftedAnchor:$e,angle:ue})}else Xt($.numGlyphs,W)}if(k){it.clear();const at=_.icon.placedSymbolArray;for(let $=0;$_.style.map.terrain.getElevation(te,es,Jr):null,mr=f.layout.get("text-rotation-alignment")==="map";G(oe,te.posMatrix,_,m,Do,Gs,$,k,mr,Kr)}const Za=_.translatePosMatrix(te.posMatrix,$t,v,C),qs=vt||m&&Ft||dc?ip:Do,Yr=_.translatePosMatrix(Gs,$t,v,C,!0),dr=ue&&f.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ar;ar=ue?oe.iconsInText?tc(ze.kind,Ue,Rt,$,_,Za,qs,Yr,cn,ni):$u(ze.kind,Ue,Rt,$,_,Za,qs,Yr,m,cn,!0):Qu(ze.kind,Ue,Rt,$,_,Za,qs,Yr,m,cn);const ts={program:wn,buffers:le,uniformValues:ar,atlasTexture:Er,atlasTextureIcon:pr,atlasInterpolation:Gn,atlasInterpolationIcon:ko,isSDF:ue,hasHalo:dr};if(ct&&oe.canOverlap){Et=!0;const Kr=le.segments.get();for(const mr of Kr)Ht.push({segments:new u.$([mr]),sortKey:mr.sortKey,state:ts,terrainData:rn})}else Ht.push({segments:le.segments,sortKey:0,state:ts,terrainData:rn})}Et&&Ht.sort((te,$t)=>te.sortKey-$t.sortKey);for(const te of Ht){const $t=te.state;if(W.activeTexture.set(it.TEXTURE0),$t.atlasTexture.bind($t.atlasInterpolation,it.CLAMP_TO_EDGE),$t.atlasTextureIcon&&(W.activeTexture.set(it.TEXTURE1),$t.atlasTextureIcon&&$t.atlasTextureIcon.bind($t.atlasInterpolationIcon,it.CLAMP_TO_EDGE)),$t.isSDF){const oe=$t.uniformValues;$t.hasHalo&&(oe.u_is_halo=1,pm($t.buffers,te.segments,f,_,$t.program,Nt,O,F,oe,te.terrainData)),oe.u_is_halo=0}pm($t.buffers,te.segments,f,_,$t.program,Nt,O,F,$t.uniformValues,te.terrainData)}}function pm(_,s,f,d,m,v,C,T,M,k){const O=d.context;m.draw(O,O.gl.TRIANGLES,v,C,T,Yn.disabled,M,k,f.id,_.layoutVertexBuffer,_.indexBuffer,s,f.paint,d.transform.zoom,_.programConfigurations.get(f.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function dh(_,s,f,d,m){if(!f||!d||!d.imageAtlas)return;const v=d.imageAtlas.patternPositions;let C=v[f.to.toString()],T=v[f.from.toString()];if(!C&&T&&(C=T),!T&&C&&(T=C),!C||!T){const M=m.getPaintProperty(s);C=v[M],T=v[M]}C&&T&&_.setConstantPatternPositions(C,T)}function dm(_,s,f,d,m,v,C){const T=_.context.gl,M="fill-pattern",k=f.paint.get(M),O=k&&k.constantOr(1),F=f.getCrossfadeParameters();let W,it,rt,at,$;C?(it=O&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=T.LINES):(it=O?"fillPattern":"fill",W=T.TRIANGLES);const vt=k.constantOr(null);for(const Rt of d){const ct=s.getTile(Rt);if(O&&!ct.patternsLoaded())continue;const Et=ct.getBucket(f);if(!Et)continue;const Nt=Et.programConfigurations.get(f.id),Ft=_.useProgram(it,Nt),Ht=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Rt);O&&(_.context.activeTexture.set(T.TEXTURE0),ct.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Nt.updatePaintBuffers(F)),dh(Nt,M,vt,ct,f);const te=Ht?Rt:null,$t=_.translatePosMatrix(te?te.posMatrix:Rt.posMatrix,ct,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){at=Et.indexBuffer2,$=Et.segments2;const oe=[T.drawingBufferWidth,T.drawingBufferHeight];rt=it==="fillOutlinePattern"&&O?Qd($t,_,F,ct,oe):Oy($t,oe)}else at=Et.indexBuffer,$=Et.segments,rt=O?Qc($t,_,F,ct):Jd($t);Ft.draw(_.context,W,m,_.stencilModeForClipping(Rt),v,Yn.disabled,rt,Ht,f.id,Et.layoutVertexBuffer,at,$,f.paint,_.transform.zoom,Nt)}}function mh(_,s,f,d,m,v,C){const T=_.context,M=T.gl,k="fill-extrusion-pattern",O=f.paint.get(k),F=O.constantOr(1),W=f.getCrossfadeParameters(),it=f.paint.get("fill-extrusion-opacity"),rt=O.constantOr(null);for(const at of d){const $=s.getTile(at),vt=$.getBucket(f);if(!vt)continue;const Rt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(at),ct=vt.programConfigurations.get(f.id),Et=_.useProgram(F?"fillExtrusionPattern":"fillExtrusion",ct);F&&(_.context.activeTexture.set(M.TEXTURE0),$.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ct.updatePaintBuffers(W)),dh(ct,k,rt,$,f);const Nt=_.translatePosMatrix(at.posMatrix,$,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Ft=f.paint.get("fill-extrusion-vertical-gradient"),Ht=F?Ny(Nt,_,Ft,it,at,W,$):Yu(Nt,_,Ft,it);Et.draw(T,T.gl.TRIANGLES,m,v,C,Yn.backCCW,Ht,Rt,f.id,vt.layoutVertexBuffer,vt.indexBuffer,vt.segments,f.paint,_.transform.zoom,ct,_.style.map.terrain&&vt.centroidVertexBuffer)}}function gh(_,s,f,d,m,v,C){const T=_.context,M=T.gl,k=f.fbo;if(!k)return;const O=_.useProgram("hillshade"),F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(s);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,k.colorAttachment.get()),O.draw(T,M.TRIANGLES,m,v,C,Yn.disabled,((W,it,rt,at)=>{const $=rt.paint.get("hillshade-shadow-color"),vt=rt.paint.get("hillshade-highlight-color"),Rt=rt.paint.get("hillshade-accent-color");let ct=rt.paint.get("hillshade-illumination-direction")*(Math.PI/180);rt.paint.get("hillshade-illumination-anchor")==="viewport"&&(ct-=W.transform.angle);const Et=!W.options.moving;return{u_matrix:at?at.posMatrix:W.transform.calculatePosMatrix(it.tileID.toUnwrapped(),Et),u_image:0,u_latrange:nm(0,it.tileID),u_light:[rt.paint.get("hillshade-exaggeration"),ct],u_shadow:$,u_highlight:vt,u_accent:Rt}})(_,f,d,F?s:null),F,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function op(_,s,f,d,m,v){const C=_.context,T=C.gl,M=s.dem;if(M&&M.data){const k=M.dim,O=M.stride,F=M.getPixels();if(C.activeTexture.set(T.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||_.getTileTexture(O),s.demTexture){const it=s.demTexture;it.update(F,{premultiply:!1}),it.bind(T.NEAREST,T.CLAMP_TO_EDGE)}else s.demTexture=new Q(C,F,T.RGBA,{premultiply:!1}),s.demTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE);C.activeTexture.set(T.TEXTURE0);let W=s.fbo;if(!W){const it=new Q(C,{width:k,height:k,data:null},T.RGBA);it.bind(T.LINEAR,T.CLAMP_TO_EDGE),W=s.fbo=C.createFramebuffer(k,k,!0,!1),W.colorAttachment.set(it.texture)}C.bindFramebuffer.set(W.framebuffer),C.viewport.set([0,0,k,k]),_.useProgram("hillshadePrepare").draw(C,T.TRIANGLES,d,m,v,Yn.disabled,((it,rt)=>{const at=rt.stride,$=u.F();return u.aN($,0,u.W,-u.W,0,0,1),u.H($,$,[0,-u.W,0]),{u_matrix:$,u_image:1,u_dimension:[at,at],u_zoom:it.overscaledZ,u_unpack:rt.getUnpackVector()}})(s.tileID,M),null,f.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function mm(_,s,f,d,m,v){const C=d.paint.get("raster-fade-duration");if(!v&&C>0){const T=I.now(),M=(T-_.timeAdded)/C,k=s?(T-s.timeAdded)/C:-1,O=f.getSource(),F=m.coveringZoomLevel({tileSize:O.tileSize,roundZoom:O.roundZoom}),W=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(_.tileID.overscaledZ-F),it=W&&_.refreshedUponExpiration?1:u.ac(W?M:1-k,0,1);return _.refreshedUponExpiration&&M>=1&&(_.refreshedUponExpiration=!1),s?{opacity:1,mix:1-it}:{opacity:it,mix:0}}return{opacity:1,mix:0}}const gm=new u.aO(1,0,0,1),yh=new u.aO(0,1,0,1),sp=new u.aO(0,0,1,1),Yy=new u.aO(1,0,1,1),ym=new u.aO(0,1,1,1);function wr(_,s,f,d){$i(_,0,s+f/2,_.transform.width,f,d)}function Ga(_,s,f,d){$i(_,s-f/2,0,f,_.transform.height,d)}function $i(_,s,f,d,m,v){const C=_.context,T=C.gl;T.enable(T.SCISSOR_TEST),T.scissor(s*_.pixelRatio,f*_.pixelRatio,d*_.pixelRatio,m*_.pixelRatio),C.clear({color:v}),T.disable(T.SCISSOR_TEST)}function ap(_,s,f){const d=_.context,m=d.gl,v=f.posMatrix,C=_.useProgram("debug"),T=xn.disabled,M=tr.disabled,k=_.colorModeForRenderPass(),O="$debug",F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(f);d.activeTexture.set(m.TEXTURE0);const W=s.getTileByID(f.key).latestRawTileData,it=Math.floor((W&&W.byteLength||0)/1024),rt=s.getTile(f).tileSize,at=512/Math.min(rt,512)*(f.overscaledZ/_.transform.zoom)*.5;let $=f.canonical.toString();f.overscaledZ!==f.canonical.z&&($+=` => ${f.overscaledZ}`),function(vt,Rt){vt.initDebugOverlayCanvas();const ct=vt.debugOverlayCanvas,Et=vt.context.gl,Nt=vt.debugOverlayCanvas.getContext("2d");Nt.clearRect(0,0,ct.width,ct.height),Nt.shadowColor="white",Nt.shadowBlur=2,Nt.lineWidth=1.5,Nt.strokeStyle="white",Nt.textBaseline="top",Nt.font="bold 36px Open Sans, sans-serif",Nt.fillText(Rt,5,5),Nt.strokeText(Rt,5,5),vt.debugOverlayTexture.update(ct),vt.debugOverlayTexture.bind(Et.LINEAR,Et.CLAMP_TO_EDGE)}(_,`${$} ${it}kB`),C.draw(d,m.TRIANGLES,T,M,Fr.alphaBlended,Yn.disabled,tm(v,u.aO.transparent,at),null,O,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),C.draw(d,m.LINE_STRIP,T,M,k,Yn.disabled,tm(v,u.aO.red),F,O,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function _h(_,s,f){const d=_.context,m=d.gl,v=_.colorModeForRenderPass(),C=new xn(m.LEQUAL,xn.ReadWrite,_.depthRangeFor3D),T=_.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const k of f){const O=_.renderToTexture.getTexture(k),F=s.getTerrainData(k.tileID);d.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,O.texture);const W={u_matrix:_.transform.calculatePosMatrix(k.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(_.transform.zoom)};T.draw(d,m.TRIANGLES,C,tr.disabled,v,Yn.backCCW,W,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class _m{constructor(s,f){this.context=new Xy(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Hr.maxUnderzooming+Hr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Va}resize(s,f,d){if(this.width=Math.floor(s*d),this.height=Math.floor(f*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const s=this.context,f=new u.aV;f.emplaceBack(0,0),f.emplaceBack(u.W,0),f.emplaceBack(0,u.W),f.emplaceBack(u.W,u.W),this.tileExtentBuffer=s.createVertexBuffer(f,Yc.members),this.tileExtentSegments=u.$.simpleSegment(0,0,4,2);const d=new u.aV;d.emplaceBack(0,0),d.emplaceBack(u.W,0),d.emplaceBack(0,u.W),d.emplaceBack(u.W,u.W),this.debugBuffer=s.createVertexBuffer(d,Yc.members),this.debugSegments=u.$.simpleSegment(0,0,4,5);const m=new u.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(u.W,0,u.W,0),m.emplaceBack(0,u.W,0,u.W),m.emplaceBack(u.W,u.W,u.W,u.W),this.rasterBoundsBuffer=s.createVertexBuffer(m,on.members),this.rasterBoundsSegments=u.$.simpleSegment(0,0,4,2);const v=new u.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,Yc.members),this.viewportSegments=u.$.simpleSegment(0,0,4,2);const C=new u.aW;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(C);const T=new u.aX;T.emplaceBack(0,1,2),T.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(T);const M=this.context.gl;this.stencilClearMode=new tr({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=u.F();u.aN(d,0,this.width,this.height,0,0,1),u.J(d,d,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,xn.disabled,this.stencilClearMode,Fr.disabled,Yn.disabled,$c(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,f){if(this.currentStencilSource===s.source||!s.isTileClipped()||!f||!f.length)return;this.currentStencilSource=s.source;const d=this.context,m=d.gl;this.nextStencilID+f.length>256&&this.clearStencil(),d.setColorMode(Fr.disabled),d.setDepthMode(xn.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const T=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(d,m.TRIANGLES,xn.disabled,new tr({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),Fr.disabled,Yn.disabled,$c(C.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new tr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new tr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,d=s.sort((C,T)=>T.overscaledZ-C.overscaledZ),m=d[d.length-1].overscaledZ,v=d[0].overscaledZ-m+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const C={};for(let T=0;T=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],k=m[M.source],O=v[M.source];this._renderTileClippingMasks(M,O),this.renderLayer(this,k,M,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer$.source&&!$.isHidden(O)?[k.sourceCaches[$.source]]:[]),it=W.filter($=>$.getSource().type==="vector"),rt=W.filter($=>$.getSource().type!=="vector"),at=$=>{(!F||F.getSource().maxzoom<$.getSource().maxzoom)&&(F=$)};return it.forEach($=>at($)),F||rt.forEach($=>at($)),F}(this.style,this.transform.zoom);M&&function(k,O,F){for(let W=0;W0),m&&(u.a_(f,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const T=v.context,M=T.gl,k=Fr.unblended,O=new xn(M.LEQUAL,xn.ReadWrite,[0,1]),F=C.getTerrainMesh(),W=C.sourceCache.getRenderableTiles(),it=v.useProgram("terrainDepth");T.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1});for(const rt of W){const at=C.getTerrainData(rt.tileID),$={u_matrix:v.transform.calculatePosMatrix(rt.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};it.draw(T,M.TRIANGLES,O,tr.disabled,k,Yn.backCCW,$,at,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const T=v.context,M=T.gl,k=Fr.unblended,O=new xn(M.LEQUAL,xn.ReadWrite,[0,1]),F=C.getTerrainMesh(),W=C.getCoordsTexture(),it=C.sourceCache.getRenderableTiles(),rt=v.useProgram("terrainCoords");T.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1}),C.coordsIndex=[];for(const at of it){const $=C.getTerrainData(at.tileID);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,W.texture);const vt={u_matrix:v.transform.calculatePosMatrix(at.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};rt.draw(T,M.TRIANGLES,O,tr.disabled,k,Yn.backCCW,vt,$,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(at.tileID.key)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,d,m){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(m||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(v,C,T,M,k){if(v.renderPass!=="translucent")return;const O=tr.disabled,F=v.colorModeForRenderPass();(T._unevaluatedLayout.hasValue("text-variable-anchor")||T._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(W,it,rt,at,$,vt,Rt){const ct=it.transform,Et=$==="map",Nt=vt==="map";for(const Ft of W){const Ht=at.getTile(Ft),te=Ht.getBucket(rt);if(!te||!te.text||!te.text.segments.get().length)continue;const $t=u.ag(te.textSizeData,ct.zoom),oe=je(Ht,1,it.transform.zoom),le=Xe(Ft.posMatrix,Nt,Et,it.transform,oe),$e=rt.layout.get("icon-text-fit")!=="none"&&te.hasIconData();if($t){const ue=Math.pow(2,ct.zoom-Ht.tileID.overscaledZ);hh(te,Et,Nt,Rt,ct,le,Ft.posMatrix,ue,$t,$e,it.style.map.terrain?(ze,tn)=>it.style.map.terrain.getElevation(Ft,ze,tn):null)}}}(M,v,T,C,T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),k),T.paint.get("icon-opacity").constantOr(1)!==0&&ph(v,C,T,M,!1,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),T.layout.get("icon-rotation-alignment"),T.layout.get("icon-pitch-alignment"),T.layout.get("icon-keep-upright"),O,F),T.paint.get("text-opacity").constantOr(1)!==0&&ph(v,C,T,M,!0,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),T.layout.get("text-keep-upright"),O,F),C.map.showCollisionBoxes&&(ch(v,C,T,M,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),!0),ch(v,C,T,M,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),!1))})(s,f,d,m,this.style.placement.variableOffsets);break;case"circle":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("circle-opacity"),O=T.paint.get("circle-stroke-width"),F=T.paint.get("circle-stroke-opacity"),W=!T.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(O.constantOr(1)===0||F.constantOr(1)===0))return;const it=v.context,rt=it.gl,at=v.depthModeForSublayer(0,xn.ReadOnly),$=tr.disabled,vt=v.colorModeForRenderPass(),Rt=[];for(let ct=0;ctct.sortKey-Et.sortKey);for(const ct of Rt){const{programConfiguration:Et,program:Nt,layoutVertexBuffer:Ft,indexBuffer:Ht,uniformValues:te,terrainData:$t}=ct.state;Nt.draw(it,rt.TRIANGLES,at,$,vt,Yn.disabled,te,$t,T.id,Ft,Ht,ct.segments,T.paint,v.transform.zoom,Et)}})(s,f,d,m);break;case"heatmap":(function(v,C,T,M){if(T.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const k=v.context,O=k.gl,F=tr.disabled,W=new Fr([O.ONE,O.ONE],u.aO.transparent,[!0,!0,!0,!0]);(function(it,rt,at){const $=it.gl;it.activeTexture.set($.TEXTURE1),it.viewport.set([0,0,rt.width/4,rt.height/4]);let vt=at.heatmapFbo;if(vt)$.bindTexture($.TEXTURE_2D,vt.colorAttachment.get()),it.bindFramebuffer.set(vt.framebuffer);else{const Rt=$.createTexture();$.bindTexture($.TEXTURE_2D,Rt),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_S,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_T,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MIN_FILTER,$.LINEAR),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MAG_FILTER,$.LINEAR),vt=at.heatmapFbo=it.createFramebuffer(rt.width/4,rt.height/4,!1,!1),function(ct,Et,Nt,Ft){var Ht,te;const $t=ct.gl,oe=(Ht=ct.HALF_FLOAT)!==null&&Ht!==void 0?Ht:$t.UNSIGNED_BYTE,le=(te=ct.RGBA16F)!==null&&te!==void 0?te:$t.RGBA;$t.texImage2D($t.TEXTURE_2D,0,le,Et.width/4,Et.height/4,0,$t.RGBA,oe,null),Ft.colorAttachment.set(Nt)}(it,rt,Rt,vt)}})(k,v,T),k.clear({color:u.aO.transparent});for(let it=0;it{const ct=u.F();u.aN(ct,0,at.width,at.height,0,0,1);const Et=at.context.gl;return{u_matrix:ct,u_world:[Et.drawingBufferWidth,Et.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:$.paint.get("heatmap-opacity")}})(k,O),null,O.id,k.viewportBuffer,k.quadTriangleIndexBuffer,k.viewportSegments,O.paint,k.transform.zoom)}(v,T))})(s,f,d,m);break;case"line":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("line-opacity"),O=T.paint.get("line-width");if(k.constantOr(1)===0||O.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,xn.ReadOnly),W=v.colorModeForRenderPass(),it=T.paint.get("line-dasharray"),rt=T.paint.get("line-pattern"),at=rt.constantOr(1),$=T.paint.get("line-gradient"),vt=T.getCrossfadeParameters(),Rt=at?"linePattern":it?"lineSDF":$?"lineGradient":"line",ct=v.context,Et=ct.gl;let Nt=!0;for(const Ft of M){const Ht=C.getTile(Ft);if(at&&!Ht.patternsLoaded())continue;const te=Ht.getBucket(T);if(!te)continue;const $t=te.programConfigurations.get(T.id),oe=v.context.program.get(),le=v.useProgram(Rt,$t),$e=Nt||le.program!==oe,ue=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ft),ze=rt.constantOr(null);if(ze&&Ht.imageAtlas){const Ue=Ht.imageAtlas,rn=Ue.patternPositions[ze.to.toString()],cn=Ue.patternPositions[ze.from.toString()];rn&&cn&&$t.setConstantPatternPositions(rn,cn)}const tn=ue?Ft:null,wn=at?xl(v,Ht,T,vt,tn):it?eh(v,Ht,T,it,vt,tn):$?rm(v,Ht,T,te.lineClipsArray.length,tn):th(v,Ht,T,tn);if(at)ct.activeTexture.set(Et.TEXTURE0),Ht.imageAtlasTexture.bind(Et.LINEAR,Et.CLAMP_TO_EDGE),$t.updatePaintBuffers(vt);else if(it&&($e||v.lineAtlas.dirty))ct.activeTexture.set(Et.TEXTURE0),v.lineAtlas.bind(ct);else if($){const Ue=te.gradients[T.id];let rn=Ue.texture;if(T.gradientVersion!==Ue.version){let cn=256;if(T.stepInterpolant){const Er=C.getSource().maxzoom,Gn=Ft.canonical.z===Er?Math.ceil(1<0?f.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const f=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!f||!d}useProgram(s,f){this.cache=this.cache||{};const d=s+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Ua(this.context,Xu[s],f,im[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Q(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:f}=this.context.gl;return this.width!==s||this.height!==f}}class qa{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,d){const m=Math.pow(2,d),v=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(T=>{const M=1/(T=u.af([],T,s))[3]/f*m;return u.a$(T,T,[M,M,1/T[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{const M=function(W,it){var rt=it[0],at=it[1],$=it[2],vt=rt*rt+at*at+$*$;return vt>0&&(vt=1/Math.sqrt(vt)),W[0]=it[0]*vt,W[1]=it[1]*vt,W[2]=it[2]*vt,W}([],function(W,it,rt){var at=it[0],$=it[1],vt=it[2],Rt=rt[0],ct=rt[1],Et=rt[2];return W[0]=$*Et-vt*ct,W[1]=vt*Rt-at*Et,W[2]=at*ct-$*Rt,W}([],ft([],v[T[0]],v[T[1]]),ft([],v[T[2]],v[T[1]]))),k=-((O=M)[0]*(F=v[T[1]])[0]+O[1]*F[1]+O[2]*F[2]);var O,F;return M.concat(k)});return new qa(v,C)}}class ja{constructor(s,f){this.min=s,this.max=f,this.center=function(d,m,v){return d[0]=.5*m[0],d[1]=.5*m[1],d[2]=.5*m[2],d}([],function(d,m,v){return d[0]=m[0]+v[0],d[1]=m[1]+v[1],d[2]=m[2]+v[2],d}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],d=dt(this.min),m=dt(this.max);for(let v=0;v=0&&C++;if(C===0)return 0;C!==f.length&&(d=!1)}if(d)return 2;for(let m=0;m<3;m++){let v=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let T=0;Tthis.max[m]-this.min[m])return 0}return 1}}class lu{constructor(s=0,f=0,d=0,m=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(d)||d<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=d,this.right=m}interpolate(s,f,d){return f.top!=null&&s.top!=null&&(this.top=u.z.number(s.top,f.top,d)),f.bottom!=null&&s.bottom!=null&&(this.bottom=u.z.number(s.bottom,f.bottom,d)),f.left!=null&&s.left!=null&&(this.left=u.z.number(s.left,f.left,d)),f.right!=null&&s.right!=null&&(this.right=u.z.number(s.right,f.right,d)),this}getCenter(s,f){const d=u.ac((this.left+s-this.right)/2,0,s),m=u.ac((this.top+f-this.bottom)/2,0,f);return new u.P(d,m)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new lu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const lp=85.051129;class vh{constructor(s,f,d,m,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=d??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new u.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new lu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new vh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-u.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var d=new u.A(4);return u.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,m,v){var C=m[0],T=m[1],M=m[2],k=m[3],O=Math.sin(v),F=Math.cos(v);d[0]=C*F+M*O,d[1]=T*F+k*O,d[2]=C*-O+M*F,d[3]=T*-O+k*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=u.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const f=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,f,d){this._unmodified=!1,this._edgeInsets.interpolate(s,f,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const f=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(s){const f=[new u.b2(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new u.P(0,0)),m=this.pointCoordinate(new u.P(this.width,0)),v=this.pointCoordinate(new u.P(this.width,this.height)),C=this.pointCoordinate(new u.P(0,this.height)),T=Math.floor(Math.min(d.x,m.x,v.x,C.x)),M=Math.floor(Math.max(d.x,m.x,v.x,C.x)),k=1;for(let O=T-k;O<=M+k;O++)O!==0&&f.push(new u.b2(O,s))}return f}coveringTiles(s){var f,d;let m=this.coveringZoomLevel(s);const v=m;if(s.minzoom!==void 0&&ms.maxzoom&&(m=s.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),T=u.Y.fromLngLat(this.center),M=Math.pow(2,m),k=[M*C.x,M*C.y,0],O=[M*T.x,M*T.y,0],F=qa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let W=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(W=m);const it=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,rt=ct=>({aabb:new ja([ct*M,0,0],[(ct+1)*M,M,0]),zoom:0,x:0,y:0,wrap:ct,fullyVisible:!1}),at=[],$=[],vt=m,Rt=s.reparseOverscaled?v:m;if(this._renderWorldCopies)for(let ct=1;ct<=3;ct++)at.push(rt(-ct)),at.push(rt(ct));for(at.push(rt(0));at.length>0;){const ct=at.pop(),Et=ct.x,Nt=ct.y;let Ft=ct.fullyVisible;if(!Ft){const le=ct.aabb.intersects(F);if(le===0)continue;Ft=le===2}const Ht=s.terrain?k:O,te=ct.aabb.distanceX(Ht),$t=ct.aabb.distanceY(Ht),oe=Math.max(Math.abs(te),Math.abs($t));if(ct.zoom===vt||oe>it+(1<=W){const le=vt-ct.zoom,$e=k[0]-.5-(Et<>1),ze=ct.zoom+1;let tn=ct.aabb.quadrant(le);if(s.terrain){const wn=new u.Q(ze,ct.wrap,ze,$e,ue),Ue=s.terrain.getMinMaxElevation(wn),rn=(f=Ue.minElevation)!==null&&f!==void 0?f:this.elevation,cn=(d=Ue.maxElevation)!==null&&d!==void 0?d:this.elevation;tn=new ja([tn.min[0],tn.min[1],rn],[tn.max[0],tn.max[1],cn])}at.push({aabb:tn,zoom:ze,x:$e,y:ue,wrap:ct.wrap,fullyVisible:Ft})}}return $.sort((ct,Et)=>ct.distanceSq-Et.distanceSq).map(ct=>ct.tileID)}resize(s,f){this.width=s,this.height=f,this.pixelsToGLUnits=[2/s,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const f=u.ac(s.lat,-85.051129,lp);return new u.P(u.N(s.lng)*this.worldSize,u.O(f)*this.worldSize)}unproject(s){return new u.Y(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const f=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-v))return;const C=d+f-v,T=Math.cos(this._pitch)*this.cameraToCenterDistance/C/u.b3(1,m.lat),M=this.scaleZoom(T/this.tileSize);this._elevation=v,this._center=m,this.zoom=M}setLocationAtPoint(s,f){const d=this.pointCoordinate(f),m=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),C=new u.Y(v.x-(d.x-m.x),v.y-(d.y-m.y));this.center=this.coordinateLocation(C),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,f){return f?this.coordinatePoint(this.locationCoordinate(s),f.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,f){return this.coordinateLocation(this.pointCoordinate(s,f))}locationCoordinate(s){return u.Y.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,f){if(f){const W=f.pointCoordinate(s);if(W!=null)return W}const d=[s.x,s.y,0,1],m=[s.x,s.y,1,1];u.af(d,d,this.pixelMatrixInverse),u.af(m,m,this.pixelMatrixInverse);const v=d[3],C=m[3],T=d[1]/v,M=m[1]/C,k=d[2]/v,O=m[2]/C,F=k===O?0:(0-k)/(O-k);return new u.Y(u.z.number(d[0]/v,m[0]/C,F)/this.worldSize,u.z.number(T,M,F)/this.worldSize)}coordinatePoint(s,f=0,d=this.pixelMatrix){const m=[s.x*this.worldSize,s.y*this.worldSize,f,1];return u.af(m,m,d),new u.P(m[0]/m[3],m[1]/m[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Ct().extend(this.pointLocation(new u.P(0,s))).extend(this.pointLocation(new u.P(this.width,s))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ct([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,lp])}calculatePosMatrix(s,f=!1){const d=s.key,m=f?this._alignedPosMatrixCache:this._posMatrixCache;if(m[d])return m[d];const v=s.canonical,C=this.worldSize/this.zoomScale(v.z),T=v.x+Math.pow(2,v.z)*s.wrap,M=u.an(new Float64Array(16));return u.H(M,M,[T*C,v.y*C,0]),u.J(M,M,[C/u.W,C/u.W,1]),u.K(M,f?this.alignedProjMatrix:this.projMatrix,M),m[d]=new Float32Array(M),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=u.ac(+f,this.minZoom,this.maxZoom);const d={center:new u.M(s.lng,s.lat),zoom:f};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ct=179.9999999999;m=[-ct,ct]}const v=this.tileSize*this.zoomScale(d.zoom);let C=0,T=v,M=0,k=v,O=0,F=0;const{x:W,y:it}=this.size;if(this.latRange){const ct=this.latRange;C=u.O(ct[1])*v,T=u.O(ct[0])*v,T-CT&&(vt=T-ct)}if(m){const ct=(M+k)/2;let Et=rt;this._renderWorldCopies&&(Et=u.b1(rt,ct-v/2,ct+v/2));const Nt=W/2;Et-Ntk&&($=k-Nt)}if($!==void 0||vt!==void 0){const ct=new u.P($??rt,vt??at);d.center=this.unproject.call({worldSize:v},ct).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=d,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b3(1,this.center.lat)*this.worldSize;let m=u.an(new Float64Array(16));u.J(m,m,[this.width/2,-this.height/2,1]),u.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=u.an(new Float64Array(16)),u.J(m,m,[1,-1,1]),u.H(m,m,[-1,-1,0]),u.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),T=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?T:v,k=Math.PI/2+this._pitch,O=this._fov*(.5+s.y/this.height),F=Math.sin(O)*M/Math.sin(u.ac(Math.PI-k-O,.01,Math.PI-.01)),W=this.getHorizon(),it=2*Math.atan(W/this.cameraToCenterDistance)*(.5+s.y/(2*W)),rt=Math.sin(it)*M/Math.sin(u.ac(Math.PI-k-it,.01,Math.PI-.01)),at=Math.min(F,rt),$=1.01*(Math.cos(Math.PI/2-this._pitch)*at+M),vt=this.height/50;m=new Float64Array(16),u.b4(m,this._fov,this.width/this.height,vt,$),m[8]=2*-s.x/this.width,m[9]=2*s.y/this.height,u.J(m,m,[1,-1,1]),u.H(m,m,[0,0,-this.cameraToCenterDistance]),u.b5(m,m,this._pitch),u.ad(m,m,this.angle),u.H(m,m,[-f,-d,0]),this.mercatorMatrix=u.J([],m,[this.worldSize,this.worldSize,this.worldSize]),u.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.K(new Float64Array(16),this.labelPlaneMatrix,m),u.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=u.ar([],m),this.pixelMatrix3D=u.K(new Float64Array(16),this.labelPlaneMatrix,m);const Rt=this.width%2/2,ct=this.height%2/2,Et=Math.cos(this.angle),Nt=Math.sin(this.angle),Ft=f-Math.round(f)+Et*Rt+Nt*ct,Ht=d-Math.round(d)+Et*ct+Nt*Rt,te=new Float64Array(m);if(u.H(te,te,[Ft>.5?Ft-1:Ft,Ht>.5?Ht-1:Ht,0]),this.alignedProjMatrix=te,m=u.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new u.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return u.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let d=f.x,m=f.y,v=f.x,C=f.y;for(const T of s)d=Math.min(d,T.x),m=Math.min(m,T.y),v=Math.max(v,T.x),C=Math.max(C,T.y);return[new u.P(d,m),new u.P(v,m),new u.P(v,C),new u.P(d,C),new u.P(d,m)]}}lngLatToCameraDepth(s,f){const d=this.locationCoordinate(s),m=[d.x*this.worldSize,d.y*this.worldSize,f,1];return u.af(m,m,this.projMatrix),m[2]/m[3]}}function up(_,s){let f,d=!1,m=null,v=null;const C=()=>{m=null,d&&(_.apply(v,f),m=setTimeout(C,s),d=!1)};return(...T)=>(d=!0,v=this,f=T,m||C(),m)}class cp{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let d;return f.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(d=m)}),(d&&d[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:d,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const f=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,f)}catch{}},this._updateHash=up(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(s){const f=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,m=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,m),C=Math.round(f.lng*v)/v,T=Math.round(f.lat*v)/v,M=this._map.getBearing(),k=this._map.getPitch();let O="";if(O+=s?`/${C}/${T}/${d}`:`${d}/${T}/${C}`,(M||k)&&(O+="/"+Math.round(10*M)/10),k&&(O+=`/${Math.round(k)}`),this._hashName){const F=this._hashName;let W=!1;const it=window.location.hash.slice(1).split("&").map(rt=>{const at=rt.split("=")[0];return at===F?(W=!0,`${at}=${O}`):rt}).filter(rt=>rt);return W||it.push(`${F}=${O}`),`#${it.join("&")}`}return`#${O}`}}const nc={linearity:.3,easing:u.b6(0,0,.3,1)},Il=u.e({deceleration:2500,maxSpeed:1400},nc),vm=u.e({deceleration:20,maxSpeed:1400},nc),bm=u.e({deceleration:1e3,maxSpeed:360},nc),xm=u.e({deceleration:1e3,maxSpeed:90},nc);class wm{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:I.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,f=I.now();for(;s.length>0&&f-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)f.zoom+=v.zoomDelta||0,f.bearing+=v.bearingDelta||0,f.pitch+=v.pitchDelta||0,v.panDelta&&f.pan._add(v.panDelta),v.around&&(f.around=v.around),v.pinchAround&&(f.pinchAround=v.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(f.pan.mag()){const v=ic(f.pan.mag(),d,u.e({},Il,s||{}));m.offset=f.pan.mult(v.amount/f.pan.mag()),m.center=this._map.transform.center,rc(m,v)}if(f.zoom){const v=ic(f.zoom,d,vm);m.zoom=this._map.transform.zoom+v.amount,rc(m,v)}if(f.bearing){const v=ic(f.bearing,d,bm);m.bearing=this._map.transform.bearing+u.ac(v.amount,-179,179),rc(m,v)}if(f.pitch){const v=ic(f.pitch,d,xm);m.pitch=this._map.transform.pitch+v.amount,rc(m,v)}if(m.zoom||m.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;m.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),u.e(m,{noMoveStart:!0})}}function rc(_,s){(!_.duration||_.durationf.unproject(M)),T=v.reduce((M,k,O,F)=>M.add(k.div(F.length)),new u.P(0,0));super(s,{points:v,point:T,lngLats:C,lngLat:f.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class hp extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class ms{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new hp(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new fo(s.type,this._map,s))}mouseup(s){this._map.fire(new fo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new fo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new fo(s.type,this._map,s))}mouseover(s){this._map.fire(new fo(s.type,this._map,s))}mouseout(s){this._map.fire(new fo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Bs(s.type,this._map,s))}touchmove(s){this._map.fire(new Bs(s.type,this._map,s))}touchend(s){this._map.fire(new Bs(s.type,this._map,s))}touchcancel(s){this._map.fire(new Bs(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new fo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new fo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new fo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class uu{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(u.P.convert(s),this._map.terrain)}}class gs{constructor(s,f){this._map=s,this._tr=new uu(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(P.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const d=f;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)v.fitScreenCoordinates(d,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(P.remove(this._box),this._box=null),P.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new u.k(s,{originalEvent:f}))}}function Cl(_,s){if(_.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${s.length}`);const f={};for(let d=0;d<_.length;d++)f[_[d].identifier]=s[d];return f}class Ky{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,f,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(m){const v=new u.P(0,0);for(const C of m)v._add(C);return v.div(m.length)}(f),this.touches=Cl(d,f)))}touchmove(s,f,d){if(this.aborted||!this.centroid)return;const m=Cl(d,f);for(const v in this.touches){const C=m[v];(!C||C.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,f,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class fp{constructor(s){this.singleTap=new Ky(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,f,d){this.singleTap.touchstart(s,f,d)}touchmove(s,f,d){this.singleTap.touchmove(s,f,d)}touchend(s,f,d){const m=this.singleTap.touchend(s,f,d);if(m){const v=s.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(m)<30;if(v&&C||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Jy{constructor(s){this._tr=new uu(s),this._zoomIn=new fp({numTouches:1,numTaps:2}),this._zoomOut=new fp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,d){this._zoomIn.touchstart(s,f,d),this._zoomOut.touchstart(s,f,d)}touchmove(s,f,d){this._zoomIn.touchmove(s,f,d),this._zoomOut.touchmove(s,f,d)}touchend(s,f,d){const m=this._zoomIn.touchend(s,f,d),v=this._zoomOut.touchend(s,f,d),C=this._tr;return m?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(m)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(v)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cu{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const m=f.length?f[0]:f;return!this._moved&&m.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(s){s.preventDefault()}},hu=({enable:_,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const d=new Us({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new cu({clickTolerance:s,move:(m,v)=>({bearingDelta:(v.x-m.x)*f}),moveStateManager:d,enable:_,assignEvents:bh})},fu=({enable:_,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const d=new Us({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new cu({clickTolerance:s,move:(m,v)=>({pitchDelta:(v.y-m.y)*f}),moveStateManager:d,enable:_,assignEvents:bh})};class Sm{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,d){return this._calculateTransform(s,f,d)}touchmove(s,f,d){if(this._active&&!(d.length0&&(this._active=!0);const m=Cl(d,f),v=new u.P(0,0),C=new u.P(0,0);let T=0;for(const k in m){const O=m[k],F=this._touches[k];F&&(v._add(O),C._add(O.sub(F)),T++,m[k]=O)}if(this._touches=m,TMath.abs(_.x)}class Cm extends ge{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,d){super.touchstart(s,f,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,wh(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,v,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(m.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,d){if(this._valid!==void 0)return this._valid;const m=s.mag()>=2,v=f.mag()>=2;if(!m&&!v)return;if(!m||!v)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const C=s.y>0==f.y>0;return wh(s)&&wh(f)&&C}}const Qy={panStep:100,bearingStep:15,pitchStep:10};class Wa{constructor(s){this._tr=new uu(s);const f=Qy;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let f=0,d=0,m=0,v=0,C=0;switch(s.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?m=1:(s.preventDefault(),C=-1);break;case 40:s.shiftKey?m=-1:(s.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(d=0,m=0),{cameraAnimation:T=>{const M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:sr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+m*this._pitchStep,offset:[-v*this._panStep,-C*this._panStep],center:M.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function sr(_){return _*(2-_)}const sc=4.000244140625;class Sh{constructor(s,f){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new uu(s),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=I.now(),m=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,f!==0&&f%sc==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(m*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),s.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=s,this._delta-=f,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const f=P.mousePos(this._map.getCanvas(),s),d=this._tr;this._around=f.y>d.transform.height/2-d.transform.getHorizon()?u.M.convert(this._aroundCenter?d.center:d.unproject(f)):u.M.convert(d.center),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>sc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&M!==0&&(M=1/M);const k=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(k*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,m=this._easing;let v,C=!1;if(this._type==="wheel"&&d&&m){const T=Math.min((I.now()-this._lastWheelEventTime)/200,1),M=m(T);v=u.z.number(d,f,M),T<1?this._frameId||(this._frameId=!0):C=!0}else v=f,C=!0;return this._active=!0,C&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!C,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=u.b7;if(this._prevEase){const d=this._prevEase,m=(I.now()-d.start)/d.duration,v=d.easing(m+.01)-d.easing(m),C=.27/Math.sqrt(v*v+1e-4)*.01,T=Math.sqrt(.0729-C*C);f=u.b6(C,T,.25,1)}return this._prevEase={start:I.now(),duration:s,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class dp{constructor(s,f){this._clickZoom=s,this._tapZoom=f}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Tm{constructor(s){this._tr=new uu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Lm{constructor(){this._tap=new fp({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,f,d){if(!this._swipePoint)if(this._tapTime){const m=f[0],v=s.timeStamp-this._tapTime<500,C=this._tapPoint.dist(m)<30;v&&C?d.length>0&&(this._swipePoint=m,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,f,d)}touchmove(s,f,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const m=f[0],v=m.y-this._swipePoint.y;return this._swipePoint=m,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,f,d)}touchend(s,f,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const m=this._tap.touchend(s,f,d);m&&(this._tapTime=s.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pm{constructor(s,f,d){this._el=s,this._mousePan=f,this._touchPan=d}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ys{constructor(s,f,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ac{constructor(s,f,d,m){this._el=s,this._touchZoom=f,this._touchRotate=d,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Me{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=P.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=f,this._container.appendChild(m);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=d,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(P.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Oe=_=>_.zoom||_.drag||_.pitch||_.rotate;class Eh extends u.k{}function lc(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class mp{constructor(s,f){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,v)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=m.type==="renderFrame"?void 0:m,T={needsRenderFrame:!1},M={},k={},O=m.touches,F=O?this._getMapTouches(O):void 0,W=F?P.touchPos(this._map.getCanvas(),F):P.mousePos(this._map.getCanvas(),m);for(const{handlerName:at,handler:$,allowed:vt}of this._handlers){if(!$.isEnabled())continue;let Rt;this._blockedByActive(k,vt,at)?$.reset():$[v||m.type]&&(Rt=$[v||m.type](m,W,F),this.mergeHandlerResult(T,M,Rt,at,C),Rt&&Rt.needsRenderFrame&&this._triggerRenderFrame()),(Rt||$.isActive())&&(k[at]=$)}const it={};for(const at in this._previousActiveHandlers)k[at]||(it[at]=C);this._previousActiveHandlers=k,(Object.keys(it).length||lc(T))&&(this._changes.push([T,M,it]),this._triggerRenderFrame()),(Object.keys(k).length||lc(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:rt}=T;rt&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],rt(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new wm(s),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,v,C]of this._listeners)P.addEventListener(m,v,m===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,d]of this._listeners)P.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const f=this._map,d=f.getCanvasContainer();this._add("mapEvent",new ms(f,s));const m=f.boxZoom=new gs(f,s);this._add("boxZoom",m),s.interactive&&s.boxZoom&&m.enable();const v=f.cooperativeGestures=new Me(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new Jy(f),T=new Tm(f);f.doubleClickZoom=new dp(T,C),this._add("tapZoom",C),this._add("clickZoom",T),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new Lm;this._add("tapDragZoom",M);const k=f.touchPitch=new Cm(f);this._add("touchPitch",k),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const O=hu(s),F=fu(s);f.dragRotate=new ys(s,O,F),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const W=(({enable:Rt,clickTolerance:ct})=>{const Et=new Us({checkCorrectEvent:Nt=>P.mouseButton(Nt)===0&&!Nt.ctrlKey});return new cu({clickTolerance:ct,move:(Nt,Ft)=>({around:Ft,panDelta:Ft.sub(Nt)}),activateOnStart:!0,moveStateManager:Et,enable:Rt,assignEvents:bh})})(s),it=new Sm(s,f);f.dragPan=new Pm(d,W,it),this._add("mousePan",W),this._add("touchPan",it,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const rt=new pp,at=new Im;f.touchZoomRotate=new ac(d,at,rt,M),this._add("touchRotate",rt,["touchPan","touchZoom"]),this._add("touchZoom",at,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const $=f.scrollZoom=new Sh(f,()=>this._triggerRenderFrame());this._add("scrollZoom",$,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const vt=f.keyboard=new Wa(f);this._add("keyboard",vt),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new Vs(f))}_add(s,f,d){this._handlers.push({handlerName:s,handler:f,allowed:d}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Oe(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,d){for(const m in s)if(m!==d&&(!f||f.indexOf(m)<0))return!0;return!1}_getMapTouches(s){const f=[];for(const d of s)this._el.contains(d.target)&&f.push(d);return f}mergeHandlerResult(s,f,d,m,v){if(!d)return;u.e(s,d);const C={handlerName:m,originalEvent:d.originalEvent||v};d.zoomDelta!==void 0&&(f.zoom=C),d.panDelta!==void 0&&(f.drag=C),d.pitchDelta!==void 0&&(f.pitch=C),d.bearingDelta!==void 0&&(f.rotate=C)}_applyChanges(){const s={},f={},d={};for(const[m,v,C]of this._changes)m.panDelta&&(s.panDelta=(s.panDelta||new u.P(0,0))._add(m.panDelta)),m.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(s.around=m.around),m.pinchAround!==void 0&&(s.pinchAround=m.pinchAround),m.noInertia&&(s.noInertia=m.noInertia),u.e(f,v),u.e(d,C);this._updateMapTransform(s,f,d),this._changes=[]}_updateMapTransform(s,f,d){const m=this._map,v=m._getTransformForUpdate(),C=m.terrain;if(!(lc(s)||C&&this._terrainMovement))return this._fireEvents(f,d,!0);let{panDelta:T,zoomDelta:M,bearingDelta:k,pitchDelta:O,around:F,pinchAround:W}=s;W!==void 0&&(F=W),m._stop(!0),F=F||m.transform.centerPoint;const it=v.pointLocation(T?F.sub(T):F);k&&(v.bearing+=k),O&&(v.pitch+=O),M&&(v.zoom+=M),C?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(T)):v.setLocationAtPoint(it,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(it,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(m.terrain)})):v.setLocationAtPoint(it,F),m._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,d,!0)}_fireEvents(s,f,d){const m=Oe(this._eventsInProgress),v=Oe(s),C={};for(const O in s){const{originalEvent:F}=s[O];this._eventsInProgress[O]||(C[`${O}start`]=F),this._eventsInProgress[O]=s[O]}!m&&v&&this._fireEvent("movestart",v.originalEvent);for(const O in C)this._fireEvent(O,C[O]);v&&this._fireEvent("move",v.originalEvent);for(const O in s){const{originalEvent:F}=s[O];this._fireEvent(O,F)}const T={};let M;for(const O in this._eventsInProgress){const{handlerName:F,originalEvent:W}=this._eventsInProgress[O];this._handlersById[F].isActive()||(delete this._eventsInProgress[O],M=f[F]||W,T[`${O}end`]=M)}for(const O in T)this._fireEvent(O,T[O]);const k=Oe(this._eventsInProgress);if(d&&(m||v)&&!k){this._updatingCamera=!0;const O=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=W=>W!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Eh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class po extends u.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const d=Math.min((I.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,d){return s=u.P.convert(s).mult(-1),this.panTo(this.transform.center,u.e({offset:s},f),d)}panTo(s,f,d){return this.easeTo(u.e({center:s},f),d)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,d){return this.easeTo(u.e({zoom:s},f),d)}zoomIn(s,f){return this.zoomTo(this.getZoom()+1,s,f),this}zoomOut(s,f){return this.zoomTo(this.getZoom()-1,s,f),this}getBearing(){return this.transform.bearing}setBearing(s,f){return this.jumpTo({bearing:s},f),this}getPadding(){return this.transform.padding}setPadding(s,f){return this.jumpTo({padding:s},f),this}rotateTo(s,f,d){return this.easeTo(u.e({bearing:s},f),d)}resetNorth(s,f){return this.rotateTo(0,u.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=u.z.number(v,$,Ht)),this._rotating&&(m.bearing=u.z.number(C,k,Ht)),this._pitching&&(m.pitch=u.z.number(T,O,Ht)),this._padding&&(m.interpolatePadding(M,F,Ht),it=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Ht),Et)m.setLocationAtPoint(Et,Nt);else{const te=m.zoomScale(m.zoom-v),$t=$>v?Math.min(2,ct):Math.max(.5,ct),oe=Math.pow($t,1-Ht),le=m.unproject(vt.add(Rt.mult(Ht*oe)).mult(te));m.setLocationAtPoint(m.renderWorldCopies?le.wrap():le,it)}this._applyUpdatedTransform(m),this._fireMoveEvents(f)},Ht=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Ht)},s),this}_prepareEase(s,f,d={}){this._moving=!0,f||d.moving||this.fire(new u.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new u.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new u.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new u.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&f!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(f-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=u.z.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(s){if(!this.transformCameraUpdate)return;const f=s.clone(),{center:d,zoom:m,pitch:v,bearing:C,elevation:T}=this.transformCameraUpdate(f);d&&(f.center=d),m!==void 0&&(f.zoom=m),v!==void 0&&(f.pitch=v),C!==void 0&&(f.bearing=C),T!==void 0&&(f.elevation=T),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new u.k("move",s)),this._zooming&&this.fire(new u.k("zoom",s)),this._rotating&&this.fire(new u.k("rotate",s)),this._pitching&&this.fire(new u.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const d=this._zooming,m=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new u.k("zoomend",s)),m&&this.fire(new u.k("rotateend",s)),v&&this.fire(new u.k("pitchend",s)),this.fire(new u.k("moveend",s))}flyTo(s,f){var d;if(!s.essential&&I.prefersReducedMotion){const wn=u.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(wn,f)}this.stop(),s=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b7},s);const m=this._getTransformForUpdate(),v=this.getZoom(),C=this.getBearing(),T=this.getPitch(),M=this.getPadding(),k="bearing"in s?this._normalizeBearing(s.bearing,C):C,O="pitch"in s?+s.pitch:T,F="padding"in s?s.padding:m.padding,W=u.P.convert(s.offset);let it=m.centerPoint.add(W);const rt=m.pointLocation(it),{center:at,zoom:$}=m.getConstrained(u.M.convert(s.center||rt),(d=s.zoom)!==null&&d!==void 0?d:v);this._normalizeCenter(at);const vt=m.zoomScale($-v),Rt=m.project(rt),ct=m.project(at).sub(Rt);let Et=s.curve;const Nt=Math.max(m.width,m.height),Ft=Nt/vt,Ht=ct.mag();if("minZoom"in s){const wn=u.ac(Math.min(s.minZoom,v,$),m.minZoom,m.maxZoom),Ue=Nt/m.zoomScale(wn-v);Et=Math.sqrt(Ue/Ht*2)}const te=Et*Et;function $t(wn){const Ue=(Ft*Ft-Nt*Nt+(wn?-1:1)*te*te*Ht*Ht)/(2*(wn?Ft:Nt)*te*Ht);return Math.log(Math.sqrt(Ue*Ue+1)-Ue)}function oe(wn){return(Math.exp(wn)-Math.exp(-wn))/2}function le(wn){return(Math.exp(wn)+Math.exp(-wn))/2}const $e=$t(!1);let ue=function(wn){return le($e)/le($e+Et*wn)},ze=function(wn){return Nt*((le($e)*(oe(Ue=$e+Et*wn)/le(Ue))-oe($e))/te)/Ht;var Ue},tn=($t(!0)-$e)/Et;if(Math.abs(Ht)<1e-6||!isFinite(tn)){if(Math.abs(Nt-Ft)<1e-6)return this.easeTo(s,f);const wn=Fts.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==k,this._pitching=O!==T,this._padding=!m.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(at),this._ease(wn=>{const Ue=wn*tn,rn=1/ue(Ue);m.zoom=wn===1?$:v+m.scaleZoom(rn),this._rotating&&(m.bearing=u.z.number(C,k,wn)),this._pitching&&(m.pitch=u.z.number(T,O,wn)),this._padding&&(m.interpolatePadding(M,F,wn),it=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(wn);const cn=wn===1?at:m.unproject(Rt.add(ct.mult(ze(Ue))).mult(rn));m.setLocationAtPoint(m.renderWorldCopies?cn.wrap():cn,it),this._applyUpdatedTransform(m),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,f)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,f,d){d.animate===!1||d.duration===0?(s(1),f()):(this._easeStart=I.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=u.b1(s,-180,180);const d=Math.abs(s-f);return Math.abs(s-360-f)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(u.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const gp={compact:!0,customAttribution:'MapLibre'};class _s{constructor(s=gp){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=P.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=P.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=P.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){P.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,f){const d=this._map._getUIString(`AttributionControl.${f}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const f=this._map.style.sourceCaches;for(const m in f){const v=f[m];if(v.used||v.usedForTerrain){const C=v.getSource();C.attribution&&s.indexOf(C.attribution)<0&&s.push(C.attribution)}}s=s.filter(m=>String(m).trim()),s.sort((m,v)=>m.length-v.length),s=s.filter((m,v)=>{for(let C=v+1;C=0)return!1;return!0});const d=s.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,s.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Mm{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const d=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=P.create("div","maplibregl-ctrl");const f=P.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){P.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class uc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const f=++this._id;return this._queue.push({callback:s,id:f,cancelled:!1}),f}remove(s){const f=this._currentlyRunning,d=f?this._queue.concat(f):this._queue;for(const m of d)if(m.id===s)return void(m.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const d of f)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Sr=u.X([{name:"a_pos3d",type:"Int16",components:3}]);class Br extends u.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,f){this.sourceCache.update(s,f),this._renderableTilesKeys=[];const d={};for(const m of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))d[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),u.aN(m.posMatrix,0,u.W,0,u.W,0,1),this._tiles[m.key]=new Ko(m,this.tileSize));for(const m in this._tiles)d[m]||delete this._tiles[m]}freeRtt(s){for(const f in this._tiles){const d=this._tiles[f];(!s||d.tileID.equals(s)||d.tileID.isChildOf(s)||s.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const f={};for(const d of this._renderableTilesKeys){const m=this._tiles[d].tileID;if(m.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),u.aN(v.posMatrix,0,u.W,0,u.W,0,1),f[d]=v}else if(m.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=m.canonical.z-s.canonical.z,T=m.canonical.x-(m.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,k,0,k,0,1),u.H(v.posMatrix,v.posMatrix,[-T*k,-M*k,0]),f[d]=v}else if(s.canonical.isChildOf(m.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=s.canonical.z-m.canonical.z,T=s.canonical.x-(s.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,u.W,0,u.W,0,1),u.H(v.posMatrix,v.posMatrix,[T*k,M*k,0]),u.J(v.posMatrix,v.posMatrix,[1/2**C,1/2**C,0]),f[d]=v}}return f}getSourceTile(s,f){const d=this.sourceCache._source;let m=s.overscaledZ-this.deltaZoom;if(m>d.maxzoom&&(m=d.maxzoom),m=d.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(m--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class Am{constructor(s,f,d){this.painter=s,this.sourceCache=new Br(f),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,f,d,m=u.W){var v;if(!(f>=0&&f=0&&ds.canonical.z&&(s.canonical.z>=m?v=s.canonical.z-m:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const C=s.canonical.x-(s.canonical.x>>v<>v<>8<<4|v>>8,f[C+3]=0;const d=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),m=new Q(s,d,s.gl.RGBA,{premultiply:!1});return m.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),d=this.painter.context,m=d.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(v,T-C-1,1,1,m.RGBA,m.UNSIGNED_BYTE,f),d.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),k=f[1]+((15&f[2])<<8),O=this.coordsIndex[255-f[3]],F=O&&this.sourceCache.getTileByID(O);if(!F)return null;const W=this._coordsTextureSize,it=(1<s.id!==f),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const ga={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class yp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new cc(s.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(f)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const m=s.sourceCaches[d].getVisibleCoordinates();for(const v of m){const C=this.terrain.sourceCache.getTerrainCoords(v);for(const T in C)this._coordsDescendingInv[d][T]||(this._coordsDescendingInv[d][T]=[]),this._coordsDescendingInv[d][T].push(C[T])}}this._coordsDescendingInvStr={};for(const d of s._order){const m=s._layers[d],v=m.source;if(ga[m.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(T=>T.key).sort().join()}}for(const d of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[m][d.tileID.key];v&&v!==d.rttCoords[m]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,d=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(ga[f]&&(this._prevType&&ga[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!m))return!0;if(ga[this._prevType]||ga[f]&&m){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(_h(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[v]){const k=this.pool.getObjectForId(T.rtt[v].id);if(k.stamp===T.rtt[v].stamp){this.pool.useObject(k);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[v]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:u.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let k=0;k{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},bp={showCompass:!0,showZoom:!0,visualizePitch:!1};class xp{constructor(s,f,d=!1){this.mousedown=C=>{this.startMouse(u.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),P.mousePos(this.element,C)),P.addEventListener(window,"mousemove",this.mousemove),P.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,P.mousePos(this.element,C))},this.mouseup=C=>{this.mouseRotate.dragEnd(C),this.mousePitch&&this.mousePitch.dragEnd(C),this.offTemp()},this.touchstart=C=>{C.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),P.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.moveTouch(C,this._lastPos))},this.touchend=C=>{C.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=hu({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:T,bearingDegreesPerPixelMoved:M=.8})=>{const k=new we;return new cu({clickTolerance:T,move:(O,F)=>({bearingDelta:(F.x-O.x)*M}),moveStateManager:k,enable:C,assignEvents:Ih})})({clickTolerance:m,enable:!0}),this.map=s,d&&(this.mousePitch=fu({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:T,pitchDegreesPerPixelMoved:M=-.5})=>{const k=new we;return new cu({clickTolerance:T,move:(O,F)=>({pitchDelta:(F.y-O.y)*M}),moveStateManager:k,enable:C,assignEvents:Ih})})({clickTolerance:v,enable:!0})),P.addEventListener(f,"mousedown",this.mousedown),P.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),P.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),P.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),P.disableDrag()}moveMouse(s,f){const d=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}moveTouch(s,f){const d=this.map,{bearingDelta:m}=this.touchRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}off(){const s=this.element;P.removeEventListener(s,"mousedown",this.mousedown),P.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend),P.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){P.enableDrag(),P.removeEventListener(window,"mousemove",this.mousemove),P.removeEventListener(window,"mouseup",this.mouseup),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend)}}let ya;function Ch(_,s,f){const d=new u.M(_.lng,_.lat);if(_=new u.M(_.lng,_.lat),s){const m=new u.M(_.lng-360,_.lat),v=new u.M(_.lng+360,_.lat),C=f.locationPoint(_).distSqr(s);f.locationPoint(m).distSqr(s)180;){const m=f.locationPoint(_);if(m.x>=0&&m.y>=0&&m.x<=f.width&&m.y<=f.height)break;_.lng>f.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&f.locationPoint(_).y>f.height/2-f.getHorizon()?_:d}const fc={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Th(_,s,f){const d=_.classList;for(const m in fc)d.remove(`maplibregl-${f}-anchor-${m}`);d.add(`maplibregl-${f}-anchor-${s}`)}class pc extends u.E{constructor(s){if(super(),this._onKeyPress=f=>{const d=f.code,m=f.charCode||f.keyCode;d!=="Space"&&d!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=f=>{const d=f.originalEvent.target,m=this._element;this._popup&&(d===m||m.contains(d))&&this.togglePopup()},this._update=f=>{var d;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Ch(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),P.setTransform(this._element,`${fc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${C} ${v}`),I.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=f.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new u.k("dragstart"))),this.fire(new u.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new u.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=u.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=P.create("div"),this._element.setAttribute("aria-label","Map marker");const f=P.createNS("http://www.w3.org/2000/svg","svg"),d=41,m=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${d}px`),f.setAttributeNS(null,"width",`${m}px`),f.setAttributeNS(null,"viewBox",`0 0 ${m} ${d}`);const v=P.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const C=P.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const T=P.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const vt of M){const Rt=P.createNS("http://www.w3.org/2000/svg","ellipse");Rt.setAttributeNS(null,"opacity","0.04"),Rt.setAttributeNS(null,"cx","10.5"),Rt.setAttributeNS(null,"cy","5.80029008"),Rt.setAttributeNS(null,"rx",vt.rx),Rt.setAttributeNS(null,"ry",vt.ry),T.appendChild(Rt)}const k=P.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);const O=P.createNS("http://www.w3.org/2000/svg","path");O.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),k.appendChild(O);const F=P.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const W=P.createNS("http://www.w3.org/2000/svg","path");W.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(W);const it=P.createNS("http://www.w3.org/2000/svg","g");it.setAttributeNS(null,"transform","translate(6.0, 7.0)"),it.setAttributeNS(null,"fill","#FFFFFF");const rt=P.createNS("http://www.w3.org/2000/svg","g");rt.setAttributeNS(null,"transform","translate(8.0, 8.0)");const at=P.createNS("http://www.w3.org/2000/svg","circle");at.setAttributeNS(null,"fill","#000000"),at.setAttributeNS(null,"opacity","0.25"),at.setAttributeNS(null,"cx","5.5"),at.setAttributeNS(null,"cy","5.5"),at.setAttributeNS(null,"r","5.4999962");const $=P.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),rt.appendChild(at),rt.appendChild($),C.appendChild(T),C.appendChild(k),C.appendChild(F),C.appendChild(it),C.appendChild(rt),f.appendChild(C),f.setAttributeNS(null,"height",d*this._scale+"px"),f.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(f),this._offset=u.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Th(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),P.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=u.M.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const m=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var f,d;if(!(!((f=this._map)===null||f===void 0)&&f.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,v=m.terrain.depthAtPoint(this._pos),C=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,C)-v<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/m.transform._pixelPerMeter,M=Math.sin(m.getPitch()*Math.PI/180)*T,k=m.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),O=m.transform.lngLatToCameraDepth(this._lngLat,C+M)-k>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&O&&this._popup.remove(),this._element.style.opacity=O?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=u.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,f){return s===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const Lh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let du=0,Tl=!1;const Ph={maxWidth:100,unit:"metric"};function Mh(_,s,f){const d=f&&f.maxWidth||100,m=_._container.clientHeight/2,v=_.unproject([0,m]),C=_.unproject([d,m]),T=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*T;M>5280?Ll(s,d,M/5280,_._getUIString("ScaleControl.Miles")):Ll(s,d,M,_._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Ll(s,d,T/1852,_._getUIString("ScaleControl.NauticalMiles")):T>=1e3?Ll(s,d,T/1e3,_._getUIString("ScaleControl.Kilometers")):Ll(s,d,T,_._getUIString("ScaleControl.Meters"))}function Ll(_,s,f,d){const m=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let T=v/C;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){const k=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*k)/k}(T),C*T}(f);_.style.width=s*(m/f)+"px",_.innerHTML=`${m} ${d}`}const wp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Sp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ah(_){if(_){if(typeof _=="number"){const s=Math.round(Math.abs(_)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,_),"top-left":new u.P(s,s),"top-right":new u.P(-s,s),bottom:new u.P(0,-_),"bottom-left":new u.P(s,-s),"bottom-right":new u.P(-s,-s),left:new u.P(_,0),right:new u.P(-_,0)}}if(_ instanceof u.P||Array.isArray(_)){const s=u.P.convert(_);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:u.P.convert(_.center||[0,0]),top:u.P.convert(_.top||[0,0]),"top-left":u.P.convert(_["top-left"]||[0,0]),"top-right":u.P.convert(_["top-right"]||[0,0]),bottom:u.P.convert(_.bottom||[0,0]),"bottom-left":u.P.convert(_["bottom-left"]||[0,0]),"bottom-right":u.P.convert(_["bottom-right"]||[0,0]),left:u.P.convert(_.left||[0,0]),right:u.P.convert(_.right||[0,0])}}return Ah(new u.P(0,0))}const km=y;h.AJAXError=u.be,h.Evented=u.E,h.LngLat=u.M,h.MercatorCoordinate=u.Y,h.Point=u.P,h.addProtocol=u.bf,h.config=u.a,h.removeProtocol=u.bg,h.AttributionControl=_s,h.BoxZoomHandler=gs,h.CanvasSource=ps,h.CooperativeGesturesHandler=Me,h.DoubleClickZoomHandler=dp,h.DragPanHandler=Pm,h.DragRotateHandler=ys,h.EdgeInsets=lu,h.FullscreenControl=class extends u.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:u.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){P.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=P.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);P.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new u.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},h.GeoJSONSource=Mr,h.GeolocateControl=class extends u.E{constructor(_){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new u.M(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,m=this._map.getBearing(),v=u.e({bearing:m},this.options.fitBoundsOptions),C=Ct.fromLngLat(f,d);this._map.fitBounds(C,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new u.M(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Tl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",f=>f.preventDefault()),this._geolocateButton=P.create("button","maplibregl-ctrl-geolocate",this._container),P.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=P.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new pc({element:this._dotElement}),this._circleElement=P.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new pc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new u.k("trackuserlocationend")))})}},this.options=u.e({},Lh,_)}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return u._(this,arguments,void 0,function*(s=!1){if(ya!==void 0&&!s)return ya;if(window.navigator.permissions===void 0)return ya=!!window.navigator.geolocation,ya;try{ya=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ya=!!window.navigator.geolocation}return ya})}().then(s=>this._setupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),P.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,du=0,Tl=!1}_isOutOfMapMaxBounds(_){const s=this._map.getMaxBounds(),f=_.coords;return s&&(f.longitudes.getEast()||f.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const _=this._map.getBounds(),s=_.getSouthEast(),f=_.getNorthEast(),d=s.distanceTo(f),m=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return u.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":du--,Tl=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new u.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new u.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),du++,du>1?(_={maximumAge:6e5,timeout:0},Tl=!0):(_=this.options.positionOptions,Tl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},h.Hash=cp,h.ImageSource=Kn,h.KeyboardHandler=Wa,h.LngLatBounds=Ct,h.LogoControl=Mm,h.Map=class extends po{constructor(_){if(u.bc.mark(u.bd.create),(_=u.e({},hc,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new vh(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new uc,this._controls=[],this._mapId=u.a3(),this._locale=u.e({},_p,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=q.addThrottleControl(()=>this.isMoving()),this._requestManager=new Y(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=up(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?f(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new mp(this,_),this._hash=_.hash&&new cp(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,u.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new _s(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Mm,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new u.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new u.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new u.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(_,s){if(s===void 0&&(s=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new u.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(f,d.firstChild):d.appendChild(f),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new u.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(_);return s>-1&&this._controls.splice(s,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,s,f,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,s,f,d)}resize(_){var s;const f=this._containerDimensions(),d=f[0],m=f[1],v=this._getClampedPixelRatio(d,m);if(this._resizeCanvas(d,m,v),this.painter.resize(d,m,v),this.painter.overLimit()){const T=this.painter.context.gl;this._maxCanvasSize=[T.drawingBufferWidth,T.drawingBufferHeight];const M=this._getClampedPixelRatio(d,m);this._resizeCanvas(d,m,M),this.painter.resize(d,m,M)}this.transform.resize(d,m),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,m);const C=!this._moving;return C&&(this.stop(),this.fire(new u.k("movestart",_)).fire(new u.k("move",_))),this.fire(new u.k("resize",_)),C&&this.fire(new u.k("moveend",_)),this}_getClampedPixelRatio(_,s){const{0:f,1:d}=this._maxCanvasSize,m=this.getPixelRatio(),v=_*m,C=s*m;return Math.min(v>f?f/v:1,C>d?d/C:1)*m}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(Ct.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(u.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(u.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,s,f){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const C=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];C.length?d||(d=!0,f.call(this,new fo(_,this,v.originalEvent,{features:C}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:C=>{(this.getLayer(s)?this.queryRenderedFeatures(C.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,f.call(this,new fo(_,this,C.originalEvent)))},mouseout:C=>{d&&(d=!1,f.call(this,new fo(_,this,C.originalEvent)))}}}}{const d=m=>{const v=this.getLayer(s)?this.queryRenderedFeatures(m.point,{layers:[s]}):[];v.length&&(m.features=v,f.call(this,m),delete m.features)};return{layer:s,listener:f,delegates:{[_]:d}}}}on(_,s,f){if(f===void 0)return super.on(_,s);const d=this._createDelegatedListener(_,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const m in d.delegates)this.on(m,d.delegates[m]);return this}once(_,s,f){if(f===void 0)return super.once(_,s);const d=this._createDelegatedListener(_,s,f);for(const m in d.delegates)this.once(m,d.delegates[m]);return this}off(_,s,f){return f===void 0?super.off(_,s):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const m=this._delegatedListeners[_];for(let v=0;vthis._updateStyle(_,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new Mo(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,s,f):this.style.loadJSON(_,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Mo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,s){if(typeof _=="string"){const f=this._requestManager.transformRequest(_,"Style");u.h(f,new AbortController).then(d=>{this._updateDiff(d.data,s)}).catch(d=>{d&&this.fire(new u.j(d))})}else typeof _=="object"&&this._updateDiff(_,s)}_updateDiff(_,s){try{this.style.setState(_,s)&&this._update(!0)}catch(f){u.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(_,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(_,s){return this._lazyInitEmptyStyle(),this.style.addSource(_,s),this._update(!0)}isSourceLoaded(_){const s=this.style&&this.style.sourceCaches[_];if(s!==void 0)return s.loaded();this.fire(new u.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const s=this.style.sourceCaches[_.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const d=this.style._layers[f];d.type==="hillshade"&&d.source===_.source&&u.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Am(this.painter,s,_),this.painter.renderToTexture=new yp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.k("terrain",{terrain:_})),this}getTerrain(){var _,s;return(s=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const s in _){const f=_[s]._tiles;for(const d in f){const m=f[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,s,f={}){const{pixelRatio:d=1,sdf:m=!1,stretchX:v,stretchY:C,content:T}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||u.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:k,data:O}=s,F=s;return this.style.addImage(_,{data:new u.R({width:M,height:k},new Uint8Array(O)),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:m,version:0,userImage:F}),F.onAdd&&F.onAdd(this,_),this}}{const{width:M,height:k,data:O}=I.getImageData(s);this.style.addImage(_,{data:new u.R({width:M,height:k},O),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:m,version:0})}}updateImage(_,s){const f=this.style.getImage(_);if(!f)return this.fire(new u.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=s instanceof HTMLImageElement||u.b(s)?I.getImageData(s):s,{width:m,height:v,data:C}=d;if(m===void 0||v===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==f.data.width||v!==f.data.height)return this.fire(new u.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const T=!(s instanceof HTMLImageElement||u.b(s));return f.data.replace(C,T),this.style.updateImage(_,f),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return q.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,s){return this._lazyInitEmptyStyle(),this.style.addLayer(_,s),this._update(!0)}moveLayer(_,s){return this.style.moveLayer(_,s),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,s,f){return this.style.setLayerZoomRange(_,s,f),this._update(!0)}setFilter(_,s,f={}){return this.style.setFilter(_,s,f),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,s,f,d={}){return this.style.setPaintProperty(_,s,f,d),this._update(!0)}getPaintProperty(_,s){return this.style.getPaintProperty(_,s)}setLayoutProperty(_,s,f,d={}){return this.style.setLayoutProperty(_,s,f,d),this._update(!0)}getLayoutProperty(_,s){return this.style.getLayoutProperty(_,s)}setGlyphs(_,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,s,f,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,s,f=>{f||this._update(!0)}),this}setLight(_,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,s){return this.style.setFeatureState(_,s),this._update()}removeFeatureState(_,s){return this.style.removeFeatureState(_,s),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,s=0;return this._container&&(_=this._container.clientWidth||400,s=this._container.clientHeight||300),[_,s]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const s=this._canvasContainer=P.create("div","maplibregl-canvas-container",_);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=P.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const f=this._containerDimensions(),d=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],d);const m=this._controlContainer=P.create("div","maplibregl-control-container",_),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=P.create("div",`maplibregl-ctrl-${C} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,s,f){this._canvas.width=Math.floor(f*_),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:_},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const f=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!f){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new _m(f,this.transform),z.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,v=I.now();this.style.zoomHistory.update(m,v);const C=new u.a8(m,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),T=C.crossFadingFactor();T===1&&T===this._crossFadingFactor||(f=!0,this._crossFadingFactor=T),this.style.update(C)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bc.mark(u.bd.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,u.bc.mark(u.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),q.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),P.remove(this._canvasContainer),P.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.bc.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(_=>{u.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return vp}getCameraTargetElevation(){return this.transform.elevation}},h.MapMouseEvent=fo,h.MapTouchEvent=Bs,h.MapWheelEvent=hp,h.Marker=pc,h.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,f)=>{const d=this._map._getUIString(`NavigationControl.${f}`);s.title=d,s.setAttribute("aria-label",d)},this.options=u.e({},bp,_),this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=P.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new xp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){P.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(_,s){const f=P.create("button",_,this._container);return f.type="button",f.addEventListener("click",s),f}},h.Popup=class extends u.E{constructor(_){super(),this.remove=()=>(this._content&&P.remove(this._content),this._container&&(P.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new u.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=P.create("div","maplibregl-popup",this._map.getContainer()),this._tip=P.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Ch(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!s)return;const d=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const v=Ah(this.options.offset);if(!m){const T=this._container.offsetWidth,M=this._container.offsetHeight;let k;k=d.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],d.xthis._map.transform.width-T/2&&k.push("right"),m=k.length===0?"bottom":k.join("-")}let C=d.add(v[m]);this.options.subpixelPositioning||(C=C.round()),P.setTransform(this._container,`${fc[m]} translate(${C.x}px,${C.y}px)`),Th(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(wp),_)}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=u.M.convert(_),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const s=document.createDocumentFragment(),f=document.createElement("body");let d;for(f.innerHTML=_;d=f.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=P.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=P.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Sp);_&&_.focus()}},h.RasterDEMTileSource=Ze,h.RasterTileSource=At,h.ScaleControl=class{constructor(_){this._onMove=()=>{Mh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Mh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ph),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){P.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},h.ScrollZoomHandler=Sh,h.Style=Mo,h.TerrainControl=class{constructor(_){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=_}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=P.create("button","maplibregl-ctrl-terrain",this._container),P.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){P.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},h.TwoFingersTouchPitchHandler=Cm,h.TwoFingersTouchRotateHandler=pp,h.TwoFingersTouchZoomHandler=Im,h.TwoFingersTouchZoomRotateHandler=ac,h.VectorTileSource=kn,h.VideoSource=Lo,h.addSourceType=(_,s)=>u._(void 0,void 0,void 0,function*(){if(Ba(_))throw new Error(`A source type called "${_}" already exists.`);((f,d)=>{Os[f]=d})(_,s)}),h.clearPrewarmedResources=function(){const _=mn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Pe),mn=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},h.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},h.getRTLTextPluginStatus=function(){return re().getRTLTextPluginStatus()},h.getVersion=function(){return km},h.getWorkerCount=function(){return un.workerCount},h.getWorkerUrl=function(){return u.a.WORKER_URL},h.importScriptInWorkers=function(_){return Pr().broadcast("IS",_)},h.prewarm=function(){An().acquire(Pe)},h.setMaxParallelImageRequests=function(_){u.a.MAX_PARALLEL_IMAGE_REQUESTS=_},h.setRTLTextPlugin=function(_,s){return re().setRTLTextPlugin(_,s)},h.setWorkerCount=function(_){un.workerCount=_},h.setWorkerUrl=function(_){u.a.WORKER_URL=_}});var a=n;return a})})(JE);var g4=JE.exports;const Es=dv(g4);var y4=Object.defineProperty,_4=(e,t,n)=>t in e?y4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ww=(e,t,n)=>(_4(e,typeof t!="symbol"?t+"":t,n),n);function gd(){}function $E(e){return e()}function Sw(){return Object.create(null)}function gy(e){e.forEach($E)}function tI(e){return typeof e=="function"}function v4(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function b4(e){return Object.keys(e).length===0}function x4(e,t){e.appendChild(t)}function w4(e,t,n){e.insertBefore(t,n||null)}function eI(e){e.parentNode&&e.parentNode.removeChild(e)}function Ew(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function xu(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function S4(e){return Array.from(e.childNodes)}function og(e,t,n){e.classList.toggle(t,!!n)}let Ov;function ud(e){Ov=e}const $h=[],Iw=[];let af=[];const Cw=[],E4=Promise.resolve();let U0=!1;function I4(){U0||(U0=!0,E4.then(nI))}function G0(e){af.push(e)}const a0=new Set;let Zh=0;function nI(){if(Zh!==0)return;const e=Ov;do{try{for(;Zh<$h.length;){const t=$h[Zh];Zh++,ud(t),C4(t.$$)}}catch(t){throw $h.length=0,Zh=0,t}for(ud(null),$h.length=0,Zh=0;Iw.length;)Iw.pop()();for(let t=0;te.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),af=t}const L4=new Set;function P4(e,t){e&&e.i&&(L4.delete(e),e.i(t))}function M4(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),G0(()=>{const a=e.$$.on_mount.map($E).filter(tI);e.$$.on_destroy?e.$$.on_destroy.push(...a):gy(a),e.$$.on_mount=[]}),i.forEach(G0)}function A4(e,t){const n=e.$$;n.fragment!==null&&(T4(n.after_update),gy(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function k4(e,t){e.$$.dirty[0]===-1&&($h.push(e),I4(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const R=z.length?z[0]:P;return w.ctx&&i(w.ctx[I],w.ctx[I]=R)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](R),S&&k4(e,I)),P}):[],w.update(),S=!0,gy(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const I=S4(t.target);w.fragment&&w.fragment.l(I),I.forEach(eI)}else w.fragment&&w.fragment.c();t.intro&&P4(e.$$.fragment),M4(e,t.target,t.anchor),nI()}ud(y)}class R4{constructor(){ww(this,"$$"),ww(this,"$$set")}$destroy(){A4(this,1),this.$destroy=gd}$on(t,n){if(!tI(n))return gd;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!b4(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const N4="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(N4);function O4(e){let t,n,r;return{c(){t=Ew("svg"),n=Ew("path"),xu(n,"stroke-width","4"),xu(n,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),xu(n,"class","svelte-gzo3ar"),xu(t,"width",r=e[0]==="list"?20:void 0),xu(t,"viewBox","0 0 70 85"),xu(t,"fill","none"),xu(t,"class","svelte-gzo3ar"),og(t,"in-map",e[0]!=="list"),og(t,"list-icon",e[0]==="list")},m(i,a){w4(i,t,a),x4(t,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&xu(t,"width",r),a&1&&og(t,"in-map",i[0]!=="list"),a&1&&og(t,"list-icon",i[0]==="list")},i:gd,o:gd,d(i){i&&eI(t)}}}function z4(e,t,n){let{displayIn:r}=t;return e.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class F4 extends R4{constructor(t){super(),D4(this,t,z4,O4,v4,{displayIn:0})}}const B4=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],V4={decimalLatitude:40.123,decimalLongitude:-74.123},U4=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],G4=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function q4(){const e=[];return B4.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...V4})}),[...e,...U4,...G4]}const j4=q4();j4.map(e=>e.verbatimCoordinates);/** +`),ut=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(ut,vt),T.compileShader(ut),!T.getShaderParameter(ut,T.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${T.getShaderInfoLog(ut)}`);T.attachShader(this.program,ut);const Et=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(Et,Rt),T.compileShader(Et),!T.getShaderParameter(Et,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(Et)}`);T.attachShader(this.program,Et),this.attributes={};const Nt={};this.numAttributes=O.length;for(let Ft=0;Ft({u_depth:new u.aG(Ft,Ht.u_depth),u_terrain:new u.aG(Ft,Ht.u_terrain),u_terrain_dim:new u.aH(Ft,Ht.u_terrain_dim),u_terrain_matrix:new u.aI(Ft,Ht.u_terrain_matrix),u_terrain_unpack:new u.aJ(Ft,Ht.u_terrain_unpack),u_terrain_exaggeration:new u.aH(Ft,Ht.u_terrain_exaggeration)}))(s,Nt),this.binderUniforms=d?d.getUniforms(s,Nt):[]}draw(s,f,d,m,v,C,T,M,k,O,F,H,it,rt,at,$,vt,Rt){const ut=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(m),s.setColorMode(v),s.setCullFace(C),M){s.activeTexture.set(ut.TEXTURE2),ut.bindTexture(ut.TEXTURE_2D,M.depthTexture),s.activeTexture.set(ut.TEXTURE3),ut.bindTexture(ut.TEXTURE_2D,M.texture);for(const Nt in this.terrainUniforms)this.terrainUniforms[Nt].set(M[Nt])}for(const Nt in this.fixedUniforms)this.fixedUniforms[Nt].set(T[Nt]);at&&at.setUniforms(s,this.binderUniforms,it,{zoom:rt});let Et=0;switch(f){case ut.LINES:Et=2;break;case ut.TRIANGLES:Et=3;break;case ut.LINE_STRIP:Et=1}for(const Nt of H.get()){const Ft=Nt.vaos||(Nt.vaos={});(Ft[k]||(Ft[k]=new Kc)).bind(s,this,O,at?at.getPaintVertexBuffers():[],F,Nt.vertexOffset,$,vt,Rt),ut.drawElements(f,Nt.primitiveLength*Et,ut.UNSIGNED_SHORT,Nt.primitiveOffset*Et*2)}}}function Jc(_,s,f){const d=1/je(f,1,s.transform.tileZoom),m=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/m,C=v*(f.tileID.canonical.x+f.tileID.wrap*m),T=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[C>>16,T>>16],u_pixel_coord_lower:[65535&C,65535&T]}}const Yu=(_,s,f,d)=>{const m=s.style.light,v=m.properties.get("position"),C=[v.x,v.y,v.z],T=function(){var k=new u.A(9);return u.A!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0),k[0]=1,k[4]=1,k[8]=1,k}();m.properties.get("anchor")==="viewport"&&function(k,O){var F=Math.sin(O),H=Math.cos(O);k[0]=H,k[1]=F,k[2]=0,k[3]=-F,k[4]=H,k[5]=0,k[6]=0,k[7]=0,k[8]=1}(T,-s.transform.angle),function(k,O,F){var H=O[0],it=O[1],rt=O[2];k[0]=H*F[0]+it*F[3]+rt*F[6],k[1]=H*F[1]+it*F[4]+rt*F[7],k[2]=H*F[2]+it*F[5]+rt*F[8]}(C,C,T);const M=m.properties.get("color");return{u_matrix:_,u_lightpos:C,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:d}},Ny=(_,s,f,d,m,v,C)=>u.e(Yu(_,s,f,d),Jc(v,s,C),{u_height_factor:-Math.pow(2,m.overscaledZ)/C.tileSize/8}),Jd=_=>({u_matrix:_}),Qc=(_,s,f,d)=>u.e(Jd(_),Jc(f,s,d)),Oy=(_,s)=>({u_matrix:_,u_world:s}),Qd=(_,s,f,d,m)=>u.e(Qc(_,s,f,d),{u_world:m}),zy=(_,s,f,d)=>{const m=_.transform;let v,C;if(d.paint.get("circle-pitch-alignment")==="map"){const T=je(f,1,m.zoom);v=!0,C=[T,T]}else v=!1,C=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(s.posMatrix,f,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:C}},$d=(_,s,f)=>{const d=je(f,1,s.zoom),m=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*m),s.pixelsToGLUnits[1]/(d*m)],u_overscale_factor:v}},tm=(_,s,f=1)=>({u_matrix:_,u_color:s,u_overlay:0,u_overlay_scale:f}),$c=_=>({u_matrix:_}),em=(_,s,f,d)=>({u_matrix:_,u_extrude_scale:je(s,1,f),u_intensity:d});function nm(_,s){const f=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new u.Y(0,d/f).toLngLat().lat,new u.Y(0,(d+1)/f).toLngLat().lat]}const th=(_,s,f,d)=>{const m=_.transform;return{u_matrix:Ku(_,s,f,d),u_ratio:1/je(s,1,m.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},rm=(_,s,f,d,m)=>u.e(th(_,s,f,m),{u_image:0,u_image_height:d}),xl=(_,s,f,d,m)=>{const v=_.transform,C=Ao(s,v);return{u_matrix:Ku(_,s,f,m),u_texsize:s.imageAtlasTexture.size,u_ratio:1/je(s,1,v.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[C,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},eh=(_,s,f,d,m,v)=>{const C=_.lineAtlas,T=Ao(s,_.transform),M=f.layout.get("line-cap")==="round",k=C.getDash(d.from,M),O=C.getDash(d.to,M),F=k.width*m.fromScale,H=O.width*m.toScale;return u.e(th(_,s,f,v),{u_patternscale_a:[T/F,-k.height/2],u_patternscale_b:[T/H,-O.height/2],u_sdfgamma:C.width/(256*Math.min(F,H)*_.pixelRatio)/2,u_image:0,u_tex_y_a:k.y,u_tex_y_b:O.y,u_mix:m.t})};function Ao(_,s){return 1/je(_,1,s.tileZoom)}function Ku(_,s,f,d){return _.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const nh=(_,s,f,d,m)=>{return{u_matrix:_,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(C=m.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(v=m.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:Ju(m.paint.get("raster-hue-rotate"))};var v,C};function Ju(_){_*=Math.PI/180;const s=Math.sin(_),f=Math.cos(_);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const Qu=(_,s,f,d,m,v,C,T,M,k)=>{const O=m.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:O.cameraToCenterDistance,u_pitch:O.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:O.width/O.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:T,u_is_text:+M,u_pitch_with_map:+d,u_texsize:k,u_texture:0}},$u=(_,s,f,d,m,v,C,T,M,k,O)=>{const F=m.transform;return u.e(Qu(_,s,f,d,m,v,C,T,M,k),{u_gamma_scale:d?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+O})},tc=(_,s,f,d,m,v,C,T,M,k)=>u.e($u(_,s,f,d,m,v,C,T,!0,M,!0),{u_texsize_icon:k,u_texture_icon:1}),Fy=(_,s,f)=>({u_matrix:_,u_opacity:s,u_color:f}),By=(_,s,f,d,m,v)=>u.e(function(C,T,M,k){const O=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:H,height:it}=M.imageManager.getPixelSize(),rt=Math.pow(2,k.tileID.overscaledZ),at=k.tileSize*Math.pow(2,M.transform.tileZoom)/rt,$=at*(k.tileID.canonical.x+k.tileID.wrap*rt),vt=at*k.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:O.tl,u_pattern_br_a:O.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[H,it],u_mix:T.t,u_pattern_size_a:O.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/je(k,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,vt>>16],u_pixel_coord_lower:[65535&$,65535&vt]}}(d,v,f,m),{u_matrix:_,u_opacity:s}),im={fillExtrusion:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_opacity:new u.aH(_,s.u_opacity)}),fillExtrusionPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_height_factor:new u.aH(_,s.u_height_factor),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade),u_opacity:new u.aH(_,s.u_opacity)}),fill:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),fillPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),fillOutline:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world)}),fillOutlinePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),circle:(_,s)=>({u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_scale_with_map:new u.aG(_,s.u_scale_with_map),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_matrix:new u.aI(_,s.u_matrix)}),collisionBox:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aH(_,s.u_pixels_to_tile_units),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_overscale_factor:new u.aH(_,s.u_overscale_factor)}),collisionCircle:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_inv_matrix:new u.aI(_,s.u_inv_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_viewport_size:new u.aL(_,s.u_viewport_size)}),debug:(_,s)=>({u_color:new u.aM(_,s.u_color),u_matrix:new u.aI(_,s.u_matrix),u_overlay:new u.aG(_,s.u_overlay),u_overlay_scale:new u.aH(_,s.u_overlay_scale)}),clippingMask:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),heatmap:(_,s)=>({u_extrude_scale:new u.aH(_,s.u_extrude_scale),u_intensity:new u.aH(_,s.u_intensity),u_matrix:new u.aI(_,s.u_matrix)}),heatmapTexture:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_color_ramp:new u.aG(_,s.u_color_ramp),u_opacity:new u.aH(_,s.u_opacity)}),hillshade:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_latrange:new u.aL(_,s.u_latrange),u_light:new u.aL(_,s.u_light),u_shadow:new u.aM(_,s.u_shadow),u_highlight:new u.aM(_,s.u_highlight),u_accent:new u.aM(_,s.u_accent)}),hillshadePrepare:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_dimension:new u.aL(_,s.u_dimension),u_zoom:new u.aH(_,s.u_zoom),u_unpack:new u.aJ(_,s.u_unpack)}),line:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels)}),lineGradient:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_image:new u.aG(_,s.u_image),u_image_height:new u.aH(_,s.u_image_height)}),linePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texsize:new u.aL(_,s.u_texsize),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_image:new u.aG(_,s.u_image),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),lineSDF:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_patternscale_a:new u.aL(_,s.u_patternscale_a),u_patternscale_b:new u.aL(_,s.u_patternscale_b),u_sdfgamma:new u.aH(_,s.u_sdfgamma),u_image:new u.aG(_,s.u_image),u_tex_y_a:new u.aH(_,s.u_tex_y_a),u_tex_y_b:new u.aH(_,s.u_tex_y_b),u_mix:new u.aH(_,s.u_mix)}),raster:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_tl_parent:new u.aL(_,s.u_tl_parent),u_scale_parent:new u.aH(_,s.u_scale_parent),u_buffer_scale:new u.aH(_,s.u_buffer_scale),u_fade_t:new u.aH(_,s.u_fade_t),u_opacity:new u.aH(_,s.u_opacity),u_image0:new u.aG(_,s.u_image0),u_image1:new u.aG(_,s.u_image1),u_brightness_low:new u.aH(_,s.u_brightness_low),u_brightness_high:new u.aH(_,s.u_brightness_high),u_saturation_factor:new u.aH(_,s.u_saturation_factor),u_contrast_factor:new u.aH(_,s.u_contrast_factor),u_spin_weights:new u.aK(_,s.u_spin_weights)}),symbolIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture)}),symbolSDF:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),symbolTextAndIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texsize_icon:new u.aL(_,s.u_texsize_icon),u_texture:new u.aG(_,s.u_texture),u_texture_icon:new u.aG(_,s.u_texture_icon),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),background:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_color:new u.aM(_,s.u_color)}),backgroundPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_image:new u.aG(_,s.u_image),u_pattern_tl_a:new u.aL(_,s.u_pattern_tl_a),u_pattern_br_a:new u.aL(_,s.u_pattern_br_a),u_pattern_tl_b:new u.aL(_,s.u_pattern_tl_b),u_pattern_br_b:new u.aL(_,s.u_pattern_br_b),u_texsize:new u.aL(_,s.u_texsize),u_mix:new u.aH(_,s.u_mix),u_pattern_size_a:new u.aL(_,s.u_pattern_size_a),u_pattern_size_b:new u.aL(_,s.u_pattern_size_b),u_scale_a:new u.aH(_,s.u_scale_a),u_scale_b:new u.aH(_,s.u_scale_b),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aH(_,s.u_tile_units_to_pixels)}),terrain:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainDepth:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainCoords:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_terrain_coords_id:new u.aH(_,s.u_terrain_coords_id),u_ele_delta:new u.aH(_,s.u_ele_delta)})};class Vy{constructor(s,f,d){this.context=s;const m=s.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const f=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const wl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class rh{constructor(s,f,d,m){this.length=f.length,this.attributes=d,this.itemSize=f.bytesPerElement,this.dynamicDraw=m,this.context=s;const v=s.gl;this.buffer=v.createBuffer(),s.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,f){for(let d=0;d0){const oe=u.F(),le=Ht;u.aP(oe,Ft.placementInvProjMatrix,_.transform.glCoordMatrix),u.aP(oe,oe,Ft.placementViewportMatrix),O.push({circleArray:$t,circleOffset:H,transform:le,invTransform:oe,coord:Et}),F+=$t.length/4,H=F}te&&k.draw(T,M.LINES,xn.disabled,tr.disabled,_.colorModeForRenderPass(),Yn.disabled,$d(Ht,_.transform,Nt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(Et),f.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,_.transform.zoom,null,null,te.collisionVertexBuffer)}if(!C||!O.length)return;const it=_.useProgram("collisionCircle"),rt=new u.aQ;rt.resize(4*F),rt._trim();let at=0;for(const ut of O)for(let Et=0;Et=0&&(rt[$.associatedIconIndex]={shiftedAnchor:$e,angle:ue})}else Xt($.numGlyphs,H)}if(k){it.clear();const at=_.icon.placedSymbolArray;for(let $=0;$_.style.map.terrain.getElevation(te,es,Jr):null,mr=f.layout.get("text-rotation-alignment")==="map";G(oe,te.posMatrix,_,m,Do,Gs,$,k,mr,Kr)}const Za=_.translatePosMatrix(te.posMatrix,$t,v,C),qs=vt||m&&Ft||dc?ip:Do,Yr=_.translatePosMatrix(Gs,$t,v,C,!0),dr=ue&&f.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ar;ar=ue?oe.iconsInText?tc(ze.kind,Ue,Rt,$,_,Za,qs,Yr,hn,ni):$u(ze.kind,Ue,Rt,$,_,Za,qs,Yr,m,hn,!0):Qu(ze.kind,Ue,Rt,$,_,Za,qs,Yr,m,hn);const ts={program:wn,buffers:le,uniformValues:ar,atlasTexture:Er,atlasTextureIcon:pr,atlasInterpolation:Gn,atlasInterpolationIcon:ko,isSDF:ue,hasHalo:dr};if(ut&&oe.canOverlap){Et=!0;const Kr=le.segments.get();for(const mr of Kr)Ht.push({segments:new u.$([mr]),sortKey:mr.sortKey,state:ts,terrainData:rn})}else Ht.push({segments:le.segments,sortKey:0,state:ts,terrainData:rn})}Et&&Ht.sort((te,$t)=>te.sortKey-$t.sortKey);for(const te of Ht){const $t=te.state;if(H.activeTexture.set(it.TEXTURE0),$t.atlasTexture.bind($t.atlasInterpolation,it.CLAMP_TO_EDGE),$t.atlasTextureIcon&&(H.activeTexture.set(it.TEXTURE1),$t.atlasTextureIcon&&$t.atlasTextureIcon.bind($t.atlasInterpolationIcon,it.CLAMP_TO_EDGE)),$t.isSDF){const oe=$t.uniformValues;$t.hasHalo&&(oe.u_is_halo=1,pm($t.buffers,te.segments,f,_,$t.program,Nt,O,F,oe,te.terrainData)),oe.u_is_halo=0}pm($t.buffers,te.segments,f,_,$t.program,Nt,O,F,$t.uniformValues,te.terrainData)}}function pm(_,s,f,d,m,v,C,T,M,k){const O=d.context;m.draw(O,O.gl.TRIANGLES,v,C,T,Yn.disabled,M,k,f.id,_.layoutVertexBuffer,_.indexBuffer,s,f.paint,d.transform.zoom,_.programConfigurations.get(f.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function dh(_,s,f,d,m){if(!f||!d||!d.imageAtlas)return;const v=d.imageAtlas.patternPositions;let C=v[f.to.toString()],T=v[f.from.toString()];if(!C&&T&&(C=T),!T&&C&&(T=C),!C||!T){const M=m.getPaintProperty(s);C=v[M],T=v[M]}C&&T&&_.setConstantPatternPositions(C,T)}function dm(_,s,f,d,m,v,C){const T=_.context.gl,M="fill-pattern",k=f.paint.get(M),O=k&&k.constantOr(1),F=f.getCrossfadeParameters();let H,it,rt,at,$;C?(it=O&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",H=T.LINES):(it=O?"fillPattern":"fill",H=T.TRIANGLES);const vt=k.constantOr(null);for(const Rt of d){const ut=s.getTile(Rt);if(O&&!ut.patternsLoaded())continue;const Et=ut.getBucket(f);if(!Et)continue;const Nt=Et.programConfigurations.get(f.id),Ft=_.useProgram(it,Nt),Ht=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Rt);O&&(_.context.activeTexture.set(T.TEXTURE0),ut.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Nt.updatePaintBuffers(F)),dh(Nt,M,vt,ut,f);const te=Ht?Rt:null,$t=_.translatePosMatrix(te?te.posMatrix:Rt.posMatrix,ut,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){at=Et.indexBuffer2,$=Et.segments2;const oe=[T.drawingBufferWidth,T.drawingBufferHeight];rt=it==="fillOutlinePattern"&&O?Qd($t,_,F,ut,oe):Oy($t,oe)}else at=Et.indexBuffer,$=Et.segments,rt=O?Qc($t,_,F,ut):Jd($t);Ft.draw(_.context,H,m,_.stencilModeForClipping(Rt),v,Yn.disabled,rt,Ht,f.id,Et.layoutVertexBuffer,at,$,f.paint,_.transform.zoom,Nt)}}function mh(_,s,f,d,m,v,C){const T=_.context,M=T.gl,k="fill-extrusion-pattern",O=f.paint.get(k),F=O.constantOr(1),H=f.getCrossfadeParameters(),it=f.paint.get("fill-extrusion-opacity"),rt=O.constantOr(null);for(const at of d){const $=s.getTile(at),vt=$.getBucket(f);if(!vt)continue;const Rt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(at),ut=vt.programConfigurations.get(f.id),Et=_.useProgram(F?"fillExtrusionPattern":"fillExtrusion",ut);F&&(_.context.activeTexture.set(M.TEXTURE0),$.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ut.updatePaintBuffers(H)),dh(ut,k,rt,$,f);const Nt=_.translatePosMatrix(at.posMatrix,$,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Ft=f.paint.get("fill-extrusion-vertical-gradient"),Ht=F?Ny(Nt,_,Ft,it,at,H,$):Yu(Nt,_,Ft,it);Et.draw(T,T.gl.TRIANGLES,m,v,C,Yn.backCCW,Ht,Rt,f.id,vt.layoutVertexBuffer,vt.indexBuffer,vt.segments,f.paint,_.transform.zoom,ut,_.style.map.terrain&&vt.centroidVertexBuffer)}}function gh(_,s,f,d,m,v,C){const T=_.context,M=T.gl,k=f.fbo;if(!k)return;const O=_.useProgram("hillshade"),F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(s);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,k.colorAttachment.get()),O.draw(T,M.TRIANGLES,m,v,C,Yn.disabled,((H,it,rt,at)=>{const $=rt.paint.get("hillshade-shadow-color"),vt=rt.paint.get("hillshade-highlight-color"),Rt=rt.paint.get("hillshade-accent-color");let ut=rt.paint.get("hillshade-illumination-direction")*(Math.PI/180);rt.paint.get("hillshade-illumination-anchor")==="viewport"&&(ut-=H.transform.angle);const Et=!H.options.moving;return{u_matrix:at?at.posMatrix:H.transform.calculatePosMatrix(it.tileID.toUnwrapped(),Et),u_image:0,u_latrange:nm(0,it.tileID),u_light:[rt.paint.get("hillshade-exaggeration"),ut],u_shadow:$,u_highlight:vt,u_accent:Rt}})(_,f,d,F?s:null),F,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function op(_,s,f,d,m,v){const C=_.context,T=C.gl,M=s.dem;if(M&&M.data){const k=M.dim,O=M.stride,F=M.getPixels();if(C.activeTexture.set(T.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||_.getTileTexture(O),s.demTexture){const it=s.demTexture;it.update(F,{premultiply:!1}),it.bind(T.NEAREST,T.CLAMP_TO_EDGE)}else s.demTexture=new Q(C,F,T.RGBA,{premultiply:!1}),s.demTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE);C.activeTexture.set(T.TEXTURE0);let H=s.fbo;if(!H){const it=new Q(C,{width:k,height:k,data:null},T.RGBA);it.bind(T.LINEAR,T.CLAMP_TO_EDGE),H=s.fbo=C.createFramebuffer(k,k,!0,!1),H.colorAttachment.set(it.texture)}C.bindFramebuffer.set(H.framebuffer),C.viewport.set([0,0,k,k]),_.useProgram("hillshadePrepare").draw(C,T.TRIANGLES,d,m,v,Yn.disabled,((it,rt)=>{const at=rt.stride,$=u.F();return u.aN($,0,u.W,-u.W,0,0,1),u.H($,$,[0,-u.W,0]),{u_matrix:$,u_image:1,u_dimension:[at,at],u_zoom:it.overscaledZ,u_unpack:rt.getUnpackVector()}})(s.tileID,M),null,f.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function mm(_,s,f,d,m,v){const C=d.paint.get("raster-fade-duration");if(!v&&C>0){const T=I.now(),M=(T-_.timeAdded)/C,k=s?(T-s.timeAdded)/C:-1,O=f.getSource(),F=m.coveringZoomLevel({tileSize:O.tileSize,roundZoom:O.roundZoom}),H=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(_.tileID.overscaledZ-F),it=H&&_.refreshedUponExpiration?1:u.ac(H?M:1-k,0,1);return _.refreshedUponExpiration&&M>=1&&(_.refreshedUponExpiration=!1),s?{opacity:1,mix:1-it}:{opacity:it,mix:0}}return{opacity:1,mix:0}}const gm=new u.aO(1,0,0,1),yh=new u.aO(0,1,0,1),sp=new u.aO(0,0,1,1),Yy=new u.aO(1,0,1,1),ym=new u.aO(0,1,1,1);function wr(_,s,f,d){$i(_,0,s+f/2,_.transform.width,f,d)}function Ga(_,s,f,d){$i(_,s-f/2,0,f,_.transform.height,d)}function $i(_,s,f,d,m,v){const C=_.context,T=C.gl;T.enable(T.SCISSOR_TEST),T.scissor(s*_.pixelRatio,f*_.pixelRatio,d*_.pixelRatio,m*_.pixelRatio),C.clear({color:v}),T.disable(T.SCISSOR_TEST)}function ap(_,s,f){const d=_.context,m=d.gl,v=f.posMatrix,C=_.useProgram("debug"),T=xn.disabled,M=tr.disabled,k=_.colorModeForRenderPass(),O="$debug",F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(f);d.activeTexture.set(m.TEXTURE0);const H=s.getTileByID(f.key).latestRawTileData,it=Math.floor((H&&H.byteLength||0)/1024),rt=s.getTile(f).tileSize,at=512/Math.min(rt,512)*(f.overscaledZ/_.transform.zoom)*.5;let $=f.canonical.toString();f.overscaledZ!==f.canonical.z&&($+=` => ${f.overscaledZ}`),function(vt,Rt){vt.initDebugOverlayCanvas();const ut=vt.debugOverlayCanvas,Et=vt.context.gl,Nt=vt.debugOverlayCanvas.getContext("2d");Nt.clearRect(0,0,ut.width,ut.height),Nt.shadowColor="white",Nt.shadowBlur=2,Nt.lineWidth=1.5,Nt.strokeStyle="white",Nt.textBaseline="top",Nt.font="bold 36px Open Sans, sans-serif",Nt.fillText(Rt,5,5),Nt.strokeText(Rt,5,5),vt.debugOverlayTexture.update(ut),vt.debugOverlayTexture.bind(Et.LINEAR,Et.CLAMP_TO_EDGE)}(_,`${$} ${it}kB`),C.draw(d,m.TRIANGLES,T,M,Fr.alphaBlended,Yn.disabled,tm(v,u.aO.transparent,at),null,O,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),C.draw(d,m.LINE_STRIP,T,M,k,Yn.disabled,tm(v,u.aO.red),F,O,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function _h(_,s,f){const d=_.context,m=d.gl,v=_.colorModeForRenderPass(),C=new xn(m.LEQUAL,xn.ReadWrite,_.depthRangeFor3D),T=_.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const k of f){const O=_.renderToTexture.getTexture(k),F=s.getTerrainData(k.tileID);d.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,O.texture);const H={u_matrix:_.transform.calculatePosMatrix(k.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(_.transform.zoom)};T.draw(d,m.TRIANGLES,C,tr.disabled,v,Yn.backCCW,H,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class _m{constructor(s,f){this.context=new Xy(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Hr.maxUnderzooming+Hr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Va}resize(s,f,d){if(this.width=Math.floor(s*d),this.height=Math.floor(f*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const s=this.context,f=new u.aV;f.emplaceBack(0,0),f.emplaceBack(u.W,0),f.emplaceBack(0,u.W),f.emplaceBack(u.W,u.W),this.tileExtentBuffer=s.createVertexBuffer(f,Yc.members),this.tileExtentSegments=u.$.simpleSegment(0,0,4,2);const d=new u.aV;d.emplaceBack(0,0),d.emplaceBack(u.W,0),d.emplaceBack(0,u.W),d.emplaceBack(u.W,u.W),this.debugBuffer=s.createVertexBuffer(d,Yc.members),this.debugSegments=u.$.simpleSegment(0,0,4,5);const m=new u.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(u.W,0,u.W,0),m.emplaceBack(0,u.W,0,u.W),m.emplaceBack(u.W,u.W,u.W,u.W),this.rasterBoundsBuffer=s.createVertexBuffer(m,on.members),this.rasterBoundsSegments=u.$.simpleSegment(0,0,4,2);const v=new u.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,Yc.members),this.viewportSegments=u.$.simpleSegment(0,0,4,2);const C=new u.aW;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(C);const T=new u.aX;T.emplaceBack(0,1,2),T.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(T);const M=this.context.gl;this.stencilClearMode=new tr({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=u.F();u.aN(d,0,this.width,this.height,0,0,1),u.J(d,d,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,xn.disabled,this.stencilClearMode,Fr.disabled,Yn.disabled,$c(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,f){if(this.currentStencilSource===s.source||!s.isTileClipped()||!f||!f.length)return;this.currentStencilSource=s.source;const d=this.context,m=d.gl;this.nextStencilID+f.length>256&&this.clearStencil(),d.setColorMode(Fr.disabled),d.setDepthMode(xn.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const T=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(d,m.TRIANGLES,xn.disabled,new tr({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),Fr.disabled,Yn.disabled,$c(C.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new tr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new tr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,d=s.sort((C,T)=>T.overscaledZ-C.overscaledZ),m=d[d.length-1].overscaledZ,v=d[0].overscaledZ-m+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const C={};for(let T=0;T=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],k=m[M.source],O=v[M.source];this._renderTileClippingMasks(M,O),this.renderLayer(this,k,M,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer$.source&&!$.isHidden(O)?[k.sourceCaches[$.source]]:[]),it=H.filter($=>$.getSource().type==="vector"),rt=H.filter($=>$.getSource().type!=="vector"),at=$=>{(!F||F.getSource().maxzoom<$.getSource().maxzoom)&&(F=$)};return it.forEach($=>at($)),F||rt.forEach($=>at($)),F}(this.style,this.transform.zoom);M&&function(k,O,F){for(let H=0;H0),m&&(u.a_(f,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const T=v.context,M=T.gl,k=Fr.unblended,O=new xn(M.LEQUAL,xn.ReadWrite,[0,1]),F=C.getTerrainMesh(),H=C.sourceCache.getRenderableTiles(),it=v.useProgram("terrainDepth");T.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1});for(const rt of H){const at=C.getTerrainData(rt.tileID),$={u_matrix:v.transform.calculatePosMatrix(rt.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};it.draw(T,M.TRIANGLES,O,tr.disabled,k,Yn.backCCW,$,at,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const T=v.context,M=T.gl,k=Fr.unblended,O=new xn(M.LEQUAL,xn.ReadWrite,[0,1]),F=C.getTerrainMesh(),H=C.getCoordsTexture(),it=C.sourceCache.getRenderableTiles(),rt=v.useProgram("terrainCoords");T.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1}),C.coordsIndex=[];for(const at of it){const $=C.getTerrainData(at.tileID);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,H.texture);const vt={u_matrix:v.transform.calculatePosMatrix(at.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};rt.draw(T,M.TRIANGLES,O,tr.disabled,k,Yn.backCCW,vt,$,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(at.tileID.key)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,d,m){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(m||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(v,C,T,M,k){if(v.renderPass!=="translucent")return;const O=tr.disabled,F=v.colorModeForRenderPass();(T._unevaluatedLayout.hasValue("text-variable-anchor")||T._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(H,it,rt,at,$,vt,Rt){const ut=it.transform,Et=$==="map",Nt=vt==="map";for(const Ft of H){const Ht=at.getTile(Ft),te=Ht.getBucket(rt);if(!te||!te.text||!te.text.segments.get().length)continue;const $t=u.ag(te.textSizeData,ut.zoom),oe=je(Ht,1,it.transform.zoom),le=Ye(Ft.posMatrix,Nt,Et,it.transform,oe),$e=rt.layout.get("icon-text-fit")!=="none"&&te.hasIconData();if($t){const ue=Math.pow(2,ut.zoom-Ht.tileID.overscaledZ);hh(te,Et,Nt,Rt,ut,le,Ft.posMatrix,ue,$t,$e,it.style.map.terrain?(ze,tn)=>it.style.map.terrain.getElevation(Ft,ze,tn):null)}}}(M,v,T,C,T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),k),T.paint.get("icon-opacity").constantOr(1)!==0&&ph(v,C,T,M,!1,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),T.layout.get("icon-rotation-alignment"),T.layout.get("icon-pitch-alignment"),T.layout.get("icon-keep-upright"),O,F),T.paint.get("text-opacity").constantOr(1)!==0&&ph(v,C,T,M,!0,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),T.layout.get("text-keep-upright"),O,F),C.map.showCollisionBoxes&&(ch(v,C,T,M,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),!0),ch(v,C,T,M,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),!1))})(s,f,d,m,this.style.placement.variableOffsets);break;case"circle":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("circle-opacity"),O=T.paint.get("circle-stroke-width"),F=T.paint.get("circle-stroke-opacity"),H=!T.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(O.constantOr(1)===0||F.constantOr(1)===0))return;const it=v.context,rt=it.gl,at=v.depthModeForSublayer(0,xn.ReadOnly),$=tr.disabled,vt=v.colorModeForRenderPass(),Rt=[];for(let ut=0;utut.sortKey-Et.sortKey);for(const ut of Rt){const{programConfiguration:Et,program:Nt,layoutVertexBuffer:Ft,indexBuffer:Ht,uniformValues:te,terrainData:$t}=ut.state;Nt.draw(it,rt.TRIANGLES,at,$,vt,Yn.disabled,te,$t,T.id,Ft,Ht,ut.segments,T.paint,v.transform.zoom,Et)}})(s,f,d,m);break;case"heatmap":(function(v,C,T,M){if(T.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const k=v.context,O=k.gl,F=tr.disabled,H=new Fr([O.ONE,O.ONE],u.aO.transparent,[!0,!0,!0,!0]);(function(it,rt,at){const $=it.gl;it.activeTexture.set($.TEXTURE1),it.viewport.set([0,0,rt.width/4,rt.height/4]);let vt=at.heatmapFbo;if(vt)$.bindTexture($.TEXTURE_2D,vt.colorAttachment.get()),it.bindFramebuffer.set(vt.framebuffer);else{const Rt=$.createTexture();$.bindTexture($.TEXTURE_2D,Rt),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_S,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_T,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MIN_FILTER,$.LINEAR),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MAG_FILTER,$.LINEAR),vt=at.heatmapFbo=it.createFramebuffer(rt.width/4,rt.height/4,!1,!1),function(ut,Et,Nt,Ft){var Ht,te;const $t=ut.gl,oe=(Ht=ut.HALF_FLOAT)!==null&&Ht!==void 0?Ht:$t.UNSIGNED_BYTE,le=(te=ut.RGBA16F)!==null&&te!==void 0?te:$t.RGBA;$t.texImage2D($t.TEXTURE_2D,0,le,Et.width/4,Et.height/4,0,$t.RGBA,oe,null),Ft.colorAttachment.set(Nt)}(it,rt,Rt,vt)}})(k,v,T),k.clear({color:u.aO.transparent});for(let it=0;it{const ut=u.F();u.aN(ut,0,at.width,at.height,0,0,1);const Et=at.context.gl;return{u_matrix:ut,u_world:[Et.drawingBufferWidth,Et.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:$.paint.get("heatmap-opacity")}})(k,O),null,O.id,k.viewportBuffer,k.quadTriangleIndexBuffer,k.viewportSegments,O.paint,k.transform.zoom)}(v,T))})(s,f,d,m);break;case"line":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("line-opacity"),O=T.paint.get("line-width");if(k.constantOr(1)===0||O.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,xn.ReadOnly),H=v.colorModeForRenderPass(),it=T.paint.get("line-dasharray"),rt=T.paint.get("line-pattern"),at=rt.constantOr(1),$=T.paint.get("line-gradient"),vt=T.getCrossfadeParameters(),Rt=at?"linePattern":it?"lineSDF":$?"lineGradient":"line",ut=v.context,Et=ut.gl;let Nt=!0;for(const Ft of M){const Ht=C.getTile(Ft);if(at&&!Ht.patternsLoaded())continue;const te=Ht.getBucket(T);if(!te)continue;const $t=te.programConfigurations.get(T.id),oe=v.context.program.get(),le=v.useProgram(Rt,$t),$e=Nt||le.program!==oe,ue=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ft),ze=rt.constantOr(null);if(ze&&Ht.imageAtlas){const Ue=Ht.imageAtlas,rn=Ue.patternPositions[ze.to.toString()],hn=Ue.patternPositions[ze.from.toString()];rn&&hn&&$t.setConstantPatternPositions(rn,hn)}const tn=ue?Ft:null,wn=at?xl(v,Ht,T,vt,tn):it?eh(v,Ht,T,it,vt,tn):$?rm(v,Ht,T,te.lineClipsArray.length,tn):th(v,Ht,T,tn);if(at)ut.activeTexture.set(Et.TEXTURE0),Ht.imageAtlasTexture.bind(Et.LINEAR,Et.CLAMP_TO_EDGE),$t.updatePaintBuffers(vt);else if(it&&($e||v.lineAtlas.dirty))ut.activeTexture.set(Et.TEXTURE0),v.lineAtlas.bind(ut);else if($){const Ue=te.gradients[T.id];let rn=Ue.texture;if(T.gradientVersion!==Ue.version){let hn=256;if(T.stepInterpolant){const Er=C.getSource().maxzoom,Gn=Ft.canonical.z===Er?Math.ceil(1<0?f.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const f=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!f||!d}useProgram(s,f){this.cache=this.cache||{};const d=s+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Ua(this.context,Xu[s],f,im[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Q(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:f}=this.context.gl;return this.width!==s||this.height!==f}}class qa{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,d){const m=Math.pow(2,d),v=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(T=>{const M=1/(T=u.af([],T,s))[3]/f*m;return u.a$(T,T,[M,M,1/T[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{const M=function(H,it){var rt=it[0],at=it[1],$=it[2],vt=rt*rt+at*at+$*$;return vt>0&&(vt=1/Math.sqrt(vt)),H[0]=it[0]*vt,H[1]=it[1]*vt,H[2]=it[2]*vt,H}([],function(H,it,rt){var at=it[0],$=it[1],vt=it[2],Rt=rt[0],ut=rt[1],Et=rt[2];return H[0]=$*Et-vt*ut,H[1]=vt*Rt-at*Et,H[2]=at*ut-$*Rt,H}([],ht([],v[T[0]],v[T[1]]),ht([],v[T[2]],v[T[1]]))),k=-((O=M)[0]*(F=v[T[1]])[0]+O[1]*F[1]+O[2]*F[2]);var O,F;return M.concat(k)});return new qa(v,C)}}class ja{constructor(s,f){this.min=s,this.max=f,this.center=function(d,m,v){return d[0]=.5*m[0],d[1]=.5*m[1],d[2]=.5*m[2],d}([],function(d,m,v){return d[0]=m[0]+v[0],d[1]=m[1]+v[1],d[2]=m[2]+v[2],d}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],d=_t(this.min),m=_t(this.max);for(let v=0;v=0&&C++;if(C===0)return 0;C!==f.length&&(d=!1)}if(d)return 2;for(let m=0;m<3;m++){let v=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let T=0;Tthis.max[m]-this.min[m])return 0}return 1}}class lu{constructor(s=0,f=0,d=0,m=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(d)||d<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=d,this.right=m}interpolate(s,f,d){return f.top!=null&&s.top!=null&&(this.top=u.z.number(s.top,f.top,d)),f.bottom!=null&&s.bottom!=null&&(this.bottom=u.z.number(s.bottom,f.bottom,d)),f.left!=null&&s.left!=null&&(this.left=u.z.number(s.left,f.left,d)),f.right!=null&&s.right!=null&&(this.right=u.z.number(s.right,f.right,d)),this}getCenter(s,f){const d=u.ac((this.left+s-this.right)/2,0,s),m=u.ac((this.top+f-this.bottom)/2,0,f);return new u.P(d,m)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new lu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const lp=85.051129;class vh{constructor(s,f,d,m,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=d??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new u.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new lu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new vh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-u.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var d=new u.A(4);return u.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,m,v){var C=m[0],T=m[1],M=m[2],k=m[3],O=Math.sin(v),F=Math.cos(v);d[0]=C*F+M*O,d[1]=T*F+k*O,d[2]=C*-O+M*F,d[3]=T*-O+k*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=u.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const f=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,f,d){this._unmodified=!1,this._edgeInsets.interpolate(s,f,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const f=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(s){const f=[new u.b2(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new u.P(0,0)),m=this.pointCoordinate(new u.P(this.width,0)),v=this.pointCoordinate(new u.P(this.width,this.height)),C=this.pointCoordinate(new u.P(0,this.height)),T=Math.floor(Math.min(d.x,m.x,v.x,C.x)),M=Math.floor(Math.max(d.x,m.x,v.x,C.x)),k=1;for(let O=T-k;O<=M+k;O++)O!==0&&f.push(new u.b2(O,s))}return f}coveringTiles(s){var f,d;let m=this.coveringZoomLevel(s);const v=m;if(s.minzoom!==void 0&&ms.maxzoom&&(m=s.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),T=u.Y.fromLngLat(this.center),M=Math.pow(2,m),k=[M*C.x,M*C.y,0],O=[M*T.x,M*T.y,0],F=qa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let H=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(H=m);const it=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,rt=ut=>({aabb:new ja([ut*M,0,0],[(ut+1)*M,M,0]),zoom:0,x:0,y:0,wrap:ut,fullyVisible:!1}),at=[],$=[],vt=m,Rt=s.reparseOverscaled?v:m;if(this._renderWorldCopies)for(let ut=1;ut<=3;ut++)at.push(rt(-ut)),at.push(rt(ut));for(at.push(rt(0));at.length>0;){const ut=at.pop(),Et=ut.x,Nt=ut.y;let Ft=ut.fullyVisible;if(!Ft){const le=ut.aabb.intersects(F);if(le===0)continue;Ft=le===2}const Ht=s.terrain?k:O,te=ut.aabb.distanceX(Ht),$t=ut.aabb.distanceY(Ht),oe=Math.max(Math.abs(te),Math.abs($t));if(ut.zoom===vt||oe>it+(1<=H){const le=vt-ut.zoom,$e=k[0]-.5-(Et<>1),ze=ut.zoom+1;let tn=ut.aabb.quadrant(le);if(s.terrain){const wn=new u.Q(ze,ut.wrap,ze,$e,ue),Ue=s.terrain.getMinMaxElevation(wn),rn=(f=Ue.minElevation)!==null&&f!==void 0?f:this.elevation,hn=(d=Ue.maxElevation)!==null&&d!==void 0?d:this.elevation;tn=new ja([tn.min[0],tn.min[1],rn],[tn.max[0],tn.max[1],hn])}at.push({aabb:tn,zoom:ze,x:$e,y:ue,wrap:ut.wrap,fullyVisible:Ft})}}return $.sort((ut,Et)=>ut.distanceSq-Et.distanceSq).map(ut=>ut.tileID)}resize(s,f){this.width=s,this.height=f,this.pixelsToGLUnits=[2/s,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const f=u.ac(s.lat,-85.051129,lp);return new u.P(u.N(s.lng)*this.worldSize,u.O(f)*this.worldSize)}unproject(s){return new u.Y(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const f=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-v))return;const C=d+f-v,T=Math.cos(this._pitch)*this.cameraToCenterDistance/C/u.b3(1,m.lat),M=this.scaleZoom(T/this.tileSize);this._elevation=v,this._center=m,this.zoom=M}setLocationAtPoint(s,f){const d=this.pointCoordinate(f),m=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),C=new u.Y(v.x-(d.x-m.x),v.y-(d.y-m.y));this.center=this.coordinateLocation(C),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,f){return f?this.coordinatePoint(this.locationCoordinate(s),f.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,f){return this.coordinateLocation(this.pointCoordinate(s,f))}locationCoordinate(s){return u.Y.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,f){if(f){const H=f.pointCoordinate(s);if(H!=null)return H}const d=[s.x,s.y,0,1],m=[s.x,s.y,1,1];u.af(d,d,this.pixelMatrixInverse),u.af(m,m,this.pixelMatrixInverse);const v=d[3],C=m[3],T=d[1]/v,M=m[1]/C,k=d[2]/v,O=m[2]/C,F=k===O?0:(0-k)/(O-k);return new u.Y(u.z.number(d[0]/v,m[0]/C,F)/this.worldSize,u.z.number(T,M,F)/this.worldSize)}coordinatePoint(s,f=0,d=this.pixelMatrix){const m=[s.x*this.worldSize,s.y*this.worldSize,f,1];return u.af(m,m,d),new u.P(m[0]/m[3],m[1]/m[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Ct().extend(this.pointLocation(new u.P(0,s))).extend(this.pointLocation(new u.P(this.width,s))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ct([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,lp])}calculatePosMatrix(s,f=!1){const d=s.key,m=f?this._alignedPosMatrixCache:this._posMatrixCache;if(m[d])return m[d];const v=s.canonical,C=this.worldSize/this.zoomScale(v.z),T=v.x+Math.pow(2,v.z)*s.wrap,M=u.an(new Float64Array(16));return u.H(M,M,[T*C,v.y*C,0]),u.J(M,M,[C/u.W,C/u.W,1]),u.K(M,f?this.alignedProjMatrix:this.projMatrix,M),m[d]=new Float32Array(M),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=u.ac(+f,this.minZoom,this.maxZoom);const d={center:new u.M(s.lng,s.lat),zoom:f};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ut=179.9999999999;m=[-ut,ut]}const v=this.tileSize*this.zoomScale(d.zoom);let C=0,T=v,M=0,k=v,O=0,F=0;const{x:H,y:it}=this.size;if(this.latRange){const ut=this.latRange;C=u.O(ut[1])*v,T=u.O(ut[0])*v,T-CT&&(vt=T-ut)}if(m){const ut=(M+k)/2;let Et=rt;this._renderWorldCopies&&(Et=u.b1(rt,ut-v/2,ut+v/2));const Nt=H/2;Et-Ntk&&($=k-Nt)}if($!==void 0||vt!==void 0){const ut=new u.P($??rt,vt??at);d.center=this.unproject.call({worldSize:v},ut).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=d,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b3(1,this.center.lat)*this.worldSize;let m=u.an(new Float64Array(16));u.J(m,m,[this.width/2,-this.height/2,1]),u.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=u.an(new Float64Array(16)),u.J(m,m,[1,-1,1]),u.H(m,m,[-1,-1,0]),u.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),T=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?T:v,k=Math.PI/2+this._pitch,O=this._fov*(.5+s.y/this.height),F=Math.sin(O)*M/Math.sin(u.ac(Math.PI-k-O,.01,Math.PI-.01)),H=this.getHorizon(),it=2*Math.atan(H/this.cameraToCenterDistance)*(.5+s.y/(2*H)),rt=Math.sin(it)*M/Math.sin(u.ac(Math.PI-k-it,.01,Math.PI-.01)),at=Math.min(F,rt),$=1.01*(Math.cos(Math.PI/2-this._pitch)*at+M),vt=this.height/50;m=new Float64Array(16),u.b4(m,this._fov,this.width/this.height,vt,$),m[8]=2*-s.x/this.width,m[9]=2*s.y/this.height,u.J(m,m,[1,-1,1]),u.H(m,m,[0,0,-this.cameraToCenterDistance]),u.b5(m,m,this._pitch),u.ad(m,m,this.angle),u.H(m,m,[-f,-d,0]),this.mercatorMatrix=u.J([],m,[this.worldSize,this.worldSize,this.worldSize]),u.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.K(new Float64Array(16),this.labelPlaneMatrix,m),u.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=u.ar([],m),this.pixelMatrix3D=u.K(new Float64Array(16),this.labelPlaneMatrix,m);const Rt=this.width%2/2,ut=this.height%2/2,Et=Math.cos(this.angle),Nt=Math.sin(this.angle),Ft=f-Math.round(f)+Et*Rt+Nt*ut,Ht=d-Math.round(d)+Et*ut+Nt*Rt,te=new Float64Array(m);if(u.H(te,te,[Ft>.5?Ft-1:Ft,Ht>.5?Ht-1:Ht,0]),this.alignedProjMatrix=te,m=u.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new u.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return u.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let d=f.x,m=f.y,v=f.x,C=f.y;for(const T of s)d=Math.min(d,T.x),m=Math.min(m,T.y),v=Math.max(v,T.x),C=Math.max(C,T.y);return[new u.P(d,m),new u.P(v,m),new u.P(v,C),new u.P(d,C),new u.P(d,m)]}}lngLatToCameraDepth(s,f){const d=this.locationCoordinate(s),m=[d.x*this.worldSize,d.y*this.worldSize,f,1];return u.af(m,m,this.projMatrix),m[2]/m[3]}}function up(_,s){let f,d=!1,m=null,v=null;const C=()=>{m=null,d&&(_.apply(v,f),m=setTimeout(C,s),d=!1)};return(...T)=>(d=!0,v=this,f=T,m||C(),m)}class cp{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let d;return f.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(d=m)}),(d&&d[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:d,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const f=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,f)}catch{}},this._updateHash=up(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(s){const f=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,m=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,m),C=Math.round(f.lng*v)/v,T=Math.round(f.lat*v)/v,M=this._map.getBearing(),k=this._map.getPitch();let O="";if(O+=s?`/${C}/${T}/${d}`:`${d}/${T}/${C}`,(M||k)&&(O+="/"+Math.round(10*M)/10),k&&(O+=`/${Math.round(k)}`),this._hashName){const F=this._hashName;let H=!1;const it=window.location.hash.slice(1).split("&").map(rt=>{const at=rt.split("=")[0];return at===F?(H=!0,`${at}=${O}`):rt}).filter(rt=>rt);return H||it.push(`${F}=${O}`),`#${it.join("&")}`}return`#${O}`}}const nc={linearity:.3,easing:u.b6(0,0,.3,1)},Il=u.e({deceleration:2500,maxSpeed:1400},nc),vm=u.e({deceleration:20,maxSpeed:1400},nc),bm=u.e({deceleration:1e3,maxSpeed:360},nc),xm=u.e({deceleration:1e3,maxSpeed:90},nc);class wm{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:I.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,f=I.now();for(;s.length>0&&f-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)f.zoom+=v.zoomDelta||0,f.bearing+=v.bearingDelta||0,f.pitch+=v.pitchDelta||0,v.panDelta&&f.pan._add(v.panDelta),v.around&&(f.around=v.around),v.pinchAround&&(f.pinchAround=v.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(f.pan.mag()){const v=ic(f.pan.mag(),d,u.e({},Il,s||{}));m.offset=f.pan.mult(v.amount/f.pan.mag()),m.center=this._map.transform.center,rc(m,v)}if(f.zoom){const v=ic(f.zoom,d,vm);m.zoom=this._map.transform.zoom+v.amount,rc(m,v)}if(f.bearing){const v=ic(f.bearing,d,bm);m.bearing=this._map.transform.bearing+u.ac(v.amount,-179,179),rc(m,v)}if(f.pitch){const v=ic(f.pitch,d,xm);m.pitch=this._map.transform.pitch+v.amount,rc(m,v)}if(m.zoom||m.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;m.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),u.e(m,{noMoveStart:!0})}}function rc(_,s){(!_.duration||_.durationf.unproject(M)),T=v.reduce((M,k,O,F)=>M.add(k.div(F.length)),new u.P(0,0));super(s,{points:v,point:T,lngLats:C,lngLat:f.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class hp extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class ms{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new hp(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new fo(s.type,this._map,s))}mouseup(s){this._map.fire(new fo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new fo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new fo(s.type,this._map,s))}mouseover(s){this._map.fire(new fo(s.type,this._map,s))}mouseout(s){this._map.fire(new fo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Bs(s.type,this._map,s))}touchmove(s){this._map.fire(new Bs(s.type,this._map,s))}touchend(s){this._map.fire(new Bs(s.type,this._map,s))}touchcancel(s){this._map.fire(new Bs(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new fo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new fo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new fo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class uu{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(u.P.convert(s),this._map.terrain)}}class gs{constructor(s,f){this._map=s,this._tr=new uu(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(P.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const d=f;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)v.fitScreenCoordinates(d,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(P.remove(this._box),this._box=null),P.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new u.k(s,{originalEvent:f}))}}function Cl(_,s){if(_.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${s.length}`);const f={};for(let d=0;d<_.length;d++)f[_[d].identifier]=s[d];return f}class Ky{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,f,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(m){const v=new u.P(0,0);for(const C of m)v._add(C);return v.div(m.length)}(f),this.touches=Cl(d,f)))}touchmove(s,f,d){if(this.aborted||!this.centroid)return;const m=Cl(d,f);for(const v in this.touches){const C=m[v];(!C||C.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,f,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class fp{constructor(s){this.singleTap=new Ky(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,f,d){this.singleTap.touchstart(s,f,d)}touchmove(s,f,d){this.singleTap.touchmove(s,f,d)}touchend(s,f,d){const m=this.singleTap.touchend(s,f,d);if(m){const v=s.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(m)<30;if(v&&C||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Jy{constructor(s){this._tr=new uu(s),this._zoomIn=new fp({numTouches:1,numTaps:2}),this._zoomOut=new fp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,d){this._zoomIn.touchstart(s,f,d),this._zoomOut.touchstart(s,f,d)}touchmove(s,f,d){this._zoomIn.touchmove(s,f,d),this._zoomOut.touchmove(s,f,d)}touchend(s,f,d){const m=this._zoomIn.touchend(s,f,d),v=this._zoomOut.touchend(s,f,d),C=this._tr;return m?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(m)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(v)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cu{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const m=f.length?f[0]:f;return!this._moved&&m.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(s){s.preventDefault()}},hu=({enable:_,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const d=new Us({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new cu({clickTolerance:s,move:(m,v)=>({bearingDelta:(v.x-m.x)*f}),moveStateManager:d,enable:_,assignEvents:bh})},fu=({enable:_,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const d=new Us({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new cu({clickTolerance:s,move:(m,v)=>({pitchDelta:(v.y-m.y)*f}),moveStateManager:d,enable:_,assignEvents:bh})};class Sm{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,d){return this._calculateTransform(s,f,d)}touchmove(s,f,d){if(this._active&&!(d.length0&&(this._active=!0);const m=Cl(d,f),v=new u.P(0,0),C=new u.P(0,0);let T=0;for(const k in m){const O=m[k],F=this._touches[k];F&&(v._add(O),C._add(O.sub(F)),T++,m[k]=O)}if(this._touches=m,TMath.abs(_.x)}class Cm extends ge{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,d){super.touchstart(s,f,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,wh(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,v,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(m.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,d){if(this._valid!==void 0)return this._valid;const m=s.mag()>=2,v=f.mag()>=2;if(!m&&!v)return;if(!m||!v)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const C=s.y>0==f.y>0;return wh(s)&&wh(f)&&C}}const Qy={panStep:100,bearingStep:15,pitchStep:10};class Wa{constructor(s){this._tr=new uu(s);const f=Qy;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let f=0,d=0,m=0,v=0,C=0;switch(s.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?m=1:(s.preventDefault(),C=-1);break;case 40:s.shiftKey?m=-1:(s.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(d=0,m=0),{cameraAnimation:T=>{const M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:sr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+m*this._pitchStep,offset:[-v*this._panStep,-C*this._panStep],center:M.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function sr(_){return _*(2-_)}const sc=4.000244140625;class Sh{constructor(s,f){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new uu(s),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=I.now(),m=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,f!==0&&f%sc==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(m*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),s.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=s,this._delta-=f,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const f=P.mousePos(this._map.getCanvas(),s),d=this._tr;this._around=f.y>d.transform.height/2-d.transform.getHorizon()?u.M.convert(this._aroundCenter?d.center:d.unproject(f)):u.M.convert(d.center),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>sc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&M!==0&&(M=1/M);const k=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(k*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,m=this._easing;let v,C=!1;if(this._type==="wheel"&&d&&m){const T=Math.min((I.now()-this._lastWheelEventTime)/200,1),M=m(T);v=u.z.number(d,f,M),T<1?this._frameId||(this._frameId=!0):C=!0}else v=f,C=!0;return this._active=!0,C&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!C,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=u.b7;if(this._prevEase){const d=this._prevEase,m=(I.now()-d.start)/d.duration,v=d.easing(m+.01)-d.easing(m),C=.27/Math.sqrt(v*v+1e-4)*.01,T=Math.sqrt(.0729-C*C);f=u.b6(C,T,.25,1)}return this._prevEase={start:I.now(),duration:s,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class dp{constructor(s,f){this._clickZoom=s,this._tapZoom=f}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Tm{constructor(s){this._tr=new uu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Lm{constructor(){this._tap=new fp({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,f,d){if(!this._swipePoint)if(this._tapTime){const m=f[0],v=s.timeStamp-this._tapTime<500,C=this._tapPoint.dist(m)<30;v&&C?d.length>0&&(this._swipePoint=m,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,f,d)}touchmove(s,f,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const m=f[0],v=m.y-this._swipePoint.y;return this._swipePoint=m,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,f,d)}touchend(s,f,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const m=this._tap.touchend(s,f,d);m&&(this._tapTime=s.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pm{constructor(s,f,d){this._el=s,this._mousePan=f,this._touchPan=d}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ys{constructor(s,f,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ac{constructor(s,f,d,m){this._el=s,this._touchZoom=f,this._touchRotate=d,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Me{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=P.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=f,this._container.appendChild(m);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=d,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(P.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Oe=_=>_.zoom||_.drag||_.pitch||_.rotate;class Eh extends u.k{}function lc(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class mp{constructor(s,f){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,v)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=m.type==="renderFrame"?void 0:m,T={needsRenderFrame:!1},M={},k={},O=m.touches,F=O?this._getMapTouches(O):void 0,H=F?P.touchPos(this._map.getCanvas(),F):P.mousePos(this._map.getCanvas(),m);for(const{handlerName:at,handler:$,allowed:vt}of this._handlers){if(!$.isEnabled())continue;let Rt;this._blockedByActive(k,vt,at)?$.reset():$[v||m.type]&&(Rt=$[v||m.type](m,H,F),this.mergeHandlerResult(T,M,Rt,at,C),Rt&&Rt.needsRenderFrame&&this._triggerRenderFrame()),(Rt||$.isActive())&&(k[at]=$)}const it={};for(const at in this._previousActiveHandlers)k[at]||(it[at]=C);this._previousActiveHandlers=k,(Object.keys(it).length||lc(T))&&(this._changes.push([T,M,it]),this._triggerRenderFrame()),(Object.keys(k).length||lc(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:rt}=T;rt&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],rt(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new wm(s),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,v,C]of this._listeners)P.addEventListener(m,v,m===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,d]of this._listeners)P.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const f=this._map,d=f.getCanvasContainer();this._add("mapEvent",new ms(f,s));const m=f.boxZoom=new gs(f,s);this._add("boxZoom",m),s.interactive&&s.boxZoom&&m.enable();const v=f.cooperativeGestures=new Me(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new Jy(f),T=new Tm(f);f.doubleClickZoom=new dp(T,C),this._add("tapZoom",C),this._add("clickZoom",T),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new Lm;this._add("tapDragZoom",M);const k=f.touchPitch=new Cm(f);this._add("touchPitch",k),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const O=hu(s),F=fu(s);f.dragRotate=new ys(s,O,F),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const H=(({enable:Rt,clickTolerance:ut})=>{const Et=new Us({checkCorrectEvent:Nt=>P.mouseButton(Nt)===0&&!Nt.ctrlKey});return new cu({clickTolerance:ut,move:(Nt,Ft)=>({around:Ft,panDelta:Ft.sub(Nt)}),activateOnStart:!0,moveStateManager:Et,enable:Rt,assignEvents:bh})})(s),it=new Sm(s,f);f.dragPan=new Pm(d,H,it),this._add("mousePan",H),this._add("touchPan",it,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const rt=new pp,at=new Im;f.touchZoomRotate=new ac(d,at,rt,M),this._add("touchRotate",rt,["touchPan","touchZoom"]),this._add("touchZoom",at,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const $=f.scrollZoom=new Sh(f,()=>this._triggerRenderFrame());this._add("scrollZoom",$,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const vt=f.keyboard=new Wa(f);this._add("keyboard",vt),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new Vs(f))}_add(s,f,d){this._handlers.push({handlerName:s,handler:f,allowed:d}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Oe(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,d){for(const m in s)if(m!==d&&(!f||f.indexOf(m)<0))return!0;return!1}_getMapTouches(s){const f=[];for(const d of s)this._el.contains(d.target)&&f.push(d);return f}mergeHandlerResult(s,f,d,m,v){if(!d)return;u.e(s,d);const C={handlerName:m,originalEvent:d.originalEvent||v};d.zoomDelta!==void 0&&(f.zoom=C),d.panDelta!==void 0&&(f.drag=C),d.pitchDelta!==void 0&&(f.pitch=C),d.bearingDelta!==void 0&&(f.rotate=C)}_applyChanges(){const s={},f={},d={};for(const[m,v,C]of this._changes)m.panDelta&&(s.panDelta=(s.panDelta||new u.P(0,0))._add(m.panDelta)),m.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(s.around=m.around),m.pinchAround!==void 0&&(s.pinchAround=m.pinchAround),m.noInertia&&(s.noInertia=m.noInertia),u.e(f,v),u.e(d,C);this._updateMapTransform(s,f,d),this._changes=[]}_updateMapTransform(s,f,d){const m=this._map,v=m._getTransformForUpdate(),C=m.terrain;if(!(lc(s)||C&&this._terrainMovement))return this._fireEvents(f,d,!0);let{panDelta:T,zoomDelta:M,bearingDelta:k,pitchDelta:O,around:F,pinchAround:H}=s;H!==void 0&&(F=H),m._stop(!0),F=F||m.transform.centerPoint;const it=v.pointLocation(T?F.sub(T):F);k&&(v.bearing+=k),O&&(v.pitch+=O),M&&(v.zoom+=M),C?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(T)):v.setLocationAtPoint(it,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(it,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(m.terrain)})):v.setLocationAtPoint(it,F),m._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,d,!0)}_fireEvents(s,f,d){const m=Oe(this._eventsInProgress),v=Oe(s),C={};for(const O in s){const{originalEvent:F}=s[O];this._eventsInProgress[O]||(C[`${O}start`]=F),this._eventsInProgress[O]=s[O]}!m&&v&&this._fireEvent("movestart",v.originalEvent);for(const O in C)this._fireEvent(O,C[O]);v&&this._fireEvent("move",v.originalEvent);for(const O in s){const{originalEvent:F}=s[O];this._fireEvent(O,F)}const T={};let M;for(const O in this._eventsInProgress){const{handlerName:F,originalEvent:H}=this._eventsInProgress[O];this._handlersById[F].isActive()||(delete this._eventsInProgress[O],M=f[F]||H,T[`${O}end`]=M)}for(const O in T)this._fireEvent(O,T[O]);const k=Oe(this._eventsInProgress);if(d&&(m||v)&&!k){this._updatingCamera=!0;const O=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=H=>H!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Eh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class po extends u.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const d=Math.min((I.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,d){return s=u.P.convert(s).mult(-1),this.panTo(this.transform.center,u.e({offset:s},f),d)}panTo(s,f,d){return this.easeTo(u.e({center:s},f),d)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,d){return this.easeTo(u.e({zoom:s},f),d)}zoomIn(s,f){return this.zoomTo(this.getZoom()+1,s,f),this}zoomOut(s,f){return this.zoomTo(this.getZoom()-1,s,f),this}getBearing(){return this.transform.bearing}setBearing(s,f){return this.jumpTo({bearing:s},f),this}getPadding(){return this.transform.padding}setPadding(s,f){return this.jumpTo({padding:s},f),this}rotateTo(s,f,d){return this.easeTo(u.e({bearing:s},f),d)}resetNorth(s,f){return this.rotateTo(0,u.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=u.z.number(v,$,Ht)),this._rotating&&(m.bearing=u.z.number(C,k,Ht)),this._pitching&&(m.pitch=u.z.number(T,O,Ht)),this._padding&&(m.interpolatePadding(M,F,Ht),it=m.centerPoint.add(H)),this.terrain&&!s.freezeElevation&&this._updateElevation(Ht),Et)m.setLocationAtPoint(Et,Nt);else{const te=m.zoomScale(m.zoom-v),$t=$>v?Math.min(2,ut):Math.max(.5,ut),oe=Math.pow($t,1-Ht),le=m.unproject(vt.add(Rt.mult(Ht*oe)).mult(te));m.setLocationAtPoint(m.renderWorldCopies?le.wrap():le,it)}this._applyUpdatedTransform(m),this._fireMoveEvents(f)},Ht=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Ht)},s),this}_prepareEase(s,f,d={}){this._moving=!0,f||d.moving||this.fire(new u.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new u.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new u.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new u.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&f!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(f-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=u.z.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(s){if(!this.transformCameraUpdate)return;const f=s.clone(),{center:d,zoom:m,pitch:v,bearing:C,elevation:T}=this.transformCameraUpdate(f);d&&(f.center=d),m!==void 0&&(f.zoom=m),v!==void 0&&(f.pitch=v),C!==void 0&&(f.bearing=C),T!==void 0&&(f.elevation=T),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new u.k("move",s)),this._zooming&&this.fire(new u.k("zoom",s)),this._rotating&&this.fire(new u.k("rotate",s)),this._pitching&&this.fire(new u.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const d=this._zooming,m=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new u.k("zoomend",s)),m&&this.fire(new u.k("rotateend",s)),v&&this.fire(new u.k("pitchend",s)),this.fire(new u.k("moveend",s))}flyTo(s,f){var d;if(!s.essential&&I.prefersReducedMotion){const wn=u.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(wn,f)}this.stop(),s=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b7},s);const m=this._getTransformForUpdate(),v=this.getZoom(),C=this.getBearing(),T=this.getPitch(),M=this.getPadding(),k="bearing"in s?this._normalizeBearing(s.bearing,C):C,O="pitch"in s?+s.pitch:T,F="padding"in s?s.padding:m.padding,H=u.P.convert(s.offset);let it=m.centerPoint.add(H);const rt=m.pointLocation(it),{center:at,zoom:$}=m.getConstrained(u.M.convert(s.center||rt),(d=s.zoom)!==null&&d!==void 0?d:v);this._normalizeCenter(at);const vt=m.zoomScale($-v),Rt=m.project(rt),ut=m.project(at).sub(Rt);let Et=s.curve;const Nt=Math.max(m.width,m.height),Ft=Nt/vt,Ht=ut.mag();if("minZoom"in s){const wn=u.ac(Math.min(s.minZoom,v,$),m.minZoom,m.maxZoom),Ue=Nt/m.zoomScale(wn-v);Et=Math.sqrt(Ue/Ht*2)}const te=Et*Et;function $t(wn){const Ue=(Ft*Ft-Nt*Nt+(wn?-1:1)*te*te*Ht*Ht)/(2*(wn?Ft:Nt)*te*Ht);return Math.log(Math.sqrt(Ue*Ue+1)-Ue)}function oe(wn){return(Math.exp(wn)-Math.exp(-wn))/2}function le(wn){return(Math.exp(wn)+Math.exp(-wn))/2}const $e=$t(!1);let ue=function(wn){return le($e)/le($e+Et*wn)},ze=function(wn){return Nt*((le($e)*(oe(Ue=$e+Et*wn)/le(Ue))-oe($e))/te)/Ht;var Ue},tn=($t(!0)-$e)/Et;if(Math.abs(Ht)<1e-6||!isFinite(tn)){if(Math.abs(Nt-Ft)<1e-6)return this.easeTo(s,f);const wn=Fts.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==k,this._pitching=O!==T,this._padding=!m.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(at),this._ease(wn=>{const Ue=wn*tn,rn=1/ue(Ue);m.zoom=wn===1?$:v+m.scaleZoom(rn),this._rotating&&(m.bearing=u.z.number(C,k,wn)),this._pitching&&(m.pitch=u.z.number(T,O,wn)),this._padding&&(m.interpolatePadding(M,F,wn),it=m.centerPoint.add(H)),this.terrain&&!s.freezeElevation&&this._updateElevation(wn);const hn=wn===1?at:m.unproject(Rt.add(ut.mult(ze(Ue))).mult(rn));m.setLocationAtPoint(m.renderWorldCopies?hn.wrap():hn,it),this._applyUpdatedTransform(m),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,f)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,f,d){d.animate===!1||d.duration===0?(s(1),f()):(this._easeStart=I.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=u.b1(s,-180,180);const d=Math.abs(s-f);return Math.abs(s-360-f)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(u.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const gp={compact:!0,customAttribution:'MapLibre'};class _s{constructor(s=gp){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=P.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=P.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=P.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){P.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,f){const d=this._map._getUIString(`AttributionControl.${f}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const f=this._map.style.sourceCaches;for(const m in f){const v=f[m];if(v.used||v.usedForTerrain){const C=v.getSource();C.attribution&&s.indexOf(C.attribution)<0&&s.push(C.attribution)}}s=s.filter(m=>String(m).trim()),s.sort((m,v)=>m.length-v.length),s=s.filter((m,v)=>{for(let C=v+1;C=0)return!1;return!0});const d=s.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,s.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Mm{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const d=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=P.create("div","maplibregl-ctrl");const f=P.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){P.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class uc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const f=++this._id;return this._queue.push({callback:s,id:f,cancelled:!1}),f}remove(s){const f=this._currentlyRunning,d=f?this._queue.concat(f):this._queue;for(const m of d)if(m.id===s)return void(m.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const d of f)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Sr=u.X([{name:"a_pos3d",type:"Int16",components:3}]);class Br extends u.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,f){this.sourceCache.update(s,f),this._renderableTilesKeys=[];const d={};for(const m of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))d[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),u.aN(m.posMatrix,0,u.W,0,u.W,0,1),this._tiles[m.key]=new Ko(m,this.tileSize));for(const m in this._tiles)d[m]||delete this._tiles[m]}freeRtt(s){for(const f in this._tiles){const d=this._tiles[f];(!s||d.tileID.equals(s)||d.tileID.isChildOf(s)||s.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const f={};for(const d of this._renderableTilesKeys){const m=this._tiles[d].tileID;if(m.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),u.aN(v.posMatrix,0,u.W,0,u.W,0,1),f[d]=v}else if(m.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=m.canonical.z-s.canonical.z,T=m.canonical.x-(m.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,k,0,k,0,1),u.H(v.posMatrix,v.posMatrix,[-T*k,-M*k,0]),f[d]=v}else if(s.canonical.isChildOf(m.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=s.canonical.z-m.canonical.z,T=s.canonical.x-(s.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,u.W,0,u.W,0,1),u.H(v.posMatrix,v.posMatrix,[T*k,M*k,0]),u.J(v.posMatrix,v.posMatrix,[1/2**C,1/2**C,0]),f[d]=v}}return f}getSourceTile(s,f){const d=this.sourceCache._source;let m=s.overscaledZ-this.deltaZoom;if(m>d.maxzoom&&(m=d.maxzoom),m=d.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(m--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class Am{constructor(s,f,d){this.painter=s,this.sourceCache=new Br(f),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,f,d,m=u.W){var v;if(!(f>=0&&f=0&&ds.canonical.z&&(s.canonical.z>=m?v=s.canonical.z-m:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const C=s.canonical.x-(s.canonical.x>>v<>v<>8<<4|v>>8,f[C+3]=0;const d=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),m=new Q(s,d,s.gl.RGBA,{premultiply:!1});return m.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),d=this.painter.context,m=d.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(v,T-C-1,1,1,m.RGBA,m.UNSIGNED_BYTE,f),d.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),k=f[1]+((15&f[2])<<8),O=this.coordsIndex[255-f[3]],F=O&&this.sourceCache.getTileByID(O);if(!F)return null;const H=this._coordsTextureSize,it=(1<s.id!==f),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const ga={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class yp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new cc(s.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(f)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const m=s.sourceCaches[d].getVisibleCoordinates();for(const v of m){const C=this.terrain.sourceCache.getTerrainCoords(v);for(const T in C)this._coordsDescendingInv[d][T]||(this._coordsDescendingInv[d][T]=[]),this._coordsDescendingInv[d][T].push(C[T])}}this._coordsDescendingInvStr={};for(const d of s._order){const m=s._layers[d],v=m.source;if(ga[m.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(T=>T.key).sort().join()}}for(const d of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[m][d.tileID.key];v&&v!==d.rttCoords[m]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,d=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(ga[f]&&(this._prevType&&ga[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!m))return!0;if(ga[this._prevType]||ga[f]&&m){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(_h(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[v]){const k=this.pool.getObjectForId(T.rtt[v].id);if(k.stamp===T.rtt[v].stamp){this.pool.useObject(k);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[v]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:u.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let k=0;k{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},bp={showCompass:!0,showZoom:!0,visualizePitch:!1};class xp{constructor(s,f,d=!1){this.mousedown=C=>{this.startMouse(u.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),P.mousePos(this.element,C)),P.addEventListener(window,"mousemove",this.mousemove),P.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,P.mousePos(this.element,C))},this.mouseup=C=>{this.mouseRotate.dragEnd(C),this.mousePitch&&this.mousePitch.dragEnd(C),this.offTemp()},this.touchstart=C=>{C.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),P.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.moveTouch(C,this._lastPos))},this.touchend=C=>{C.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=hu({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:T,bearingDegreesPerPixelMoved:M=.8})=>{const k=new we;return new cu({clickTolerance:T,move:(O,F)=>({bearingDelta:(F.x-O.x)*M}),moveStateManager:k,enable:C,assignEvents:Ih})})({clickTolerance:m,enable:!0}),this.map=s,d&&(this.mousePitch=fu({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:T,pitchDegreesPerPixelMoved:M=-.5})=>{const k=new we;return new cu({clickTolerance:T,move:(O,F)=>({pitchDelta:(F.y-O.y)*M}),moveStateManager:k,enable:C,assignEvents:Ih})})({clickTolerance:v,enable:!0})),P.addEventListener(f,"mousedown",this.mousedown),P.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),P.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),P.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),P.disableDrag()}moveMouse(s,f){const d=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}moveTouch(s,f){const d=this.map,{bearingDelta:m}=this.touchRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}off(){const s=this.element;P.removeEventListener(s,"mousedown",this.mousedown),P.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend),P.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){P.enableDrag(),P.removeEventListener(window,"mousemove",this.mousemove),P.removeEventListener(window,"mouseup",this.mouseup),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend)}}let ya;function Ch(_,s,f){const d=new u.M(_.lng,_.lat);if(_=new u.M(_.lng,_.lat),s){const m=new u.M(_.lng-360,_.lat),v=new u.M(_.lng+360,_.lat),C=f.locationPoint(_).distSqr(s);f.locationPoint(m).distSqr(s)180;){const m=f.locationPoint(_);if(m.x>=0&&m.y>=0&&m.x<=f.width&&m.y<=f.height)break;_.lng>f.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&f.locationPoint(_).y>f.height/2-f.getHorizon()?_:d}const fc={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Th(_,s,f){const d=_.classList;for(const m in fc)d.remove(`maplibregl-${f}-anchor-${m}`);d.add(`maplibregl-${f}-anchor-${s}`)}class pc extends u.E{constructor(s){if(super(),this._onKeyPress=f=>{const d=f.code,m=f.charCode||f.keyCode;d!=="Space"&&d!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=f=>{const d=f.originalEvent.target,m=this._element;this._popup&&(d===m||m.contains(d))&&this.togglePopup()},this._update=f=>{var d;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Ch(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),P.setTransform(this._element,`${fc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${C} ${v}`),I.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=f.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new u.k("dragstart"))),this.fire(new u.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new u.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=u.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=P.create("div"),this._element.setAttribute("aria-label","Map marker");const f=P.createNS("http://www.w3.org/2000/svg","svg"),d=41,m=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${d}px`),f.setAttributeNS(null,"width",`${m}px`),f.setAttributeNS(null,"viewBox",`0 0 ${m} ${d}`);const v=P.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const C=P.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const T=P.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const vt of M){const Rt=P.createNS("http://www.w3.org/2000/svg","ellipse");Rt.setAttributeNS(null,"opacity","0.04"),Rt.setAttributeNS(null,"cx","10.5"),Rt.setAttributeNS(null,"cy","5.80029008"),Rt.setAttributeNS(null,"rx",vt.rx),Rt.setAttributeNS(null,"ry",vt.ry),T.appendChild(Rt)}const k=P.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);const O=P.createNS("http://www.w3.org/2000/svg","path");O.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),k.appendChild(O);const F=P.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const H=P.createNS("http://www.w3.org/2000/svg","path");H.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(H);const it=P.createNS("http://www.w3.org/2000/svg","g");it.setAttributeNS(null,"transform","translate(6.0, 7.0)"),it.setAttributeNS(null,"fill","#FFFFFF");const rt=P.createNS("http://www.w3.org/2000/svg","g");rt.setAttributeNS(null,"transform","translate(8.0, 8.0)");const at=P.createNS("http://www.w3.org/2000/svg","circle");at.setAttributeNS(null,"fill","#000000"),at.setAttributeNS(null,"opacity","0.25"),at.setAttributeNS(null,"cx","5.5"),at.setAttributeNS(null,"cy","5.5"),at.setAttributeNS(null,"r","5.4999962");const $=P.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),rt.appendChild(at),rt.appendChild($),C.appendChild(T),C.appendChild(k),C.appendChild(F),C.appendChild(it),C.appendChild(rt),f.appendChild(C),f.setAttributeNS(null,"height",d*this._scale+"px"),f.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(f),this._offset=u.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Th(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),P.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=u.M.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const m=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var f,d;if(!(!((f=this._map)===null||f===void 0)&&f.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,v=m.terrain.depthAtPoint(this._pos),C=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,C)-v<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/m.transform._pixelPerMeter,M=Math.sin(m.getPitch()*Math.PI/180)*T,k=m.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),O=m.transform.lngLatToCameraDepth(this._lngLat,C+M)-k>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&O&&this._popup.remove(),this._element.style.opacity=O?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=u.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,f){return s===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const Lh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let du=0,Tl=!1;const Ph={maxWidth:100,unit:"metric"};function Mh(_,s,f){const d=f&&f.maxWidth||100,m=_._container.clientHeight/2,v=_.unproject([0,m]),C=_.unproject([d,m]),T=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*T;M>5280?Ll(s,d,M/5280,_._getUIString("ScaleControl.Miles")):Ll(s,d,M,_._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Ll(s,d,T/1852,_._getUIString("ScaleControl.NauticalMiles")):T>=1e3?Ll(s,d,T/1e3,_._getUIString("ScaleControl.Kilometers")):Ll(s,d,T,_._getUIString("ScaleControl.Meters"))}function Ll(_,s,f,d){const m=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let T=v/C;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){const k=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*k)/k}(T),C*T}(f);_.style.width=s*(m/f)+"px",_.innerHTML=`${m} ${d}`}const wp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Sp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ah(_){if(_){if(typeof _=="number"){const s=Math.round(Math.abs(_)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,_),"top-left":new u.P(s,s),"top-right":new u.P(-s,s),bottom:new u.P(0,-_),"bottom-left":new u.P(s,-s),"bottom-right":new u.P(-s,-s),left:new u.P(_,0),right:new u.P(-_,0)}}if(_ instanceof u.P||Array.isArray(_)){const s=u.P.convert(_);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:u.P.convert(_.center||[0,0]),top:u.P.convert(_.top||[0,0]),"top-left":u.P.convert(_["top-left"]||[0,0]),"top-right":u.P.convert(_["top-right"]||[0,0]),bottom:u.P.convert(_.bottom||[0,0]),"bottom-left":u.P.convert(_["bottom-left"]||[0,0]),"bottom-right":u.P.convert(_["bottom-right"]||[0,0]),left:u.P.convert(_.left||[0,0]),right:u.P.convert(_.right||[0,0])}}return Ah(new u.P(0,0))}const km=y;h.AJAXError=u.be,h.Evented=u.E,h.LngLat=u.M,h.MercatorCoordinate=u.Y,h.Point=u.P,h.addProtocol=u.bf,h.config=u.a,h.removeProtocol=u.bg,h.AttributionControl=_s,h.BoxZoomHandler=gs,h.CanvasSource=ps,h.CooperativeGesturesHandler=Me,h.DoubleClickZoomHandler=dp,h.DragPanHandler=Pm,h.DragRotateHandler=ys,h.EdgeInsets=lu,h.FullscreenControl=class extends u.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:u.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){P.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=P.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);P.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new u.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},h.GeoJSONSource=Mr,h.GeolocateControl=class extends u.E{constructor(_){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new u.M(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,m=this._map.getBearing(),v=u.e({bearing:m},this.options.fitBoundsOptions),C=Ct.fromLngLat(f,d);this._map.fitBounds(C,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new u.M(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Tl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",f=>f.preventDefault()),this._geolocateButton=P.create("button","maplibregl-ctrl-geolocate",this._container),P.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=P.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new pc({element:this._dotElement}),this._circleElement=P.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new pc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new u.k("trackuserlocationend")))})}},this.options=u.e({},Lh,_)}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return u._(this,arguments,void 0,function*(s=!1){if(ya!==void 0&&!s)return ya;if(window.navigator.permissions===void 0)return ya=!!window.navigator.geolocation,ya;try{ya=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ya=!!window.navigator.geolocation}return ya})}().then(s=>this._setupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),P.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,du=0,Tl=!1}_isOutOfMapMaxBounds(_){const s=this._map.getMaxBounds(),f=_.coords;return s&&(f.longitudes.getEast()||f.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const _=this._map.getBounds(),s=_.getSouthEast(),f=_.getNorthEast(),d=s.distanceTo(f),m=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return u.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":du--,Tl=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new u.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new u.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),du++,du>1?(_={maximumAge:6e5,timeout:0},Tl=!0):(_=this.options.positionOptions,Tl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},h.Hash=cp,h.ImageSource=Kn,h.KeyboardHandler=Wa,h.LngLatBounds=Ct,h.LogoControl=Mm,h.Map=class extends po{constructor(_){if(u.bc.mark(u.bd.create),(_=u.e({},hc,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new vh(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new uc,this._controls=[],this._mapId=u.a3(),this._locale=u.e({},_p,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=j.addThrottleControl(()=>this.isMoving()),this._requestManager=new q(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=up(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?f(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new mp(this,_),this._hash=_.hash&&new cp(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,u.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new _s(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Mm,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new u.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new u.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new u.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(_,s){if(s===void 0&&(s=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new u.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(f,d.firstChild):d.appendChild(f),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new u.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(_);return s>-1&&this._controls.splice(s,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,s,f,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,s,f,d)}resize(_){var s;const f=this._containerDimensions(),d=f[0],m=f[1],v=this._getClampedPixelRatio(d,m);if(this._resizeCanvas(d,m,v),this.painter.resize(d,m,v),this.painter.overLimit()){const T=this.painter.context.gl;this._maxCanvasSize=[T.drawingBufferWidth,T.drawingBufferHeight];const M=this._getClampedPixelRatio(d,m);this._resizeCanvas(d,m,M),this.painter.resize(d,m,M)}this.transform.resize(d,m),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,m);const C=!this._moving;return C&&(this.stop(),this.fire(new u.k("movestart",_)).fire(new u.k("move",_))),this.fire(new u.k("resize",_)),C&&this.fire(new u.k("moveend",_)),this}_getClampedPixelRatio(_,s){const{0:f,1:d}=this._maxCanvasSize,m=this.getPixelRatio(),v=_*m,C=s*m;return Math.min(v>f?f/v:1,C>d?d/C:1)*m}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(Ct.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(u.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(u.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,s,f){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const C=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];C.length?d||(d=!0,f.call(this,new fo(_,this,v.originalEvent,{features:C}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:C=>{(this.getLayer(s)?this.queryRenderedFeatures(C.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,f.call(this,new fo(_,this,C.originalEvent)))},mouseout:C=>{d&&(d=!1,f.call(this,new fo(_,this,C.originalEvent)))}}}}{const d=m=>{const v=this.getLayer(s)?this.queryRenderedFeatures(m.point,{layers:[s]}):[];v.length&&(m.features=v,f.call(this,m),delete m.features)};return{layer:s,listener:f,delegates:{[_]:d}}}}on(_,s,f){if(f===void 0)return super.on(_,s);const d=this._createDelegatedListener(_,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const m in d.delegates)this.on(m,d.delegates[m]);return this}once(_,s,f){if(f===void 0)return super.once(_,s);const d=this._createDelegatedListener(_,s,f);for(const m in d.delegates)this.once(m,d.delegates[m]);return this}off(_,s,f){return f===void 0?super.off(_,s):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const m=this._delegatedListeners[_];for(let v=0;vthis._updateStyle(_,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new Mo(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,s,f):this.style.loadJSON(_,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Mo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,s){if(typeof _=="string"){const f=this._requestManager.transformRequest(_,"Style");u.h(f,new AbortController).then(d=>{this._updateDiff(d.data,s)}).catch(d=>{d&&this.fire(new u.j(d))})}else typeof _=="object"&&this._updateDiff(_,s)}_updateDiff(_,s){try{this.style.setState(_,s)&&this._update(!0)}catch(f){u.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(_,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(_,s){return this._lazyInitEmptyStyle(),this.style.addSource(_,s),this._update(!0)}isSourceLoaded(_){const s=this.style&&this.style.sourceCaches[_];if(s!==void 0)return s.loaded();this.fire(new u.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const s=this.style.sourceCaches[_.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const d=this.style._layers[f];d.type==="hillshade"&&d.source===_.source&&u.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Am(this.painter,s,_),this.painter.renderToTexture=new yp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.k("terrain",{terrain:_})),this}getTerrain(){var _,s;return(s=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const s in _){const f=_[s]._tiles;for(const d in f){const m=f[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,s,f={}){const{pixelRatio:d=1,sdf:m=!1,stretchX:v,stretchY:C,content:T}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||u.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:k,data:O}=s,F=s;return this.style.addImage(_,{data:new u.R({width:M,height:k},new Uint8Array(O)),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:m,version:0,userImage:F}),F.onAdd&&F.onAdd(this,_),this}}{const{width:M,height:k,data:O}=I.getImageData(s);this.style.addImage(_,{data:new u.R({width:M,height:k},O),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:m,version:0})}}updateImage(_,s){const f=this.style.getImage(_);if(!f)return this.fire(new u.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=s instanceof HTMLImageElement||u.b(s)?I.getImageData(s):s,{width:m,height:v,data:C}=d;if(m===void 0||v===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==f.data.width||v!==f.data.height)return this.fire(new u.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const T=!(s instanceof HTMLImageElement||u.b(s));return f.data.replace(C,T),this.style.updateImage(_,f),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return j.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,s){return this._lazyInitEmptyStyle(),this.style.addLayer(_,s),this._update(!0)}moveLayer(_,s){return this.style.moveLayer(_,s),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,s,f){return this.style.setLayerZoomRange(_,s,f),this._update(!0)}setFilter(_,s,f={}){return this.style.setFilter(_,s,f),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,s,f,d={}){return this.style.setPaintProperty(_,s,f,d),this._update(!0)}getPaintProperty(_,s){return this.style.getPaintProperty(_,s)}setLayoutProperty(_,s,f,d={}){return this.style.setLayoutProperty(_,s,f,d),this._update(!0)}getLayoutProperty(_,s){return this.style.getLayoutProperty(_,s)}setGlyphs(_,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,s,f,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,s,f=>{f||this._update(!0)}),this}setLight(_,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,s){return this.style.setFeatureState(_,s),this._update()}removeFeatureState(_,s){return this.style.removeFeatureState(_,s),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,s=0;return this._container&&(_=this._container.clientWidth||400,s=this._container.clientHeight||300),[_,s]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const s=this._canvasContainer=P.create("div","maplibregl-canvas-container",_);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=P.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const f=this._containerDimensions(),d=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],d);const m=this._controlContainer=P.create("div","maplibregl-control-container",_),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=P.create("div",`maplibregl-ctrl-${C} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,s,f){this._canvas.width=Math.floor(f*_),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:_},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const f=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!f){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new _m(f,this.transform),z.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,v=I.now();this.style.zoomHistory.update(m,v);const C=new u.a8(m,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),T=C.crossFadingFactor();T===1&&T===this._crossFadingFactor||(f=!0,this._crossFadingFactor=T),this.style.update(C)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bc.mark(u.bd.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,u.bc.mark(u.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),j.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),P.remove(this._canvasContainer),P.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.bc.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(_=>{u.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return vp}getCameraTargetElevation(){return this.transform.elevation}},h.MapMouseEvent=fo,h.MapTouchEvent=Bs,h.MapWheelEvent=hp,h.Marker=pc,h.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,f)=>{const d=this._map._getUIString(`NavigationControl.${f}`);s.title=d,s.setAttribute("aria-label",d)},this.options=u.e({},bp,_),this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=P.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new xp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){P.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(_,s){const f=P.create("button",_,this._container);return f.type="button",f.addEventListener("click",s),f}},h.Popup=class extends u.E{constructor(_){super(),this.remove=()=>(this._content&&P.remove(this._content),this._container&&(P.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new u.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=P.create("div","maplibregl-popup",this._map.getContainer()),this._tip=P.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Ch(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!s)return;const d=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const v=Ah(this.options.offset);if(!m){const T=this._container.offsetWidth,M=this._container.offsetHeight;let k;k=d.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],d.xthis._map.transform.width-T/2&&k.push("right"),m=k.length===0?"bottom":k.join("-")}let C=d.add(v[m]);this.options.subpixelPositioning||(C=C.round()),P.setTransform(this._container,`${fc[m]} translate(${C.x}px,${C.y}px)`),Th(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(wp),_)}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=u.M.convert(_),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const s=document.createDocumentFragment(),f=document.createElement("body");let d;for(f.innerHTML=_;d=f.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=P.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=P.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Sp);_&&_.focus()}},h.RasterDEMTileSource=Xe,h.RasterTileSource=kt,h.ScaleControl=class{constructor(_){this._onMove=()=>{Mh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Mh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ph),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){P.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},h.ScrollZoomHandler=Sh,h.Style=Mo,h.TerrainControl=class{constructor(_){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=_}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=P.create("button","maplibregl-ctrl-terrain",this._container),P.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){P.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},h.TwoFingersTouchPitchHandler=Cm,h.TwoFingersTouchRotateHandler=pp,h.TwoFingersTouchZoomHandler=Im,h.TwoFingersTouchZoomRotateHandler=ac,h.VectorTileSource=kn,h.VideoSource=Lo,h.addSourceType=(_,s)=>u._(void 0,void 0,void 0,function*(){if(Ba(_))throw new Error(`A source type called "${_}" already exists.`);((f,d)=>{Os[f]=d})(_,s)}),h.clearPrewarmedResources=function(){const _=mn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Pe),mn=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},h.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},h.getRTLTextPluginStatus=function(){return re().getRTLTextPluginStatus()},h.getVersion=function(){return km},h.getWorkerCount=function(){return cn.workerCount},h.getWorkerUrl=function(){return u.a.WORKER_URL},h.importScriptInWorkers=function(_){return Pr().broadcast("IS",_)},h.prewarm=function(){An().acquire(Pe)},h.setMaxParallelImageRequests=function(_){u.a.MAX_PARALLEL_IMAGE_REQUESTS=_},h.setRTLTextPlugin=function(_,s){return re().setRTLTextPlugin(_,s)},h.setWorkerCount=function(_){cn.workerCount=_},h.setWorkerUrl=function(_){u.a.WORKER_URL=_}});var a=n;return a})})(JE);var g4=JE.exports;const Es=dv(g4);var y4=Object.defineProperty,_4=(e,t,n)=>t in e?y4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ww=(e,t,n)=>(_4(e,typeof t!="symbol"?t+"":t,n),n);function gd(){}function $E(e){return e()}function Sw(){return Object.create(null)}function gy(e){e.forEach($E)}function tI(e){return typeof e=="function"}function v4(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function b4(e){return Object.keys(e).length===0}function x4(e,t){e.appendChild(t)}function w4(e,t,n){e.insertBefore(t,n||null)}function eI(e){e.parentNode&&e.parentNode.removeChild(e)}function Ew(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function xu(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function S4(e){return Array.from(e.childNodes)}function og(e,t,n){e.classList.toggle(t,!!n)}let Ov;function ud(e){Ov=e}const $h=[],Iw=[];let af=[];const Cw=[],E4=Promise.resolve();let U0=!1;function I4(){U0||(U0=!0,E4.then(nI))}function G0(e){af.push(e)}const a0=new Set;let Zh=0;function nI(){if(Zh!==0)return;const e=Ov;do{try{for(;Zh<$h.length;){const t=$h[Zh];Zh++,ud(t),C4(t.$$)}}catch(t){throw $h.length=0,Zh=0,t}for(ud(null),$h.length=0,Zh=0;Iw.length;)Iw.pop()();for(let t=0;te.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),af=t}const L4=new Set;function P4(e,t){e&&e.i&&(L4.delete(e),e.i(t))}function M4(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),G0(()=>{const a=e.$$.on_mount.map($E).filter(tI);e.$$.on_destroy?e.$$.on_destroy.push(...a):gy(a),e.$$.on_mount=[]}),i.forEach(G0)}function A4(e,t){const n=e.$$;n.fragment!==null&&(T4(n.after_update),gy(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function k4(e,t){e.$$.dirty[0]===-1&&($h.push(e),I4(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const R=z.length?z[0]:P;return w.ctx&&i(w.ctx[I],w.ctx[I]=R)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](R),S&&k4(e,I)),P}):[],w.update(),S=!0,gy(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const I=S4(t.target);w.fragment&&w.fragment.l(I),I.forEach(eI)}else w.fragment&&w.fragment.c();t.intro&&P4(e.$$.fragment),M4(e,t.target,t.anchor),nI()}ud(y)}class R4{constructor(){ww(this,"$$"),ww(this,"$$set")}$destroy(){A4(this,1),this.$destroy=gd}$on(t,n){if(!tI(n))return gd;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!b4(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const N4="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(N4);function O4(e){let t,n,r;return{c(){t=Ew("svg"),n=Ew("path"),xu(n,"stroke-width","4"),xu(n,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),xu(n,"class","svelte-gzo3ar"),xu(t,"width",r=e[0]==="list"?20:void 0),xu(t,"viewBox","0 0 70 85"),xu(t,"fill","none"),xu(t,"class","svelte-gzo3ar"),og(t,"in-map",e[0]!=="list"),og(t,"list-icon",e[0]==="list")},m(i,a){w4(i,t,a),x4(t,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&xu(t,"width",r),a&1&&og(t,"in-map",i[0]!=="list"),a&1&&og(t,"list-icon",i[0]==="list")},i:gd,o:gd,d(i){i&&eI(t)}}}function z4(e,t,n){let{displayIn:r}=t;return e.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class F4 extends R4{constructor(t){super(),D4(this,t,z4,O4,v4,{displayIn:0})}}const B4=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],V4={decimalLatitude:40.123,decimalLongitude:-74.123},U4=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],G4=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function q4(){const e=[];return B4.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...V4})}),[...e,...U4,...G4]}const j4=q4();j4.map(e=>e.verbatimCoordinates);/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * @@ -602,19 +602,20 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function W4(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,h;return h={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function u(w){return function(S){return y([w,S])}}function y(w){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=w[0]&2?i.return:w[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,w[1])).done)return a;switch(i=0,a&&(w=[w[0]&2,a.value]),w[0]){case 0:case 1:a=w;break;case 4:return n.label++,{value:w[1],done:!1};case 5:n.label++,i=w[1],w=[0];continue;case 7:w=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(w[0]===6||w[0]===2)){n=0;continue}if(w[0]===3&&(!a||w[1]>a[0]&&w[1]t?1:e0){if(t.right===null)break;if(n(e,t.right.key)>0){var u=t.right;if(t.right=u.left,u.left=t,t=u,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,a.left=t.right,t.left=r.right,t.right=r.left,t}function l0(e,t,n,r){var i=new Mu(e,t);if(n===null)return i.left=i.right=null,i;n=Iu(e,n,r);var a=r(e,n.key);return a<0?(i.left=n.left,i.right=n,n.left=null):a>=0&&(i.right=n.right,i.left=n,n.right=null),i}function Tw(e,t,n){var r=null,i=null;if(t){t=Iu(e,t,n);var a=n(t.key,e);a===0?(r=t.left,i=t.right):a<0?(i=t.right,t.right=null,r=t):(r=t.left,t.left=null,i=t)}return{left:r,right:i}}function Z4(e,t,n){return t===null?e:(e===null||(t=Iu(e.key,t,n),t.left=e),t)}function q0(e,t,n,r,i){if(e){r(""+t+(n?"└── ":"├── ")+i(e)+` -`);var a=t+(n?" ":"│ ");e.left&&q0(e.left,a,!1,r,i),e.right&&q0(e.right,a,!0,r,i)}}var zv=function(){function e(t){t===void 0&&(t=H4),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,n){return this._size++,this._root=l0(t,n,this._root,this._comparator)},e.prototype.add=function(t,n){var r=new Mu(t,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,a=Iu(t,this._root,i),h=i(t,a.key);return h===0?this._root=a:(h<0?(r.left=a.left,r.right=a,a.left=null):h>0&&(r.right=a.right,r.left=a,a.right=null),this._size++,this._root=r),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,n,r){var i;if(n===null)return null;n=Iu(t,n,r);var a=r(t,n.key);return a===0?(n.left===null?i=n.right:(i=Iu(t,n.left,r),i.right=n.right),this._size--,i):n},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Iu(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var n=this._root,r=this._comparator;n;){var i=r(t,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},e.prototype.find=function(t){return this._root&&(this._root=Iu(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var n=this._root,r=this._comparator;n;){var i=r(t,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},e.prototype.forEach=function(t,n){for(var r=this._root,i=[],a=!1;!a;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),t.call(n,r),r=r.right):a=!0;return this},e.prototype.range=function(t,n,r,i){for(var a=[],h=this._comparator,u=this._root,y;a.length!==0||u;)if(u)a.push(u),u=u.left;else{if(u=a.pop(),y=h(u.key,n),y>0)break;if(h(u.key,t)>=0&&r.call(i,u))return this;u=u.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(n){var r=n.key;return t.push(r)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(n){var r=n.data;return t.push(r)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var n=this._root,r=!1,i=0,a=[];!r;)if(n)a.push(n),n=n.left;else if(a.length>0){if(n=a.pop(),i===t)return n;i++,n=n.right}else r=!0;return null},e.prototype.next=function(t){var n=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var a=i(t.key,n.key);if(a===0)break;a<0?(r=n,n=n.left):n=n.right}return r},e.prototype.prev=function(t){var n=this._root,r=null;if(t.left!==null){for(r=t.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var a=i(t.key,n.key);if(a===0)break;a<0?n=n.left:(r=n,n=n.right)}return r},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return Y4(this._root)},e.prototype.load=function(t,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=t.length,a=this._comparator;if(r&&H0(t,n,0,i-1,a),this._root===null)this._root=j0(t,n,0,i),this._size=i;else{var h=K4(this.toList(),X4(t,n),a);i=this._size+i,this._root=W0({head:h},0,i)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(r){return String(r.key)});var n=[];return q0(this._root,"",!0,function(r){return n.push(r)},t),n.join("")},e.prototype.update=function(t,n,r){var i=this._comparator,a=Tw(t,this._root,i),h=a.left,u=a.right;i(t,n)<0?u=l0(n,r,u,i):h=l0(n,r,h,i),this._root=Z4(h,u,i)},e.prototype.split=function(t){return Tw(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,n,r;return W4(this,function(i){switch(i.label){case 0:t=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:t===null?[3,2]:(n.push(t),t=t.left,[3,5]);case 2:return n.length===0?[3,4]:(t=n.pop(),[4,t]);case 3:return i.sent(),t=t.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function j0(e,t,n,r){var i=r-n;if(i>0){var a=n+Math.floor(i/2),h=e[a],u=t[a],y=new Mu(h,u);return y.left=j0(e,t,n,a),y.right=j0(e,t,a+1,r),y}return null}function X4(e,t){for(var n=new Mu(null,null),r=n,i=0;i0?(t=a=a.next=n.pop(),t=t.right):r=!0;return a.next=null,i.next}function W0(e,t,n){var r=n-t;if(r>0){var i=t+Math.floor(r/2),a=W0(e,t,i),h=e.head;return h.left=a,e.head=e.head.next,h.right=W0(e,i+1,n),h}return null}function K4(e,t,n){for(var r=new Mu(null,null),i=r,a=e,h=t;a!==null&&h!==null;)n(a.key,h.key)<0?(i.next=a,a=a.next):(i.next=h,h=h.next),i=i.next;return a!==null?i.next=a:h!==null&&(i.next=h),r.next}function H0(e,t,n,r,i){if(!(n>=r)){for(var a=e[n+r>>1],h=n-1,u=r+1;;){do h++;while(i(e[h],a)<0);do u--;while(i(e[u],a)>0);if(h>=u)break;var y=e[h];e[h]=e[u],e[u]=y,y=t[h],t[h]=t[u],t[u]=y}H0(e,t,n,u,i),H0(e,t,u+1,r,i)}}function fa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lw(e,t){for(var n=0;nn.x?1:t.yn.y?1:0}}]);function e(t,n){fa(this,e),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}return Go(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var n=t.point.events,r=0,i=n.length;r=0&&I>=0?wP?-1:0:y<0&&I<0?wP?1:0:Iy?1:0}}}]),e}(),nD=0,Zg=function(){Go(e,null,[{key:"compare",value:function(t,n){var r=t.leftSE.point.x,i=n.leftSE.point.x,a=t.rightSE.point.x,h=n.rightSE.point.x;if(hu&&y>w)return-1;var I=t.comparePoint(n.leftSE.point);if(I<0)return 1;if(I>0)return-1;var P=n.comparePoint(t.rightSE.point);return P!==0?P:-1}if(r>i){if(uy&&u>S)return 1;var z=n.comparePoint(t.leftSE.point);if(z!==0)return z;var R=t.comparePoint(n.rightSE.point);return R<0?1:R>0?-1:1}if(uy)return 1;if(ah){var X=t.comparePoint(n.rightSE.point);if(X<0)return 1;if(X>0)return-1}if(a!==h){var et=w-u,B=a-r,q=S-y,Y=h-i;if(et>B&&qY)return-1}return a>h?1:aS?1:t.idn.id?1:0}}]);function e(t,n,r,i){fa(this,e),this.id=++nD,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=r,this.windings=i}return Go(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tn?t:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return t.x===n.x?0:t.x0&&u.swapEvents(),el.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var a=n;n=r,r=a}if(n.prev===r){var h=n;n=r,r=h}for(var u=0,y=r.rings.length;u0)i=n,a=t,h=-1;else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var y=new el(i,!0),w=new el(a,!1);return new e(y,w,[r],[h])}}]),e}(),Dw=function(){function e(t,n,r){if(fa(this,e),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=yd.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var a=i,h=1,u=t.length;hthis.bbox.ur.x&&(this.bbox.ur.x=y.x),y.y>this.bbox.ur.y&&(this.bbox.ur.y=y.y),a=y)}(i.x!==a.x||i.y!==a.y)&&this.segments.push(Zg.fromRing(a,i,this))}return Go(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.interiorRings.push(a)}this.multiPoly=n}return Go(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.polys.push(a)}this.isSubject=n}return Go(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.polys.length;n0&&(t=i)}for(var a=t.segment.prevInResult(),h=a?a.prevInResult():null;;){if(!a)return null;if(!h)return a.ringOut;if(h.ringOut!==a.ringOut)return h.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=h.prevInResult(),h=a?a.prevInResult():null}}}]),e}(),Nw=function(){function e(t){fa(this,e),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return Go(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:Zg.compare;fa(this,e),this.queue=t,this.tree=new zv(n),this.segments=[]}return Go(e,[{key:"process",value:function(t){var n=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),r;var i=t.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var a=i,h=i,u=void 0,y=void 0;u===void 0;)a=this.tree.prev(a),a===null?u=null:a.key.consumedBy===void 0&&(u=a.key);for(;y===void 0;)h=this.tree.next(h),h===null?y=null:h.key.consumedBy===void 0&&(y=h.key);if(t.isLeft){var w=null;if(u){var S=u.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!u.isAnEndpoint(S)))for(var I=this._splitSafely(u,S),P=0,z=I.length;P0?(this.tree.remove(n),r.push(t)):(this.segments.push(n),n.prev=u)}else{if(u&&y){var ft=u.getIntersection(y);if(ft!==null){if(!u.isAnEndpoint(ft))for(var _t=this._splitSafely(u,ft),kt=0,Q=_t.length;ktOw)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Y=new sD(R),lt=R.size,dt=R.pop();dt;){var ut=dt.key;if(R.size===lt){var ft=ut.segment;throw new Error("Unable to pop() ".concat(ut.isLeft?"left":"right"," SweepEvent ")+"[".concat(ut.point.x,", ").concat(ut.point.y,"] from segment #").concat(ft.id," ")+"[".concat(ft.leftSE.point.x,", ").concat(ft.leftSE.point.y,"] -> ")+"[".concat(ft.rightSE.point.x,", ").concat(ft.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(R.size>Ow)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Y.segments.length>aD)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var _t=Y.process(ut),kt=0,Q=_t.length;kt1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rn[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]t.x?1:this.yt.y?1:0};Pt.prototype.clone=function(){};Pt.prototype.copy=function(){return new Pt(this)};Pt.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Pt.prototype.distance3D=function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return Math.sqrt(t*t+n*n+r*r)};Pt.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)};Pt.prototype.hashCode=function(){var e=17;return e=37*e+Pt.hashCode(this.x),e=37*e+Pt.hashCode(this.y),e};Pt.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z};Pt.prototype.interfaces_=function(){return[hs,_y,fs]};Pt.prototype.getClass=function(){return Pt};Pt.hashCode=function(){if(arguments.length===1){var e=arguments[0],t=We.doubleToLongBits(e);return Math.trunc((t^t)>>>32)}};Gc.DimensionalComparator.get=function(){return Gl};Gc.serialVersionUID.get=function(){return 6683108902428367e3};Gc.NULL_ORDINATE.get=function(){return We.NaN};Gc.X.get=function(){return 0};Gc.Y.get=function(){return 1};Gc.Z.get=function(){return 2};Object.defineProperties(Pt,Gc);var Gl=function(e){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new ir("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}};Gl.prototype.compare=function(e,t){var n=e,r=t,i=Gl.compare(n.x,r.x);if(i!==0)return i;var a=Gl.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var h=Gl.compare(n.z,r.z);return h};Gl.prototype.interfaces_=function(){return[ff]};Gl.prototype.getClass=function(){return Gl};Gl.compare=function(e,t){return et?1:We.isNaN(e)?We.isNaN(t)?0:-1:We.isNaN(t)?1:0};var pf=function(){};pf.prototype.create=function(){};pf.prototype.interfaces_=function(){return[]};pf.prototype.getClass=function(){return pf};var Dt=function(){},zd={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Dt.prototype.interfaces_=function(){return[]};Dt.prototype.getClass=function(){return Dt};Dt.toLocationSymbol=function(e){switch(e){case Dt.EXTERIOR:return"e";case Dt.BOUNDARY:return"b";case Dt.INTERIOR:return"i";case Dt.NONE:return"-"}throw new ir("Unknown location value: "+e)};zd.INTERIOR.get=function(){return 0};zd.BOUNDARY.get=function(){return 1};zd.EXTERIOR.get=function(){return 2};zd.NONE.get=function(){return-1};Object.defineProperties(Dt,zd);var Be=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},qo=function(){},hI={LOG_10:{configurable:!0}};qo.prototype.interfaces_=function(){return[]};qo.prototype.getClass=function(){return qo};qo.log10=function(e){var t=Math.log(e);return We.isInfinite(t)||We.isNaN(t)?t:t/qo.LOG_10};qo.min=function(e,t,n,r){var i=e;return tn?n:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],a=arguments[2];return ra?a:r}};qo.wrap=function(e,t){return e<0?t- -e%t:e%t};qo.max=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],r=e;return t>r&&(r=t),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],a=arguments[1],h=arguments[2],u=arguments[3],y=i;return a>y&&(y=a),h>y&&(y=h),u>y&&(y=u),y}};qo.average=function(e,t){return(e+t)/2};hI.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(qo,hI);var pa=function(e){this.str=e};pa.prototype.append=function(e){this.str+=e};pa.prototype.setCharAt=function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)};pa.prototype.toString=function(e){return this.str};var ta=function(e){this.value=e};ta.prototype.intValue=function(){return this.value};ta.prototype.compareTo=function(e){return this.valuee?1:0};ta.isNaN=function(e){return Number.isNaN(e)};var _d=function(){};_d.isWhitespace=function(e){return e<=32&&e>=0||e===127};_d.toUpperCase=function(e){return e.toUpperCase()};var qt=function e(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];e.call(this,e.parse(r))}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.init(i,a)}},Rs={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};qt.prototype.le=function(e){return(this._hi9?(S=!0,I="9"):I="0"+w,h.append(I),n=n.subtract(qt.valueOf(w)).multiply(qt.TEN),S&&n.selfAdd(qt.TEN);var P=!0,z=qt.magnitude(n._hi);if(z<0&&Math.abs(z)>=u-y&&(P=!1),!P)break}return t[0]=r,h.toString()};qt.prototype.sqr=function(){return this.multiply(this)};qt.prototype.doubleValue=function(){return this._hi+this._lo};qt.prototype.subtract=function(){if(arguments[0]instanceof qt){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}};qt.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}};qt.prototype.isZero=function(){return this._hi===0&&this._lo===0};qt.prototype.selfSubtract=function(){if(arguments[0]instanceof qt){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}};qt.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};qt.prototype.min=function(e){return this.le(e)?this:e};qt.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,h=null,u=null,y=null,w=null,S=null,I=null;return y=this._hi/n,w=qt.SPLIT*y,i=w-y,I=qt.SPLIT*n,i=w-i,a=y-i,h=I-n,S=y*n,h=I-h,u=n-h,I=i*h-S+i*u+a*h+a*u,w=(this._hi-S-I+this._lo-y*r)/n,I=y+w,this._hi=I,this._lo=y-I+w,this}};qt.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};qt.prototype.divide=function(){if(arguments[0]instanceof qt){var e=arguments[0],t=null,n=null,r=null,i=null,a=null,h=null,u=null,y=null;a=this._hi/e._hi,h=qt.SPLIT*a,t=h-a,y=qt.SPLIT*e._hi,t=h-t,n=a-t,r=y-e._hi,u=a*e._hi,r=y-r,i=e._hi-r,y=t*r-u+t*i+n*r+n*i,h=(this._hi-u-y+this._lo-a*e._lo)/e._hi,y=a+h;var w=y,S=a-y+h;return new qt(w,S)}else if(typeof arguments[0]=="number"){var I=arguments[0];return We.isNaN(I)?qt.createNaN():qt.copy(this).selfDivide(I,0)}};qt.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo};qt.prototype.pow=function(e){if(e===0)return qt.valueOf(1);var t=new qt(this),n=qt.valueOf(1),r=Math.abs(e);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(t),r/=2,r>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n};qt.prototype.ceil=function(){if(this.isNaN())return qt.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new qt(e,t)};qt.prototype.compareTo=function(e){var t=e;return this._hit._hi?1:this._lot._lo?1:0};qt.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()};qt.prototype.setValue=function(){if(arguments[0]instanceof qt){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}};qt.prototype.max=function(e){return this.ge(e)?this:e};qt.prototype.sqrt=function(){if(this.isZero())return qt.valueOf(0);if(this.isNegative())return qt.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=qt.valueOf(t),r=this.subtract(n.sqr()),i=r._hi*(e*.5);return n.add(i)};qt.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0],n=null,r=null,i=null,a=null,h=null,u=null;return i=this._hi+t,h=i-this._hi,a=i-h,a=t-h+(this._hi-a),u=a+this._lo,n=i+u,r=u+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var y=arguments[0],w=arguments[1],S=null,I=null,P=null,z=null,R=null,Z=null,X=null,et=null;R=this._hi+y,P=this._lo+w,X=R-this._hi,et=P-this._lo,Z=R-X,z=P-et,Z=y-X+(this._hi-Z),z=w-et+(this._lo-z),X=Z+P,S=R+X,I=X+(R-S),X=z+I;var B=S+X,q=X+(S-B);return this._hi=B,this._lo=q,this}};qt.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,h=null,u=null,y=null,w=null;y=qt.SPLIT*this._hi,i=y-this._hi,w=qt.SPLIT*n,i=y-i,a=this._hi-i,h=w-n,y=this._hi*n,h=w-h,u=n-h,w=i*h-y+i*u+a*h+a*u+(this._hi*r+this._lo*n);var S=y+w;i=y-S;var I=w+i;return this._hi=S,this._lo=I,this}};qt.prototype.selfSqr=function(){return this.selfMultiply(this)};qt.prototype.floor=function(){if(this.isNaN())return qt.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new qt(e,t)};qt.prototype.negate=function(){return this.isNaN()?this:new qt(-this._hi,-this._lo)};qt.prototype.clone=function(){};qt.prototype.multiply=function(){if(arguments[0]instanceof qt){var e=arguments[0];return e.isNaN()?qt.createNaN():qt.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return We.isNaN(t)?qt.createNaN():qt.copy(this).selfMultiply(t,0)}};qt.prototype.isNaN=function(){return We.isNaN(this._hi)};qt.prototype.intValue=function(){return Math.trunc(this._hi)};qt.prototype.toString=function(){var e=qt.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()};qt.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),r=t[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+qt.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,h=qt.stringOfChar("0",a);i=n+h+".0"}return this.isNegative()?"-"+i:i};qt.prototype.reciprocal=function(){var e=null,t=null,n=null,r=null,i=null,a=null,h=null,u=null;i=1/this._hi,a=qt.SPLIT*i,e=a-i,u=qt.SPLIT*this._hi,e=a-e,t=i-e,n=u-this._hi,h=i*this._hi,n=u-n,r=this._hi-n,u=e*n-h+e*r+t*n+t*r,a=(1-h-u-i*this._lo)/this._hi;var y=i+a,w=i-y+a;return new qt(y,w)};qt.prototype.toSciNotation=function(){if(this.isZero())return qt.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),r=qt.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var a=n.charAt(0)+"."+i;return this.isNegative()?"-"+a+r:a+r};qt.prototype.abs=function(){return this.isNaN()?qt.NaN:this.isNegative()?this.negate():new qt(this)};qt.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};qt.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo};qt.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};qt.prototype.trunc=function(){return this.isNaN()?qt.NaN:this.isPositive()?this.floor():this.ceil()};qt.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};qt.prototype.interfaces_=function(){return[fs,hs,_y]};qt.prototype.getClass=function(){return qt};qt.sqr=function(e){return qt.valueOf(e).selfMultiply(e)};qt.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return qt.parse(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return new qt(t)}};qt.sqrt=function(e){return qt.valueOf(e).sqrt()};qt.parse=function(e){for(var t=0,n=e.length;_d.isWhitespace(e.charAt(t));)t++;var r=!1;if(t=n);){var w=e.charAt(t);if(t++,_d.isDigit(w)){var S=w-"0";a.selfMultiply(qt.TEN),a.selfAdd(S),h++;continue}if(w==="."){u=h;continue}if(w==="e"||w==="E"){var I=e.substring(t);try{y=ta.parseInt(I)}catch(X){throw X instanceof Error?new Error("Invalid exponent "+I+" in string "+e):X}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+t+" in string "+e)}var P=a,z=h-u-y;if(z===0)P=a;else if(z>0){var R=qt.TEN.pow(z);P=a.divide(R)}else if(z<0){var Z=qt.TEN.pow(-z);P=a.multiply(Z)}return r?P.negate():P};qt.createNaN=function(){return new qt(We.NaN,We.NaN)};qt.copy=function(e){return new qt(e)};qt.magnitude=function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=t&&(r+=1),r};qt.stringOfChar=function(e,t){for(var n=new pa,r=0;r0){if(a<=0)return oo.signum(h);r=i+a}else if(i<0){if(a>=0)return oo.signum(h);r=-i-a}else return oo.signum(h);var u=oo.DP_SAFE_EPSILON*r;return h>=u||-h>=u?oo.signum(h):2};oo.signum=function(e){return e>0?1:e<0?-1:0};fI.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(oo,fI);var Sn=function(){},Fd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Fd.X.get=function(){return 0};Fd.Y.get=function(){return 1};Fd.Z.get=function(){return 2};Fd.M.get=function(){return 3};Sn.prototype.setOrdinate=function(e,t,n){};Sn.prototype.size=function(){};Sn.prototype.getOrdinate=function(e,t){};Sn.prototype.getCoordinate=function(){};Sn.prototype.getCoordinateCopy=function(e){};Sn.prototype.getDimension=function(){};Sn.prototype.getX=function(e){};Sn.prototype.clone=function(){};Sn.prototype.expandEnvelope=function(e){};Sn.prototype.copy=function(){};Sn.prototype.getY=function(e){};Sn.prototype.toCoordinateArray=function(){};Sn.prototype.interfaces_=function(){return[_y]};Sn.prototype.getClass=function(){return Sn};Object.defineProperties(Sn,Fd);var pI=function(){},Ff=function(e){function t(){e.call(this,"Projective point not representable on the Cartesian plane.")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(pI),bi=function(){};bi.arraycopy=function(e,t,n,r,i){for(var a=0,h=t;he._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny,r=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};ke.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof ke){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}};ke.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return et._minx?1:this._minyt._miny?1:this._maxxt._maxx?1:this._maxyt._maxy?1:0};ke.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};ke.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};ke.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};ke.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};ke.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};ke.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};ke.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof ke){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof Pt){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};ke.prototype.centre=function(){return this.isNull()?null:new Pt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};ke.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Pt){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof ke){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],h=arguments[2],u=arguments[3];ie._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxye._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)};ke.prototype.hashCode=function(){var e=17;return e=37*e+Pt.hashCode(this._minx),e=37*e+Pt.hashCode(this._maxx),e=37*e+Pt.hashCode(this._miny),e=37*e+Pt.hashCode(this._maxy),e};ke.prototype.interfaces_=function(){return[hs,fs]};ke.prototype.getClass=function(){return ke};ke.intersects=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.xt.x?e.x:t.x)&&n.y>=(e.yt.y?e.y:t.y)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],h=arguments[3],u=Math.min(a.x,h.x),y=Math.max(a.x,h.x),w=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(w>y||Sy)||Sn?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}};ur.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};ur.prototype.setPrecisionModel=function(e){this._precisionModel=e};ur.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var t=arguments[0],n=0;ni?a=r:a=i;else{var h=Math.abs(e.x-t.x),u=Math.abs(e.y-t.y);r>i?a=h:a=u,a===0&&!e.equals(t)&&(a=Math.max(h,u))}return en.isTrue(!(a===0&&!e.equals(t)),"Bad distance calculation"),a};ur.nonRobustComputeEdgeDistance=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=Math.sqrt(r*r+i*i);return en.isTrue(!(a===0&&!e.equals(t)),"Invalid distance calculation"),a};qc.DONT_INTERSECT.get=function(){return 0};qc.DO_INTERSECT.get=function(){return 1};qc.COLLINEAR.get=function(){return 2};qc.NO_INTERSECTION.get=function(){return 0};qc.POINT_INTERSECTION.get=function(){return 1};qc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(ur,qc);var ju=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var r=new ke(this._inputLines[0][0],this._inputLines[0][1]),i=new ke(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,ke.intersects(r,i,n)&&be.orientationIndex(r,i,n)===0&&be.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=e.POINT_INTERSECTION,null;this._result=e.NO_INTERSECTION}else return e.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,r,i,a,h){h.x=this.smallestInAbsValue(n.x,r.x,i.x,a.x),h.y=this.smallestInAbsValue(n.y,r.y,i.y,a.y),n.x-=h.x,n.y-=h.y,r.x-=h.x,r.y-=h.y,i.x-=h.x,i.y-=h.y,a.x-=h.x,a.y-=h.y},t.prototype.safeHCoordinateIntersection=function(n,r,i,a){var h=null;try{h=Is.intersection(n,r,i,a)}catch(u){if(u instanceof Ff)h=t.nearestEndpoint(n,r,i,a);else throw u}finally{}return h},t.prototype.intersection=function(n,r,i,a){var h=this.intersectionWithNormalization(n,r,i,a);return this.isInSegmentEnvelopes(h)||(h=new Pt(t.nearestEndpoint(n,r,i,a))),this._precisionModel!==null&&this._precisionModel.makePrecise(h),h},t.prototype.smallestInAbsValue=function(n,r,i,a){var h=n,u=Math.abs(h);return Math.abs(r)1e-4&&bi.out.println("Distance = "+h.distance(u))},t.prototype.intersectionWithNormalization=function(n,r,i,a){var h=new Pt(n),u=new Pt(r),y=new Pt(i),w=new Pt(a),S=new Pt;this.normalizeToEnvCentre(h,u,y,w,S);var I=this.safeHCoordinateIntersection(h,u,y,w);return I.x+=S.x,I.y+=S.y,I},t.prototype.computeCollinearIntersection=function(n,r,i,a){var h=ke.intersects(n,r,i),u=ke.intersects(n,r,a),y=ke.intersects(i,a,n),w=ke.intersects(i,a,r);return h&&u?(this._intPt[0]=i,this._intPt[1]=a,e.COLLINEAR_INTERSECTION):y&&w?(this._intPt[0]=n,this._intPt[1]=r,e.COLLINEAR_INTERSECTION):h&&y?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!u&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):h&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!u&&!y?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&y?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!h&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&w?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!h&&!y?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,r,i,a,h){var u=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,I=i.xa.x?i.x:a.x,R=i.y>a.y?i.y:a.y,Z=u>I?u:I,X=wP?y:P,B=S0&&u>0||h<0&&u<0)return e.NO_INTERSECTION;var y=be.orientationIndex(i,a,n),w=be.orientationIndex(i,a,r);if(y>0&&w>0||y<0&&w<0)return e.NO_INTERSECTION;var S=h===0&&u===0&&y===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,a):(h===0||u===0||y===0||w===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(a)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(a)?this._intPt[0]=r:h===0?this._intPt[0]=new Pt(i):u===0?this._intPt[0]=new Pt(a):y===0?this._intPt[0]=new Pt(n):w===0&&(this._intPt[0]=new Pt(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,a)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,r,i,a){var h=n,u=be.distancePointLine(n,i,a),y=be.distancePointLine(r,i,a);return y0?n>0?-i:i:n>0?i:-i;if(t===0||n===0)return r>0?e>0?i:-i:e>0?-i:i;if(t>0?r>0?t<=r||(i=-i,a=e,e=n,n=a,a=t,t=r,r=a):t<=-r?(i=-i,n=-n,r=-r):(a=e,e=-n,n=a,a=t,t=-r,r=a):r>0?-t<=r?(i=-i,e=-e,t=-t):(a=-e,e=n,n=a,a=-t,t=r,r=a):t>=r?(e=-e,t=-t,n=-n,r=-r):(i=-i,a=-e,e=-n,n=a,a=-t,t=-r,r=a),e>0)if(n>0){if(!(e<=n))return i}else return i;else{if(n>0)return-i;if(e>=n)i=-i,e=-e,n=-n;else return-i}for(;;){if(h=Math.floor(n/e),n=n-h*e,r=r-h*t,r<0)return-i;if(r>t)return i;if(e>n+n){if(tr+r)return-i;n=e-n,r=t-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(h=Math.floor(e/n),e=e-h*n,t=t-h*r,t<0))return i;if(t>r)return-i;if(n>e+e){if(rt+t)return i;e=n-e,t=r-t,i=-i}if(t===0)return e===0?0:i;if(e===0)return-i}};var Qs=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};Qs.prototype.countSegment=function(e,t){if(e.xr&&(n=t.x,r=e.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var i=e.x-this._p.x,a=e.y-this._p.y,h=t.x-this._p.x,u=t.y-this._p.y,y=Ec.signOfDet2x2(i,a,h,u);if(y===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}};Qs.prototype.isPointInPolygon=function(){return this.getLocation()!==Dt.EXTERIOR};Qs.prototype.getLocation=function(){return this._isPointOnSegment?Dt.BOUNDARY:this._crossingCount%2===1?Dt.INTERIOR:Dt.EXTERIOR};Qs.prototype.isOnSegment=function(){return this._isPointOnSegment};Qs.prototype.interfaces_=function(){return[]};Qs.prototype.getClass=function(){return Qs};Qs.locatePointInRing=function(){if(arguments[0]instanceof Pt&&Be(arguments[1],Sn)){for(var e=arguments[0],t=arguments[1],n=new Qs(e),r=new Pt,i=new Pt,a=1;a1||y<0||y>1)&&(i=!0)}}return i?qo.min(be.distancePointLine(e,n,r),be.distancePointLine(t,n,r),be.distancePointLine(n,e,t),be.distancePointLine(r,e,t)):0};be.isPointInRing=function(e,t){return be.locatePointInRing(e,t)!==Dt.EXTERIOR};be.computeLength=function(e){var t=e.size();if(t<=1)return 0;var n=0,r=new Pt;e.getCoordinate(0,r);for(var i=r.x,a=r.y,h=1;hn.y&&(n=a,r=i)}var h=r;do h=h-1,h<0&&(h=t);while(e[h].equals2D(n)&&h!==r);var u=r;do u=(u+1)%t;while(e[u].equals2D(n)&&u!==r);var y=e[h],w=e[u];if(y.equals2D(n)||w.equals2D(n)||y.equals2D(w))return!1;var S=be.computeOrientation(y,n,w),I=!1;return S===0?I=y.x>w.x:I=S>0,I};be.locatePointInRing=function(e,t){return Qs.locatePointInRing(e,t)};be.distancePointLinePerpendicular=function(e,t,n){var r=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),i=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/r;return Math.abs(i)*Math.sqrt(r)};be.computeOrientation=function(e,t,n){return be.orientationIndex(e,t,n)};be.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new ir("Line array must contain at least one vertex");for(var n=e.distance(t[0]),r=0;r=1)return a.distance(u);var S=((h.y-a.y)*(u.x-h.x)-(h.x-a.x)*(u.y-h.y))/y;return Math.abs(S)*Math.sqrt(y)}};be.isOnLine=function(e,t){for(var n=new ju,r=1;r0};mf.prototype.interfaces_=function(){return[ls]};mf.prototype.getClass=function(){return mf};var gf=function(){};gf.prototype.isInBoundary=function(e){return e>1};gf.prototype.interfaces_=function(){return[ls]};gf.prototype.getClass=function(){return gf};var yf=function(){};yf.prototype.isInBoundary=function(e){return e===1};yf.prototype.interfaces_=function(){return[ls]};yf.prototype.getClass=function(){return yf};var Ur=function(){};Ur.prototype.add=function(){};Ur.prototype.addAll=function(){};Ur.prototype.isEmpty=function(){};Ur.prototype.iterator=function(){};Ur.prototype.size=function(){};Ur.prototype.toArray=function(){};Ur.prototype.remove=function(){};function Bv(e){this.message=e||""}Bv.prototype=new Error;Bv.prototype.name="IndexOutOfBoundsException";var Bf=function(){};Bf.prototype.hasNext=function(){};Bf.prototype.next=function(){};Bf.prototype.remove=function(){};var Cs=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Ur);function Vf(e){this.message=e||""}Vf.prototype=new Error;Vf.prototype.name="NoSuchElementException";var he=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Ur&&this.addAll(arguments[0])}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[e,Ur]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var r=this,i=n.iterator();i.hasNext();)r.add(i.next());return!0},t.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},t.prototype.iterator=function(){return new _D(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new Bv;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,r=[],i=0,a=this.array_.length;i=1){var w=this.get(this.size()-1);if(w.equals2D(u))return null}e.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],I=arguments[1];return this.add(S,I),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var P=arguments[0],z=arguments[1],R=arguments[2];if(R)for(var Z=0;Z=0;X--)r.add(P[X],z);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Pt){var et=arguments[0],B=arguments[1],q=arguments[2];if(!q){var Y=this.size();if(Y>0){if(et>0){var lt=this.get(et-1);if(lt.equals2D(B))return null}if(etkt&&(Q=-1);for(var yt=_t;yt!==kt;yt+=Q)r.add(ut[yt],ft);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new Pt(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,n),t}(he),dn=function(){},by={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};by.ForwardComparator.get=function(){return vd};by.BidirectionalComparator.get=function(){return _f};by.coordArrayType.get=function(){return new Array(0).fill(null)};dn.prototype.interfaces_=function(){return[]};dn.prototype.getClass=function(){return dn};dn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};dn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};dn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};dn.extract=function(e,t,n){t=qo.clamp(t,0,e.length),n=qo.clamp(n,-1,e.length);var r=n-t+1;n<0&&(r=0),t>=e.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=dn.compare(n,r),a=dn.isEqualReversed(n,r);return a?0:i};_f.prototype.OLDcompare=function(e,t){var n=e,r=t;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var i=dn.increasingDirection(n),a=dn.increasingDirection(r),h=i>0?0:n.length-1,u=a>0?0:n.length-1,y=0;y0)t=t.right;else return t.value}return null};Ai.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=e.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var a=n.value;return n.value=t,a}while(n!==null);var h={key:e,left:null,right:null,value:t,parent:r,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=h:r.right=h,this.fixAfterInsertion(h),this.size_++,null};Ai.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=wu;e!=null&&e!==this.root_&&e.parent.color===wu;)if(Hn(e)===u0(Hn(Hn(e)))){var n=Vw(Hn(Hn(e)));Bw(n)===wu?(Ja(Hn(e),nl),Ja(n,nl),Ja(Hn(Hn(e)),wu),e=Hn(Hn(e))):(e===Vw(Hn(e))&&(e=Hn(e),t.rotateLeft(e)),Ja(Hn(e),nl),Ja(Hn(Hn(e)),wu),t.rotateRight(Hn(Hn(e))))}else{var r=u0(Hn(Hn(e)));Bw(r)===wu?(Ja(Hn(e),nl),Ja(r,nl),Ja(Hn(Hn(e)),wu),e=Hn(Hn(e))):(e===u0(Hn(e))&&(e=Hn(e),t.rotateRight(e)),Ja(Hn(e),nl),Ja(Hn(Hn(e)),wu),t.rotateLeft(Hn(Hn(e))))}this.root_.color=nl};Ai.prototype.values=function(){var e=new he,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=Ai.successor(t))!==null;)e.add(t.value);return e};Ai.prototype.entrySet=function(){var e=new Vv,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=Ai.successor(t))!==null;)e.add(t);return e};Ai.prototype.rotateLeft=function(e){if(e!=null){var t=e.right;e.right=t.left,t.left!=null&&(t.left.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}};Ai.prototype.rotateRight=function(e){if(e!=null){var t=e.left;e.left=t.right,t.right!=null&&(t.right.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.right===e?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}};Ai.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};Ai.successor=function(e){if(e===null)return null;if(e.right!==null){for(var t=e.right;t.left!==null;)t=t.left;return t}else{for(var n=e.parent,r=e;n!==null&&r===n.right;)r=n,n=n.parent;return n}};Ai.prototype.size=function(){return this.size_};var bd=function(){};bd.prototype.interfaces_=function(){return[]};bd.prototype.getClass=function(){return bd};function mI(){}mI.prototype=new xy;function ea(){this.array_=[],arguments[0]instanceof Ur&&this.addAll(arguments[0])}ea.prototype=new mI;ea.prototype.contains=function(e){for(var t=this,n=0,r=this.array_.length;n=0;){var h=i.substring(0,a);r.add(h),i=i.substring(a+n),a=i.indexOf(t)}i.length>0&&r.add(i);for(var u=new Array(r.size()).fill(null),y=0;y0)for(var a=i;a0&&r.append(" ");for(var a=0;a0&&r.append(","),r.append(os.toString(e.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Tr.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Tr.createClosedRing(e,t,4);var r=t.getOrdinate(0,Sn.X)===t.getOrdinate(n-1,Sn.X)&&t.getOrdinate(0,Sn.Y)===t.getOrdinate(n-1,Sn.Y);return r?t:Tr.createClosedRing(e,t,n+1)};Tr.createClosedRing=function(e,t,n){var r=e.create(n,t.getDimension()),i=t.size();Tr.copy(t,0,r,0,i);for(var a=i;a0&&Tr.reverse(r._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?Tn.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return be.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var r=this._points.copy();Tr.reverse(r);var i=this.getFactory().createLineString(r);return i},t.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],a=i,h=0,u=0;h= 2)");this._points=r},t.prototype.isCoordinate=function(r){for(var i=this,a=0;a=1&&this.getCoordinateSequence().size()= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,n),t}(yr),Ta=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return Fe.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?e.prototype.equalsExact.call(this,r,i):!1}else return e.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var r=this,i=this._geometries.length,a=new Array(i).fill(null),h=0;h0?t.createPoint(n[0]):t.createPoint():e};Sd.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Sd.prototype.getClass=function(){return Sd};var Ed=function(){};Ed.prototype.edit=function(e,t){return e instanceof Ma?t.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof yr?t.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof Eo?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};Ed.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Ed.prototype.getClass=function(){return Ed};var Ir=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n0){var t=new pa(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Ir(n):new Ir(n,r)}};Aa.prototype.interfaces_=function(){return[pf,fs]};Aa.prototype.getClass=function(){return Aa};Aa.instance=function(){return Aa.instanceObject};Gv.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};Gv.instanceObject.get=function(){return new Aa};Object.defineProperties(Aa,Gv);var yI=function(e){function t(){e.call(this),this.map_=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,r){return this.map_.set(n,r),r},t.prototype.values=function(){for(var n=new he,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},t.prototype.entrySet=function(){var n=new Vv;return this.map_.entries().forEach(function(r){return n.add(r)}),n},t.prototype.size=function(){return this.map_.size()},t}(Wc),Pn=function e(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=e.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ra){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},qv={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Pn.prototype.equals=function(e){if(!(e instanceof Pn))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};Pn.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),r=t.getMaximumSignificantDigits();return new ta(n).compareTo(new ta(r))};Pn.prototype.getScale=function(){return this._scale};Pn.prototype.isFloating=function(){return this._modelType===Pn.FLOATING||this._modelType===Pn.FLOATING_SINGLE};Pn.prototype.getType=function(){return this._modelType};Pn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===Pn.FLOATING?e="Floating":this._modelType===Pn.FLOATING_SINGLE?e="Floating-Single":this._modelType===Pn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};Pn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(We.isNaN(e))return e;if(this._modelType===Pn.FLOATING_SINGLE){var t=e;return t}return this._modelType===Pn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof Pt){var n=arguments[0];if(this._modelType===Pn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Pn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===Pn.FLOATING?e=16:this._modelType===Pn.FLOATING_SINGLE?e=6:this._modelType===Pn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};Pn.prototype.setScale=function(e){this._scale=Math.abs(e)};Pn.prototype.interfaces_=function(){return[fs,hs]};Pn.prototype.getClass=function(){return Pn};Pn.mostPrecise=function(e,t){return e.compareTo(t)>=0?e:t};qv.serialVersionUID.get=function(){return 7777263578777804e3};qv.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Pn,qv);var ra=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},jv={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ra.prototype.readResolve=function(){return ra.nameToTypeMap.get(this._name)};ra.prototype.toString=function(){return this._name};ra.prototype.interfaces_=function(){return[fs]};ra.prototype.getClass=function(){return ra};jv.serialVersionUID.get=function(){return-552860263173159e4};jv.nameToTypeMap.get=function(){return new yI};Object.defineProperties(ra,jv);Pn.Type=ra;Pn.FIXED=new ra("FIXED");Pn.FLOATING=new ra("FLOATING");Pn.FLOATING_SINGLE=new ra("FLOATING SINGLE");var pn=function e(){this._precisionModel=new Pn,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Be(arguments[0],pf)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Pn&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},_I={serialVersionUID:{configurable:!0}};pn.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new Pt(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new Pt(e.getMinX(),e.getMinY()),new Pt(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new Pt(e.getMinX(),e.getMinY()),new Pt(e.getMinX(),e.getMaxY()),new Pt(e.getMaxX(),e.getMaxY()),new Pt(e.getMaxX(),e.getMinY()),new Pt(e.getMinX(),e.getMinY())]),null)};pn.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new yr(this.getCoordinateSequenceFactory().create(e),this);if(Be(e,Sn))return new yr(e,this)}else return new yr(this.getCoordinateSequenceFactory().create([]),this)};pn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Au(null,this);if(arguments.length===1){var e=arguments[0];return new Au(e,this)}};pn.prototype.buildGeometry=function(e){for(var t=null,n=!1,r=!1,i=e.iterator();i.hasNext();){var a=i.next(),h=a.getClass();t===null&&(t=h),h!==t&&(n=!0),a.isGeometryCollectionOrDerived()&&(r=!0)}if(t===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(pn.toGeometryArray(e));var u=e.iterator().next(),y=e.size()>1;if(y){if(u instanceof Wr)return this.createMultiPolygon(pn.toPolygonArray(e));if(u instanceof yr)return this.createMultiLineString(pn.toLineStringArray(e));if(u instanceof Eo)return this.createMultiPoint(pn.toPointArray(e));en.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u};pn.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};pn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Pt){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(Be(arguments[0],Sn)){var t=arguments[0];return new Eo(t,this)}}};pn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};pn.prototype.createPolygon=function(){if(arguments.length===0)return new Wr(null,null,this);if(arguments.length===1){if(Be(arguments[0],Sn)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Ma){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Wr(r,i,this)}};pn.prototype.getSRID=function(){return this._SRID};pn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Hi(null,this);if(arguments.length===1){var e=arguments[0];return new Hi(e,this)}};pn.prototype.createGeometry=function(e){var t=new us(this);return t.edit(e,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};pn.prototype.getPrecisionModel=function(){return this._precisionModel};pn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(Be(arguments[0],Sn)){var t=arguments[0];return new Ma(t,this)}}};pn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Ta(null,this);if(arguments.length===1){var e=arguments[0];return new Ta(e,this)}};pn.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new vf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new vf(t,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Be(arguments[0],Sn)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),a=0;a=this.size())throw new Error;return this.array_[e]};da.prototype.push=function(e){return this.array_.push(e),e};da.prototype.pop=function(e){if(this.array_.length===0)throw new Cy;return this.array_.pop()};da.prototype.peek=function(){if(this.array_.length===0)throw new Cy;return this.array_[this.array_.length-1]};da.prototype.empty=function(){return this.array_.length===0};da.prototype.isEmpty=function(){return this.empty()};da.prototype.search=function(e){return this.array_.indexOf(e)};da.prototype.size=function(){return this.array_.length};da.prototype.toArray=function(){for(var e=this,t=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===be.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};ia.prototype.getRightmostSideOfSegment=function(e,t){var n=e.getEdge(),r=n.getCoordinates();if(t<0||t+1>=r.length||r[t].y===r[t+1].y)return-1;var i=ie.LEFT;return r[t].yt._minCoord.x)&&(t._minDe=e,t._minIndex=r,t._minCoord=n[r])};ia.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),t=e.getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};ia.prototype.findEdge=function(e){for(var t=this,n=e.iterator();n.hasNext();){var r=n.next();r.isForward()&&t.checkForRightmostCoordinate(r)}en.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var i=this.getRightmostSide(this._minDe,this._minIndex);i===ie.LEFT&&(this._orientedDe=this._minDe.getSym())};ia.prototype.interfaces_=function(){return[]};ia.prototype.getClass=function(){return ia};var hl=function(e){function t(n,r){e.call(this,t.msgWithCoord(n,r)),this.pt=r?new Pt(r):null,this.name="TopologyException"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},t}(ul),Ty=function(){this.array_=[]};Ty.prototype.addLast=function(e){this.array_.push(e)};Ty.prototype.removeFirst=function(){return this.array_.shift()};Ty.prototype.isEmpty=function(){return this.array_.length===0};var Zi=function(){this._finder=null,this._dirEdgeList=new he,this._nodes=new he,this._rightMostCoord=null,this._env=null,this._finder=new ia};Zi.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.setVisited(!1)}};Zi.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Zi.prototype.computeNodeDepth=function(e){for(var t=this,n=null,r=e.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new hl("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(n);for(var a=e.getEdges().iterator();a.hasNext();){var h=a.next();h.setVisited(!0),t.copySymDepths(h)}};Zi.prototype.computeDepth=function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.setEdgeDepths(ie.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)};Zi.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Zi.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(ie.RIGHT)>=1&&t.getDepth(ie.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}};Zi.prototype.computeDepths=function(e){var t=this,n=new Vv,r=new Ty,i=e.getNode();for(r.addLast(i),n.add(i),e.setVisited(!0);!r.isEmpty();){var a=r.removeFirst();n.add(a),t.computeNodeDepth(a);for(var h=a.getEdges().iterator();h.hasNext();){var u=h.next(),y=u.getSym();if(!y.isVisited()){var w=y.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};Zi.prototype.compareTo=function(e){var t=e;return this._rightMostCoord.xt._rightMostCoord.x?1:0};Zi.prototype.getEnvelope=function(){if(this._env===null){for(var e=new ke,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next(),r=n.getEdge().getCoordinates(),i=0;ithis.location.length){var n=new Array(3).fill(null);n[ie.ON]=this.location[ie.ON],n[ie.LEFT]=Dt.NONE,n[ie.RIGHT]=Dt.NONE,this.location=n}for(var r=0;r1&&e.append(Dt.toLocationSymbol(this.location[ie.LEFT])),e.append(Dt.toLocationSymbol(this.location[ie.ON])),this.location.length>1&&e.append(Dt.toLocationSymbol(this.location[ie.RIGHT])),e.toString()};Zn.prototype.setLocations=function(e,t,n){this.location[ie.ON]=e,this.location[ie.LEFT]=t,this.location[ie.RIGHT]=n};Zn.prototype.get=function(e){return e1};Zn.prototype.isAnyNull=function(){for(var e=this,t=0;te._maxNodeDegree&&(e._maxNodeDegree=r),t=e.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2};Or.prototype.addPoints=function(e,t,n){var r=this,i=e.getCoordinates();if(t){var a=1;n&&(a=0);for(var h=a;h=0;y--)r._pts.add(i[y])}};Or.prototype.isHole=function(){return this._isHole};Or.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};Or.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!be.isPointInRing(e,t.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(e))return!1}return!0};Or.prototype.addHole=function(e){this._holes.add(e)};Or.prototype.isShell=function(){return this._shell===null};Or.prototype.getLabel=function(){return this._label};Or.prototype.getEdges=function(){return this._edges};Or.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Or.prototype.getShell=function(){return this._shell};Or.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=t.getLocation(n,ie.RIGHT);if(r===Dt.NONE)return null;if(this._label.getLocation(n)===Dt.NONE)return this._label.setLocation(n,r),null}};Or.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};Or.prototype.toPolygon=function(e){for(var t=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(e)};jo.prototype.isInResult=function(){return this._isInResult};jo.prototype.isVisited=function(){return this._isVisited};jo.prototype.interfaces_=function(){return[]};jo.prototype.getClass=function(){return jo};var Ly=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Nn(0,Dt.NONE)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,r){var i=Dt.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var a=n.getLocation(r);i!==Dt.BOUNDARY&&(i=a)}return i},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new Nn(n,r):this._label.setLocation(n,r)}else return e.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Nn)for(var i=arguments[0],a=0;a<2;a++){var h=n.computeMergedLocation(i,a),u=n._label.getLocation(a);u===Dt.NONE&&n._label.setLocation(a,h)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=Dt.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case Dt.BOUNDARY:i=Dt.INTERIOR;break;case Dt.INTERIOR:i=Dt.BOUNDARY;break;default:i=Dt.BOUNDARY;break}this._label.setLocation(n,i)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jo),oa=function(){this.nodeMap=new Ai,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};oa.prototype.find=function(e){return this.nodeMap.get(e)};oa.prototype.addNode=function(){if(arguments[0]instanceof Pt){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}else if(arguments[0]instanceof Ly){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};oa.prototype.print=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};oa.prototype.iterator=function(){return this.nodeMap.values().iterator()};oa.prototype.values=function(){return this.nodeMap.values()};oa.prototype.getBoundaryNodes=function(e){for(var t=new he,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(e)===Dt.BOUNDARY&&t.add(r)}return t};oa.prototype.add=function(e){var t=e.getCoordinate(),n=this.addNode(t);n.add(e)};oa.prototype.interfaces_=function(){return[]};oa.prototype.getClass=function(){return oa};var zn=function(){},Ud={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};zn.prototype.interfaces_=function(){return[]};zn.prototype.getClass=function(){return zn};zn.isNorthern=function(e){return e===zn.NE||e===zn.NW};zn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};zn.commonHalfPlane=function(e,t){if(e===t)return e;var n=(e-t+4)%4;if(n===2)return-1;var r=et?e:t;return r===0&&i===3?3:r};zn.isInHalfPlane=function(e,t){return t===zn.SE?e===zn.SE||e===zn.SW:e===t||e===t+1};zn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new ir("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?zn.NE:zn.SE:t>=0?zn.NW:zn.SW}else if(arguments[0]instanceof Pt&&arguments[1]instanceof Pt){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new ir("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?zn.NE:zn.SE:r.y>=n.y?zn.NW:zn.SW}};Ud.NE.get=function(){return 0};Ud.NW.get=function(){return 1};Ud.SW.get=function(){return 2};Ud.SE.get=function(){return 3};Object.defineProperties(zn,Ud);var ki=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=t,this.init(n,r),this._label=i}else if(arguments.length===4){var a=arguments[0],h=arguments[1],u=arguments[2],y=arguments[3];this._edge=a,this.init(h,u),this._label=y}};ki.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){h.linkDirectedEdgesForMinimalEdgeRings();var u=h.buildMinimalRings(),y=r.findShell(u);y!==null?(r.placePolygonHoles(y,u),t.add(y)):n.addAll(u)}else i.add(h)}return i};Io.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};Io.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new he,r=e.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var a=new PD(i,t._geometryFactory);n.add(a),a.setInResult()}}return n};Io.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(e)}};Io.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};Io.prototype.findEdgeRingContaining=function(e,t){for(var n=e.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),a=null,h=null,u=t.iterator();u.hasNext();){var y=u.next(),w=y.getLinearRing(),S=w.getEnvelopeInternal();a!==null&&(h=a.getLinearRing().getEnvelopeInternal());var I=!1;S.contains(r)&&be.isPointInRing(i,w.getCoordinates())&&(I=!0),I&&(a===null||h.contains(S))&&(a=y)}return a};Io.prototype.findShell=function(e){for(var t=0,n=null,r=e.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,t++)}return en.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};Io.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];cr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(t),i=new he,a=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(a,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Io.prototype.interfaces_=function(){return[]};Io.prototype.getClass=function(){return Io};var xf=function(){};xf.prototype.getBounds=function(){};xf.prototype.interfaces_=function(){return[]};xf.prototype.getClass=function(){return xf};var Ps=function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t};Ps.prototype.getItem=function(){return this._item};Ps.prototype.getBounds=function(){return this._bounds};Ps.prototype.interfaces_=function(){return[xf,fs]};Ps.prototype.getClass=function(){return Ps};var fl=function(){this._size=null,this._items=null,this._size=0,this._items=new he,this._items.add(null)};fl.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e};fl.prototype.size=function(){return this._size};fl.prototype.reorder=function(e){for(var t=this,n=null,r=this._items.get(e);e*2<=this._size&&(n=e*2,n!==t._size&&t._items.get(n+1).compareTo(t._items.get(n))<0&&n++,t._items.get(n).compareTo(r)<0);e=n)t._items.set(e,t._items.get(n));this._items.set(e,r)};fl.prototype.clear=function(){this._size=0,this._items.clear()};fl.prototype.isEmpty=function(){return this._size===0};fl.prototype.add=function(e){var t=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)t._items.set(n,t._items.get(Math.trunc(n/2)));this._items.set(n,e)};fl.prototype.interfaces_=function(){return[]};fl.prototype.getClass=function(){return fl};var Xl=function(){};Xl.prototype.visitItem=function(e){};Xl.prototype.interfaces_=function(){return[]};Xl.prototype.getClass=function(){return Xl};var Ic=function(){};Ic.prototype.insert=function(e,t){};Ic.prototype.remove=function(e,t){};Ic.prototype.query=function(){};Ic.prototype.interfaces_=function(){return[]};Ic.prototype.getClass=function(){return Ic};var jr=function(){if(this._childBoundables=new he,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},bI={serialVersionUID:{configurable:!0}};jr.prototype.getLevel=function(){return this._level};jr.prototype.size=function(){return this._childBoundables.size()};jr.prototype.getChildBoundables=function(){return this._childBoundables};jr.prototype.addChildBoundable=function(e){en.isTrue(this._bounds===null),this._childBoundables.add(e)};jr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};jr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};jr.prototype.interfaces_=function(){return[xf,fs]};jr.prototype.getClass=function(){return jr};bI.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(jr,bI);var Ms=function(){};Ms.reverseOrder=function(){return{compare:function(e,t){return t.compareTo(e)}}};Ms.min=function(e){return Ms.sort(e),e.get(0)};Ms.sort=function(e,t){var n=e.toArray();t?Lu.sort(n,t):Lu.sort(n);for(var r=e.iterator(),i=0,a=n.length;iDr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,t),null):(this.expand(this._boundable2,this._boundable1,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,e,t),null;if(r)return this.expand(this._boundable2,this._boundable1,e,t),null;throw new ir("neither boundable is composite")};Dr.prototype.isLeaves=function(){return!(Dr.isComposite(this._boundable1)||Dr.isComposite(this._boundable2))};Dr.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Dr.prototype.expand=function(e,t,n,r){for(var i=this,a=e.getChildBoundables(),h=a.iterator();h.hasNext();){var u=h.next(),y=new Dr(u,t,i._itemDistance);y.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Py={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};hi.prototype.getNodeCapacity=function(){return this._nodeCapacity};hi.prototype.lastNode=function(e){return e.get(e.size()-1)};hi.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=arguments[0],n=0,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof jr?n+=e.size(i):i instanceof Ps&&(n+=1)}return n}};hi.prototype.removeItem=function(e,t){for(var n=null,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ps&&i.getItem()===t&&(n=i)}return n!==null?(e.getChildBoundables().remove(n),!0):!1};hi.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new he:t}else if(arguments.length===1){for(var n=arguments[0],r=new he,i=n.getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof jr){var h=e.itemsTree(a);h!==null&&r.add(h)}else a instanceof Ps?r.add(a.getItem()):en.shouldNeverReachHere()}return r.size()<=0?null:r}};hi.prototype.insert=function(e,t){en.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ps(e,t))};hi.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new he;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];if(en.isTrue(r>-2),i.getLevel()===r)return a.add(i),null;for(var h=i.getChildBoundables().iterator();h.hasNext();){var u=h.next();u instanceof jr?e.boundablesAtLevel(r,u,a):(en.isTrue(u instanceof Ps),r===-1&&a.add(u))}return null}};hi.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new he;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}else if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(Be(arguments[2],Xl)&&arguments[0]instanceof Object&&arguments[1]instanceof jr)for(var a=arguments[0],h=arguments[1],u=arguments[2],y=h.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};hi.prototype.createParentBoundables=function(e,t){var n=this;en.isTrue(!e.isEmpty());var r=new he;r.add(this.createNode(t));var i=new he(e);Ms.sort(i,this.getComparator());for(var a=i.iterator();a.hasNext();){var h=a.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(t)),n.lastNode(r).addChildBoundable(h)}return r};hi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};hi.prototype.interfaces_=function(){return[fs]};hi.prototype.getClass=function(){return hi};hi.compareDoubles=function(e,t){return e>t?1:e0);for(var h=new he,u=0;u0;){var R=z.poll(),Z=R.getDistance();if(Z>=I)break;R.isLeaves()?(I=Z,P=R):R.expandToQueue(z,I)}return[P.getBoundable(0).getItem(),P.getBoundable(1).getItem()]}}else if(arguments.length===3){var X=arguments[0],et=arguments[1],B=arguments[2],q=new Ps(X,et),Y=new Dr(this.getRoot(),q,B);return this.nearestNeighbour(Y)[0]}},t.prototype.interfaces_=function(){return[Ic,fs]},t.prototype.getClass=function(){return t},t.centreX=function(r){return t.avg(r.getMinX(),r.getMaxX())},t.avg=function(r,i){return(r+i)/2},t.centreY=function(r){return t.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return Uw},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[ff]},compare:function(r,i){return e.compareDoubles(t.centreX(r.getBounds()),t.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[ff]},compare:function(r,i){return e.compareDoubles(t.centreY(r.getBounds()),t.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(hi),Uw=function(e){function t(){var n=arguments[0];e.call(this,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new ke(i.getBounds()):n.expandToInclude(i.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jr),io=function(){};io.prototype.interfaces_=function(){return[]};io.prototype.getClass=function(){return io};io.relativeSign=function(e,t){return et?1:0};io.compare=function(e,t,n){if(t.equals2D(n))return 0;var r=io.relativeSign(t.x,n.x),i=io.relativeSign(t.y,n.y);switch(e){case 0:return io.compareValue(r,i);case 1:return io.compareValue(i,r);case 2:return io.compareValue(i,-r);case 3:return io.compareValue(-r,i);case 4:return io.compareValue(-r,-i);case 5:return io.compareValue(-i,-r);case 6:return io.compareValue(-i,r);case 7:return io.compareValue(r,-i)}return en.shouldNeverReachHere("invalid octant value"),0};io.compareValue=function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0};var Yl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];this._segString=e,this.coord=new Pt(t),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!t.equals2D(e.getCoordinate(n))};Yl.prototype.getCoordinate=function(){return this.coord};Yl.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)};Yl.prototype.compareTo=function(e){var t=e;return this.segmentIndext.segmentIndex?1:this.coord.equals2D(t.coord)?0:io.compare(this._segmentOctant,this.coord,t.coord)};Yl.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e};Yl.prototype.isInterior=function(){return this._isInterior};Yl.prototype.interfaces_=function(){return[hs]};Yl.prototype.getClass=function(){return Yl};var Xi=function(){this._nodeMap=new Ai,this._edge=null;var e=arguments[0];this._edge=e};Xi.prototype.getSplitCoordinates=function(){var e=this,t=new Bd;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();e.addEdgeCoordinates(r,i,t),r=i}return t.toCoordinateArray()};Xi.prototype.addCollapsedNodes=function(){var e=this,t=new he;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var r=n.next().intValue();e.add(e._edge.getCoordinate(r),r)}};Xi.prototype.print=function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};Xi.prototype.findCollapsesFromExistingVertices=function(e){for(var t=this,n=0;n=0?t>=0?n>=r?0:1:n>=r?7:6:t>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof Pt&&arguments[1]instanceof Pt){var i=arguments[0],a=arguments[1],h=a.x-i.x,u=a.y-i.y;if(h===0&&u===0)throw new ir("Cannot compute the octant for two identical points "+i);return Cc.octant(h,u)}};var ka=function(){};ka.prototype.getCoordinates=function(){};ka.prototype.size=function(){};ka.prototype.getCoordinate=function(e){};ka.prototype.isClosed=function(){};ka.prototype.setData=function(e){};ka.prototype.getData=function(){};ka.prototype.interfaces_=function(){return[]};ka.prototype.getClass=function(){return ka};var Id=function(){};Id.prototype.addIntersection=function(e,t){};Id.prototype.interfaces_=function(){return[ka]};Id.prototype.getClass=function(){return Id};var Lr=function(){this._nodeList=new Xi(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};Lr.prototype.getCoordinates=function(){return this._pts};Lr.prototype.size=function(){return this._pts.length};Lr.prototype.getCoordinate=function(e){return this._pts[e]};Lr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Lr.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};Lr.prototype.setData=function(e){this._data=e};Lr.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:Cc.octant(e,t)};Lr.prototype.getData=function(){return this._data};Lr.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[3],a=new Pt(n.getIntersection(i));this.addIntersection(a,r)}};Lr.prototype.toString=function(){return Ts.toLineString(new Ir(this._pts))};Lr.prototype.getNodeList=function(){return this._nodeList};Lr.prototype.addIntersectionNode=function(e,t){var n=t,r=n+1;if(r=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}else if(arguments[0]instanceof Pt){var r=arguments[0];return be.orientationIndex(this.p0,this.p1,r)}};De.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};De.prototype.isVertical=function(){return this.p0.x===this.p1.x};De.prototype.equals=function(e){if(!(e instanceof De))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};De.prototype.intersection=function(e){var t=new ju;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};De.prototype.project=function(){if(arguments[0]instanceof Pt){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new Pt(e);var t=this.projectionFactor(e),n=new Pt;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof De){var r=arguments[0],i=this.projectionFactor(r.p0),a=this.projectionFactor(r.p1);if(i>=1&&a>=1||i<=0&&a<=0)return null;var h=this.project(r.p0);i<0&&(h=this.p0),i>1&&(h=this.p1);var u=this.project(r.p1);return a<0&&(u=this.p0),a>1&&(u=this.p1),new De(h,u)}};De.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};De.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};De.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};De.prototype.distancePerpendicular=function(e){return be.distancePointLinePerpendicular(e,this.p0,this.p1)};De.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};De.prototype.midPoint=function(){return De.midPoint(this.p0,this.p1)};De.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=t*t+n*n;if(r<=0)return We.NaN;var i=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/r;return i};De.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),r=We.MAX_VALUE,i=null,a=this.closestPoint(e.p0);r=a.distance(e.p0),n[0]=a,n[1]=e.p0;var h=this.closestPoint(e.p1);i=h.distance(e.p1),i0&&t<1)return this.project(e);var n=this.p0.distance(e),r=this.p1.distance(e);return n1||We.isNaN(t))&&(t=1),t};De.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};De.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};De.prototype.distance=function(){if(arguments[0]instanceof De){var e=arguments[0];return be.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof Pt){var t=arguments[0];return be.distancePointLine(t,this.p0,this.p1)}};De.prototype.pointAlong=function(e){var t=new Pt;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t};De.prototype.hashCode=function(){var e=We.doubleToLongBits(this.p0.x);e^=We.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=We.doubleToLongBits(this.p1.x);n^=We.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return t^r};De.prototype.interfaces_=function(){return[hs,fs]};De.prototype.getClass=function(){return De};De.midPoint=function(e,t){return new Pt((e.x+t.x)/2,(e.y+t.y)/2)};wI.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(De,wI);var Cd=function(){this.tempEnv1=new ke,this.tempEnv2=new ke,this._overlapSeg1=new De,this._overlapSeg2=new De};Cd.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Cd.prototype.interfaces_=function(){return[]};Cd.prototype.getClass=function(){return Cd};var Co=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=r};Co.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};Co.prototype.computeSelect=function(e,t,n,r){var i=this._pts[t],a=this._pts[n];if(r.tempEnv1.init(i,a),n-t===1)return r.select(this,t),null;if(!e.intersects(r.tempEnv1))return null;var h=Math.trunc((t+n)/2);t=e.length-1)return e.length-1;for(var r=zn.quadrant(e[n],e[n+1]),i=t+1;ih.getId()&&(h.computeOverlaps(w,i),r._nOverlaps++),r._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return Gw},Object.defineProperties(t,n),t}(Td),Gw=function(e){function t(){e.call(this),this._si=null;var n=arguments[0];this._si=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],a=arguments[3],h=n.getContext(),u=i.getContext();this._si.processIntersections(h,r,u,a)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Cd),Ln=function e(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],h=arguments[2],u=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(a),this.setJoinStyle(h),this.setMitreLimit(u)}}},_l={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Ln.prototype.getEndCapStyle=function(){return this._endCapStyle};Ln.prototype.isSingleSided=function(){return this._isSingleSided};Ln.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Ln.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ln.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Ln.JOIN_ROUND&&(this._quadrantSegments=Ln.DEFAULT_QUADRANT_SEGMENTS)};Ln.prototype.getJoinStyle=function(){return this._joinStyle};Ln.prototype.setJoinStyle=function(e){this._joinStyle=e};Ln.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Ln.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Ln.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Ln.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Ln.prototype.getMitreLimit=function(){return this._mitreLimit};Ln.prototype.setMitreLimit=function(e){this._mitreLimit=e};Ln.prototype.setSingleSided=function(e){this._isSingleSided=e};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Ln.bufferDistanceError=function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)};_l.CAP_ROUND.get=function(){return 1};_l.CAP_FLAT.get=function(){return 2};_l.CAP_SQUARE.get=function(){return 3};_l.JOIN_ROUND.get=function(){return 1};_l.JOIN_MITRE.get=function(){return 2};_l.JOIN_BEVEL.get=function(){return 3};_l.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};_l.DEFAULT_MITRE_LIMIT.get=function(){return 5};_l.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Ln,_l);var _r=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=be.COUNTERCLOCKWISE,this._inputLine=e||null},Gd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};_r.prototype.isDeletable=function(e,t,n,r){var i=this._inputLine[e],a=this._inputLine[t],h=this._inputLine[n];return!this.isConcave(i,a,h)||!this.isShallow(i,a,h,r)?!1:this.isShallowSampled(i,a,e,n,r)};_r.prototype.deleteShallowConcavities=function(){for(var e=this,t=1,n=this.findNextNonDeletedIndex(t),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(e[i])};Wo.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1),n=e.distance(t);return nMath.PI;)e-=vn.PI_TIMES_2;for(;e<=-Math.PI;)e+=vn.PI_TIMES_2;return e};vn.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=n.x-t.x,i=n.y-t.y;return Math.atan2(i,r)}};vn.isAcute=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=n.x-t.x,h=n.y-t.y,u=r*a+i*h;return u>0};vn.isObtuse=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=n.x-t.x,h=n.y-t.y,u=r*a+i*h;return u<0};vn.interiorAngle=function(e,t,n){var r=vn.angle(t,e),i=vn.angle(t,n);return Math.abs(i-r)};vn.normalizePositive=function(e){if(e<0){for(;e<0;)e+=vn.PI_TIMES_2;e>=vn.PI_TIMES_2&&(e=0)}else{for(;e>=vn.PI_TIMES_2;)e-=vn.PI_TIMES_2;e<0&&(e=0)}return e};vn.angleBetween=function(e,t,n){var r=vn.angle(t,e),i=vn.angle(t,n);return vn.diff(r,i)};vn.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};vn.toRadians=function(e){return e*Math.PI/180};vn.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?vn.COUNTERCLOCKWISE:n<0?vn.CLOCKWISE:vn.NONE};vn.angleBetweenOriented=function(e,t,n){var r=vn.angle(t,e),i=vn.angle(t,n),a=i-r;return a<=-Math.PI?a+vn.PI_TIMES_2:a>Math.PI?a-vn.PI_TIMES_2:a};Hc.PI_TIMES_2.get=function(){return 2*Math.PI};Hc.PI_OVER_2.get=function(){return Math.PI/2};Hc.PI_OVER_4.get=function(){return Math.PI/4};Hc.COUNTERCLOCKWISE.get=function(){return be.COUNTERCLOCKWISE};Hc.CLOCKWISE.get=function(){return be.CLOCKWISE};Hc.NONE.get=function(){return be.COLLINEAR};Object.defineProperties(vn,Hc);var Qn=function e(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new De,this._seg1=new De,this._offset0=new De,this._offset1=new De,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new ju,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Ln.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},qd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Qn.prototype.addNextSegment=function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=be.computeOrientation(this._s0,this._s1,this._s2),r=n===be.CLOCKWISE&&this._side===ie.LEFT||n===be.COUNTERCLOCKWISE&&this._side===ie.RIGHT;n===0?this.addCollinear(t):r?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};Qn.prototype.addLineEndCap=function(e,t){var n=new De(e,t),r=new De;this.computeOffsetSegment(n,ie.LEFT,this._distance,r);var i=new De;this.computeOffsetSegment(n,ie.RIGHT,this._distance,i);var a=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,a);switch(this._bufParams.getEndCapStyle()){case Ln.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(t,u+Math.PI/2,u-Math.PI/2,be.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Ln.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Ln.CAP_SQUARE:var y=new Pt;y.x=Math.abs(this._distance)*Math.cos(u),y.y=Math.abs(this._distance)*Math.sin(u);var w=new Pt(r.p1.x+y.x,r.p1.y+y.y),S=new Pt(i.p1.x+y.x,i.p1.y+y.y);this._segList.addPt(w),this._segList.addPt(S);break}};Qn.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};Qn.prototype.addMitreJoin=function(e,t,n,r){var i=!0,a=null;try{a=Is.intersection(t.p0,t.p1,n.p0,n.p1);var h=r<=0?1:a.distance(e)/Math.abs(r);h>this._bufParams.getMitreLimit()&&(i=!1)}catch(u){if(u instanceof Ff)a=new Pt(0,0),i=!1;else throw u}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(t,n,r,this._bufParams.getMitreLimit())};Qn.prototype.addFilletCorner=function(e,t,n,r,i){var a=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,a),y=n.x-e.x,w=n.y-e.y,S=Math.atan2(w,y);r===be.CLOCKWISE?u<=S&&(u+=2*Math.PI):u>=S&&(u-=2*Math.PI),this._segList.addPt(t),this.addFilletArc(e,u,S,r,i),this._segList.addPt(n)};Qn.prototype.addOutsideTurn=function(e,t){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Pt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new Pt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};Qn.prototype.createCircle=function(e){var t=new Pt(e.x+this._distance,e.y);this._segList.addPt(t),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};Qn.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};Qn.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Wo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*Qn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};Qn.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var t=this._li.getIntersectionNum();t>=2&&(this._bufParams.getJoinStyle()===Ln.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ln.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,be.CLOCKWISE,this._distance))};Qn.prototype.closeRing=function(){this._segList.closeRing()};Qn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};Qn.prototype.interfaces_=function(){return[]};Qn.prototype.getClass=function(){return Qn};qd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};qd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};qd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};qd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(Qn,qd);var so=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t};so.prototype.getOffsetCurve=function(e,t){if(this._distance=t,t===0)return null;var n=t<0,r=Math.abs(t),i=this.getSegGen(r);e.length<=1?this.computePointCurve(e[0],i):this.computeOffsetCurve(e,n,i);var a=i.getCoordinates();return n&&dn.reverse(a),a};so.prototype.computeSingleSidedBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var i=_r.simplify(e,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ie.LEFT),n.addFirstSegment();for(var h=a-2;h>=0;h--)n.addNextSegment(i[h],!0)}else{n.addSegments(e,!1);var u=_r.simplify(e,r),y=u.length-1;n.initSideSegments(u[0],u[1],ie.LEFT),n.addFirstSegment();for(var w=2;w<=y;w++)n.addNextSegment(u[w],!0)}n.addLastSegment(),n.closeRing()};so.prototype.computeRingBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);t===ie.RIGHT&&(r=-r);var i=_r.simplify(e,r),a=i.length-1;n.initSideSegments(i[a-1],i[0],t);for(var h=1;h<=a;h++){var u=h!==1;n.addNextSegment(i[h],u)}n.closeRing()};so.prototype.computeLineBufferCurve=function(e,t){var n=this.simplifyTolerance(this._distance),r=_r.simplify(e,n),i=r.length-1;t.initSideSegments(r[0],r[1],ie.LEFT);for(var a=2;a<=i;a++)t.addNextSegment(r[a],!0);t.addLastSegment(),t.addLineEndCap(r[i-1],r[i]);var h=_r.simplify(e,-n),u=h.length-1;t.initSideSegments(h[u],h[u-1],ie.LEFT);for(var y=u-2;y>=0;y--)t.addNextSegment(h[y],!0);t.addLastSegment(),t.addLineEndCap(h[1],h[0]),t.closeRing()};so.prototype.computePointCurve=function(e,t){switch(this._bufParams.getEndCapStyle()){case Ln.CAP_ROUND:t.createCircle(e);break;case Ln.CAP_SQUARE:t.createSquare(e);break}};so.prototype.getLineCurve=function(e,t){if(this._distance=t,t<0&&!this._bufParams.isSingleSided()||t===0)return null;var n=Math.abs(t),r=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],r);else if(this._bufParams.isSingleSided()){var i=t<0;this.computeSingleSidedBufferCurve(e,i,r)}else this.computeLineBufferCurve(e,r);var a=r.getCoordinates();return a};so.prototype.getBufferParameters=function(){return this._bufParams};so.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()};so.prototype.getRingCurve=function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return so.copyCoordinates(e);var r=this.getSegGen(n);return this.computeRingBufferCurve(e,t,r),r.getCoordinates()};so.prototype.computeOffsetCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){var i=_r.simplify(e,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ie.LEFT),n.addFirstSegment();for(var h=a-2;h>=0;h--)n.addNextSegment(i[h],!0)}else{var u=_r.simplify(e,r),y=u.length-1;n.initSideSegments(u[0],u[1],ie.LEFT),n.addFirstSegment();for(var w=2;w<=y;w++)n.addNextSegment(u[w],!0)}n.addLastSegment()};so.prototype.getSegGen=function(e){return new Qn(this._precisionModel,this._bufParams,e)};so.prototype.interfaces_=function(){return[]};so.prototype.getClass=function(){return so};so.copyCoordinates=function(e){for(var t=new Array(e.length).fill(null),n=0;na.getMaxY()||e.findStabbedSegments(t,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Be(arguments[2],Cs)&&arguments[0]instanceof Pt&&arguments[1]instanceof J0)for(var h=arguments[0],u=arguments[1],y=arguments[2],w=u.getEdge().getCoordinates(),S=0;Se._seg.p1.y&&e._seg.reverse();var I=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(Ie._seg.p1.y)&&be.computeOrientation(e._seg.p0,e._seg.p1,h)!==be.RIGHT){var P=u.getDepth(ie.LEFT);e._seg.p0.equals(w[S])||(P=u.getDepth(ie.RIGHT));var z=new Du(e._seg,P);y.add(z)}}else if(Be(arguments[2],Cs)&&arguments[0]instanceof Pt&&Be(arguments[1],Cs))for(var R=arguments[0],Z=arguments[1],X=arguments[2],et=Z.iterator();et.hasNext();){var B=et.next();B.isForward()&&e.findStabbedSegments(R,B,X)}}};Tc.prototype.getDepth=function(e){var t=this.findStabbedSegments(e);if(t.size()===0)return 0;var n=Ms.min(t);return n._leftDepth};Tc.prototype.interfaces_=function(){return[]};Tc.prototype.getClass=function(){return Tc};EI.DepthSegment.get=function(){return Du};Object.defineProperties(Tc,EI);var Du=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new De(e),this._leftDepth=t};Du.prototype.compareTo=function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(t._upwardSeg)};Du.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};Du.prototype.toString=function(){return this._upwardSeg.toString()};Du.prototype.interfaces_=function(){return[hs]};Du.prototype.getClass=function(){return Du};var Mn=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};Mn.prototype.area=function(){return Mn.area(this.p0,this.p1,this.p2)};Mn.prototype.signedArea=function(){return Mn.signedArea(this.p0,this.p1,this.p2)};Mn.prototype.interpolateZ=function(e){if(e===null)throw new ir("Supplied point is null.");return Mn.interpolateZ(e,this.p0,this.p1,this.p2)};Mn.prototype.longestSideLength=function(){return Mn.longestSideLength(this.p0,this.p1,this.p2)};Mn.prototype.isAcute=function(){return Mn.isAcute(this.p0,this.p1,this.p2)};Mn.prototype.circumcentre=function(){return Mn.circumcentre(this.p0,this.p1,this.p2)};Mn.prototype.area3D=function(){return Mn.area3D(this.p0,this.p1,this.p2)};Mn.prototype.centroid=function(){return Mn.centroid(this.p0,this.p1,this.p2)};Mn.prototype.inCentre=function(){return Mn.inCentre(this.p0,this.p1,this.p2)};Mn.prototype.interfaces_=function(){return[]};Mn.prototype.getClass=function(){return Mn};Mn.area=function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)};Mn.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};Mn.det=function(e,t,n,r){return e*r-t*n};Mn.interpolateZ=function(e,t,n,r){var i=t.x,a=t.y,h=n.x-i,u=r.x-i,y=n.y-a,w=r.y-a,S=h*w-u*y,I=e.x-i,P=e.y-a,z=(w*I-u*P)/S,R=(-y*I+h*P)/S,Z=t.z+z*(n.z-t.z)+R*(r.z-t.z);return Z};Mn.longestSideLength=function(e,t,n){var r=e.distance(t),i=t.distance(n),a=n.distance(e),h=r;return i>h&&(h=i),a>h&&(h=a),h};Mn.isAcute=function(e,t,n){return!(!vn.isAcute(e,t,n)||!vn.isAcute(t,n,e)||!vn.isAcute(n,e,t))};Mn.circumcentre=function(e,t,n){var r=n.x,i=n.y,a=e.x-r,h=e.y-i,u=t.x-r,y=t.y-i,w=2*Mn.det(a,h,u,y),S=Mn.det(h,a*a+h*h,y,u*u+y*y),I=Mn.det(a,a*a+h*h,u,u*u+y*y),P=r-S/w,z=i+I/w;return new Pt(P,z)};Mn.perpendicularBisector=function(e,t){var n=t.x-e.x,r=t.y-e.y,i=new Is(e.x+n/2,e.y+r/2,1),a=new Is(e.x-r+n/2,e.y+n+r/2,1);return new Is(i,a)};Mn.angleBisector=function(e,t,n){var r=t.distance(e),i=t.distance(n),a=r/(r+i),h=n.x-e.x,u=n.y-e.y,y=new Pt(e.x+a*h,e.y+a*u);return y};Mn.area3D=function(e,t,n){var r=t.x-e.x,i=t.y-e.y,a=t.z-e.z,h=n.x-e.x,u=n.y-e.y,y=n.z-e.z,w=i*y-a*u,S=a*h-r*y,I=r*u-i*h,P=w*w+S*S+I*I,z=Math.sqrt(P)/2;return z};Mn.centroid=function(e,t,n){var r=(e.x+t.x+n.x)/3,i=(e.y+t.y+n.y)/3;return new Pt(r,i)};Mn.inCentre=function(e,t,n){var r=t.distance(n),i=e.distance(n),a=e.distance(t),h=r+i+a,u=(r*e.x+i*t.x+a*n.x)/h,y=(r*e.y+i*t.y+a*n.y)/h;return new Pt(u,y)};var cs=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new he;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n};cs.prototype.addPoint=function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,Dt.EXTERIOR,Dt.INTERIOR)};cs.prototype.addPolygon=function(e){var t=this,n=this._distance,r=ie.LEFT;this._distance<0&&(n=-this._distance,r=ie.RIGHT);var i=e.getExteriorRing(),a=dn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&a.length<3)return null;this.addPolygonRing(a,n,r,Dt.EXTERIOR,Dt.INTERIOR);for(var h=0;h0&&t.isErodedCompletely(u,-t._distance)||t.addPolygonRing(y,n,ie.opposite(r),Dt.INTERIOR,Dt.EXTERIOR)}};cs.prototype.isTriangleErodedCompletely=function(e,t){var n=new Mn(e[0],e[1],e[2]),r=n.inCentre(),i=be.distancePointLine(r,n.p0,n.p1);return i=Ma.MINIMUM_VALID_SIZE&&be.isCCW(e)&&(a=i,h=r,n=ie.opposite(n));var u=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(u,a,h)};cs.prototype.add=function(e){if(e.isEmpty())return null;e instanceof Wr?this.addPolygon(e):e instanceof yr?this.addLineString(e):e instanceof Eo?this.addPoint(e):e instanceof vf?this.addCollection(e):e instanceof Au?this.addCollection(e):e instanceof Ta?this.addCollection(e):e instanceof Hi&&this.addCollection(e)};cs.prototype.isErodedCompletely=function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var r=e.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return t<0&&2*Math.abs(t)>i};cs.prototype.addCollection=function(e){for(var t=this,n=0;n=this._max)throw new Vf;var e=this._parent.getGeometryN(this._index++);return e instanceof Hi?(this._subcollectionIterator=new La(e),this._subcollectionIterator.next()):e};La.prototype.remove=function(){throw new Error(this.getClass().getName())};La.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};La.prototype.interfaces_=function(){return[Bf]};La.prototype.getClass=function(){return La};La.isAtomic=function(e){return!(e instanceof Hi)};var Uo=function(){this._geom=null;var e=arguments[0];this._geom=e};Uo.prototype.locate=function(e){return Uo.locate(e,this._geom)};Uo.prototype.interfaces_=function(){return[Sf]};Uo.prototype.getClass=function(){return Uo};Uo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?be.isPointInRing(e,t.getCoordinates()):!1};Uo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!Uo.isPointInRing(e,n))return!1;for(var r=0;r0&&(r.right=a.right,r.left=a,a.right=null),this._size++,this._root=r),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,n,r){var i;if(n===null)return null;n=Iu(t,n,r);var a=r(t,n.key);return a===0?(n.left===null?i=n.right:(i=Iu(t,n.left,r),i.right=n.right),this._size--,i):n},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Iu(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var n=this._root,r=this._comparator;n;){var i=r(t,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},e.prototype.find=function(t){return this._root&&(this._root=Iu(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var n=this._root,r=this._comparator;n;){var i=r(t,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},e.prototype.forEach=function(t,n){for(var r=this._root,i=[],a=!1;!a;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),t.call(n,r),r=r.right):a=!0;return this},e.prototype.range=function(t,n,r,i){for(var a=[],h=this._comparator,u=this._root,y;a.length!==0||u;)if(u)a.push(u),u=u.left;else{if(u=a.pop(),y=h(u.key,n),y>0)break;if(h(u.key,t)>=0&&r.call(i,u))return this;u=u.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(n){var r=n.key;return t.push(r)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(n){var r=n.data;return t.push(r)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var n=this._root,r=!1,i=0,a=[];!r;)if(n)a.push(n),n=n.left;else if(a.length>0){if(n=a.pop(),i===t)return n;i++,n=n.right}else r=!0;return null},e.prototype.next=function(t){var n=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var a=i(t.key,n.key);if(a===0)break;a<0?(r=n,n=n.left):n=n.right}return r},e.prototype.prev=function(t){var n=this._root,r=null;if(t.left!==null){for(r=t.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var a=i(t.key,n.key);if(a===0)break;a<0?n=n.left:(r=n,n=n.right)}return r},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return Y4(this._root)},e.prototype.load=function(t,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=t.length,a=this._comparator;if(r&&H0(t,n,0,i-1,a),this._root===null)this._root=j0(t,n,0,i),this._size=i;else{var h=K4(this.toList(),X4(t,n),a);i=this._size+i,this._root=W0({head:h},0,i)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(r){return String(r.key)});var n=[];return q0(this._root,"",!0,function(r){return n.push(r)},t),n.join("")},e.prototype.update=function(t,n,r){var i=this._comparator,a=Tw(t,this._root,i),h=a.left,u=a.right;i(t,n)<0?u=l0(n,r,u,i):h=l0(n,r,h,i),this._root=Z4(h,u,i)},e.prototype.split=function(t){return Tw(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,n,r;return W4(this,function(i){switch(i.label){case 0:t=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:t===null?[3,2]:(n.push(t),t=t.left,[3,5]);case 2:return n.length===0?[3,4]:(t=n.pop(),[4,t]);case 3:return i.sent(),t=t.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function j0(e,t,n,r){var i=r-n;if(i>0){var a=n+Math.floor(i/2),h=e[a],u=t[a],y=new Mu(h,u);return y.left=j0(e,t,n,a),y.right=j0(e,t,a+1,r),y}return null}function X4(e,t){for(var n=new Mu(null,null),r=n,i=0;i0?(t=a=a.next=n.pop(),t=t.right):r=!0;return a.next=null,i.next}function W0(e,t,n){var r=n-t;if(r>0){var i=t+Math.floor(r/2),a=W0(e,t,i),h=e.head;return h.left=a,e.head=e.head.next,h.right=W0(e,i+1,n),h}return null}function K4(e,t,n){for(var r=new Mu(null,null),i=r,a=e,h=t;a!==null&&h!==null;)n(a.key,h.key)<0?(i.next=a,a=a.next):(i.next=h,h=h.next),i=i.next;return a!==null?i.next=a:h!==null&&(i.next=h),r.next}function H0(e,t,n,r,i){if(!(n>=r)){for(var a=e[n+r>>1],h=n-1,u=r+1;;){do h++;while(i(e[h],a)<0);do u--;while(i(e[u],a)>0);if(h>=u)break;var y=e[h];e[h]=e[u],e[u]=y,y=t[h],t[h]=t[u],t[u]=y}H0(e,t,n,u,i),H0(e,t,u+1,r,i)}}function fa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lw(e,t){for(var n=0;nn.x?1:t.yn.y?1:0}}]);function e(t,n){fa(this,e),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}return Go(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var n=t.point.events,r=0,i=n.length;r=0&&I>=0?wP?-1:0:y<0&&I<0?wP?1:0:Iy?1:0}}}]),e}(),nD=0,Zg=function(){Go(e,null,[{key:"compare",value:function(t,n){var r=t.leftSE.point.x,i=n.leftSE.point.x,a=t.rightSE.point.x,h=n.rightSE.point.x;if(hu&&y>w)return-1;var I=t.comparePoint(n.leftSE.point);if(I<0)return 1;if(I>0)return-1;var P=n.comparePoint(t.rightSE.point);return P!==0?P:-1}if(r>i){if(uy&&u>S)return 1;var z=n.comparePoint(t.leftSE.point);if(z!==0)return z;var R=t.comparePoint(n.rightSE.point);return R<0?1:R>0?-1:1}if(uy)return 1;if(ah){var Z=t.comparePoint(n.rightSE.point);if(Z<0)return 1;if(Z>0)return-1}if(a!==h){var et=w-u,B=a-r,j=S-y,q=h-i;if(et>B&&jq)return-1}return a>h?1:aS?1:t.idn.id?1:0}}]);function e(t,n,r,i){fa(this,e),this.id=++nD,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=r,this.windings=i}return Go(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tn?t:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return t.x===n.x?0:t.x0&&u.swapEvents(),el.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var a=n;n=r,r=a}if(n.prev===r){var h=n;n=r,r=h}for(var u=0,y=r.rings.length;u0)i=n,a=t,h=-1;else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var y=new el(i,!0),w=new el(a,!1);return new e(y,w,[r],[h])}}]),e}(),Dw=function(){function e(t,n,r){if(fa(this,e),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=yd.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var a=i,h=1,u=t.length;hthis.bbox.ur.x&&(this.bbox.ur.x=y.x),y.y>this.bbox.ur.y&&(this.bbox.ur.y=y.y),a=y)}(i.x!==a.x||i.y!==a.y)&&this.segments.push(Zg.fromRing(a,i,this))}return Go(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.interiorRings.push(a)}this.multiPoly=n}return Go(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.polys.push(a)}this.isSubject=n}return Go(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.polys.length;n0&&(t=i)}for(var a=t.segment.prevInResult(),h=a?a.prevInResult():null;;){if(!a)return null;if(!h)return a.ringOut;if(h.ringOut!==a.ringOut)return h.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=h.prevInResult(),h=a?a.prevInResult():null}}}]),e}(),Nw=function(){function e(t){fa(this,e),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return Go(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:Zg.compare;fa(this,e),this.queue=t,this.tree=new zv(n),this.segments=[]}return Go(e,[{key:"process",value:function(t){var n=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),r;var i=t.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var a=i,h=i,u=void 0,y=void 0;u===void 0;)a=this.tree.prev(a),a===null?u=null:a.key.consumedBy===void 0&&(u=a.key);for(;y===void 0;)h=this.tree.next(h),h===null?y=null:h.key.consumedBy===void 0&&(y=h.key);if(t.isLeft){var w=null;if(u){var S=u.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!u.isAnEndpoint(S)))for(var I=this._splitSafely(u,S),P=0,z=I.length;P0?(this.tree.remove(n),r.push(t)):(this.segments.push(n),n.prev=u)}else{if(u&&y){var ht=u.getIntersection(y);if(ht!==null){if(!u.isAnEndpoint(ht))for(var pt=this._splitSafely(u,ht),Tt=0,Q=pt.length;TtOw)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var q=new sD(R),ct=R.size,_t=R.pop();_t;){var lt=_t.key;if(R.size===ct){var ht=lt.segment;throw new Error("Unable to pop() ".concat(lt.isLeft?"left":"right"," SweepEvent ")+"[".concat(lt.point.x,", ").concat(lt.point.y,"] from segment #").concat(ht.id," ")+"[".concat(ht.leftSE.point.x,", ").concat(ht.leftSE.point.y,"] -> ")+"[".concat(ht.rightSE.point.x,", ").concat(ht.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(R.size>Ow)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(q.segments.length>aD)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var pt=q.process(lt),Tt=0,Q=pt.length;Tt1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rn[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]t.x?1:this.yt.y?1:0};Mt.prototype.clone=function(){};Mt.prototype.copy=function(){return new Mt(this)};Mt.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Mt.prototype.distance3D=function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return Math.sqrt(t*t+n*n+r*r)};Mt.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)};Mt.prototype.hashCode=function(){var e=17;return e=37*e+Mt.hashCode(this.x),e=37*e+Mt.hashCode(this.y),e};Mt.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z};Mt.prototype.interfaces_=function(){return[hs,_y,fs]};Mt.prototype.getClass=function(){return Mt};Mt.hashCode=function(){if(arguments.length===1){var e=arguments[0],t=He.doubleToLongBits(e);return Math.trunc((t^t)>>>32)}};Gc.DimensionalComparator.get=function(){return Gl};Gc.serialVersionUID.get=function(){return 6683108902428367e3};Gc.NULL_ORDINATE.get=function(){return He.NaN};Gc.X.get=function(){return 0};Gc.Y.get=function(){return 1};Gc.Z.get=function(){return 2};Object.defineProperties(Mt,Gc);var Gl=function(e){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new ir("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}};Gl.prototype.compare=function(e,t){var n=e,r=t,i=Gl.compare(n.x,r.x);if(i!==0)return i;var a=Gl.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var h=Gl.compare(n.z,r.z);return h};Gl.prototype.interfaces_=function(){return[ff]};Gl.prototype.getClass=function(){return Gl};Gl.compare=function(e,t){return et?1:He.isNaN(e)?He.isNaN(t)?0:-1:He.isNaN(t)?1:0};var pf=function(){};pf.prototype.create=function(){};pf.prototype.interfaces_=function(){return[]};pf.prototype.getClass=function(){return pf};var Dt=function(){},zd={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Dt.prototype.interfaces_=function(){return[]};Dt.prototype.getClass=function(){return Dt};Dt.toLocationSymbol=function(e){switch(e){case Dt.EXTERIOR:return"e";case Dt.BOUNDARY:return"b";case Dt.INTERIOR:return"i";case Dt.NONE:return"-"}throw new ir("Unknown location value: "+e)};zd.INTERIOR.get=function(){return 0};zd.BOUNDARY.get=function(){return 1};zd.EXTERIOR.get=function(){return 2};zd.NONE.get=function(){return-1};Object.defineProperties(Dt,zd);var Be=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},qo=function(){},hI={LOG_10:{configurable:!0}};qo.prototype.interfaces_=function(){return[]};qo.prototype.getClass=function(){return qo};qo.log10=function(e){var t=Math.log(e);return He.isInfinite(t)||He.isNaN(t)?t:t/qo.LOG_10};qo.min=function(e,t,n,r){var i=e;return tn?n:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],a=arguments[2];return ra?a:r}};qo.wrap=function(e,t){return e<0?t- -e%t:e%t};qo.max=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],r=e;return t>r&&(r=t),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],a=arguments[1],h=arguments[2],u=arguments[3],y=i;return a>y&&(y=a),h>y&&(y=h),u>y&&(y=u),y}};qo.average=function(e,t){return(e+t)/2};hI.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(qo,hI);var pa=function(e){this.str=e};pa.prototype.append=function(e){this.str+=e};pa.prototype.setCharAt=function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)};pa.prototype.toString=function(e){return this.str};var ta=function(e){this.value=e};ta.prototype.intValue=function(){return this.value};ta.prototype.compareTo=function(e){return this.valuee?1:0};ta.isNaN=function(e){return Number.isNaN(e)};var _d=function(){};_d.isWhitespace=function(e){return e<=32&&e>=0||e===127};_d.toUpperCase=function(e){return e.toUpperCase()};var qt=function e(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];e.call(this,e.parse(r))}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.init(i,a)}},Rs={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};qt.prototype.le=function(e){return(this._hi9?(S=!0,I="9"):I="0"+w,h.append(I),n=n.subtract(qt.valueOf(w)).multiply(qt.TEN),S&&n.selfAdd(qt.TEN);var P=!0,z=qt.magnitude(n._hi);if(z<0&&Math.abs(z)>=u-y&&(P=!1),!P)break}return t[0]=r,h.toString()};qt.prototype.sqr=function(){return this.multiply(this)};qt.prototype.doubleValue=function(){return this._hi+this._lo};qt.prototype.subtract=function(){if(arguments[0]instanceof qt){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}};qt.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}};qt.prototype.isZero=function(){return this._hi===0&&this._lo===0};qt.prototype.selfSubtract=function(){if(arguments[0]instanceof qt){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}};qt.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};qt.prototype.min=function(e){return this.le(e)?this:e};qt.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,h=null,u=null,y=null,w=null,S=null,I=null;return y=this._hi/n,w=qt.SPLIT*y,i=w-y,I=qt.SPLIT*n,i=w-i,a=y-i,h=I-n,S=y*n,h=I-h,u=n-h,I=i*h-S+i*u+a*h+a*u,w=(this._hi-S-I+this._lo-y*r)/n,I=y+w,this._hi=I,this._lo=y-I+w,this}};qt.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};qt.prototype.divide=function(){if(arguments[0]instanceof qt){var e=arguments[0],t=null,n=null,r=null,i=null,a=null,h=null,u=null,y=null;a=this._hi/e._hi,h=qt.SPLIT*a,t=h-a,y=qt.SPLIT*e._hi,t=h-t,n=a-t,r=y-e._hi,u=a*e._hi,r=y-r,i=e._hi-r,y=t*r-u+t*i+n*r+n*i,h=(this._hi-u-y+this._lo-a*e._lo)/e._hi,y=a+h;var w=y,S=a-y+h;return new qt(w,S)}else if(typeof arguments[0]=="number"){var I=arguments[0];return He.isNaN(I)?qt.createNaN():qt.copy(this).selfDivide(I,0)}};qt.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo};qt.prototype.pow=function(e){if(e===0)return qt.valueOf(1);var t=new qt(this),n=qt.valueOf(1),r=Math.abs(e);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(t),r/=2,r>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n};qt.prototype.ceil=function(){if(this.isNaN())return qt.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new qt(e,t)};qt.prototype.compareTo=function(e){var t=e;return this._hit._hi?1:this._lot._lo?1:0};qt.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()};qt.prototype.setValue=function(){if(arguments[0]instanceof qt){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}};qt.prototype.max=function(e){return this.ge(e)?this:e};qt.prototype.sqrt=function(){if(this.isZero())return qt.valueOf(0);if(this.isNegative())return qt.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=qt.valueOf(t),r=this.subtract(n.sqr()),i=r._hi*(e*.5);return n.add(i)};qt.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0],n=null,r=null,i=null,a=null,h=null,u=null;return i=this._hi+t,h=i-this._hi,a=i-h,a=t-h+(this._hi-a),u=a+this._lo,n=i+u,r=u+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var y=arguments[0],w=arguments[1],S=null,I=null,P=null,z=null,R=null,Y=null,Z=null,et=null;R=this._hi+y,P=this._lo+w,Z=R-this._hi,et=P-this._lo,Y=R-Z,z=P-et,Y=y-Z+(this._hi-Y),z=w-et+(this._lo-z),Z=Y+P,S=R+Z,I=Z+(R-S),Z=z+I;var B=S+Z,j=Z+(S-B);return this._hi=B,this._lo=j,this}};qt.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,h=null,u=null,y=null,w=null;y=qt.SPLIT*this._hi,i=y-this._hi,w=qt.SPLIT*n,i=y-i,a=this._hi-i,h=w-n,y=this._hi*n,h=w-h,u=n-h,w=i*h-y+i*u+a*h+a*u+(this._hi*r+this._lo*n);var S=y+w;i=y-S;var I=w+i;return this._hi=S,this._lo=I,this}};qt.prototype.selfSqr=function(){return this.selfMultiply(this)};qt.prototype.floor=function(){if(this.isNaN())return qt.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new qt(e,t)};qt.prototype.negate=function(){return this.isNaN()?this:new qt(-this._hi,-this._lo)};qt.prototype.clone=function(){};qt.prototype.multiply=function(){if(arguments[0]instanceof qt){var e=arguments[0];return e.isNaN()?qt.createNaN():qt.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return He.isNaN(t)?qt.createNaN():qt.copy(this).selfMultiply(t,0)}};qt.prototype.isNaN=function(){return He.isNaN(this._hi)};qt.prototype.intValue=function(){return Math.trunc(this._hi)};qt.prototype.toString=function(){var e=qt.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()};qt.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),r=t[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+qt.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,h=qt.stringOfChar("0",a);i=n+h+".0"}return this.isNegative()?"-"+i:i};qt.prototype.reciprocal=function(){var e=null,t=null,n=null,r=null,i=null,a=null,h=null,u=null;i=1/this._hi,a=qt.SPLIT*i,e=a-i,u=qt.SPLIT*this._hi,e=a-e,t=i-e,n=u-this._hi,h=i*this._hi,n=u-n,r=this._hi-n,u=e*n-h+e*r+t*n+t*r,a=(1-h-u-i*this._lo)/this._hi;var y=i+a,w=i-y+a;return new qt(y,w)};qt.prototype.toSciNotation=function(){if(this.isZero())return qt.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),r=qt.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var a=n.charAt(0)+"."+i;return this.isNegative()?"-"+a+r:a+r};qt.prototype.abs=function(){return this.isNaN()?qt.NaN:this.isNegative()?this.negate():new qt(this)};qt.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};qt.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo};qt.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};qt.prototype.trunc=function(){return this.isNaN()?qt.NaN:this.isPositive()?this.floor():this.ceil()};qt.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};qt.prototype.interfaces_=function(){return[fs,hs,_y]};qt.prototype.getClass=function(){return qt};qt.sqr=function(e){return qt.valueOf(e).selfMultiply(e)};qt.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return qt.parse(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return new qt(t)}};qt.sqrt=function(e){return qt.valueOf(e).sqrt()};qt.parse=function(e){for(var t=0,n=e.length;_d.isWhitespace(e.charAt(t));)t++;var r=!1;if(t=n);){var w=e.charAt(t);if(t++,_d.isDigit(w)){var S=w-"0";a.selfMultiply(qt.TEN),a.selfAdd(S),h++;continue}if(w==="."){u=h;continue}if(w==="e"||w==="E"){var I=e.substring(t);try{y=ta.parseInt(I)}catch(Z){throw Z instanceof Error?new Error("Invalid exponent "+I+" in string "+e):Z}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+t+" in string "+e)}var P=a,z=h-u-y;if(z===0)P=a;else if(z>0){var R=qt.TEN.pow(z);P=a.divide(R)}else if(z<0){var Y=qt.TEN.pow(-z);P=a.multiply(Y)}return r?P.negate():P};qt.createNaN=function(){return new qt(He.NaN,He.NaN)};qt.copy=function(e){return new qt(e)};qt.magnitude=function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=t&&(r+=1),r};qt.stringOfChar=function(e,t){for(var n=new pa,r=0;r0){if(a<=0)return oo.signum(h);r=i+a}else if(i<0){if(a>=0)return oo.signum(h);r=-i-a}else return oo.signum(h);var u=oo.DP_SAFE_EPSILON*r;return h>=u||-h>=u?oo.signum(h):2};oo.signum=function(e){return e>0?1:e<0?-1:0};fI.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(oo,fI);var Sn=function(){},Fd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Fd.X.get=function(){return 0};Fd.Y.get=function(){return 1};Fd.Z.get=function(){return 2};Fd.M.get=function(){return 3};Sn.prototype.setOrdinate=function(e,t,n){};Sn.prototype.size=function(){};Sn.prototype.getOrdinate=function(e,t){};Sn.prototype.getCoordinate=function(){};Sn.prototype.getCoordinateCopy=function(e){};Sn.prototype.getDimension=function(){};Sn.prototype.getX=function(e){};Sn.prototype.clone=function(){};Sn.prototype.expandEnvelope=function(e){};Sn.prototype.copy=function(){};Sn.prototype.getY=function(e){};Sn.prototype.toCoordinateArray=function(){};Sn.prototype.interfaces_=function(){return[_y]};Sn.prototype.getClass=function(){return Sn};Object.defineProperties(Sn,Fd);var pI=function(){},Ff=function(e){function t(){e.call(this,"Projective point not representable on the Cartesian plane.")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(pI),bi=function(){};bi.arraycopy=function(e,t,n,r,i){for(var a=0,h=t;he._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny,r=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};ke.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof ke){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}};ke.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return et._minx?1:this._minyt._miny?1:this._maxxt._maxx?1:this._maxyt._maxy?1:0};ke.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};ke.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};ke.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};ke.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};ke.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};ke.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};ke.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof ke){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof Mt){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};ke.prototype.centre=function(){return this.isNull()?null:new Mt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};ke.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Mt){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof ke){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],h=arguments[2],u=arguments[3];ie._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxye._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)};ke.prototype.hashCode=function(){var e=17;return e=37*e+Mt.hashCode(this._minx),e=37*e+Mt.hashCode(this._maxx),e=37*e+Mt.hashCode(this._miny),e=37*e+Mt.hashCode(this._maxy),e};ke.prototype.interfaces_=function(){return[hs,fs]};ke.prototype.getClass=function(){return ke};ke.intersects=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.xt.x?e.x:t.x)&&n.y>=(e.yt.y?e.y:t.y)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],h=arguments[3],u=Math.min(a.x,h.x),y=Math.max(a.x,h.x),w=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(w>y||Sy)||Sn?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}};ur.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};ur.prototype.setPrecisionModel=function(e){this._precisionModel=e};ur.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var t=arguments[0],n=0;ni?a=r:a=i;else{var h=Math.abs(e.x-t.x),u=Math.abs(e.y-t.y);r>i?a=h:a=u,a===0&&!e.equals(t)&&(a=Math.max(h,u))}return en.isTrue(!(a===0&&!e.equals(t)),"Bad distance calculation"),a};ur.nonRobustComputeEdgeDistance=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=Math.sqrt(r*r+i*i);return en.isTrue(!(a===0&&!e.equals(t)),"Invalid distance calculation"),a};qc.DONT_INTERSECT.get=function(){return 0};qc.DO_INTERSECT.get=function(){return 1};qc.COLLINEAR.get=function(){return 2};qc.NO_INTERSECTION.get=function(){return 0};qc.POINT_INTERSECTION.get=function(){return 1};qc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(ur,qc);var ju=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var r=new ke(this._inputLines[0][0],this._inputLines[0][1]),i=new ke(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,ke.intersects(r,i,n)&&be.orientationIndex(r,i,n)===0&&be.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=e.POINT_INTERSECTION,null;this._result=e.NO_INTERSECTION}else return e.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,r,i,a,h){h.x=this.smallestInAbsValue(n.x,r.x,i.x,a.x),h.y=this.smallestInAbsValue(n.y,r.y,i.y,a.y),n.x-=h.x,n.y-=h.y,r.x-=h.x,r.y-=h.y,i.x-=h.x,i.y-=h.y,a.x-=h.x,a.y-=h.y},t.prototype.safeHCoordinateIntersection=function(n,r,i,a){var h=null;try{h=Is.intersection(n,r,i,a)}catch(u){if(u instanceof Ff)h=t.nearestEndpoint(n,r,i,a);else throw u}finally{}return h},t.prototype.intersection=function(n,r,i,a){var h=this.intersectionWithNormalization(n,r,i,a);return this.isInSegmentEnvelopes(h)||(h=new Mt(t.nearestEndpoint(n,r,i,a))),this._precisionModel!==null&&this._precisionModel.makePrecise(h),h},t.prototype.smallestInAbsValue=function(n,r,i,a){var h=n,u=Math.abs(h);return Math.abs(r)1e-4&&bi.out.println("Distance = "+h.distance(u))},t.prototype.intersectionWithNormalization=function(n,r,i,a){var h=new Mt(n),u=new Mt(r),y=new Mt(i),w=new Mt(a),S=new Mt;this.normalizeToEnvCentre(h,u,y,w,S);var I=this.safeHCoordinateIntersection(h,u,y,w);return I.x+=S.x,I.y+=S.y,I},t.prototype.computeCollinearIntersection=function(n,r,i,a){var h=ke.intersects(n,r,i),u=ke.intersects(n,r,a),y=ke.intersects(i,a,n),w=ke.intersects(i,a,r);return h&&u?(this._intPt[0]=i,this._intPt[1]=a,e.COLLINEAR_INTERSECTION):y&&w?(this._intPt[0]=n,this._intPt[1]=r,e.COLLINEAR_INTERSECTION):h&&y?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!u&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):h&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!u&&!y?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&y?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!h&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&w?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!h&&!y?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,r,i,a,h){var u=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,I=i.xa.x?i.x:a.x,R=i.y>a.y?i.y:a.y,Y=u>I?u:I,Z=wP?y:P,B=S0&&u>0||h<0&&u<0)return e.NO_INTERSECTION;var y=be.orientationIndex(i,a,n),w=be.orientationIndex(i,a,r);if(y>0&&w>0||y<0&&w<0)return e.NO_INTERSECTION;var S=h===0&&u===0&&y===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,a):(h===0||u===0||y===0||w===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(a)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(a)?this._intPt[0]=r:h===0?this._intPt[0]=new Mt(i):u===0?this._intPt[0]=new Mt(a):y===0?this._intPt[0]=new Mt(n):w===0&&(this._intPt[0]=new Mt(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,a)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,r,i,a){var h=n,u=be.distancePointLine(n,i,a),y=be.distancePointLine(r,i,a);return y0?n>0?-i:i:n>0?i:-i;if(t===0||n===0)return r>0?e>0?i:-i:e>0?-i:i;if(t>0?r>0?t<=r||(i=-i,a=e,e=n,n=a,a=t,t=r,r=a):t<=-r?(i=-i,n=-n,r=-r):(a=e,e=-n,n=a,a=t,t=-r,r=a):r>0?-t<=r?(i=-i,e=-e,t=-t):(a=-e,e=n,n=a,a=-t,t=r,r=a):t>=r?(e=-e,t=-t,n=-n,r=-r):(i=-i,a=-e,e=-n,n=a,a=-t,t=-r,r=a),e>0)if(n>0){if(!(e<=n))return i}else return i;else{if(n>0)return-i;if(e>=n)i=-i,e=-e,n=-n;else return-i}for(;;){if(h=Math.floor(n/e),n=n-h*e,r=r-h*t,r<0)return-i;if(r>t)return i;if(e>n+n){if(tr+r)return-i;n=e-n,r=t-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(h=Math.floor(e/n),e=e-h*n,t=t-h*r,t<0))return i;if(t>r)return-i;if(n>e+e){if(rt+t)return i;e=n-e,t=r-t,i=-i}if(t===0)return e===0?0:i;if(e===0)return-i}};var Qs=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};Qs.prototype.countSegment=function(e,t){if(e.xr&&(n=t.x,r=e.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var i=e.x-this._p.x,a=e.y-this._p.y,h=t.x-this._p.x,u=t.y-this._p.y,y=Ec.signOfDet2x2(i,a,h,u);if(y===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}};Qs.prototype.isPointInPolygon=function(){return this.getLocation()!==Dt.EXTERIOR};Qs.prototype.getLocation=function(){return this._isPointOnSegment?Dt.BOUNDARY:this._crossingCount%2===1?Dt.INTERIOR:Dt.EXTERIOR};Qs.prototype.isOnSegment=function(){return this._isPointOnSegment};Qs.prototype.interfaces_=function(){return[]};Qs.prototype.getClass=function(){return Qs};Qs.locatePointInRing=function(){if(arguments[0]instanceof Mt&&Be(arguments[1],Sn)){for(var e=arguments[0],t=arguments[1],n=new Qs(e),r=new Mt,i=new Mt,a=1;a1||y<0||y>1)&&(i=!0)}}return i?qo.min(be.distancePointLine(e,n,r),be.distancePointLine(t,n,r),be.distancePointLine(n,e,t),be.distancePointLine(r,e,t)):0};be.isPointInRing=function(e,t){return be.locatePointInRing(e,t)!==Dt.EXTERIOR};be.computeLength=function(e){var t=e.size();if(t<=1)return 0;var n=0,r=new Mt;e.getCoordinate(0,r);for(var i=r.x,a=r.y,h=1;hn.y&&(n=a,r=i)}var h=r;do h=h-1,h<0&&(h=t);while(e[h].equals2D(n)&&h!==r);var u=r;do u=(u+1)%t;while(e[u].equals2D(n)&&u!==r);var y=e[h],w=e[u];if(y.equals2D(n)||w.equals2D(n)||y.equals2D(w))return!1;var S=be.computeOrientation(y,n,w),I=!1;return S===0?I=y.x>w.x:I=S>0,I};be.locatePointInRing=function(e,t){return Qs.locatePointInRing(e,t)};be.distancePointLinePerpendicular=function(e,t,n){var r=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),i=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/r;return Math.abs(i)*Math.sqrt(r)};be.computeOrientation=function(e,t,n){return be.orientationIndex(e,t,n)};be.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new ir("Line array must contain at least one vertex");for(var n=e.distance(t[0]),r=0;r=1)return a.distance(u);var S=((h.y-a.y)*(u.x-h.x)-(h.x-a.x)*(u.y-h.y))/y;return Math.abs(S)*Math.sqrt(y)}};be.isOnLine=function(e,t){for(var n=new ju,r=1;r0};mf.prototype.interfaces_=function(){return[ls]};mf.prototype.getClass=function(){return mf};var gf=function(){};gf.prototype.isInBoundary=function(e){return e>1};gf.prototype.interfaces_=function(){return[ls]};gf.prototype.getClass=function(){return gf};var yf=function(){};yf.prototype.isInBoundary=function(e){return e===1};yf.prototype.interfaces_=function(){return[ls]};yf.prototype.getClass=function(){return yf};var Ur=function(){};Ur.prototype.add=function(){};Ur.prototype.addAll=function(){};Ur.prototype.isEmpty=function(){};Ur.prototype.iterator=function(){};Ur.prototype.size=function(){};Ur.prototype.toArray=function(){};Ur.prototype.remove=function(){};function Bv(e){this.message=e||""}Bv.prototype=new Error;Bv.prototype.name="IndexOutOfBoundsException";var Bf=function(){};Bf.prototype.hasNext=function(){};Bf.prototype.next=function(){};Bf.prototype.remove=function(){};var Cs=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Ur);function Vf(e){this.message=e||""}Vf.prototype=new Error;Vf.prototype.name="NoSuchElementException";var he=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Ur&&this.addAll(arguments[0])}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[e,Ur]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var r=this,i=n.iterator();i.hasNext();)r.add(i.next());return!0},t.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},t.prototype.iterator=function(){return new _D(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new Bv;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,r=[],i=0,a=this.array_.length;i=1){var w=this.get(this.size()-1);if(w.equals2D(u))return null}e.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],I=arguments[1];return this.add(S,I),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var P=arguments[0],z=arguments[1],R=arguments[2];if(R)for(var Y=0;Y=0;Z--)r.add(P[Z],z);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Mt){var et=arguments[0],B=arguments[1],j=arguments[2];if(!j){var q=this.size();if(q>0){if(et>0){var ct=this.get(et-1);if(ct.equals2D(B))return null}if(etTt&&(Q=-1);for(var gt=pt;gt!==Tt;gt+=Q)r.add(lt[gt],ht);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new Mt(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,n),t}(he),dn=function(){},by={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};by.ForwardComparator.get=function(){return vd};by.BidirectionalComparator.get=function(){return _f};by.coordArrayType.get=function(){return new Array(0).fill(null)};dn.prototype.interfaces_=function(){return[]};dn.prototype.getClass=function(){return dn};dn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};dn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};dn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};dn.extract=function(e,t,n){t=qo.clamp(t,0,e.length),n=qo.clamp(n,-1,e.length);var r=n-t+1;n<0&&(r=0),t>=e.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=dn.compare(n,r),a=dn.isEqualReversed(n,r);return a?0:i};_f.prototype.OLDcompare=function(e,t){var n=e,r=t;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var i=dn.increasingDirection(n),a=dn.increasingDirection(r),h=i>0?0:n.length-1,u=a>0?0:n.length-1,y=0;y0)t=t.right;else return t.value}return null};Ai.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=e.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var a=n.value;return n.value=t,a}while(n!==null);var h={key:e,left:null,right:null,value:t,parent:r,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=h:r.right=h,this.fixAfterInsertion(h),this.size_++,null};Ai.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=wu;e!=null&&e!==this.root_&&e.parent.color===wu;)if(Hn(e)===u0(Hn(Hn(e)))){var n=Vw(Hn(Hn(e)));Bw(n)===wu?(Ja(Hn(e),nl),Ja(n,nl),Ja(Hn(Hn(e)),wu),e=Hn(Hn(e))):(e===Vw(Hn(e))&&(e=Hn(e),t.rotateLeft(e)),Ja(Hn(e),nl),Ja(Hn(Hn(e)),wu),t.rotateRight(Hn(Hn(e))))}else{var r=u0(Hn(Hn(e)));Bw(r)===wu?(Ja(Hn(e),nl),Ja(r,nl),Ja(Hn(Hn(e)),wu),e=Hn(Hn(e))):(e===u0(Hn(e))&&(e=Hn(e),t.rotateRight(e)),Ja(Hn(e),nl),Ja(Hn(Hn(e)),wu),t.rotateLeft(Hn(Hn(e))))}this.root_.color=nl};Ai.prototype.values=function(){var e=new he,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=Ai.successor(t))!==null;)e.add(t.value);return e};Ai.prototype.entrySet=function(){var e=new Vv,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=Ai.successor(t))!==null;)e.add(t);return e};Ai.prototype.rotateLeft=function(e){if(e!=null){var t=e.right;e.right=t.left,t.left!=null&&(t.left.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}};Ai.prototype.rotateRight=function(e){if(e!=null){var t=e.left;e.left=t.right,t.right!=null&&(t.right.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.right===e?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}};Ai.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};Ai.successor=function(e){if(e===null)return null;if(e.right!==null){for(var t=e.right;t.left!==null;)t=t.left;return t}else{for(var n=e.parent,r=e;n!==null&&r===n.right;)r=n,n=n.parent;return n}};Ai.prototype.size=function(){return this.size_};var bd=function(){};bd.prototype.interfaces_=function(){return[]};bd.prototype.getClass=function(){return bd};function mI(){}mI.prototype=new xy;function ea(){this.array_=[],arguments[0]instanceof Ur&&this.addAll(arguments[0])}ea.prototype=new mI;ea.prototype.contains=function(e){for(var t=this,n=0,r=this.array_.length;n=0;){var h=i.substring(0,a);r.add(h),i=i.substring(a+n),a=i.indexOf(t)}i.length>0&&r.add(i);for(var u=new Array(r.size()).fill(null),y=0;y0)for(var a=i;a0&&r.append(" ");for(var a=0;a0&&r.append(","),r.append(os.toString(e.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Tr.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Tr.createClosedRing(e,t,4);var r=t.getOrdinate(0,Sn.X)===t.getOrdinate(n-1,Sn.X)&&t.getOrdinate(0,Sn.Y)===t.getOrdinate(n-1,Sn.Y);return r?t:Tr.createClosedRing(e,t,n+1)};Tr.createClosedRing=function(e,t,n){var r=e.create(n,t.getDimension()),i=t.size();Tr.copy(t,0,r,0,i);for(var a=i;a0&&Tr.reverse(r._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?Tn.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return be.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var r=this._points.copy();Tr.reverse(r);var i=this.getFactory().createLineString(r);return i},t.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],a=i,h=0,u=0;h= 2)");this._points=r},t.prototype.isCoordinate=function(r){for(var i=this,a=0;a=1&&this.getCoordinateSequence().size()= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,n),t}(yr),Ta=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return Fe.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?e.prototype.equalsExact.call(this,r,i):!1}else return e.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var r=this,i=this._geometries.length,a=new Array(i).fill(null),h=0;h0?t.createPoint(n[0]):t.createPoint():e};Sd.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Sd.prototype.getClass=function(){return Sd};var Ed=function(){};Ed.prototype.edit=function(e,t){return e instanceof Ma?t.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof yr?t.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof Eo?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};Ed.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Ed.prototype.getClass=function(){return Ed};var Ir=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n0){var t=new pa(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Ir(n):new Ir(n,r)}};Aa.prototype.interfaces_=function(){return[pf,fs]};Aa.prototype.getClass=function(){return Aa};Aa.instance=function(){return Aa.instanceObject};Gv.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};Gv.instanceObject.get=function(){return new Aa};Object.defineProperties(Aa,Gv);var yI=function(e){function t(){e.call(this),this.map_=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,r){return this.map_.set(n,r),r},t.prototype.values=function(){for(var n=new he,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},t.prototype.entrySet=function(){var n=new Vv;return this.map_.entries().forEach(function(r){return n.add(r)}),n},t.prototype.size=function(){return this.map_.size()},t}(Wc),Pn=function e(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=e.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ra){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},qv={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Pn.prototype.equals=function(e){if(!(e instanceof Pn))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};Pn.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),r=t.getMaximumSignificantDigits();return new ta(n).compareTo(new ta(r))};Pn.prototype.getScale=function(){return this._scale};Pn.prototype.isFloating=function(){return this._modelType===Pn.FLOATING||this._modelType===Pn.FLOATING_SINGLE};Pn.prototype.getType=function(){return this._modelType};Pn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===Pn.FLOATING?e="Floating":this._modelType===Pn.FLOATING_SINGLE?e="Floating-Single":this._modelType===Pn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};Pn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(He.isNaN(e))return e;if(this._modelType===Pn.FLOATING_SINGLE){var t=e;return t}return this._modelType===Pn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof Mt){var n=arguments[0];if(this._modelType===Pn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Pn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===Pn.FLOATING?e=16:this._modelType===Pn.FLOATING_SINGLE?e=6:this._modelType===Pn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};Pn.prototype.setScale=function(e){this._scale=Math.abs(e)};Pn.prototype.interfaces_=function(){return[fs,hs]};Pn.prototype.getClass=function(){return Pn};Pn.mostPrecise=function(e,t){return e.compareTo(t)>=0?e:t};qv.serialVersionUID.get=function(){return 7777263578777804e3};qv.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Pn,qv);var ra=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},jv={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ra.prototype.readResolve=function(){return ra.nameToTypeMap.get(this._name)};ra.prototype.toString=function(){return this._name};ra.prototype.interfaces_=function(){return[fs]};ra.prototype.getClass=function(){return ra};jv.serialVersionUID.get=function(){return-552860263173159e4};jv.nameToTypeMap.get=function(){return new yI};Object.defineProperties(ra,jv);Pn.Type=ra;Pn.FIXED=new ra("FIXED");Pn.FLOATING=new ra("FLOATING");Pn.FLOATING_SINGLE=new ra("FLOATING SINGLE");var pn=function e(){this._precisionModel=new Pn,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Be(arguments[0],pf)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Pn&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},_I={serialVersionUID:{configurable:!0}};pn.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new Mt(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new Mt(e.getMinX(),e.getMinY()),new Mt(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new Mt(e.getMinX(),e.getMinY()),new Mt(e.getMinX(),e.getMaxY()),new Mt(e.getMaxX(),e.getMaxY()),new Mt(e.getMaxX(),e.getMinY()),new Mt(e.getMinX(),e.getMinY())]),null)};pn.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new yr(this.getCoordinateSequenceFactory().create(e),this);if(Be(e,Sn))return new yr(e,this)}else return new yr(this.getCoordinateSequenceFactory().create([]),this)};pn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Au(null,this);if(arguments.length===1){var e=arguments[0];return new Au(e,this)}};pn.prototype.buildGeometry=function(e){for(var t=null,n=!1,r=!1,i=e.iterator();i.hasNext();){var a=i.next(),h=a.getClass();t===null&&(t=h),h!==t&&(n=!0),a.isGeometryCollectionOrDerived()&&(r=!0)}if(t===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(pn.toGeometryArray(e));var u=e.iterator().next(),y=e.size()>1;if(y){if(u instanceof Wr)return this.createMultiPolygon(pn.toPolygonArray(e));if(u instanceof yr)return this.createMultiLineString(pn.toLineStringArray(e));if(u instanceof Eo)return this.createMultiPoint(pn.toPointArray(e));en.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u};pn.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};pn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Mt){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(Be(arguments[0],Sn)){var t=arguments[0];return new Eo(t,this)}}};pn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};pn.prototype.createPolygon=function(){if(arguments.length===0)return new Wr(null,null,this);if(arguments.length===1){if(Be(arguments[0],Sn)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Ma){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Wr(r,i,this)}};pn.prototype.getSRID=function(){return this._SRID};pn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Hi(null,this);if(arguments.length===1){var e=arguments[0];return new Hi(e,this)}};pn.prototype.createGeometry=function(e){var t=new us(this);return t.edit(e,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};pn.prototype.getPrecisionModel=function(){return this._precisionModel};pn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(Be(arguments[0],Sn)){var t=arguments[0];return new Ma(t,this)}}};pn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Ta(null,this);if(arguments.length===1){var e=arguments[0];return new Ta(e,this)}};pn.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new vf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new vf(t,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Be(arguments[0],Sn)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),a=0;a=this.size())throw new Error;return this.array_[e]};da.prototype.push=function(e){return this.array_.push(e),e};da.prototype.pop=function(e){if(this.array_.length===0)throw new Cy;return this.array_.pop()};da.prototype.peek=function(){if(this.array_.length===0)throw new Cy;return this.array_[this.array_.length-1]};da.prototype.empty=function(){return this.array_.length===0};da.prototype.isEmpty=function(){return this.empty()};da.prototype.search=function(e){return this.array_.indexOf(e)};da.prototype.size=function(){return this.array_.length};da.prototype.toArray=function(){for(var e=this,t=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===be.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};ia.prototype.getRightmostSideOfSegment=function(e,t){var n=e.getEdge(),r=n.getCoordinates();if(t<0||t+1>=r.length||r[t].y===r[t+1].y)return-1;var i=ie.LEFT;return r[t].yt._minCoord.x)&&(t._minDe=e,t._minIndex=r,t._minCoord=n[r])};ia.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),t=e.getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};ia.prototype.findEdge=function(e){for(var t=this,n=e.iterator();n.hasNext();){var r=n.next();r.isForward()&&t.checkForRightmostCoordinate(r)}en.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var i=this.getRightmostSide(this._minDe,this._minIndex);i===ie.LEFT&&(this._orientedDe=this._minDe.getSym())};ia.prototype.interfaces_=function(){return[]};ia.prototype.getClass=function(){return ia};var hl=function(e){function t(n,r){e.call(this,t.msgWithCoord(n,r)),this.pt=r?new Mt(r):null,this.name="TopologyException"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},t}(ul),Ty=function(){this.array_=[]};Ty.prototype.addLast=function(e){this.array_.push(e)};Ty.prototype.removeFirst=function(){return this.array_.shift()};Ty.prototype.isEmpty=function(){return this.array_.length===0};var Zi=function(){this._finder=null,this._dirEdgeList=new he,this._nodes=new he,this._rightMostCoord=null,this._env=null,this._finder=new ia};Zi.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.setVisited(!1)}};Zi.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Zi.prototype.computeNodeDepth=function(e){for(var t=this,n=null,r=e.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new hl("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(n);for(var a=e.getEdges().iterator();a.hasNext();){var h=a.next();h.setVisited(!0),t.copySymDepths(h)}};Zi.prototype.computeDepth=function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.setEdgeDepths(ie.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)};Zi.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Zi.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(ie.RIGHT)>=1&&t.getDepth(ie.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}};Zi.prototype.computeDepths=function(e){var t=this,n=new Vv,r=new Ty,i=e.getNode();for(r.addLast(i),n.add(i),e.setVisited(!0);!r.isEmpty();){var a=r.removeFirst();n.add(a),t.computeNodeDepth(a);for(var h=a.getEdges().iterator();h.hasNext();){var u=h.next(),y=u.getSym();if(!y.isVisited()){var w=y.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};Zi.prototype.compareTo=function(e){var t=e;return this._rightMostCoord.xt._rightMostCoord.x?1:0};Zi.prototype.getEnvelope=function(){if(this._env===null){for(var e=new ke,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next(),r=n.getEdge().getCoordinates(),i=0;ithis.location.length){var n=new Array(3).fill(null);n[ie.ON]=this.location[ie.ON],n[ie.LEFT]=Dt.NONE,n[ie.RIGHT]=Dt.NONE,this.location=n}for(var r=0;r1&&e.append(Dt.toLocationSymbol(this.location[ie.LEFT])),e.append(Dt.toLocationSymbol(this.location[ie.ON])),this.location.length>1&&e.append(Dt.toLocationSymbol(this.location[ie.RIGHT])),e.toString()};Zn.prototype.setLocations=function(e,t,n){this.location[ie.ON]=e,this.location[ie.LEFT]=t,this.location[ie.RIGHT]=n};Zn.prototype.get=function(e){return e1};Zn.prototype.isAnyNull=function(){for(var e=this,t=0;te._maxNodeDegree&&(e._maxNodeDegree=r),t=e.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2};Or.prototype.addPoints=function(e,t,n){var r=this,i=e.getCoordinates();if(t){var a=1;n&&(a=0);for(var h=a;h=0;y--)r._pts.add(i[y])}};Or.prototype.isHole=function(){return this._isHole};Or.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};Or.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!be.isPointInRing(e,t.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(e))return!1}return!0};Or.prototype.addHole=function(e){this._holes.add(e)};Or.prototype.isShell=function(){return this._shell===null};Or.prototype.getLabel=function(){return this._label};Or.prototype.getEdges=function(){return this._edges};Or.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Or.prototype.getShell=function(){return this._shell};Or.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=t.getLocation(n,ie.RIGHT);if(r===Dt.NONE)return null;if(this._label.getLocation(n)===Dt.NONE)return this._label.setLocation(n,r),null}};Or.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};Or.prototype.toPolygon=function(e){for(var t=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(e)};jo.prototype.isInResult=function(){return this._isInResult};jo.prototype.isVisited=function(){return this._isVisited};jo.prototype.interfaces_=function(){return[]};jo.prototype.getClass=function(){return jo};var Ly=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Nn(0,Dt.NONE)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,r){var i=Dt.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var a=n.getLocation(r);i!==Dt.BOUNDARY&&(i=a)}return i},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new Nn(n,r):this._label.setLocation(n,r)}else return e.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Nn)for(var i=arguments[0],a=0;a<2;a++){var h=n.computeMergedLocation(i,a),u=n._label.getLocation(a);u===Dt.NONE&&n._label.setLocation(a,h)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=Dt.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case Dt.BOUNDARY:i=Dt.INTERIOR;break;case Dt.INTERIOR:i=Dt.BOUNDARY;break;default:i=Dt.BOUNDARY;break}this._label.setLocation(n,i)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jo),oa=function(){this.nodeMap=new Ai,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};oa.prototype.find=function(e){return this.nodeMap.get(e)};oa.prototype.addNode=function(){if(arguments[0]instanceof Mt){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}else if(arguments[0]instanceof Ly){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};oa.prototype.print=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};oa.prototype.iterator=function(){return this.nodeMap.values().iterator()};oa.prototype.values=function(){return this.nodeMap.values()};oa.prototype.getBoundaryNodes=function(e){for(var t=new he,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(e)===Dt.BOUNDARY&&t.add(r)}return t};oa.prototype.add=function(e){var t=e.getCoordinate(),n=this.addNode(t);n.add(e)};oa.prototype.interfaces_=function(){return[]};oa.prototype.getClass=function(){return oa};var zn=function(){},Ud={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};zn.prototype.interfaces_=function(){return[]};zn.prototype.getClass=function(){return zn};zn.isNorthern=function(e){return e===zn.NE||e===zn.NW};zn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};zn.commonHalfPlane=function(e,t){if(e===t)return e;var n=(e-t+4)%4;if(n===2)return-1;var r=et?e:t;return r===0&&i===3?3:r};zn.isInHalfPlane=function(e,t){return t===zn.SE?e===zn.SE||e===zn.SW:e===t||e===t+1};zn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new ir("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?zn.NE:zn.SE:t>=0?zn.NW:zn.SW}else if(arguments[0]instanceof Mt&&arguments[1]instanceof Mt){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new ir("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?zn.NE:zn.SE:r.y>=n.y?zn.NW:zn.SW}};Ud.NE.get=function(){return 0};Ud.NW.get=function(){return 1};Ud.SW.get=function(){return 2};Ud.SE.get=function(){return 3};Object.defineProperties(zn,Ud);var ki=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=t,this.init(n,r),this._label=i}else if(arguments.length===4){var a=arguments[0],h=arguments[1],u=arguments[2],y=arguments[3];this._edge=a,this.init(h,u),this._label=y}};ki.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){h.linkDirectedEdgesForMinimalEdgeRings();var u=h.buildMinimalRings(),y=r.findShell(u);y!==null?(r.placePolygonHoles(y,u),t.add(y)):n.addAll(u)}else i.add(h)}return i};Io.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};Io.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new he,r=e.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var a=new PD(i,t._geometryFactory);n.add(a),a.setInResult()}}return n};Io.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(e)}};Io.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};Io.prototype.findEdgeRingContaining=function(e,t){for(var n=e.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),a=null,h=null,u=t.iterator();u.hasNext();){var y=u.next(),w=y.getLinearRing(),S=w.getEnvelopeInternal();a!==null&&(h=a.getLinearRing().getEnvelopeInternal());var I=!1;S.contains(r)&&be.isPointInRing(i,w.getCoordinates())&&(I=!0),I&&(a===null||h.contains(S))&&(a=y)}return a};Io.prototype.findShell=function(e){for(var t=0,n=null,r=e.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,t++)}return en.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};Io.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];cr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(t),i=new he,a=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(a,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Io.prototype.interfaces_=function(){return[]};Io.prototype.getClass=function(){return Io};var xf=function(){};xf.prototype.getBounds=function(){};xf.prototype.interfaces_=function(){return[]};xf.prototype.getClass=function(){return xf};var Ps=function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t};Ps.prototype.getItem=function(){return this._item};Ps.prototype.getBounds=function(){return this._bounds};Ps.prototype.interfaces_=function(){return[xf,fs]};Ps.prototype.getClass=function(){return Ps};var fl=function(){this._size=null,this._items=null,this._size=0,this._items=new he,this._items.add(null)};fl.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e};fl.prototype.size=function(){return this._size};fl.prototype.reorder=function(e){for(var t=this,n=null,r=this._items.get(e);e*2<=this._size&&(n=e*2,n!==t._size&&t._items.get(n+1).compareTo(t._items.get(n))<0&&n++,t._items.get(n).compareTo(r)<0);e=n)t._items.set(e,t._items.get(n));this._items.set(e,r)};fl.prototype.clear=function(){this._size=0,this._items.clear()};fl.prototype.isEmpty=function(){return this._size===0};fl.prototype.add=function(e){var t=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)t._items.set(n,t._items.get(Math.trunc(n/2)));this._items.set(n,e)};fl.prototype.interfaces_=function(){return[]};fl.prototype.getClass=function(){return fl};var Xl=function(){};Xl.prototype.visitItem=function(e){};Xl.prototype.interfaces_=function(){return[]};Xl.prototype.getClass=function(){return Xl};var Ic=function(){};Ic.prototype.insert=function(e,t){};Ic.prototype.remove=function(e,t){};Ic.prototype.query=function(){};Ic.prototype.interfaces_=function(){return[]};Ic.prototype.getClass=function(){return Ic};var jr=function(){if(this._childBoundables=new he,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},bI={serialVersionUID:{configurable:!0}};jr.prototype.getLevel=function(){return this._level};jr.prototype.size=function(){return this._childBoundables.size()};jr.prototype.getChildBoundables=function(){return this._childBoundables};jr.prototype.addChildBoundable=function(e){en.isTrue(this._bounds===null),this._childBoundables.add(e)};jr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};jr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};jr.prototype.interfaces_=function(){return[xf,fs]};jr.prototype.getClass=function(){return jr};bI.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(jr,bI);var Ms=function(){};Ms.reverseOrder=function(){return{compare:function(e,t){return t.compareTo(e)}}};Ms.min=function(e){return Ms.sort(e),e.get(0)};Ms.sort=function(e,t){var n=e.toArray();t?Lu.sort(n,t):Lu.sort(n);for(var r=e.iterator(),i=0,a=n.length;iDr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,t),null):(this.expand(this._boundable2,this._boundable1,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,e,t),null;if(r)return this.expand(this._boundable2,this._boundable1,e,t),null;throw new ir("neither boundable is composite")};Dr.prototype.isLeaves=function(){return!(Dr.isComposite(this._boundable1)||Dr.isComposite(this._boundable2))};Dr.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Dr.prototype.expand=function(e,t,n,r){for(var i=this,a=e.getChildBoundables(),h=a.iterator();h.hasNext();){var u=h.next(),y=new Dr(u,t,i._itemDistance);y.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Py={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};hi.prototype.getNodeCapacity=function(){return this._nodeCapacity};hi.prototype.lastNode=function(e){return e.get(e.size()-1)};hi.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=arguments[0],n=0,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof jr?n+=e.size(i):i instanceof Ps&&(n+=1)}return n}};hi.prototype.removeItem=function(e,t){for(var n=null,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ps&&i.getItem()===t&&(n=i)}return n!==null?(e.getChildBoundables().remove(n),!0):!1};hi.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new he:t}else if(arguments.length===1){for(var n=arguments[0],r=new he,i=n.getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof jr){var h=e.itemsTree(a);h!==null&&r.add(h)}else a instanceof Ps?r.add(a.getItem()):en.shouldNeverReachHere()}return r.size()<=0?null:r}};hi.prototype.insert=function(e,t){en.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ps(e,t))};hi.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new he;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];if(en.isTrue(r>-2),i.getLevel()===r)return a.add(i),null;for(var h=i.getChildBoundables().iterator();h.hasNext();){var u=h.next();u instanceof jr?e.boundablesAtLevel(r,u,a):(en.isTrue(u instanceof Ps),r===-1&&a.add(u))}return null}};hi.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new he;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}else if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(Be(arguments[2],Xl)&&arguments[0]instanceof Object&&arguments[1]instanceof jr)for(var a=arguments[0],h=arguments[1],u=arguments[2],y=h.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};hi.prototype.createParentBoundables=function(e,t){var n=this;en.isTrue(!e.isEmpty());var r=new he;r.add(this.createNode(t));var i=new he(e);Ms.sort(i,this.getComparator());for(var a=i.iterator();a.hasNext();){var h=a.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(t)),n.lastNode(r).addChildBoundable(h)}return r};hi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};hi.prototype.interfaces_=function(){return[fs]};hi.prototype.getClass=function(){return hi};hi.compareDoubles=function(e,t){return e>t?1:e0);for(var h=new he,u=0;u0;){var R=z.poll(),Y=R.getDistance();if(Y>=I)break;R.isLeaves()?(I=Y,P=R):R.expandToQueue(z,I)}return[P.getBoundable(0).getItem(),P.getBoundable(1).getItem()]}}else if(arguments.length===3){var Z=arguments[0],et=arguments[1],B=arguments[2],j=new Ps(Z,et),q=new Dr(this.getRoot(),j,B);return this.nearestNeighbour(q)[0]}},t.prototype.interfaces_=function(){return[Ic,fs]},t.prototype.getClass=function(){return t},t.centreX=function(r){return t.avg(r.getMinX(),r.getMaxX())},t.avg=function(r,i){return(r+i)/2},t.centreY=function(r){return t.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return Uw},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[ff]},compare:function(r,i){return e.compareDoubles(t.centreX(r.getBounds()),t.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[ff]},compare:function(r,i){return e.compareDoubles(t.centreY(r.getBounds()),t.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(hi),Uw=function(e){function t(){var n=arguments[0];e.call(this,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new ke(i.getBounds()):n.expandToInclude(i.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jr),io=function(){};io.prototype.interfaces_=function(){return[]};io.prototype.getClass=function(){return io};io.relativeSign=function(e,t){return et?1:0};io.compare=function(e,t,n){if(t.equals2D(n))return 0;var r=io.relativeSign(t.x,n.x),i=io.relativeSign(t.y,n.y);switch(e){case 0:return io.compareValue(r,i);case 1:return io.compareValue(i,r);case 2:return io.compareValue(i,-r);case 3:return io.compareValue(-r,i);case 4:return io.compareValue(-r,-i);case 5:return io.compareValue(-i,-r);case 6:return io.compareValue(-i,r);case 7:return io.compareValue(r,-i)}return en.shouldNeverReachHere("invalid octant value"),0};io.compareValue=function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0};var Yl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];this._segString=e,this.coord=new Mt(t),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!t.equals2D(e.getCoordinate(n))};Yl.prototype.getCoordinate=function(){return this.coord};Yl.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)};Yl.prototype.compareTo=function(e){var t=e;return this.segmentIndext.segmentIndex?1:this.coord.equals2D(t.coord)?0:io.compare(this._segmentOctant,this.coord,t.coord)};Yl.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e};Yl.prototype.isInterior=function(){return this._isInterior};Yl.prototype.interfaces_=function(){return[hs]};Yl.prototype.getClass=function(){return Yl};var Xi=function(){this._nodeMap=new Ai,this._edge=null;var e=arguments[0];this._edge=e};Xi.prototype.getSplitCoordinates=function(){var e=this,t=new Bd;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();e.addEdgeCoordinates(r,i,t),r=i}return t.toCoordinateArray()};Xi.prototype.addCollapsedNodes=function(){var e=this,t=new he;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var r=n.next().intValue();e.add(e._edge.getCoordinate(r),r)}};Xi.prototype.print=function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};Xi.prototype.findCollapsesFromExistingVertices=function(e){for(var t=this,n=0;n=0?t>=0?n>=r?0:1:n>=r?7:6:t>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof Mt&&arguments[1]instanceof Mt){var i=arguments[0],a=arguments[1],h=a.x-i.x,u=a.y-i.y;if(h===0&&u===0)throw new ir("Cannot compute the octant for two identical points "+i);return Cc.octant(h,u)}};var ka=function(){};ka.prototype.getCoordinates=function(){};ka.prototype.size=function(){};ka.prototype.getCoordinate=function(e){};ka.prototype.isClosed=function(){};ka.prototype.setData=function(e){};ka.prototype.getData=function(){};ka.prototype.interfaces_=function(){return[]};ka.prototype.getClass=function(){return ka};var Id=function(){};Id.prototype.addIntersection=function(e,t){};Id.prototype.interfaces_=function(){return[ka]};Id.prototype.getClass=function(){return Id};var Lr=function(){this._nodeList=new Xi(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};Lr.prototype.getCoordinates=function(){return this._pts};Lr.prototype.size=function(){return this._pts.length};Lr.prototype.getCoordinate=function(e){return this._pts[e]};Lr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Lr.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};Lr.prototype.setData=function(e){this._data=e};Lr.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:Cc.octant(e,t)};Lr.prototype.getData=function(){return this._data};Lr.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[3],a=new Mt(n.getIntersection(i));this.addIntersection(a,r)}};Lr.prototype.toString=function(){return Ts.toLineString(new Ir(this._pts))};Lr.prototype.getNodeList=function(){return this._nodeList};Lr.prototype.addIntersectionNode=function(e,t){var n=t,r=n+1;if(r=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}else if(arguments[0]instanceof Mt){var r=arguments[0];return be.orientationIndex(this.p0,this.p1,r)}};De.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};De.prototype.isVertical=function(){return this.p0.x===this.p1.x};De.prototype.equals=function(e){if(!(e instanceof De))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};De.prototype.intersection=function(e){var t=new ju;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};De.prototype.project=function(){if(arguments[0]instanceof Mt){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new Mt(e);var t=this.projectionFactor(e),n=new Mt;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof De){var r=arguments[0],i=this.projectionFactor(r.p0),a=this.projectionFactor(r.p1);if(i>=1&&a>=1||i<=0&&a<=0)return null;var h=this.project(r.p0);i<0&&(h=this.p0),i>1&&(h=this.p1);var u=this.project(r.p1);return a<0&&(u=this.p0),a>1&&(u=this.p1),new De(h,u)}};De.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};De.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};De.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};De.prototype.distancePerpendicular=function(e){return be.distancePointLinePerpendicular(e,this.p0,this.p1)};De.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};De.prototype.midPoint=function(){return De.midPoint(this.p0,this.p1)};De.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=t*t+n*n;if(r<=0)return He.NaN;var i=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/r;return i};De.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),r=He.MAX_VALUE,i=null,a=this.closestPoint(e.p0);r=a.distance(e.p0),n[0]=a,n[1]=e.p0;var h=this.closestPoint(e.p1);i=h.distance(e.p1),i0&&t<1)return this.project(e);var n=this.p0.distance(e),r=this.p1.distance(e);return n1||He.isNaN(t))&&(t=1),t};De.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};De.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};De.prototype.distance=function(){if(arguments[0]instanceof De){var e=arguments[0];return be.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof Mt){var t=arguments[0];return be.distancePointLine(t,this.p0,this.p1)}};De.prototype.pointAlong=function(e){var t=new Mt;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t};De.prototype.hashCode=function(){var e=He.doubleToLongBits(this.p0.x);e^=He.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=He.doubleToLongBits(this.p1.x);n^=He.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return t^r};De.prototype.interfaces_=function(){return[hs,fs]};De.prototype.getClass=function(){return De};De.midPoint=function(e,t){return new Mt((e.x+t.x)/2,(e.y+t.y)/2)};wI.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(De,wI);var Cd=function(){this.tempEnv1=new ke,this.tempEnv2=new ke,this._overlapSeg1=new De,this._overlapSeg2=new De};Cd.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Cd.prototype.interfaces_=function(){return[]};Cd.prototype.getClass=function(){return Cd};var Co=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=r};Co.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};Co.prototype.computeSelect=function(e,t,n,r){var i=this._pts[t],a=this._pts[n];if(r.tempEnv1.init(i,a),n-t===1)return r.select(this,t),null;if(!e.intersects(r.tempEnv1))return null;var h=Math.trunc((t+n)/2);t=e.length-1)return e.length-1;for(var r=zn.quadrant(e[n],e[n+1]),i=t+1;ih.getId()&&(h.computeOverlaps(w,i),r._nOverlaps++),r._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return Gw},Object.defineProperties(t,n),t}(Td),Gw=function(e){function t(){e.call(this),this._si=null;var n=arguments[0];this._si=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],a=arguments[3],h=n.getContext(),u=i.getContext();this._si.processIntersections(h,r,u,a)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Cd),Ln=function e(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],h=arguments[2],u=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(a),this.setJoinStyle(h),this.setMitreLimit(u)}}},_l={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Ln.prototype.getEndCapStyle=function(){return this._endCapStyle};Ln.prototype.isSingleSided=function(){return this._isSingleSided};Ln.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Ln.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ln.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Ln.JOIN_ROUND&&(this._quadrantSegments=Ln.DEFAULT_QUADRANT_SEGMENTS)};Ln.prototype.getJoinStyle=function(){return this._joinStyle};Ln.prototype.setJoinStyle=function(e){this._joinStyle=e};Ln.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Ln.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Ln.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Ln.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Ln.prototype.getMitreLimit=function(){return this._mitreLimit};Ln.prototype.setMitreLimit=function(e){this._mitreLimit=e};Ln.prototype.setSingleSided=function(e){this._isSingleSided=e};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Ln.bufferDistanceError=function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)};_l.CAP_ROUND.get=function(){return 1};_l.CAP_FLAT.get=function(){return 2};_l.CAP_SQUARE.get=function(){return 3};_l.JOIN_ROUND.get=function(){return 1};_l.JOIN_MITRE.get=function(){return 2};_l.JOIN_BEVEL.get=function(){return 3};_l.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};_l.DEFAULT_MITRE_LIMIT.get=function(){return 5};_l.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Ln,_l);var _r=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=be.COUNTERCLOCKWISE,this._inputLine=e||null},Gd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};_r.prototype.isDeletable=function(e,t,n,r){var i=this._inputLine[e],a=this._inputLine[t],h=this._inputLine[n];return!this.isConcave(i,a,h)||!this.isShallow(i,a,h,r)?!1:this.isShallowSampled(i,a,e,n,r)};_r.prototype.deleteShallowConcavities=function(){for(var e=this,t=1,n=this.findNextNonDeletedIndex(t),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(e[i])};Wo.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1),n=e.distance(t);return nMath.PI;)e-=vn.PI_TIMES_2;for(;e<=-Math.PI;)e+=vn.PI_TIMES_2;return e};vn.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=n.x-t.x,i=n.y-t.y;return Math.atan2(i,r)}};vn.isAcute=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=n.x-t.x,h=n.y-t.y,u=r*a+i*h;return u>0};vn.isObtuse=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=n.x-t.x,h=n.y-t.y,u=r*a+i*h;return u<0};vn.interiorAngle=function(e,t,n){var r=vn.angle(t,e),i=vn.angle(t,n);return Math.abs(i-r)};vn.normalizePositive=function(e){if(e<0){for(;e<0;)e+=vn.PI_TIMES_2;e>=vn.PI_TIMES_2&&(e=0)}else{for(;e>=vn.PI_TIMES_2;)e-=vn.PI_TIMES_2;e<0&&(e=0)}return e};vn.angleBetween=function(e,t,n){var r=vn.angle(t,e),i=vn.angle(t,n);return vn.diff(r,i)};vn.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};vn.toRadians=function(e){return e*Math.PI/180};vn.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?vn.COUNTERCLOCKWISE:n<0?vn.CLOCKWISE:vn.NONE};vn.angleBetweenOriented=function(e,t,n){var r=vn.angle(t,e),i=vn.angle(t,n),a=i-r;return a<=-Math.PI?a+vn.PI_TIMES_2:a>Math.PI?a-vn.PI_TIMES_2:a};Hc.PI_TIMES_2.get=function(){return 2*Math.PI};Hc.PI_OVER_2.get=function(){return Math.PI/2};Hc.PI_OVER_4.get=function(){return Math.PI/4};Hc.COUNTERCLOCKWISE.get=function(){return be.COUNTERCLOCKWISE};Hc.CLOCKWISE.get=function(){return be.CLOCKWISE};Hc.NONE.get=function(){return be.COLLINEAR};Object.defineProperties(vn,Hc);var Qn=function e(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new De,this._seg1=new De,this._offset0=new De,this._offset1=new De,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new ju,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Ln.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},qd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Qn.prototype.addNextSegment=function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=be.computeOrientation(this._s0,this._s1,this._s2),r=n===be.CLOCKWISE&&this._side===ie.LEFT||n===be.COUNTERCLOCKWISE&&this._side===ie.RIGHT;n===0?this.addCollinear(t):r?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};Qn.prototype.addLineEndCap=function(e,t){var n=new De(e,t),r=new De;this.computeOffsetSegment(n,ie.LEFT,this._distance,r);var i=new De;this.computeOffsetSegment(n,ie.RIGHT,this._distance,i);var a=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,a);switch(this._bufParams.getEndCapStyle()){case Ln.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(t,u+Math.PI/2,u-Math.PI/2,be.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Ln.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Ln.CAP_SQUARE:var y=new Mt;y.x=Math.abs(this._distance)*Math.cos(u),y.y=Math.abs(this._distance)*Math.sin(u);var w=new Mt(r.p1.x+y.x,r.p1.y+y.y),S=new Mt(i.p1.x+y.x,i.p1.y+y.y);this._segList.addPt(w),this._segList.addPt(S);break}};Qn.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};Qn.prototype.addMitreJoin=function(e,t,n,r){var i=!0,a=null;try{a=Is.intersection(t.p0,t.p1,n.p0,n.p1);var h=r<=0?1:a.distance(e)/Math.abs(r);h>this._bufParams.getMitreLimit()&&(i=!1)}catch(u){if(u instanceof Ff)a=new Mt(0,0),i=!1;else throw u}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(t,n,r,this._bufParams.getMitreLimit())};Qn.prototype.addFilletCorner=function(e,t,n,r,i){var a=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,a),y=n.x-e.x,w=n.y-e.y,S=Math.atan2(w,y);r===be.CLOCKWISE?u<=S&&(u+=2*Math.PI):u>=S&&(u-=2*Math.PI),this._segList.addPt(t),this.addFilletArc(e,u,S,r,i),this._segList.addPt(n)};Qn.prototype.addOutsideTurn=function(e,t){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Mt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new Mt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};Qn.prototype.createCircle=function(e){var t=new Mt(e.x+this._distance,e.y);this._segList.addPt(t),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};Qn.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};Qn.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Wo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*Qn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};Qn.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var t=this._li.getIntersectionNum();t>=2&&(this._bufParams.getJoinStyle()===Ln.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ln.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,be.CLOCKWISE,this._distance))};Qn.prototype.closeRing=function(){this._segList.closeRing()};Qn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};Qn.prototype.interfaces_=function(){return[]};Qn.prototype.getClass=function(){return Qn};qd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};qd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};qd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};qd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(Qn,qd);var so=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t};so.prototype.getOffsetCurve=function(e,t){if(this._distance=t,t===0)return null;var n=t<0,r=Math.abs(t),i=this.getSegGen(r);e.length<=1?this.computePointCurve(e[0],i):this.computeOffsetCurve(e,n,i);var a=i.getCoordinates();return n&&dn.reverse(a),a};so.prototype.computeSingleSidedBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var i=_r.simplify(e,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ie.LEFT),n.addFirstSegment();for(var h=a-2;h>=0;h--)n.addNextSegment(i[h],!0)}else{n.addSegments(e,!1);var u=_r.simplify(e,r),y=u.length-1;n.initSideSegments(u[0],u[1],ie.LEFT),n.addFirstSegment();for(var w=2;w<=y;w++)n.addNextSegment(u[w],!0)}n.addLastSegment(),n.closeRing()};so.prototype.computeRingBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);t===ie.RIGHT&&(r=-r);var i=_r.simplify(e,r),a=i.length-1;n.initSideSegments(i[a-1],i[0],t);for(var h=1;h<=a;h++){var u=h!==1;n.addNextSegment(i[h],u)}n.closeRing()};so.prototype.computeLineBufferCurve=function(e,t){var n=this.simplifyTolerance(this._distance),r=_r.simplify(e,n),i=r.length-1;t.initSideSegments(r[0],r[1],ie.LEFT);for(var a=2;a<=i;a++)t.addNextSegment(r[a],!0);t.addLastSegment(),t.addLineEndCap(r[i-1],r[i]);var h=_r.simplify(e,-n),u=h.length-1;t.initSideSegments(h[u],h[u-1],ie.LEFT);for(var y=u-2;y>=0;y--)t.addNextSegment(h[y],!0);t.addLastSegment(),t.addLineEndCap(h[1],h[0]),t.closeRing()};so.prototype.computePointCurve=function(e,t){switch(this._bufParams.getEndCapStyle()){case Ln.CAP_ROUND:t.createCircle(e);break;case Ln.CAP_SQUARE:t.createSquare(e);break}};so.prototype.getLineCurve=function(e,t){if(this._distance=t,t<0&&!this._bufParams.isSingleSided()||t===0)return null;var n=Math.abs(t),r=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],r);else if(this._bufParams.isSingleSided()){var i=t<0;this.computeSingleSidedBufferCurve(e,i,r)}else this.computeLineBufferCurve(e,r);var a=r.getCoordinates();return a};so.prototype.getBufferParameters=function(){return this._bufParams};so.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()};so.prototype.getRingCurve=function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return so.copyCoordinates(e);var r=this.getSegGen(n);return this.computeRingBufferCurve(e,t,r),r.getCoordinates()};so.prototype.computeOffsetCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){var i=_r.simplify(e,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ie.LEFT),n.addFirstSegment();for(var h=a-2;h>=0;h--)n.addNextSegment(i[h],!0)}else{var u=_r.simplify(e,r),y=u.length-1;n.initSideSegments(u[0],u[1],ie.LEFT),n.addFirstSegment();for(var w=2;w<=y;w++)n.addNextSegment(u[w],!0)}n.addLastSegment()};so.prototype.getSegGen=function(e){return new Qn(this._precisionModel,this._bufParams,e)};so.prototype.interfaces_=function(){return[]};so.prototype.getClass=function(){return so};so.copyCoordinates=function(e){for(var t=new Array(e.length).fill(null),n=0;na.getMaxY()||e.findStabbedSegments(t,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Be(arguments[2],Cs)&&arguments[0]instanceof Mt&&arguments[1]instanceof J0)for(var h=arguments[0],u=arguments[1],y=arguments[2],w=u.getEdge().getCoordinates(),S=0;Se._seg.p1.y&&e._seg.reverse();var I=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(Ie._seg.p1.y)&&be.computeOrientation(e._seg.p0,e._seg.p1,h)!==be.RIGHT){var P=u.getDepth(ie.LEFT);e._seg.p0.equals(w[S])||(P=u.getDepth(ie.RIGHT));var z=new Du(e._seg,P);y.add(z)}}else if(Be(arguments[2],Cs)&&arguments[0]instanceof Mt&&Be(arguments[1],Cs))for(var R=arguments[0],Y=arguments[1],Z=arguments[2],et=Y.iterator();et.hasNext();){var B=et.next();B.isForward()&&e.findStabbedSegments(R,B,Z)}}};Tc.prototype.getDepth=function(e){var t=this.findStabbedSegments(e);if(t.size()===0)return 0;var n=Ms.min(t);return n._leftDepth};Tc.prototype.interfaces_=function(){return[]};Tc.prototype.getClass=function(){return Tc};EI.DepthSegment.get=function(){return Du};Object.defineProperties(Tc,EI);var Du=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new De(e),this._leftDepth=t};Du.prototype.compareTo=function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(t._upwardSeg)};Du.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};Du.prototype.toString=function(){return this._upwardSeg.toString()};Du.prototype.interfaces_=function(){return[hs]};Du.prototype.getClass=function(){return Du};var Mn=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};Mn.prototype.area=function(){return Mn.area(this.p0,this.p1,this.p2)};Mn.prototype.signedArea=function(){return Mn.signedArea(this.p0,this.p1,this.p2)};Mn.prototype.interpolateZ=function(e){if(e===null)throw new ir("Supplied point is null.");return Mn.interpolateZ(e,this.p0,this.p1,this.p2)};Mn.prototype.longestSideLength=function(){return Mn.longestSideLength(this.p0,this.p1,this.p2)};Mn.prototype.isAcute=function(){return Mn.isAcute(this.p0,this.p1,this.p2)};Mn.prototype.circumcentre=function(){return Mn.circumcentre(this.p0,this.p1,this.p2)};Mn.prototype.area3D=function(){return Mn.area3D(this.p0,this.p1,this.p2)};Mn.prototype.centroid=function(){return Mn.centroid(this.p0,this.p1,this.p2)};Mn.prototype.inCentre=function(){return Mn.inCentre(this.p0,this.p1,this.p2)};Mn.prototype.interfaces_=function(){return[]};Mn.prototype.getClass=function(){return Mn};Mn.area=function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)};Mn.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};Mn.det=function(e,t,n,r){return e*r-t*n};Mn.interpolateZ=function(e,t,n,r){var i=t.x,a=t.y,h=n.x-i,u=r.x-i,y=n.y-a,w=r.y-a,S=h*w-u*y,I=e.x-i,P=e.y-a,z=(w*I-u*P)/S,R=(-y*I+h*P)/S,Y=t.z+z*(n.z-t.z)+R*(r.z-t.z);return Y};Mn.longestSideLength=function(e,t,n){var r=e.distance(t),i=t.distance(n),a=n.distance(e),h=r;return i>h&&(h=i),a>h&&(h=a),h};Mn.isAcute=function(e,t,n){return!(!vn.isAcute(e,t,n)||!vn.isAcute(t,n,e)||!vn.isAcute(n,e,t))};Mn.circumcentre=function(e,t,n){var r=n.x,i=n.y,a=e.x-r,h=e.y-i,u=t.x-r,y=t.y-i,w=2*Mn.det(a,h,u,y),S=Mn.det(h,a*a+h*h,y,u*u+y*y),I=Mn.det(a,a*a+h*h,u,u*u+y*y),P=r-S/w,z=i+I/w;return new Mt(P,z)};Mn.perpendicularBisector=function(e,t){var n=t.x-e.x,r=t.y-e.y,i=new Is(e.x+n/2,e.y+r/2,1),a=new Is(e.x-r+n/2,e.y+n+r/2,1);return new Is(i,a)};Mn.angleBisector=function(e,t,n){var r=t.distance(e),i=t.distance(n),a=r/(r+i),h=n.x-e.x,u=n.y-e.y,y=new Mt(e.x+a*h,e.y+a*u);return y};Mn.area3D=function(e,t,n){var r=t.x-e.x,i=t.y-e.y,a=t.z-e.z,h=n.x-e.x,u=n.y-e.y,y=n.z-e.z,w=i*y-a*u,S=a*h-r*y,I=r*u-i*h,P=w*w+S*S+I*I,z=Math.sqrt(P)/2;return z};Mn.centroid=function(e,t,n){var r=(e.x+t.x+n.x)/3,i=(e.y+t.y+n.y)/3;return new Mt(r,i)};Mn.inCentre=function(e,t,n){var r=t.distance(n),i=e.distance(n),a=e.distance(t),h=r+i+a,u=(r*e.x+i*t.x+a*n.x)/h,y=(r*e.y+i*t.y+a*n.y)/h;return new Mt(u,y)};var cs=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new he;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n};cs.prototype.addPoint=function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,Dt.EXTERIOR,Dt.INTERIOR)};cs.prototype.addPolygon=function(e){var t=this,n=this._distance,r=ie.LEFT;this._distance<0&&(n=-this._distance,r=ie.RIGHT);var i=e.getExteriorRing(),a=dn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&a.length<3)return null;this.addPolygonRing(a,n,r,Dt.EXTERIOR,Dt.INTERIOR);for(var h=0;h0&&t.isErodedCompletely(u,-t._distance)||t.addPolygonRing(y,n,ie.opposite(r),Dt.INTERIOR,Dt.EXTERIOR)}};cs.prototype.isTriangleErodedCompletely=function(e,t){var n=new Mn(e[0],e[1],e[2]),r=n.inCentre(),i=be.distancePointLine(r,n.p0,n.p1);return i=Ma.MINIMUM_VALID_SIZE&&be.isCCW(e)&&(a=i,h=r,n=ie.opposite(n));var u=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(u,a,h)};cs.prototype.add=function(e){if(e.isEmpty())return null;e instanceof Wr?this.addPolygon(e):e instanceof yr?this.addLineString(e):e instanceof Eo?this.addPoint(e):e instanceof vf?this.addCollection(e):e instanceof Au?this.addCollection(e):e instanceof Ta?this.addCollection(e):e instanceof Hi&&this.addCollection(e)};cs.prototype.isErodedCompletely=function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var r=e.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return t<0&&2*Math.abs(t)>i};cs.prototype.addCollection=function(e){for(var t=this,n=0;n=this._max)throw new Vf;var e=this._parent.getGeometryN(this._index++);return e instanceof Hi?(this._subcollectionIterator=new La(e),this._subcollectionIterator.next()):e};La.prototype.remove=function(){throw new Error(this.getClass().getName())};La.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};La.prototype.interfaces_=function(){return[Bf]};La.prototype.getClass=function(){return La};La.isAtomic=function(e){return!(e instanceof Hi)};var Uo=function(){this._geom=null;var e=arguments[0];this._geom=e};Uo.prototype.locate=function(e){return Uo.locate(e,this._geom)};Uo.prototype.interfaces_=function(){return[Sf]};Uo.prototype.getClass=function(){return Uo};Uo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?be.isPointInRing(e,t.getCoordinates()):!1};Uo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!Uo.isPointInRing(e,n))return!1;for(var r=0;r=0;a--){var h=n._edgeList.get(a),u=h.getSym();i===null&&(i=u),r!==null&&u.setNext(r),r=h}i.setNext(r)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),a=r.getDepth(ie.LEFT),h=r.getDepth(ie.RIGHT),u=this.computeDepths(i+1,this._edgeList.size(),a),y=this.computeDepths(0,i,u);if(y!==h)throw new hl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],I=arguments[2],P=I,z=w;z=0;u--){var y=r._resultAreaEdgeList.get(u),w=y.getSym();switch(i===null&&y.getEdgeRing()===n&&(i=y),h){case r._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;a=w,h=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(y.getEdgeRing()!==n)continue;a.setNextMin(y),h=r._SCANNING_FOR_INCOMING;break}}h===this._LINKING_TO_OUTGOING&&(en.isTrue(i!==null,"found null for first outgoing dirEdge"),en.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),a.setNextMin(i))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var a=arguments[0],h=0,u=this.iterator();u.hasNext();){var y=u.next();y.getEdgeRing()===a&&h++}return h}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=Dt.NONE,r=this.iterator();r.hasNext();){var i=r.next(),a=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=Dt.INTERIOR;break}if(a.isInResult()){n=Dt.EXTERIOR;break}}}if(n===Dt.NONE)return null;for(var h=n,u=this.iterator();u.hasNext();){var y=u.next(),w=y.getSym();y.isLineEdge()?y.getEdge().setCovered(h===Dt.INTERIOR):(y.isInResult()&&(h=Dt.EXTERIOR),w.isInResult()&&(h=Dt.INTERIOR))}},t.prototype.computeLabelling=function(n){var r=this;e.prototype.computeLabelling.call(this,n),this._label=new Nn(Dt.NONE);for(var i=this.iterator();i.hasNext();)for(var a=i.next(),h=a.getEdge(),u=h.getLabel(),y=0;y<2;y++){var w=u.getLocation(y);(w===Dt.INTERIOR||w===Dt.BOUNDARY)&&r._label.setLocation(y,Dt.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Di),II=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new Ly(n,new AD)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(bf),Kl=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};Kl.prototype.compareTo=function(e){var t=e,n=Kl.compareOriented(this._pts,this._orientation,t._pts,t._orientation);return n};Kl.prototype.interfaces_=function(){return[hs]};Kl.prototype.getClass=function(){return Kl};Kl.orientation=function(e){return dn.increasingDirection(e)===1};Kl.compareOriented=function(e,t,n,r){for(var i=t?1:-1,a=r?1:-1,h=t?e.length:-1,u=r?n.length:-1,y=t?0:e.length-1,w=r?0:n.length-1;;){var S=e[y].compareTo(n[w]);if(S!==0)return S;y+=i,w+=a;var I=y===h,P=w===u;if(I&&!P)return-1;if(!I&&P)return 1;if(I&&P)return 0}};var As=function(){this._edges=new he,this._ocaMap=new Ai};As.prototype.print=function(e){var t=this;e.print("MULTILINESTRING ( ");for(var n=0;n0&&e.print(","),e.print("(");for(var i=r.getCoordinates(),a=0;a0&&e.print(","),e.print(i[a].x+" "+i[a].y);e.println(")")}e.print(") ")};As.prototype.addAll=function(e){for(var t=this,n=e.iterator();n.hasNext();)t.add(n.next())};As.prototype.findEdgeIndex=function(e){for(var t=this,n=0;n0||!t.coord.equals2D(i);a||r--;var h=new Array(r).fill(null),u=0;h[u++]=new Pt(e.coord);for(var y=e.segmentIndex+1;y<=t.segmentIndex;y++)h[u++]=n.edge.pts[y];return a&&(h[u]=t.coord),new Jg(h,new Nn(this.edge._label))};Da.prototype.add=function(e,t,n){var r=new sa(e,t,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Da.prototype.isIntersection=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();if(n.coord.equals(e))return!0}return!1};Da.prototype.interfaces_=function(){return[]};Da.prototype.getClass=function(){return Da};var Nu=function(){};Nu.prototype.getChainStartIndices=function(e){var t=this,n=0,r=new he;r.add(new ta(n));do{var i=t.findChainEnd(e,n);r.add(new ta(i)),n=i}while(nn?t:n};pl.prototype.getMinX=function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return tn&&(i=1),e._depth[t][r]=i}}};vi.prototype.getDelta=function(e){return this._depth[e][ie.RIGHT]-this._depth[e][ie.LEFT]};vi.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?Dt.EXTERIOR:Dt.INTERIOR};vi.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};vi.prototype.add=function(){var e=this;if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=t.getLocation(n,r);(i===Dt.EXTERIOR||i===Dt.INTERIOR)&&(e.isNull(n,r)?e._depth[n][r]=vi.depthAtLocation(i):e._depth[n][r]+=vi.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],h=arguments[1],u=arguments[2];u===Dt.INTERIOR&&this._depth[a][h]++}};vi.prototype.interfaces_=function(){return[]};vi.prototype.getClass=function(){return vi};vi.depthAtLocation=function(e){return e===Dt.EXTERIOR?0:e===Dt.INTERIOR?1:vi.NULL_VALUE};CI.NULL_VALUE.get=function(){return-1};Object.defineProperties(vi,CI);var Jg=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new Da(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new vi,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new t(n,Nn.toLineLabel(this._label));return r},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var r=this;if(!(n instanceof t))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var a=!0,h=!0,u=this.pts.length,y=0;y0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i0&&n.print(","),n.print(r.pts[i].x+" "+r.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(r.pts[i]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new pl(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new ke;for(var r=0;r0&&r.append(","),r.append(n.pts[i].x+" "+n.pts[i].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},t.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxya;if(h)return!1;var u=this.intersectsToleranceSquare(e,t);return en.isTrue(!(h&&u),"Found bad envelope test"),u};ao.prototype.initCorners=function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new Pt(this._maxx,this._maxy),this._corner[1]=new Pt(this._minx,this._maxy),this._corner[2]=new Pt(this._minx,this._miny),this._corner[3]=new Pt(this._maxx,this._miny)};ao.prototype.intersects=function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};ao.prototype.scale=function(e){return Math.round(e*this._scaleFactor)};ao.prototype.getCoordinate=function(){return this._originalPt};ao.prototype.copyScaled=function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)};ao.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=ao.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new ke(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv};ao.prototype.intersectsPixelClosure=function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.hasIntersection()))};ao.prototype.intersectsToleranceSquare=function(e,t){var n=!1,r=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||e.equals(this._pt)||t.equals(this._pt))};ao.prototype.addSnappedNode=function(e,t){var n=e.getCoordinate(t),r=e.getCoordinate(t+1);return this.intersects(n,r)?(e.addIntersection(this.getCoordinate(),t),!0):!1};ao.prototype.interfaces_=function(){return[]};ao.prototype.getClass=function(){return ao};LI.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(ao,LI);var Ld=function(){this.tempEnv1=new ke,this.selectedSegment=new De};Ld.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}};Ld.prototype.interfaces_=function(){return[]};Ld.prototype.getClass=function(){return Ld};var Ef=function(){this._index=null;var e=arguments[0];this._index=e},PI={HotPixelSnapAction:{configurable:!0}};Ef.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2],i=t.getSafeEnvelope(),a=new MI(t,n,r);return this._index.query(i,{interfaces_:function(){return[Xl]},visitItem:function(h){var u=h;u.select(i,a)}}),a.isNodeAdded()}};Ef.prototype.interfaces_=function(){return[]};Ef.prototype.getClass=function(){return Ef};PI.HotPixelSnapAction.get=function(){return MI};Object.defineProperties(Ef,PI);var MI=function(e){function t(){e.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getContext();if(this._parentEdge!==null&&i===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,r)}else return e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ld),Lc=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new he};Lc.prototype.processIntersections=function(e,t,n,r){var i=this;if(e===n&&t===r)return null;var a=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],y=n.getCoordinates()[r+1];if(this._li.computeIntersection(a,h,u,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;t--){try{e.bufferReducedPrecision(t)}catch(a){if(a instanceof hl)e._saveException=a;else throw a}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=_i.precisionScaleFactor(this._argGeom,this._distance,n),i=new Pn(r);this.bufferFixedPrecision(i)}};_i.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Pn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};_i.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};_i.prototype.bufferOriginalPrecision=function(){try{var e=new Wi(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(t instanceof ul)this._saveException=t;else throw t}finally{}};_i.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};_i.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};_i.prototype.interfaces_=function(){return[]};_i.prototype.getClass=function(){return _i};_i.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new _i(e),r=n.getResultGeometry(t);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Fe&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],h=arguments[2],u=new _i(i);u.setQuadrantSegments(h);var y=u.getResultGeometry(a);return y}else if(arguments[2]instanceof Ln&&arguments[0]instanceof Fe&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],I=arguments[2],P=new _i(w,I),z=P.getResultGeometry(S);return z}}else if(arguments.length===4){var R=arguments[0],Z=arguments[1],X=arguments[2],et=arguments[3],B=new _i(R);B.setQuadrantSegments(X),B.setEndCapStyle(et);var q=B.getResultGeometry(Z);return q}};_i.precisionScaleFactor=function(e,t,n){var r=e.getEnvelopeInternal(),i=qo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),a=t>0?t:0,h=i+2*a,u=Math.trunc(Math.log(h)/Math.log(10)+1),y=n-u,w=Math.pow(10,y);return w};Uf.CAP_ROUND.get=function(){return Ln.CAP_ROUND};Uf.CAP_BUTT.get=function(){return Ln.CAP_FLAT};Uf.CAP_FLAT.get=function(){return Ln.CAP_FLAT};Uf.CAP_SQUARE.get=function(){return Ln.CAP_SQUARE};Uf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(_i,Uf);var Gi=function(){this._pt=[new Pt,new Pt],this._distance=We.NaN,this._isNull=!0};Gi.prototype.getCoordinates=function(){return this._pt};Gi.prototype.getCoordinate=function(e){return this._pt[e]};Gi.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(t,n),null;var r=t.distance(n);rthis._distance&&this.initialize(t,n,r)}};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};var Sa=function(){};Sa.prototype.interfaces_=function(){return[]};Sa.prototype.getClass=function(){return Sa};Sa.computeDistance=function(){if(arguments[2]instanceof Gi&&arguments[0]instanceof yr&&arguments[1]instanceof Pt)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=e.getCoordinates(),i=new De,a=0;a0||this._isIn?Dt.INTERIOR:Dt.EXTERIOR)};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};var qi=function e(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],n=arguments[1];e.call(this,t,e.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._component=r,this._segIndex=i,this._pt=a}},AI={INSIDE_AREA:{configurable:!0}};qi.prototype.isInsideArea=function(){return this._segIndex===qi.INSIDE_AREA};qi.prototype.getCoordinate=function(){return this._pt};qi.prototype.getGeometryComponent=function(){return this._component};qi.prototype.getSegmentIndex=function(){return this._segIndex};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};AI.INSIDE_AREA.get=function(){return-1};Object.defineProperties(qi,AI);var jl=function(e){this._pts=e||null};jl.prototype.filter=function(e){e instanceof Eo&&this._pts.add(e)};jl.prototype.interfaces_=function(){return[na]};jl.prototype.getClass=function(){return jl};jl.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof Eo?Ms.singletonList(e):jl.getPoints(e,new he)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof Eo?n.add(t):t instanceof Hi&&t.apply(new jl(n)),n}};var Mc=function(){this._locations=null;var e=arguments[0];this._locations=e};Mc.prototype.filter=function(e){(e instanceof Eo||e instanceof yr||e instanceof Wr)&&this._locations.add(new qi(e,0,e.getCoordinate()))};Mc.prototype.interfaces_=function(){return[na]};Mc.prototype.getClass=function(){return Mc};Mc.getLocations=function(e){var t=new he;return e.apply(new Mc(t)),t};var Ii=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ks,this._minDistanceLocation=null,this._minDistance=We.MAX_VALUE,arguments.length===2){var e=arguments[0],t=arguments[1];this._geom=[e,t],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Ii.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,a=sl.getPolygons(this._geom[n]);if(a.size()>0){var h=Mc.getLocations(this._geom[i]);if(this.computeContainmentDistance(h,a,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Be(arguments[0],Cs)&&Be(arguments[1],Cs)){for(var u=arguments[0],y=arguments[1],w=arguments[2],S=0;Sthis._minDistance)return null;for(var i=t.getCoordinates(),a=n.getCoordinate(),h=0;hthis._minDistance)return null;for(var z=S.getCoordinates(),R=I.getCoordinates(),Z=0;Zthis._distance&&this.initialize(t,n,r)}};Mi.prototype.interfaces_=function(){return[]};Mi.prototype.getClass=function(){return Mi};var Ys=function(){};Ys.prototype.interfaces_=function(){return[]};Ys.prototype.getClass=function(){return Ys};Ys.computeDistance=function(){if(arguments[2]instanceof Mi&&arguments[0]instanceof yr&&arguments[1]instanceof Pt)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=new De,i=e.getCoordinates(),a=0;a1||e<=0)throw new ir("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e};ss.prototype.compute=function(e,t){this.computeOrientedDistance(e,t,this._ptDist),this.computeOrientedDistance(t,e,this._ptDist)};ss.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ss.prototype.computeOrientedDistance=function(e,t,n){var r=new Ac(t);if(e.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new $l(t,this._densifyFrac);e.apply(i),n.setMaximum(i.getMaxPointDistance())}};ss.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ss.prototype.interfaces_=function(){return[]};ss.prototype.getClass=function(){return ss};ss.distance=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new ss(e,t);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],h=new ss(r,i);return h.setDensifyFraction(a),h.distance()}};Xv.MaxPointDistanceFilter.get=function(){return Ac};Xv.MaxDensifiedByFractionDistanceFilter.get=function(){return $l};Object.defineProperties(ss,Xv);var Ac=function(){this._maxPtDist=new Mi,this._minPtDist=new Mi,this._euclideanDist=new Ys,this._geom=null;var e=arguments[0];this._geom=e};Ac.prototype.filter=function(e){this._minPtDist.initialize(),Ys.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Ac.prototype.getMaxPointDistance=function(){return this._maxPtDist};Ac.prototype.interfaces_=function(){return[Pa]};Ac.prototype.getClass=function(){return Ac};var $l=function(){this._maxPtDist=new Mi,this._minPtDist=new Mi,this._geom=null,this._numSubSegs=0;var e=arguments[0],t=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/t))};$l.prototype.filter=function(e,t){var n=this;if(t===0)return null;for(var r=e.getCoordinate(t-1),i=e.getCoordinate(t),a=(i.x-r.x)/this._numSubSegs,h=(i.y-r.y)/this._numSubSegs,u=0;un){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=e.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ts.toLineString(i[0],i[1])+")"}};xo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=xo.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-t,this._maxValidDistance=e+t,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),xo.VERBOSE&&bi.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};xo.prototype.checkNegativeValid=function(){if(!(this._input instanceof Wr||this._input instanceof Ta||this._input instanceof Hi))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)};xo.prototype.getErrorIndicator=function(){return this._errorIndicator};xo.prototype.checkMinimumDistance=function(e,t,n){var r=new Ii(e,t,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&e>t&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Ci.prototype.report=function(e){if(!Ci.VERBOSE)return null;bi.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};Ci.prototype.getErrorMessage=function(){return this._errorMsg};Ci.prototype.interfaces_=function(){return[]};Ci.prototype.getClass=function(){return Ci};Ci.isValidMsg=function(e,t,n){var r=new Ci(e,t,n);return r.isValid()?null:r.getErrorMessage()};Ci.isValid=function(e,t,n){var r=new Ci(e,t,n);return!!r.isValid()};Kv.VERBOSE.get=function(){return!1};Kv.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Ci,Kv);var la=function(){this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};la.prototype.getCoordinates=function(){return this._pts};la.prototype.size=function(){return this._pts.length};la.prototype.getCoordinate=function(e){return this._pts[e]};la.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};la.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:Cc.octant(this.getCoordinate(e),this.getCoordinate(e+1))};la.prototype.setData=function(e){this._data=e};la.prototype.getData=function(){return this._data};la.prototype.toString=function(){return Ts.toLineString(new Ir(this._pts))};la.prototype.interfaces_=function(){return[ka]};la.prototype.getClass=function(){return la};var fi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new he,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};fi.prototype.getInteriorIntersection=function(){return this._interiorIntersection};fi.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};fi.prototype.getIntersectionSegments=function(){return this._intSegments};fi.prototype.count=function(){return this._intersectionCount};fi.prototype.getIntersections=function(){return this._intersections};fi.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};fi.prototype.setKeepIntersections=function(e){this._keepIntersections=e};fi.prototype.processIntersections=function(e,t,n,r){if(!this._findAllIntersections&&this.hasIntersection()||e===n&&t===r)return null;if(this._isCheckEndSegmentsOnly){var i=this.isEndSegment(e,t)||this.isEndSegment(n,r);if(!i)return null}var a=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],y=n.getCoordinates()[r+1];this._li.computeIntersection(a,h,u,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=a,this._intSegments[1]=h,this._intSegments[2]=u,this._intSegments[3]=y,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};fi.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};fi.prototype.hasIntersection=function(){return this._interiorIntersection!==null};fi.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};fi.prototype.interfaces_=function(){return[Ru]};fi.prototype.getClass=function(){return fi};fi.createAllIntersectionsFinder=function(e){var t=new fi(e);return t.setFindAllIntersections(!0),t};fi.createAnyIntersectionFinder=function(e){return new fi(e)};fi.createIntersectionCounter=function(e){var t=new fi(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Ds=function(){this._li=new ju,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Ds.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Ds.prototype.getIntersections=function(){return this._segInt.getIntersections()};Ds.prototype.isValid=function(){return this.execute(),this._isValid};Ds.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Ds.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new fi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new Hv;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Ds.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new hl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Ds.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ts.toLineString(e[0],e[1])+" and "+Ts.toLineString(e[2],e[3])};Ds.prototype.interfaces_=function(){return[]};Ds.prototype.getClass=function(){return Ds};Ds.computeIntersections=function(e){var t=new Ds(e);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()};var zu=function e(){this._nv=null;var t=arguments[0];this._nv=new Ds(e.toSegmentStrings(t))};zu.prototype.checkValid=function(){this._nv.checkValid()};zu.prototype.interfaces_=function(){return[]};zu.prototype.getClass=function(){return zu};zu.toSegmentStrings=function(e){for(var t=new he,n=e.iterator();n.hasNext();){var r=n.next();t.add(new la(r.getCoordinates(),r))}return t};zu.checkValid=function(e){var t=new zu(e);t.checkValid()};var kc=function(e){this._mapOp=e};kc.prototype.map=function(e){for(var t=this,n=new he,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};lo.prototype.interfaces_=function(){return[]};lo.prototype.getClass=function(){return lo};var Na=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new De,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof yr&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];e.call(this,t.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=e.isClosed(r),this._snapTolerance=i}};Na.prototype.snapVertices=function(e,t){for(var n=this,r=this._isClosed?e.size()-1:e.size(),i=0;i=0&&e.add(h+1,new Pt(a),!1)}};Na.prototype.findSegmentIndexToSnap=function(e,t){for(var n=this,r=We.MAX_VALUE,i=-1,a=0;at&&(t=r)}return t}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return Math.min(Cr.computeOverlaySnapTolerance(i),Cr.computeOverlaySnapTolerance(a))}};Cr.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),r=n*Cr.SNAP_PRECISION_FACTOR;return r};Cr.snapToSelf=function(e,t,n){var r=new Cr(e);return r.snapToSelf(t,n)};kI.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Cr,kI);var DI=function(e){function t(n,r,i){e.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,r){var i=new Na(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},t.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),a=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(a)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(lo),Vi=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Vi.prototype.getCommon=function(){return We.longBitsToDouble(this._commonBits)};Vi.prototype.add=function(e){var t=We.doubleToLongBits(e);if(this._isFirst)return this._commonBits=t,this._commonSignExp=Vi.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Vi.signExpBits(t);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Vi.numCommonMostSigMantissaBits(this._commonBits,t),this._commonBits=Vi.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Vi.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],t=We.longBitsToDouble(e),n=We.toBinaryString(e),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),a=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+t+" ]";return a}};Vi.prototype.interfaces_=function(){return[]};Vi.prototype.getClass=function(){return Vi};Vi.getBit=function(e,t){var n=1<>52};Vi.zeroLowerBits=function(e,t){var n=(1<=0;r--){if(Vi.getBit(e,r)!==Vi.getBit(t,r))return n;n++}return 52};var tu=function(){this._commonCoord=null,this._ccFilter=new Rc},Jv={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};tu.prototype.addCommonBits=function(e){var t=new eu(this._commonCoord);e.apply(t),e.geometryChanged()};tu.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var t=new Pt(this._commonCoord);t.x=-t.x,t.y=-t.y;var n=new eu(t);return e.apply(n),e.geometryChanged(),e};tu.prototype.getCommonCoordinate=function(){return this._commonCoord};tu.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};tu.prototype.interfaces_=function(){return[]};tu.prototype.getClass=function(){return tu};Jv.CommonCoordinateFilter.get=function(){return Rc};Jv.Translater.get=function(){return eu};Object.defineProperties(tu,Jv);var Rc=function(){this._commonBitsX=new Vi,this._commonBitsY=new Vi};Rc.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)};Rc.prototype.getCommonCoordinate=function(){return new Pt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Rc.prototype.interfaces_=function(){return[Pa]};Rc.prototype.getClass=function(){return Rc};var eu=function(){this.trans=null;var e=arguments[0];this.trans=e};eu.prototype.filter=function(e,t){var n=e.getOrdinate(t,0)+this.trans.x,r=e.getOrdinate(t,1)+this.trans.y;e.setOrdinate(t,0,n),e.setOrdinate(t,1,r)};eu.prototype.isDone=function(){return!1};eu.prototype.isGeometryChanged=function(){return!0};eu.prototype.interfaces_=function(){return[Ls]};eu.prototype.getClass=function(){return eu};var pi=function(e,t){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=t,this.computeSnapTolerance()};pi.prototype.selfSnap=function(e){var t=new Cr(e),n=t.snapTo(e,this._snapTolerance);return n};pi.prototype.removeCommonBits=function(e){this._cbr=new tu,this._cbr.add(e[0]),this._cbr.add(e[1]);var t=new Array(2).fill(null);return t[0]=this._cbr.removeCommonBits(e[0].copy()),t[1]=this._cbr.removeCommonBits(e[1].copy()),t};pi.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};pi.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=Je.overlayOp(t[0],t[1],e);return this.prepareResult(n)};pi.prototype.checkValid=function(e){e.isValid()||bi.out.println("Snapped geometry is invalid")};pi.prototype.computeSnapTolerance=function(){this._snapTolerance=Cr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};pi.prototype.snap=function(e){var t=this.removeCommonBits(e),n=Cr.snap(t[0],t[1],this._snapTolerance);return n};pi.prototype.interfaces_=function(){return[]};pi.prototype.getClass=function(){return pi};pi.overlayOp=function(e,t,n){var r=new pi(e,t);return r.getResultGeometry(n)};pi.union=function(e,t){return pi.overlayOp(e,t,Je.UNION)};pi.intersection=function(e,t){return pi.overlayOp(e,t,Je.INTERSECTION)};pi.symDifference=function(e,t){return pi.overlayOp(e,t,Je.SYMDIFFERENCE)};pi.difference=function(e,t){return pi.overlayOp(e,t,Je.DIFFERENCE)};var Yi=function(e,t){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=t};Yi.prototype.getResultGeometry=function(e){var t=null,n=!1,r=null;try{t=Je.overlayOp(this._geom[0],this._geom[1],e);var i=!0;i&&(n=!0)}catch(a){if(a instanceof ul)r=a;else throw a}finally{}if(!n)try{t=pi.overlayOp(this._geom[0],this._geom[1],e)}catch(a){throw a instanceof ul?r:a}finally{}return t};Yi.prototype.interfaces_=function(){return[]};Yi.prototype.getClass=function(){return Yi};Yi.overlayOp=function(e,t,n){var r=new Yi(e,t);return r.getResultGeometry(n)};Yi.union=function(e,t){return Yi.overlayOp(e,t,Je.UNION)};Yi.intersection=function(e,t){return Yi.overlayOp(e,t,Je.INTERSECTION)};Yi.symDifference=function(e,t){return Yi.overlayOp(e,t,Je.SYMDIFFERENCE)};Yi.difference=function(e,t){return Yi.overlayOp(e,t,Je.DIFFERENCE)};var Pd=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],t=arguments[1];this.mce=e,this.chainIndex=t};Pd.prototype.computeIntersections=function(e,t){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,t)};Pd.prototype.interfaces_=function(){return[]};Pd.prototype.getClass=function(){return Pd};var To=function e(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],n=arguments[1];this._eventType=e.DELETE,this._xValue=t,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._eventType=e.INSERT,this._label=r,this._xValue=i,this._obj=a}},Qv={INSERT:{configurable:!0},DELETE:{configurable:!0}};To.prototype.isDelete=function(){return this._eventType===To.DELETE};To.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};To.prototype.getObject=function(){return this._obj};To.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};To.prototype.getInsertEvent=function(){return this._insertEvent};To.prototype.isInsert=function(){return this._eventType===To.INSERT};To.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};To.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};To.prototype.interfaces_=function(){return[hs]};To.prototype.getClass=function(){return To};Qv.INSERT.get=function(){return 1};Qv.DELETE.get=function(){return 2};Object.defineProperties(To,Qv);var Qg=function(){};Qg.prototype.interfaces_=function(){return[]};Qg.prototype.getClass=function(){return Qg};var Ti=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._li=e,this._includeProper=t,this._recordIsolated=n};Ti.prototype.isTrivialIntersection=function(e,t,n,r){if(e===n&&this._li.getIntersectionNum()===1){if(Ti.isAdjacentSegments(t,r))return!0;if(e.isClosed()){var i=e.getNumPoints()-1;if(t===0&&r===i||r===0&&t===i)return!0}}return!1};Ti.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Ti.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};Ti.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Ti.prototype.isBoundaryPointInternal=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(e.isIntersection(i))return!0}return!1};Ti.prototype.hasProperIntersection=function(){return this._hasProper};Ti.prototype.hasIntersection=function(){return this._hasIntersection};Ti.prototype.isDone=function(){return this._isDone};Ti.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};Ti.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};Ti.prototype.addIntersections=function(e,t,n,r){if(e===n&&t===r)return null;this.numTests++;var i=e.getCoordinates()[t],a=e.getCoordinates()[t+1],h=n.getCoordinates()[r],u=n.getCoordinates()[r+1];this._li.computeIntersection(i,a,h,u),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,t,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,t,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};Ti.prototype.interfaces_=function(){return[]};Ti.prototype.getClass=function(){return Ti};Ti.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var kD=function(e){function t(){e.call(this),this.events=new he,this.nOverlaps=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;Ms.sort(this.events);for(var r=0;rt||this._maxa?1:0};Md.prototype.interfaces_=function(){return[ff]};Md.prototype.getClass=function(){return Md};var DD=function(e){function t(){e.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Oa),RD=function(e){function t(){e.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},t.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,i),this._node2!==null&&this._node2.query(n,r,i)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Oa),za=function(){this._leaves=new he,this._root=null,this._level=0};za.prototype.buildTree=function(){var e=this;Ms.sort(this._leaves,new Oa.NodeComparator);for(var t=this._leaves,n=null,r=new he;;){if(e.buildLevel(t,r),r.size()===1)return r.get(0);n=t,t=r,r=n}};za.prototype.insert=function(e,t,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new DD(e,t,n))};za.prototype.query=function(e,t,n){this.init(),this._root.query(e,t,n)};za.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};za.prototype.printNode=function(e){bi.out.println(Ts.toLineString(new Pt(e._min,this._level),new Pt(e._max,this._level)))};za.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};za.prototype.buildLevel=function(e,t){this._level++,t.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,a=n.iterator();a.hasNext();){var h=a.next();r[i++]=h.getCoordinate().copy()}return r},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===Dt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},t.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var a=dn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var h=r,u=i;be.isCCW(a)&&(h=i,u=r);var y=new Jg(a,new Nn(this._argIndex,Dt.BOUNDARY,h,u));this._lineEdgeMap.put(n,y),this.insertEdge(y),this.insertPoint(this._argIndex,a[0],Dt.BOUNDARY)},t.prototype.insertPoint=function(n,r,i){var a=this._nodes.addNode(r),h=a.getLabel();h===null?a._label=new Nn(n,i):h.setLocation(n,i)},t.prototype.createEdgeSetIntersector=function(){return new kD},t.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var a=i.next(),h=a.getLabel().getLocation(n),u=a.eiList.iterator();u.hasNext();){var y=u.next();r.addSelfIntersectionNode(n,y.coord,h)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Ta&&(this._useBoundaryDeterminationRule=!1),n instanceof Wr)this.addPolygon(n);else if(n instanceof yr)this.addLineString(n);else if(n instanceof Eo)this.addPoint(n);else if(n instanceof vf)this.addCollection(n);else if(n instanceof Au)this.addCollection(n);else if(n instanceof Ta)this.addCollection(n);else if(n instanceof Hi)this.addCollection(n);else throw new Error(n.getClass().getName())}else return e.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new Cf(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return e.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,r){return n.isInBoundary(r)?Dt.BOUNDARY:Dt.INTERIOR},t}(cr),Lf=function(){if(this._li=new ju,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Kp(0,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=ls.OGC_SFS_BOUNDARY_RULE;t.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Kp(0,t,r),this._arg[1]=new Kp(1,n,r)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],h=arguments[2];i.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Kp(0,i,h),this._arg[1]=new Kp(1,a,h)}};Lf.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()};Lf.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)};Lf.prototype.interfaces_=function(){return[]};Lf.prototype.getClass=function(){return Lf};var Pu=function(){};Pu.prototype.interfaces_=function(){return[]};Pu.prototype.getClass=function(){return Pu};Pu.map=function(){if(arguments[0]instanceof Fe&&Be(arguments[1],Pu.MapOp)){for(var e=arguments[0],t=arguments[1],n=new he,r=0;r=e.size()?null:e.get(t)};Rr.union=function(e){var t=new Rr(e);return t.union()};OI.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Rr,OI);var $g=function(){};$g.prototype.interfaces_=function(){return[]};$g.prototype.getClass=function(){return $g};$g.union=function(e,t){if(e.isEmpty()||t.isEmpty()){if(e.isEmpty()&&t.isEmpty())return Je.createEmptyResult(Je.UNION,e,t,e.getFactory());if(e.isEmpty())return t.copy();if(t.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(t),Yi.overlayOp(e,t,Je.UNION)};function Wu(){return new ty}function ty(){this.reset()}ty.prototype={constructor:ty,reset:function(){this.s=this.t=0},add:function(e){qw(sg,e,this.t),qw(this,sg.s,this.s),this.s?this.t+=sg.t:this.s=sg.t},valueOf:function(){return this.s}};var sg=new ty;function qw(e,t,n){var r=e.s=t+n,i=r-t,a=r-i;e.t=t-a+(n-i)}var gr=1e-6,qn=Math.PI,ol=qn/2,jw=qn/4,dl=qn*2,Su=180/qn,Zs=qn/180,ji=Math.abs,ND=Math.atan,Mf=Math.atan2,Gr=Math.cos,qr=Math.sin,Gf=Math.sqrt;function zI(e){return e>1?0:e<-1?qn:Math.acos(e)}function Nc(e){return e>1?ol:e<-1?-ol:Math.asin(e)}function ed(){}function ey(e,t){e&&Hw.hasOwnProperty(e.type)&&Hw[e.type](e,t)}var Ww={Feature:function(e,t){ey(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++rqn?e-dl:e<-qn?e+dl:e,t]}ev.invert=ev;function zD(e,t,n){return(e%=dl)?t||n?FI(Yw(e),Kw(t,n)):Yw(e):t||n?Kw(t,n):ev}function Xw(e){return function(t,n){return t+=e,[t>qn?t-dl:t<-qn?t+dl:t,n]}}function Yw(e){var t=Xw(e);return t.invert=Xw(-e),t}function Kw(e,t){var n=Gr(e),r=qr(e),i=Gr(t),a=qr(t);function h(u,y){var w=Gr(y),S=Gr(u)*w,I=qr(u)*w,P=qr(y),z=P*n+S*r;return[Mf(I*i-z*a,S*n-P*r),Nc(z*i+I*a)]}return h.invert=function(u,y){var w=Gr(y),S=Gr(u)*w,I=qr(u)*w,P=qr(y),z=P*i-I*a;return[Mf(I*i+P*a,S*n+z*r),Nc(z*n-S*r)]},h}function FD(e,t,n,r,i,a){if(n){var h=Gr(t),u=qr(t),y=r*n;i==null?(i=t+r*dl,a=t-y/2):(i=Jw(h,i),a=Jw(h,a),(r>0?ia)&&(i+=r*dl));for(var w,S=i;r>0?S>a:S1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function BD(e,t,n,r,i,a){var h=e[0],u=e[1],y=t[0],w=t[1],S=0,I=1,P=y-h,z=w-u,R;if(R=n-h,!(!P&&R>0)){if(R/=P,P<0){if(R0){if(R>I)return;R>S&&(S=R)}if(R=i-h,!(!P&&R<0)){if(R/=P,P<0){if(R>I)return;R>S&&(S=R)}else if(P>0){if(R0)){if(R/=z,z<0){if(R0){if(R>I)return;R>S&&(S=R)}if(R=a-u,!(!z&&R<0)){if(R/=z,z<0){if(R>I)return;R>S&&(S=R)}else if(z>0){if(R0&&(e[0]=h+S*P,e[1]=u+S*z),I<1&&(t[0]=h+I*P,t[1]=u+I*z),!0}}}}}function Eg(e,t){return ji(e[0]-t[0])=0;--u)i.point((I=S[u])[0],I[1]);else r(P.x,P.p.x,-1,i);P=P.p}P=P.o,S=P.z,z=!z}while(!P.v);i.lineEnd()}}}function Qw(e){if(t=e.length){for(var t,n=0,r=e[0],i;++nt?1:e>=t?0:NaN}function VD(e){return e.length===1&&(e=UD(e)),{left:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[a],n)<0?r=a+1:i=a}return r},right:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[a],n)>0?i=a:r=a+1}return r}}}function UD(e){return function(t,n){return UI(e(t),n)}}VD(UI);function GI(e){for(var t=e.length,n,r=-1,i=0,a,h;++r=0;)for(h=e[t],n=h.length;--n>=0;)a[--i]=h[n];return a}var nd=1e9,cg=-nd;function GD(e,t,n,r){function i(w,S){return e<=w&&w<=n&&t<=S&&S<=r}function a(w,S,I,P){var z=0,R=0;if(w==null||(z=h(w,I))!==(R=h(S,I))||y(w,S)<0^I>0)do P.point(z===0||z===3?e:n,z>1?r:t);while((z=(z+I+4)%4)!==R);else P.point(S[0],S[1])}function h(w,S){return ji(w[0]-e)0?0:3:ji(w[0]-n)0?2:1:ji(w[1]-t)0?1:0:S>0?3:2}function u(w,S){return y(w.x,S.x)}function y(w,S){var I=h(w,1),P=h(S,1);return I!==P?I-P:I===0?S[1]-w[1]:I===1?w[0]-S[0]:I===2?w[1]-S[1]:S[0]-w[0]}return function(w){var S=w,I=BI(),P,z,R,Z,X,et,B,q,Y,lt,dt,ut={point:ft,lineStart:yt,lineEnd:Kt,polygonStart:kt,polygonEnd:Q};function ft(Ut,ee){i(Ut,ee)&&S.point(Ut,ee)}function _t(){for(var Ut=0,ee=0,Gt=z.length;eer&&(Cn-Pe)*(r-un)>(mn-un)*(e-Pe)&&++Ut:mn<=r&&(Cn-Pe)*(r-un)<(mn-un)*(e-Pe)&&--Ut;return Ut}function kt(){S=I,P=[],z=[],dt=!0}function Q(){var Ut=_t(),ee=dt&&Ut,Gt=(P=GI(P)).length;(ee||Gt)&&(w.polygonStart(),ee&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),Gt&&VI(P,u,Ut,a,w),w.polygonEnd()),S=w,P=z=R=null}function yt(){ut.point=bt,z&&z.push(R=[]),lt=!0,Y=!1,B=q=NaN}function Kt(){P&&(bt(Z,X),et&&Y&&I.rejoin(),P.push(I.result())),ut.point=ft,Y&&S.lineEnd()}function bt(Ut,ee){var Gt=i(Ut,ee);if(z&&R.push([Ut,ee]),lt)Z=Ut,X=ee,et=Gt,lt=!1,Gt&&(S.lineStart(),S.point(Ut,ee));else if(Gt&&Y)S.point(Ut,ee);else{var Re=[B=Math.max(cg,Math.min(nd,B)),q=Math.max(cg,Math.min(nd,q))],xe=[Ut=Math.max(cg,Math.min(nd,Ut)),ee=Math.max(cg,Math.min(nd,ee))];BD(Re,xe,e,t,n,r)?(Y||(S.lineStart(),S.point(Re[0],Re[1])),S.point(xe[0],xe[1]),Gt||S.lineEnd(),dt=!1):Gt&&(S.lineStart(),S.point(Ut,ee),dt=!1)}B=Ut,q=ee,Y=Gt}return ut}}var h0=Wu();function qD(e,t){var n=t[0],r=t[1],i=[qr(n),-Gr(n),0],a=0,h=0;h0.reset();for(var u=0,y=e.length;u=0?1:-1,ft=ut*dt,_t=ft>qn,kt=R*Y;if(h0.add(Mf(kt*ut*qr(ft),Z*lt+kt*Gr(ft))),a+=_t?dt+ut*dl:dt,_t^P>=n^B>=n){var Q=ny(Af(I),Af(et));tv(Q);var yt=ny(i,Q);tv(yt);var Kt=(_t^dt>=0?-1:1)*Nc(yt[2]);(r>Kt||r===Kt&&(Q[0]||Q[1]))&&(h+=_t^dt>=0?1:-1)}}return(a<-gr||aAd&&(Ad=e),tiy&&(iy=t)}Wu();function qI(e,t,n,r){return function(i,a){var h=t(a),u=i.invert(r[0],r[1]),y=BI(),w=t(y),S=!1,I,P,z,R={point:Z,lineStart:et,lineEnd:B,polygonStart:function(){R.point=q,R.lineStart=Y,R.lineEnd=lt,P=[],I=[]},polygonEnd:function(){R.point=Z,R.lineStart=et,R.lineEnd=B,P=GI(P);var dt=qD(I,u);P.length?(S||(a.polygonStart(),S=!0),VI(P,HD,dt,n,a)):dt&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),P=I=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function Z(dt,ut){var ft=i(dt,ut);e(dt=ft[0],ut=ft[1])&&a.point(dt,ut)}function X(dt,ut){var ft=i(dt,ut);h.point(ft[0],ft[1])}function et(){R.point=X,h.lineStart()}function B(){R.point=Z,h.lineEnd()}function q(dt,ut){z.push([dt,ut]);var ft=i(dt,ut);w.point(ft[0],ft[1])}function Y(){w.lineStart(),z=[]}function lt(){q(z[0][0],z[0][1]),w.lineEnd();var dt=w.clean(),ut=y.result(),ft,_t=ut.length,kt,Q,yt;if(z.pop(),I.push(z),z=null,!!_t){if(dt&1){if(Q=ut[0],(kt=Q.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),ft=0;ft1&&dt&2&&ut.push(ut.pop().concat(ut.shift())),P.push(ut.filter(WD))}}return R}}function WD(e){return e.length>1}function HD(e,t){return((e=e.x)[0]<0?e[1]-ol-gr:ol-e[1])-((t=t.x)[0]<0?t[1]-ol-gr:ol-t[1])}const e2=qI(function(){return!0},ZD,YD,[-qn,-ol]);function ZD(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,h){var u=a>0?qn:-qn,y=ji(a-t);ji(y-qn)0?ol:-ol),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(u,n),e.point(a,n),i=0):r!==u&&y>=qn&&(ji(t-r)gr?ND((qr(t)*(a=Gr(r))*qr(n)-qr(r)*(i=Gr(t))*qr(e))/(i*a*h)):(t+r)/2}function YD(e,t,n,r){var i;if(e==null)i=n*ol,r.point(-qn,i),r.point(0,i),r.point(qn,i),r.point(qn,0),r.point(qn,-i),r.point(0,-i),r.point(-qn,-i),r.point(-qn,0),r.point(-qn,i);else if(ji(e[0]-t[0])>gr){var a=e[0]0,i=ji(n)>gr;function a(S,I,P,z){FD(z,e,t,P,S,I)}function h(S,I){return Gr(S)*Gr(I)>n}function u(S){var I,P,z,R,Z;return{lineStart:function(){R=z=!1,Z=1},point:function(X,et){var B=[X,et],q,Y=h(X,et),lt=r?Y?0:w(X,et):Y?w(X+(X<0?qn:-qn),et):0;if(!I&&(R=z=Y)&&S.lineStart(),Y!==z&&(q=y(I,B),(!q||Eg(I,q)||Eg(B,q))&&(B[0]+=gr,B[1]+=gr,Y=h(B[0],B[1]))),Y!==z)Z=0,Y?(S.lineStart(),q=y(B,I),S.point(q[0],q[1])):(q=y(I,B),S.point(q[0],q[1]),S.lineEnd()),I=q;else if(i&&I&&r^Y){var dt;!(lt&P)&&(dt=y(B,I,!0))&&(Z=0,r?(S.lineStart(),S.point(dt[0][0],dt[0][1]),S.point(dt[1][0],dt[1][1]),S.lineEnd()):(S.point(dt[1][0],dt[1][1]),S.lineEnd(),S.lineStart(),S.point(dt[0][0],dt[0][1])))}Y&&(!I||!Eg(I,B))&&S.point(B[0],B[1]),I=B,z=Y,P=lt},lineEnd:function(){z&&S.lineEnd(),I=null},clean:function(){return Z|(R&&z)<<1}}}function y(S,I,P){var z=Af(S),R=Af(I),Z=[1,0,0],X=ny(z,R),et=ag(X,X),B=X[0],q=et-B*B;if(!q)return!P&&S;var Y=n*et/q,lt=-n*B/q,dt=ny(Z,X),ut=lg(Z,Y),ft=lg(X,lt);c0(ut,ft);var _t=dt,kt=ag(ut,_t),Q=ag(_t,_t),yt=kt*kt-Q*(ag(ut,ut)-1);if(!(yt<0)){var Kt=Gf(yt),bt=lg(_t,(-kt-Kt)/Q);if(c0(bt,ut),bt=$0(bt),!P)return bt;var Ut=S[0],ee=I[0],Gt=S[1],Re=I[1],xe;ee0^bt[1]<(ji(bt[0]-Ut)qn^(Ut<=bt[0]&&bt[0]<=ee)){var un=lg(_t,(-kt+Kt)/Q);return c0(un,ut),[bt,$0(un)]}}}function w(S,I){var P=r?e:qn-e,z=0;return S<-P?z|=1:S>P&&(z|=2),I<-P?z|=4:I>P&&(z|=8),z}return qI(h,u,a,r?[0,-e]:[-qn,e-qn])}function jI(e){return function(t){var n=new nv;for(var r in e)n[r]=e[r];return n.stream=t,n}}function nv(){}nv.prototype={constructor:nv,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function WI(e,t,n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),a!=null&&e.clipExtent(null),OD(n,e.stream(t2));var h=t2.result(),u=Math.min(r/(h[1][0]-h[0][0]),i/(h[1][1]-h[0][1])),y=+t[0][0]+(r-u*(h[1][0]+h[0][0]))/2,w=+t[0][1]+(i-u*(h[1][1]+h[0][1]))/2;return a!=null&&e.clipExtent(a),e.scale(u*150).translate([y,w])}function JD(e,t,n){return WI(e,[[0,0],t],n)}var n2=16,QD=Gr(30*Zs);function r2(e,t){return+t?tR(e,t):$D(e)}function $D(e){return jI({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function tR(e,t){function n(r,i,a,h,u,y,w,S,I,P,z,R,Z,X){var et=w-r,B=S-i,q=et*et+B*B;if(q>4*t&&Z--){var Y=h+P,lt=u+z,dt=y+R,ut=Gf(Y*Y+lt*lt+dt*dt),ft=Nc(dt/=ut),_t=ji(ji(dt)-1)t||ji((et*Kt+B*bt)/q-.5)>.3||h*P+u*z+y*R2?bt[2]%360*Zs:0,yt()):[w*Su,S*Su,I*Su]},_t.precision=function(bt){return arguments.length?(dt=r2(Q,lt=bt*bt),Kt()):Gf(lt)},_t.fitExtent=function(bt,Ut){return WI(_t,bt,Ut)},_t.fitSize=function(bt,Ut){return JD(_t,bt,Ut)};function yt(){z=FI(P=zD(w,S,I),t);var bt=t(u,y);return a=r-bt[0]*n,h=i+bt[1]*n,Kt()}function Kt(){return ut=ft=null,_t}return function(){return t=e.apply(this,arguments),_t.invert=t.invert&&kt,yt()}}function HI(e){return function(t,n){var r=Gr(t),i=Gr(n),a=e(r*i);return[a*i*qr(t),a*qr(n)]}}function ZI(e){return function(t,n){var r=Gf(t*t+n*n),i=e(r),a=qr(i),h=Gr(i);return[Mf(t*a,r*h),Nc(r&&n*a/r)]}}var iR=HI(function(e){return Gf(2/(1+e))});iR.invert=ZI(function(e){return 2*Nc(e/2)});var XI=HI(function(e){return(e=zI(e))&&e/qr(e)});XI.invert=ZI(function(e){return e});function oR(){return nR(XI).scale(79.4188).clipAngle(180-.001)}function i2(e,t){return[e,t]}i2.invert=i2;function sR(e,t,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!e)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var a=[];switch(e.type){case"GeometryCollection":return uI(e,function(h){var u=Ig(h,t,r,i);u&&a.push(u)}),Y0(a);case"FeatureCollection":return Fw(e,function(h){var u=Ig(h,t,r,i);u&&Fw(u,function(y){y&&a.push(y)})}),Y0(a)}return Ig(e,t,r,i)}function Ig(e,t,n,r){var i=e.properties||{},a=e.type==="Feature"?e.geometry:e;if(a.type==="GeometryCollection"){var h=[];return uI(e,function(Z){var X=Ig(Z,t,n,r);X&&h.push(X)}),Y0(h)}var u=aR(a),y={type:a.type,coordinates:KI(a.coordinates,u)},w=new Wv,S=w.read(y),I=dD(mD(t,n),"meters"),P=_i.bufferOp(S,I,r),z=new vI;if(P=z.write(P),!YI(P.coordinates)){var R={type:P.type,coordinates:JI(P.coordinates,u)};return yy(R,i)}}function YI(e){return Array.isArray(e[0])?YI(e[0]):isNaN(e[0])}function KI(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return KI(n,t)})}function JI(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return JI(n,t)})}function aR(e){var t=yD(e).geometry.coordinates,n=[-t[0],-t[1]];return oR().rotate(n).scale(Fo)}function lR(e,t){var n=Xg(e),r=Xg(t),i=e.properties||{},a=iI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?sI(a[0],i):aI(a,i)}function o2(e){let t;for(const n of e)t&&n[0]-t[0]>=180?n[0]-=360:t&&n[0]-t[0]<-180&&(n[0]+=360),t=n}function s2(e,t){const n=lR({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const r=sR(e,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)o2(i);else for(const i of r.geometry.coordinates)for(const a of i)o2(a);t({type:"FeatureCollection",features:[r,n]})}let a2={type:"FeatureCollection",features:[]};function uR(e,t,n=!0,r=!0,i={},a={},h={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let u,y=[],w,S;function I(){(h!=null&&h.fill||h!=null&&h.line)&&e.addSource("full-geom",{type:"geojson",data:a2}),h!=null&&h.fill&&e.addLayer({...h==null?void 0:h.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),h!=null&&h.line&&e.addLayer({...h==null?void 0:h.line,id:"full-geom-line",type:"line",source:"full-geom"})}e.loaded()?I():e.once("load",()=>{I()});const P=R=>{u==null||u({type:"mapClick",coordinates:[R.lngLat.lng,R.lngLat.lat]})};function z(R=!1){if(!t)throw new Error;const Z=document.createElement("div");return R&&Z.classList.add("marker-interactive"),new F4({props:{displayIn:"maplibre"},target:Z}),new t.Marker({element:Z,offset:[1,-13]})}return{setEventHandler(R){R?(u=R,e.on("click",P)):(u=void 0,e.off("click",P))},flyTo(R,Z){e.flyTo({center:R,zoom:Z,...i})},fitBounds(R,Z,X){e.fitBounds([[R[0],R[1]],[R[2],R[3]]],{padding:Z,maxZoom:X,...a})},indicateReverse(R){e.getCanvasContainer().style.cursor=R?"crosshair":""},setReverseMarker(R){!t||!n||(S?R?S.setLngLat(R):(S.remove(),S=void 0):R&&(S=(typeof n=="object"?new t.Marker(n):z()).setLngLat(R).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(R,Z){if(!n)return;function X(et){var B;(B=e.getSource("full-geom"))==null||B.setData(et)}for(const et of y)et.remove();if(y.length=0,X(a2),!!t){if(Z){let et=!1;if(Z.geometry.type==="GeometryCollection"){const B=Z.geometry.geometries.filter(q=>q.type==="Polygon"||q.type==="MultiPolygon");if(B.length>0){let q=B.pop();for(const Y of B)q=gD(q,Y);s2({...Z,geometry:q},X),et=!0}else{const q=Z.geometry.geometries.filter(Y=>Y.type==="LineString"||Y.type==="MultiLineString");q.length>0&&(X({...Z,geometry:{type:"GeometryCollection",geometries:q}}),et=!0)}}if(!et){if(Z.geometry.type==="Polygon"||Z.geometry.type==="MultiPolygon")s2(Z,X);else if(Z.geometry.type==="LineString"||Z.geometry.type==="MultiLineString"){X(Z);return}}n&&y.push((typeof n=="object"?new t.Marker(n):z()).setLngLat(Z.center).addTo(e))}if(r)for(const et of R??[]){if(et===Z)continue;const B=(typeof r=="object"?new t.Marker(r):z(!0)).setLngLat(et.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(et.place_type[0]==="reverse"?et.place_name:et.place_name.replace(/,.*/,""))).addTo(e),q=B.getElement();q.addEventListener("click",Y=>{Y.stopPropagation(),u==null||u({type:"markerClick",id:et.id})}),q.addEventListener("mouseenter",()=>{u==null||u({type:"markerMouseEnter",id:et.id}),B.togglePopup()}),q.addEventListener("mouseleave",()=>{u==null||u({type:"markerMouseLeave",id:et.id}),B.togglePopup()}),y.push(B)}}},setSelectedMarker(R){w&&w.getElement().classList.toggle("marker-selected",!1),w=R>-1?y[R]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const R=e.getCenter();return[e.getZoom(),R.lng,R.lat]}}}function cR(e){let t,n;return{c(){t=ql("svg"),n=ql("path"),Zt(n,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),Zt(t,"viewBox","0 0 14 14"),Zt(t,"width","13"),Zt(t,"height","13"),Zt(t,"class","svelte-en2qvf")},m(r,i){Vt(r,t,i),Ot(t,n)},p:Se,i:Se,o:Se,d(r){r&&Bt(t)}}}class QI extends an{constructor(t){super(),sn(this,t,null,cR,He,{})}}function hR(e){let t,n;return{c(){t=ql("svg"),n=ql("path"),Zt(n,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),Zt(t,"viewBox","0 0 30 30"),Zt(t,"fill","none"),Zt(t,"xmlns","http://www.w3.org/2000/svg"),Zt(t,"class","svelte-d2loi5")},m(r,i){Vt(r,t,i),Ot(t,n)},p:Se,i:Se,o:Se,d(r){r&&Bt(t)}}}class $I extends an{constructor(t){super(),sn(this,t,null,hR,He,{})}}function fR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"area.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"area.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function pR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"reverse.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"reverse.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function dR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"poi.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"poi.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function mR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"postal_code.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"postal_code.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function gR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"street.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"street.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function yR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"road.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"road.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function _R(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"housenumber.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"housenumber.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function vR(e){let t,n,r,i;return{c(){t=jt("img"),wo(t.src,n=e[5])||Zt(t,"src",n),Zt(t,"alt",e[4]),Zt(t,"class","svelte-ltkwvy")},m(a,h){Vt(a,t,h),r||(i=Ye(t,"error",e[14]),r=!0)},p(a,h){h&32&&!wo(t.src,n=a[5])&&Zt(t,"src",n),h&16&&Zt(t,"alt",a[4])},d(a){a&&Bt(t),r=!1,i()}}}function l2(e){let t,n;return{c(){t=jt("span"),n=hn(e[6]),Zt(t,"class","secondary svelte-ltkwvy")},m(r,i){Vt(r,t,i),Ot(t,n)},p(r,i){i&64&&Nr(n,r[6])},d(r){r&&Bt(t)}}}function bR(e){var ut,ft;let t,n,r,i,a,h,u,y,w=(e[7]?e[0].place_name:e[0].place_name.replace(/,.*/,""))+"",S,I,P=e[2]==="always"||e[2]&&!e[0].address&&((ut=e[0].properties)==null?void 0:ut.kind)!=="road"&&((ft=e[0].properties)==null?void 0:ft.kind)!=="road_relation"&&!e[0].id.startsWith("address.")&&!e[0].id.startsWith("postal_code.")&&(!e[0].id.startsWith("poi.")||!e[5])&&!e[7],z,R,Z=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",X,et,B;function q(_t,kt){var Q,yt;return kt&1&&(n=null),kt&1&&(r=null),kt&1&&(i=null),_t[5]?vR:_t[0].address?_R:((Q=_t[0].properties)==null?void 0:Q.kind)==="road"||((yt=_t[0].properties)==null?void 0:yt.kind)==="road_relation"?yR:(n==null&&(n=!!_t[0].id.startsWith("address.")),n?gR:(r==null&&(r=!!_t[0].id.startsWith("postal_code.")),r?mR:(i==null&&(i=!!_t[0].id.startsWith("poi.")),i?dR:_t[7]?pR:fR)))}let Y=q(e,-1),lt=Y(e),dt=P&&l2(e);return{c(){t=jt("li"),lt.c(),a=fe(),h=jt("span"),u=jt("span"),y=jt("span"),S=hn(w),I=fe(),dt&&dt.c(),z=fe(),R=jt("span"),X=hn(Z),Zt(y,"class","primary svelte-ltkwvy"),Zt(u,"class","svelte-ltkwvy"),Zt(R,"class","line2 svelte-ltkwvy"),Zt(h,"class","texts svelte-ltkwvy"),Zt(t,"tabindex","0"),Zt(t,"data-selected",e[1]),Zt(t,"class","svelte-ltkwvy"),il(t,"selected",e[1])},m(_t,kt){Vt(_t,t,kt),lt.m(t,null),Ot(t,a),Ot(t,h),Ot(h,u),Ot(u,y),Ot(y,S),Ot(u,I),dt&&dt.m(u,null),Ot(h,z),Ot(h,R),Ot(R,X),et||(B=[Ye(t,"mouseenter",e[12]),Ye(t,"focus",e[13])],et=!0)},p(_t,[kt]){var Q,yt;Y===(Y=q(_t,kt))&<?lt.p(_t,kt):(lt.d(1),lt=Y(_t),lt&&(lt.c(),lt.m(t,a))),kt&1&&w!==(w=(_t[7]?_t[0].place_name:_t[0].place_name.replace(/,.*/,""))+"")&&Nr(S,w),kt&37&&(P=_t[2]==="always"||_t[2]&&!_t[0].address&&((Q=_t[0].properties)==null?void 0:Q.kind)!=="road"&&((yt=_t[0].properties)==null?void 0:yt.kind)!=="road_relation"&&!_t[0].id.startsWith("address.")&&!_t[0].id.startsWith("postal_code.")&&(!_t[0].id.startsWith("poi.")||!_t[5])&&!_t[7]),P?dt?dt.p(_t,kt):(dt=l2(_t),dt.c(),dt.m(u,null)):dt&&(dt.d(1),dt=null),kt&1&&Z!==(Z=(_t[7]?"":_t[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Nr(X,Z),kt&2&&Zt(t,"data-selected",_t[1]),kt&2&&il(t,"selected",_t[1])},i:Se,o:Se,d(_t){_t&&Bt(t),lt.d(),dt&&dt.d(),et=!1,Ri(B)}}}function xR(e,t,n){var q;let r,i,{feature:a}=t,{selected:h=!1}=t,{showPlaceType:u}=t,{missingIconsCache:y}=t,{iconsBaseUrl:w}=t;const S=(q=a.properties)==null?void 0:q.categories;let I,P,z=0,R=a.place_type[0]==="reverse";function Z(Y){P&&y.add(P),n(10,z++,z)}function X(Y){En.call(this,e,Y)}function et(Y){En.call(this,e,Y)}const B=Y=>Z(Y.currentTarget);return e.$$set=Y=>{"feature"in Y&&n(0,a=Y.feature),"selected"in Y&&n(1,h=Y.selected),"showPlaceType"in Y&&n(2,u=Y.showPlaceType),"missingIconsCache"in Y&&n(9,y=Y.missingIconsCache),"iconsBaseUrl"in Y&&n(3,w=Y.iconsBaseUrl)},e.$$.update=()=>{var Y,lt,dt,ut;if(e.$$.dirty&3640)do n(11,r--,r),n(4,I=S==null?void 0:S[r]),n(5,P=I?w+I.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!P||y.has(P)));e.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?(lt=(Y=a.properties)==null?void 0:Y.categories)==null?void 0:lt.join(", "):((ut=(dt=a.properties)==null?void 0:dt.place_type_name)==null?void 0:ut[0])??a.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[a,h,u,w,I,P,i,R,Z,y,z,r,X,et,B]}class wR extends an{constructor(t){super(),sn(this,t,xR,bR,He,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function SR(e){let t;return{c(){t=jt("div"),t.innerHTML='',Zt(t,"class","svelte-7cmwmc")},m(n,r){Vt(n,t,r)},p:Se,i:Se,o:Se,d(n){n&&Bt(t)}}}class ER extends an{constructor(t){super(),sn(this,t,null,SR,He,{})}}function IR(e){let t,n;return{c(){t=ql("svg"),n=ql("path"),Zt(n,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),Zt(t,"viewBox","0 0 60.006 21.412"),Zt(t,"width","14"),Zt(t,"height","20"),Zt(t,"class","svelte-en2qvf")},m(r,i){Vt(r,t,i),Ot(t,n)},p:Se,i:Se,o:Se,d(r){r&&Bt(t)}}}class CR extends an{constructor(t){super(),sn(this,t,null,IR,He,{})}}function TR(e){let t,n,r;return{c(){t=ql("svg"),n=ql("circle"),r=ql("path"),Zt(n,"cx","4.789"),Zt(n,"cy","4.787"),Zt(n,"r","3.85"),Ui(n,"stroke-width","1.875"),Ui(n,"fill","none"),Zt(r,"d","M12.063 12.063 7.635 7.635"),Ui(r,"stroke-width","1.875"),Ui(r,"stroke-linecap","round"),Zt(t,"xmlns","http://www.w3.org/2000/svg"),Zt(t,"width","13"),Zt(t,"height","13"),Zt(t,"viewBox","0 0 13 13"),Zt(t,"class","svelte-1bpbt60")},m(i,a){Vt(i,t,a),Ot(t,n),Ot(t,r)},p:Se,i:Se,o:Se,d(i){i&&Bt(t)}}}class LR extends an{constructor(t){super(),sn(this,t,null,TR,He,{})}}function PR(e,t,n){const r=t[1],i=t[0],a=r-i;return e===r&&n?e:((e-i)%a+a)%a+i}function u2(e){const t=[...e];return t[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!Jp.coords)break t;return Jp.coords}let a;try{return a=await new Promise((h,u)=>{n.signal.addEventListener("abort",()=>{u(Error("aborted"))}),navigator.geolocation.getCurrentPosition(y=>{h([y.coords.longitude,y.coords.latitude].map(w=>w.toFixed(6)).join(","))},y=>{u(y)},i)}),a}catch{}finally{i.cachedLocationExpiry&&(Jp={time:Date.now(),coords:a})}if(n.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const c2=/(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?/i,h2=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?/i,f2=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?/i,p2=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?/i;function AR(e){if(!["DMS","DM","DD"].includes(e))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(e=="DD")return this.decimalCoordinates;const t=this.decimalCoordinates.split(",").map(h=>Number(h.trim()));let n=d2(t[0],e),r=d2(t[1],e);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const i=t[0]>=0?" N":" S",a=t[1]>=0?" E":" W";return`${n+i}, ${r+a}`}else throw new Error("no decimal coordinates to convert")}function d2(e,t){const n=Math.abs(e),r=Math.floor(n),i=(n-r)*60;if(t=="DM"){let u=kR(i,3).toFixed(3).padStart(6,"0");return`${r}° ${u}'`}let a=Math.floor(i),h=((i-a)*60).toFixed(1).padStart(4,"0");return a=a.toString().padStart(2,"0"),`${r}° ${a}' ${h}"`}function kR(e,t){const n=Math.pow(10,t);return Math.round((e+Number.EPSILON)*n)/n}function t1(e,t){t||(t=5),e=e.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",h=[],u=!1;if(c2.test(e))if(h=c2.exec(e),u=hg(h),u){if(n=h[2],r=h[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");h[1]?(i=h[1],a=h[5]):h[4]&&(i=h[4],a=h[8])}else throw new Error("invalid decimal coordinate format");else if(h2.test(e))if(h=h2.exec(e),u=hg(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6].replace(",",".")/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[9])),h[11]&&(r+=h[11]/60),h[13]&&(r+=h[13].replace(",",".")/3600),parseInt(h[9])<0&&(r=-1*r),h[1]?(i=h[1],a=h[8]):h[7]&&(i=h[7],a=h[14]);else throw new Error("invalid DMS coordinates format");else if(f2.test(e))if(h=f2.exec(e),u=hg(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(i=h[1],a=h[9]):h[8]&&(i=h[8],a=h[16]);else throw new Error("invalid DMS coordinates format");else if(p2.test(e))if(h=p2.exec(e),u=hg(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(i=h[1],a=h[9]):h[8]&&(i=h[8],a=h[16]);else throw new Error("invalid coordinates format");if(u){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||a)&&(!i||!a))throw new Error("invalid coordinates format");if(i&&i==a)throw new Error("invalid coordinates format");let y=/S|SOUTH/i;y.test(i)&&n>0&&(n=-1*n),y=/W|WEST/i,y.test(a)&&r>0&&(r=-1*r);const w=h[0].trim();let S,I;const P=/[,/;\u0020]/g,z=w.match(P);if(z==null){const X=Math.floor(e.length/2);S=w.substring(0,X).trim(),I=w.substring(X).trim()}else{let X;z.length%2==1?X=Math.floor(z.length/2):X=z.length/2-1;let et=0;if(X==0)et=w.indexOf(z[0]),S=w.substring(0,et).trim(),I=w.substring(et+1).trim();else{let B=0,q=0;for(;B<=X;)et=w.indexOf(z[B],q),q=et+1,B++;S=w.substring(0,et).trim(),I=w.substring(et+1).trim()}}const R=S.split(".");if(R.length==2&&R[1]==0&&R[1].length!=2)throw new Error("invalid coordinates format");const Z=I.split(".");if(Z.length==2&&Z[1]==0&&Z[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(I))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(t)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(t)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:S,verbatimLongitude:I,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:DR,toCoordinateFormat:AR})}else throw new Error("coordinates pattern match failed")}function hg(e){if(!isNaN(e[0]))return!1;const t=[...e];if(t.shift(),t.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,i=t.length/2;for(let a=0;a{t.decimalLatitude?e.push(t):e.push({...t,...OR})}),[...e,...zR,...FR]}const VR=BR();t1.formats=VR.map(e=>e.verbatimCoordinates);const UR=t1;function g2(e,t,n){const r=e.slice();return r[81]=t[n],r[83]=n,r}function y2(e){let t,n;return t=new ER({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function _2(e){let t,n,r,i,a;return n=new CR({}),{c(){t=jt("button"),_e(n.$$.fragment),Zt(t,"type","button"),Zt(t,"title",e[9]),Zt(t,"class","svelte-zh3kmv"),il(t,"active",e[0])},m(h,u){Vt(h,t,u),de(n,t,null),r=!0,i||(a=Ye(t,"click",e[67]),i=!0)},p(h,u){(!r||u[0]&512)&&Zt(t,"title",h[9]),(!r||u[0]&1)&&il(t,"active",h[0])},i(h){r||(It(n.$$.fragment,h),r=!0)},o(h){Mt(n.$$.fragment,h),r=!1},d(h){h&&Bt(t),me(n),i=!1,a()}}}function GR(e){let t,n=[],r=new Map,i,a,h,u=ti(e[14]);const y=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{ut=null}),Bn()),(!q||Ut[0]&2)&&il(w,"displayable",bt[1]!==""),bt[5]===!0?ft?(ft.p(bt,Ut),Ut[0]&32&&It(ft,1)):(ft=_2(bt),ft.c(),It(ft,1),ft.m(r,R)):ft&&(Fn(),Mt(ft,1,1,()=>{ft=null}),Bn()),kt&&kt.p&&(!q||Ut[1]&134217728)&&Si(kt,_t,bt,bt[58],q?wi(_t,bt[58],Ut,null):Ei(bt[58]),null);let ee=X;X=Kt(bt),X===ee?~X&&yt[X].p(bt,Ut):(et&&(Fn(),Mt(yt[ee],1,1,()=>{yt[ee]=null}),Bn()),~X?(et=yt[X],et?et.p(bt,Ut):(et=yt[X]=Q[X](bt),et.c()),It(et,1),et.m(n,null)):et=null),(!q||Ut[0]&4&&B!==(B=Pg(bt[2])+" svelte-zh3kmv"))&&Zt(n,"class",B),(!q||Ut[0]&22)&&il(n,"can-collapse",bt[4]&&bt[1]==="")},i(bt){q||(It(dt),It(a.$$.fragment,bt),It(I.$$.fragment,bt),It(ut),It(ft),It(kt,bt),It(et),q=!0)},o(bt){Mt(dt),Mt(a.$$.fragment,bt),Mt(I.$$.fragment,bt),Mt(ut),Mt(ft),Mt(kt,bt),Mt(et),q=!1},d(bt){bt&&(Bt(t),Bt(n)),me(a),e[61](null),me(I),ut&&ut.d(),ft&&ft.d(),kt&&kt.d(bt),~X&&yt[X].d(),Y=!1,Ri(lt)}}}function ZR(e,t,n){let r,{$$slots:i={},$$scope:a}=t,{class:h=void 0}=t,{apiKey:u}=t,{bbox:y=void 0}=t,{clearButtonTitle:w="clear"}=t,{clearOnBlur:S=!1}=t,{collapsed:I=!1}=t,{country:P=void 0}=t,{debounceSearch:z=200}=t,{enableReverse:R=!1}=t,{errorMessage:Z="Something went wrong…"}=t,{filter:X=()=>!0}=t,{flyTo:et=!0}=t,{fuzzyMatch:B=!0}=t,{language:q=void 0}=t,{limit:Y=void 0}=t,{mapController:lt=void 0}=t,{minLength:dt=2}=t,{noResultsMessage:ut="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=t,{placeholder:ft="Search"}=t,{proximity:_t=[{type:"server-geolocation"}]}=t,{reverseActive:kt=R==="always"}=t,{reverseButtonTitle:Q="toggle reverse geocoding"}=t,{searchValue:yt=""}=t,{showFullGeometry:Kt=!0}=t,{showPlaceType:bt="ifNeeded"}=t,{showResultsWhileTyping:Ut=!0}=t,{selectFirst:ee=!0}=t,{flyToSelected:Gt=!1}=t,{markerOnSelected:Re=!0}=t,{types:xe=void 0}=t,{excludeTypes:ln=!1}=t,{zoom:Ve=16}=t,{maxZoom:Pe=18}=t,{apiUrl:un="https://api.maptiler.com/geocoding"}=t,{fetchParameters:Cn={}}=t,{iconsBaseUrl:mn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=t,{adjustUrlQuery:gn=J=>{}}=t;function An(){At.focus()}function vr(){At.blur()}function Pr(J,wt=!0){n(1,yt=J),wt?(n(15,Ze=-1),vl()):(Hr(),setTimeout(()=>{At.focus(),At.select()}))}function br(){n(14,mt=void 0),n(55,Ie=void 0),n(15,Ze=-1)}function hr(){n(54,Ct=[]),n(55,Ie=void 0)}let Qt=!1,mt,Ct,Ie,kn="",At,Ze=-1,Mr,on=[],Kn,Lo,ps,Os;const Ba=new Set,Li=Uu();as(()=>{lt&&(lt.setEventHandler(void 0),lt.indicateReverse(!1),lt.setSelectedMarker(-1),lt.setMarkers(void 0,void 0))});function vl(J){if(Lo&&(clearTimeout(Lo),Lo=void 0),Ze>-1&&mt)n(55,Ie=mt[Ze]),n(1,yt=Ie.place_type[0]==="reverse"?Ie.place_name:Ie.place_name.replace(/,.*/,"")),n(18,Mr=void 0),n(54,Ct=void 0),n(15,Ze=-1);else if(yt){const wt=J||!ds(yt);re(yt,{exact:!0}).then(()=>{n(54,Ct=mt),n(55,Ie=void 0),wt&&Ko()}).catch(pt=>n(18,Mr=pt))}}function ds(J){try{return UR(J,6)}catch{return!1}}async function re(J,{byId:wt=!1,exact:pt=!1}={}){n(18,Mr=void 0),Kn==null||Kn.abort();const Tt=new AbortController;n(19,Kn=Tt);try{const zt=ds(J),Wt=new URLSearchParams;if(q!==void 0&&Wt.set("language",Array.isArray(q)?q.join(","):q??""),xe&&Wt.set("types",xe.join(",")),ln&&Wt.set("excludeTypes",String(ln)),y&&Wt.set("bbox",y.map(Ge=>Ge.toFixed(6)).join(",")),P&&Wt.set("country",Array.isArray(P)?P.join(","):P),!wt&&!zt){const Ge=await MR(lt,_t,Tt);Ge&&Wt.set("proximity",Ge),(pt||!Ut)&&Wt.set("autocomplete","false"),Wt.set("fuzzyMatch",String(B))}Y!==void 0&&(!zt||(xe==null?void 0:xe.length)===1)&&Wt.set("limit",String(Y)),Wt.set("key",u),gn(Wt);const Xt=un+"/"+encodeURIComponent(zt?zt.decimalLongitude+","+zt.decimalLatitude:J)+".json?"+Wt.toString();if(Xt===kn){wt?(n(14,mt=void 0),n(55,Ie=on[0])):n(14,mt=on);return}kn=Xt;const Te=await fetch(Xt,{signal:Tt.signal,...Cn});if(!Te.ok)throw new Error(await Te.text());const Ae=await Te.json();Li("response",{url:Xt,featureCollection:Ae}),wt?(n(14,mt=void 0),n(55,Ie=Ae.features[0]),on=[Ie]):(n(14,mt=Ae.features.filter(X)),zt&&mt.unshift({type:"Feature",properties:{},id:"reverse_"+zt.decimalLongitude+"_"+zt.decimalLatitude,text:zt.decimalLatitude+", "+zt.decimalLongitude,place_name:zt.decimalLatitude+", "+zt.decimalLongitude,place_type:["reverse"],center:[zt.decimalLongitude,zt.decimalLatitude],bbox:[zt.decimalLongitude,zt.decimalLatitude,zt.decimalLongitude,zt.decimalLatitude],geometry:{type:"Point",coordinates:[zt.decimalLongitude,zt.decimalLatitude]}}),on=mt,zt&&At.focus())}catch(zt){if(zt&&typeof zt=="object"&&"name"in zt&&zt.name==="AbortError")return;throw zt}finally{Tt===Kn&&n(19,Kn=void 0)}}function Ko(){var pt;if(!(Ct!=null&&Ct.length)||!et)return;const J=[180,90,-180,-90],wt=!Ct.some(Tt=>!Tt.matching_text);for(const Tt of Ct)if(wt||!Tt.matching_text)for(const zt of[0,1,2,3])J[zt]=Math[zt<2?"min":"max"](J[zt],((pt=Tt.bbox)==null?void 0:pt[zt])??Tt.center[zt%2]);lt&&Ct.length>0&&(Ie&&J[0]===J[2]&&J[1]===J[3]?lt.flyTo(Ie.center,Ve):lt.fitBounds(u2(J),50,Pe))}function Ki(J){n(0,kt=R==="always"),n(14,mt=void 0),n(55,Ie=void 0),n(15,Ze=-1),Pr(J[1].toFixed(6)+", "+PR(J[0],[-180,180],!0).toFixed(6),!1)}function bl(J){if(!mt)return;let wt=J.key==="ArrowDown"?1:J.key==="ArrowUp"?-1:0;wt&&(Ze===(ee?0:-1)&&wt===-1&&n(15,Ze=mt.length),n(15,Ze+=wt),Ze>=mt.length&&n(15,Ze=-1),Ze<0&&ee&&n(15,Ze=0),J.preventDefault())}function Hr(J=!0){if(n(18,Mr=void 0),Ut){if(Lo&&clearTimeout(Lo),yt.length{re(wt).catch(pt=>n(18,Mr=pt))},J?z:0)}else n(14,mt=void 0),n(18,Mr=void 0)}function ae(J){n(55,Ie=J),n(1,yt=J.place_name),n(15,Ze=-1)}const Qe=()=>At.focus();function Ke(J){rr[J?"unshift":"push"](()=>{At=J,n(17,At)})}function Ar(){yt=this.value,n(1,yt),n(13,Qt),n(27,S)}const Jo=()=>n(13,Qt=!0),Xe=()=>n(13,Qt=!1),ma=()=>Hr(),zr=()=>{n(1,yt=""),At.focus()},st=()=>n(0,kt=!kt),V=()=>n(18,Mr=void 0),G=J=>n(15,Ze=J),K=J=>ae(J),nt=()=>{ee||n(15,Ze=-1)},xt=()=>{};return e.$$set=J=>{"class"in J&&n(2,h=J.class),"apiKey"in J&&n(25,u=J.apiKey),"bbox"in J&&n(26,y=J.bbox),"clearButtonTitle"in J&&n(3,w=J.clearButtonTitle),"clearOnBlur"in J&&n(27,S=J.clearOnBlur),"collapsed"in J&&n(4,I=J.collapsed),"country"in J&&n(28,P=J.country),"debounceSearch"in J&&n(29,z=J.debounceSearch),"enableReverse"in J&&n(5,R=J.enableReverse),"errorMessage"in J&&n(6,Z=J.errorMessage),"filter"in J&&n(30,X=J.filter),"flyTo"in J&&n(31,et=J.flyTo),"fuzzyMatch"in J&&n(32,B=J.fuzzyMatch),"language"in J&&n(33,q=J.language),"limit"in J&&n(34,Y=J.limit),"mapController"in J&&n(35,lt=J.mapController),"minLength"in J&&n(36,dt=J.minLength),"noResultsMessage"in J&&n(7,ut=J.noResultsMessage),"placeholder"in J&&n(8,ft=J.placeholder),"proximity"in J&&n(37,_t=J.proximity),"reverseActive"in J&&n(0,kt=J.reverseActive),"reverseButtonTitle"in J&&n(9,Q=J.reverseButtonTitle),"searchValue"in J&&n(1,yt=J.searchValue),"showFullGeometry"in J&&n(38,Kt=J.showFullGeometry),"showPlaceType"in J&&n(10,bt=J.showPlaceType),"showResultsWhileTyping"in J&&n(39,Ut=J.showResultsWhileTyping),"selectFirst"in J&&n(11,ee=J.selectFirst),"flyToSelected"in J&&n(40,Gt=J.flyToSelected),"markerOnSelected"in J&&n(41,Re=J.markerOnSelected),"types"in J&&n(42,xe=J.types),"excludeTypes"in J&&n(43,ln=J.excludeTypes),"zoom"in J&&n(44,Ve=J.zoom),"maxZoom"in J&&n(45,Pe=J.maxZoom),"apiUrl"in J&&n(46,un=J.apiUrl),"fetchParameters"in J&&n(47,Cn=J.fetchParameters),"iconsBaseUrl"in J&&n(12,mn=J.iconsBaseUrl),"adjustUrlQuery"in J&&n(48,gn=J.adjustUrlQuery),"$$scope"in J&&n(58,a=J.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,ps=Qt),S&&!Qt&&n(1,yt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&yt.lengthn(18,Mr=J)),e.$$.dirty[1]&50356241&&(lt&&Ie&&Ie.id!==Os&&et&&(!Ie.bbox||Ie.bbox[0]===Ie.bbox[2]&&Ie.bbox[1]===Ie.bbox[3]?lt.flyTo(Ie.center,Ie.id.startsWith("poi.")||Ie.id.startsWith("address.")?Pe:Ve):lt.fitBounds(u2(Ie.bbox),50,Pe),n(14,mt=void 0),n(54,Ct=void 0),n(15,Ze=-1)),n(56,Os=Ie==null?void 0:Ie.id)),e.$$.dirty[0]&18432&&ee&&mt!=null&&mt.length&&n(15,Ze=0),e.$$.dirty[0]&2050&&(ee||n(15,Ze=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&Ct!==mt&&n(54,Ct=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&<&<.setEventHandler(J=>{switch(J.type){case"mapClick":kt&&Ki(J.coordinates);break;case"markerClick":{const wt=mt==null?void 0:mt.find(pt=>pt.id===J.id);wt&&ae(wt)}break;case"markerMouseEnter":Ct&&n(15,Ze=ps?(mt==null?void 0:mt.findIndex(wt=>wt.id===J.id))??-1:-1);break;case"markerMouseLeave":Ct&&n(15,Ze=-1);break}}),e.$$.dirty[0]&49152&&n(57,r=mt==null?void 0:mt[Ze]),e.$$.dirty[1]&67133969&<&&r&&et&&Gt&<.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Pe:Ve),e.$$.dirty[1]&1040&&(Re||lt==null||lt.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&<&&Re&&!Ct&&(lt.setMarkers(r?[r]:void 0,void 0),lt.setSelectedMarker(r?0:-1)),e.$$.dirty[1]&25165840&<&<.setMarkers(Ct,Ie),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&Ct&<&<.setSelectedMarker(Ze),e.$$.dirty[0]&2|e.$$.dirty[1]&16&<){const J=ds(yt);lt.setReverseMarker(J?[J.decimalLongitude,J.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&Li("select",r),e.$$.dirty[1]&16777216&&Li("pick",Ie),e.$$.dirty[0]&81920&&Li("optionsVisibilityChange",ps&&!!mt),e.$$.dirty[0]&16384&&Li("featuresListed",mt),e.$$.dirty[1]&8388608&&Li("featuresMarked",Ct),e.$$.dirty[0]&1&&Li("reverseToggle",kt),e.$$.dirty[0]&2&&Li("queryChange",yt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&<&<.indicateReverse(kt)},[kt,yt,h,w,I,R,Z,ut,ft,Q,bt,ee,mn,Qt,mt,Ze,ps,At,Mr,Kn,Ba,vl,bl,Hr,ae,u,y,S,P,z,X,et,B,q,Y,lt,dt,_t,Kt,Ut,Gt,Re,xe,ln,Ve,Pe,un,Cn,gn,An,vr,Pr,br,hr,Ct,Ie,Os,r,a,i,Qe,Ke,Ar,Jo,Xe,ma,zr,st,V,G,K,nt,xt]}class XR extends an{constructor(t){super(),sn(this,t,ZR,HR,He,{class:2,apiKey:25,bbox:26,clearButtonTitle:3,clearOnBlur:27,collapsed:4,country:28,debounceSearch:29,enableReverse:5,errorMessage:6,filter:30,flyTo:31,fuzzyMatch:32,language:33,limit:34,mapController:35,minLength:36,noResultsMessage:7,placeholder:8,proximity:37,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:38,showPlaceType:10,showResultsWhileTyping:39,selectFirst:11,flyToSelected:40,markerOnSelected:41,types:42,excludeTypes:43,zoom:44,maxZoom:45,apiUrl:46,fetchParameters:47,iconsBaseUrl:12,adjustUrlQuery:48,focus:49,blur:50,setQuery:51,clearList:52,clearMap:53},null,[-1,-1,-1])}get focus(){return this.$$.ctx[49]}get blur(){return this.$$.ctx[50]}get setQuery(){return this.$$.ctx[51]}get clearList(){return this.$$.ctx[52]}get clearMap(){return this.$$.ctx[53]}}function b2(e){let t,n,r;return n=new XR({props:{mapController:e[1],apiKey:e[0]}}),{c(){t=jt("div"),_e(n.$$.fragment),Zt(t,"class","svelte-ixhnie")},m(i,a){Vt(i,t,a),de(n,t,null),r=!0},p(i,a){const h={};a&2&&(h.mapController=i[1]),a&1&&(h.apiKey=i[0]),n.$set(h)},i(i){r||(It(n.$$.fragment,i),r=!0)},o(i){Mt(n.$$.fragment,i),r=!1},d(i){i&&Bt(t),me(n)}}}function YR(e){let t,n,r=e[1]&&b2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&It(r,1)):(r=b2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),Mt(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){Mt(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function KR(e,t,n){let r,{apiKey:i}=t,{map:a}=t;return e.$$set=h=>{"apiKey"in h&&n(0,i=h.apiKey),"map"in h&&n(2,a=h.map)},e.$$.update=()=>{e.$$.dirty&4&&n(1,r=a?uR(a,Es):null)},[i,r,a]}class JR extends an{constructor(t){super(),sn(this,t,KR,YR,He,{apiKey:0,map:2})}}const Xh=[];function f0(e,t){return{subscribe:$r(e,t).subscribe}}function $r(e,t=Se){let n;const r=new Set;function i(u){if(He(e,u)&&(e=u,n)){const y=!Xh.length;for(const w of r)w[1](),Xh.push(w,e);if(y){for(let w=0;w{r.delete(w),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:h}}const QR=Symbol.for("svelte-maplibre");function $R(){return hv(QR)}function tN(e){return"layerType"in e&&e.layerType==="deckgl"}var Oc=eN;function eN(e){var t,n,r;if(e){if(Array.isArray(e)){for(t=[],n=e.length,r=0;r({features:e[0]&16,data:e[0]&16,map:e[0]&4,close:e[0]&1}),w2=e=>{var t;return{features:e[4],data:(t=e[4])==null?void 0:t[0],map:e[2],close:e[31]}};function S2(e){let t,n,r=(e[4]||e[3]instanceof Es.Marker)&&E2(e);return{c(){t=jt("div"),r&&r.c()},m(i,a){Vt(i,t,a),r&&r.m(t,null),e[32](t),n=!0},p(i,a){i[4]||i[3]instanceof Es.Marker?r?(r.p(i,a),a[0]&24&&It(r,1)):(r=E2(i),r.c(),It(r,1),r.m(t,null)):r&&(Fn(),Mt(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){Mt(r),n=!1},d(i){i&&Bt(t),r&&r.d(),e[32](null)}}}function E2(e){let t;const n=e[30].default,r=xi(n,e,e[29],w2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a[0]&536870933)&&Si(r,n,i,i[29],t?wi(n,i[29],a,iN):Ei(i[29]),w2)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function oN(e){let t,n,r=e[9].default&&S2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&It(r,1)):(r=S2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),Mt(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){Mt(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function sN(e,t,n){let r,i,a,h,u,y,{$$slots:w={},$$scope:S}=t;const I=LL(w);let{closeButton:P=void 0}=t,{closeOnClickOutside:z=!0}=t,{closeOnClickInside:R=!1}=t,{closeOnMove:Z=!1}=t,{openOn:X="click"}=t,{openIfTopMost:et=!0}=t,{focusAfterOpen:B=!0}=t,{anchor:q=void 0}=t,{offset:Y=void 0}=t,{popupClass:lt=void 0}=t,{maxWidth:dt=void 0}=t,{lngLat:ut=void 0}=t,{html:ft=void 0}=t,{open:_t=!1}=t;const kt=Uu(),{map:Q,popupTarget:yt,layerEvent:Kt,layer:bt,eventTopMost:Ut}=$R();qe(e,Q,Ct=>n(2,a=Ct)),qe(e,yt,Ct=>n(3,u=Ct)),qe(e,Kt,Ct=>n(28,h=Ct)),qe(e,bt,Ct=>n(35,y=Ct));const ee=["click","dblclick","contextmenu"];let Gt,Re=!1,xe;function ln(){if(!Gt)return;let Ct=Gt.getElement();!Ct||Ct===xe||(xe=Ct,X==="hover"&&(xe.style.pointerEvents="none"),xe.addEventListener("mouseenter",()=>{n(24,Re=!0)},{passive:!0}),xe.addEventListener("mouseleave",()=>{n(24,Re=!1)},{passive:!0}),xe.addEventListener("click",()=>{R&&n(0,_t=!1)},{passive:!0}))}Vu(()=>{if(a)return a.on("click",br),a.on("contextmenu",br),typeof u=="string"&&(a.on("click",u,Cn),a.on("dblclick",u,Cn),a.on("contextmenu",u,Cn),a.on("mousemove",u,Pr),a.on("mouseleave",u,vr),a.on("touchstart",u,gn),a.on("touchend",u,An)),()=>{a!=null&&a.loaded()&&(Gt==null||Gt.remove(),a.off("click",br),a.off("contextmenu",br),u instanceof Es.Marker?u.getPopup()===Gt&&u.setPopup(void 0):typeof u=="string"&&(a.off("click",u,Cn),a.off("dblclick",u,Cn),a.off("contextmenu",u,Cn),a.off("mousemove",u,Pr),a.off("mouseleave",u,vr),a.off("touchstart",u,gn),a.off("touchend",u,An)))}});function Ve(Ct){return et?!("marker"in Ct)&&!tN(Ct)&&Ut(Ct)!==y:!1}let Pe=null,un="normal";function Cn(Ct){Ct.type===X&&(Ve(Ct)||("layerType"in Ct?Ct.layerType==="deckgl"?(n(10,ut=Ct.coordinate),n(4,Pe=Ct.object?[Ct.object]:null)):(n(10,ut=Ct.lngLat),n(4,Pe=Ct.features??[])):(n(10,ut=Ct.lngLat),n(4,Pe=Ct.features??[])),setTimeout(()=>n(0,_t=!0))))}let mn=null;function gn(Ct){mn=Ct.point}function An(Ct){if(!mn||X!=="hover")return;let Ie=mn.dist(Ct.point);mn=null,Ie<3&&(n(10,ut=Ct.lngLat),n(4,Pe=Ct.features??[]),Gt.isOpen()?n(25,un="justOpened"):(n(25,un="opening"),n(0,_t=!0)))}function vr(Ct){X!=="hover"||mn||un!=="normal"||(n(0,_t=!1),n(4,Pe=null))}function Pr(Ct){if(!(X!=="hover"||mn||un!=="normal")){if(Ve(Ct)){n(0,_t=!1),n(4,Pe=null);return}n(0,_t=!0),n(4,Pe=Ct.features??[]),n(10,ut=Ct.lngLat)}}function br(Ct){if(un==="justOpened"){n(25,un="normal");return}if(!z)return;let Ie=[xe,u instanceof Es.Marker?u==null?void 0:u.getElement():null];_t&&Gt.isOpen()&&!Ie.some(kn=>kn==null?void 0:kn.contains(Ct.originalEvent.target))&&(Ct.type==="contextmenu"&&X==="contextmenu"||Ct.type!=="contextmenu")&&n(0,_t=!1)}as(()=>{a&&(Gt!=null&&Gt.isOpen())&&Gt.remove()});let hr;const Qt=()=>n(0,_t=!1);function mt(Ct){rr[Ct?"unshift":"push"](()=>{hr=Ct,n(1,hr)})}return e.$$set=Ct=>{"closeButton"in Ct&&n(11,P=Ct.closeButton),"closeOnClickOutside"in Ct&&n(12,z=Ct.closeOnClickOutside),"closeOnClickInside"in Ct&&n(13,R=Ct.closeOnClickInside),"closeOnMove"in Ct&&n(14,Z=Ct.closeOnMove),"openOn"in Ct&&n(15,X=Ct.openOn),"openIfTopMost"in Ct&&n(16,et=Ct.openIfTopMost),"focusAfterOpen"in Ct&&n(17,B=Ct.focusAfterOpen),"anchor"in Ct&&n(18,q=Ct.anchor),"offset"in Ct&&n(19,Y=Ct.offset),"popupClass"in Ct&&n(20,lt=Ct.popupClass),"maxWidth"in Ct&&n(21,dt=Ct.maxWidth),"lngLat"in Ct&&n(10,ut=Ct.lngLat),"html"in Ct&&n(22,ft=Ct.html),"open"in Ct&&n(0,_t=Ct.open),"$$scope"in Ct&&n(29,S=Ct.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,r=P??(!z&&!R)),e.$$.dirty[0]&146685952&&(Gt||(n(23,Gt=new Es.Popup({closeButton:r,closeOnClick:!1,closeOnMove:Z,focusAfterOpen:B,maxWidth:dt,className:lt,anchor:q,offset:Y})),xe=Gt.getElement(),Gt.on("open",()=>{n(0,_t=!0),ln(),kt("open",Gt)}),Gt.on("close",()=>{n(0,_t=!1),kt("close",Gt)}),Gt.on("hover",()=>{kt("hover",Gt)}))),e.$$.dirty[0]&8421384&&Gt&&u instanceof Es.Marker&&(X==="click"?u.setPopup(Gt):u.getPopup()===Gt&&u.setPopup(void 0)),e.$$.dirty[0]&268468224&&ee.includes(X)&&(h==null?void 0:h.type)===X&&(Cn(h),Jn(Kt,h=null,h)),e.$$.dirty[0]&268468224&&n(26,i=X==="hover"&&((h==null?void 0:h.type)==="mousemove"||(h==null?void 0:h.type)==="mouseenter")),e.$$.dirty[0]&352354304&&X==="hover"&&Kt&&(i&&h&&(h.layerType==="deckgl"?(n(10,ut=h.coordinate),n(4,Pe=h.object?[h.object]:null)):(n(10,ut=h.lngLat),n(4,Pe=h.features??[]))),n(0,_t=(i||Re)??!1)),e.$$.dirty[0]&12582914&&(hr?Gt.setDOMContent(hr):ft&&Gt.setHTML(ft)),e.$$.dirty[0]&8389632&&ut&&Gt.setLngLat(ut),e.$$.dirty[0]&41943045&&a){let Ct=Gt.isOpen();_t&&!Ct?(Gt.addTo(a),un==="opening"&&n(25,un="justOpened")):!_t&&Ct&&Gt.remove()}},[_t,hr,a,u,Pe,Q,yt,Kt,bt,I,ut,P,z,R,Z,X,et,B,q,Y,lt,dt,ft,Gt,Re,un,i,r,h,S,w,Qt,mt]}class aN extends an{constructor(t){super(),sn(this,t,sN,oN,He,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}var jd=Uint8Array,tC=Uint16Array,lN=Int32Array,uN=new jd([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cN=new jd([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),eC=function(e,t){for(var n=new tC(31),r=0;r<31;++r)n[r]=t+=1<>1|(Xn&21845)<<1,Ol=(Ol&52428)>>2|(Ol&13107)<<2,Ol=(Ol&61680)>>4|(Ol&3855)<<4,pN[Xn]=((Ol&65280)>>8|(Ol&255)<<8)>>1;var Ol,Xn,My=new jd(288);for(Xn=0;Xn<144;++Xn)My[Xn]=8;var Xn;for(Xn=144;Xn<256;++Xn)My[Xn]=9;var Xn;for(Xn=256;Xn<280;++Xn)My[Xn]=7;var Xn;for(Xn=280;Xn<288;++Xn)My[Xn]=8;var Xn,dN=new jd(32);for(Xn=0;Xn<32;++Xn)dN[Xn]=5;var Xn,mN=new jd(0),gN=typeof TextDecoder<"u"&&new TextDecoder,yN=0;try{gN.decode(mN,{stream:!0}),yN=1}catch{}const _N=e=>({props:e&8}),I2=e=>({props:xN(e[3])});function vN(e){let t;const n=e[1].default,r=xi(n,e,e[2],I2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&12)&&Si(r,n,i,i[2],t?wi(n,i[2],a,_N):Ei(i[2]),I2)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function bN(e){let t,n;return t=new aN({props:{openOn:e[0],$$slots:{default:[vN,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.openOn=r[0]),i&12&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function xN(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function wN(e,t,n){let{$$slots:r={},$$scope:i}=t,{openOn:a="hover"}=t;return e.$$set=h=>{"openOn"in h&&n(0,a=h.openOn),"$$scope"in h&&n(2,i=h.$$scope)},[a,r,i]}class Wd extends an{constructor(t){super(),sn(this,t,wN,bN,He,{openOn:0})}}const SN=["==",["geometry-type"],"Polygon"],EN=["==",["geometry-type"],"LineString"];function n1(e,t,n){let r=["match",e];for(let[i,a]of Object.entries(t))r.push(i),r.push(a);return r.push(n),r}function C2(e,t,n){let r=["step",e];for(let i=1;i{var h;let r=t.get(n.originalEvent);if(r!==void 0)return r;let a=(h=n.target.queryRenderedFeatures(n.point).find(u=>{var y;return(y=e.get(u.layer.id))==null?void 0:y.interactive}))==null?void 0:h.layer.id;return t.set(n.originalEvent,a),a}}function TN(){let e=new Map;return cv(r1,{map:$r(null),source:f0(null),layer:f0(null),popupTarget:f0(null),cluster:$r(),loadedImages:$r(new Set),minzoom:$r(0),maxzoom:$r(24),layerEvent:$r(null),layerInfo:e,eventTopMost:CN(e)})}function T2(e){return{subscribe:e.subscribe}}function i1({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=qf(),a=$r(null),h=T2(a),u={...i,[e]:T2(a)};if(t&&(u.popupTarget=h),r){let y=$r(null);u.layerEvent=y,i.layerEvent=y}return n&&(u.cluster=$r()),cv(r1,u),{...i,self:a}}function LN(){return i1({key:"source",setCluster:!0})}function PN(e=!0){return i1({key:"layer",setPopupTarget:e,setMouseEvent:e})}function MN(){return i1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function L2(e){let t;return n=>{if(n)for(let r in n){let i=t==null?void 0:t[r],a=n[r];i!==a&&e(r,a,i)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function AN(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function kN(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function Ay(e,t){return["case",["boolean",["feature-state","hover"],!1],t,e]}function P2(e){let t=e[0],n,r,i=M2(e);return{c(){i.c(),n=di()},m(a,h){i.m(a,h),Vt(a,n,h),r=!0},p(a,h){h[0]&1&&He(t,t=a[0])?(Fn(),Mt(i,1,1,Se),Bn(),i=M2(a),i.c(),It(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(It(i),r=!0)},o(a){Mt(i),r=!1},d(a){a&&Bt(n),i.d(a)}}}function M2(e){let t;const n=e[36].default,r=xi(n,e,e[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a[1]&16)&&Si(r,n,i,i[35],t?wi(n,i[35],a,null):Ei(i[35]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function DN(e){let t,n,r=e[0]&&P2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&It(r,1)):(r=P2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),Mt(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){Mt(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function RN(e,t,n){let r,i,a,h,u,y,w,S,I,P,z,R,{$$slots:Z={},$$scope:X}=t,{id:et=Hd("layer")}=t,{source:B=void 0}=t,{sourceLayer:q=void 0}=t,{beforeId:Y=void 0}=t,{beforeLayerType:lt=void 0}=t,{type:dt}=t,{paint:ut=void 0}=t,{layout:ft=void 0}=t,{filter:_t=void 0}=t,{applyToClusters:kt=void 0}=t,{minzoom:Q=void 0}=t,{maxzoom:yt=void 0}=t,{manageHoverState:Kt=!1}=t,{hovered:bt=null}=t,{interactive:Ut=!0}=t,{hoverCursor:ee=void 0}=t,{eventsIfTopMost:Gt=!1}=t;const Re=Uu(),{map:xe,source:ln,self:Ve,minzoom:Pe,maxzoom:un,eventTopMost:Cn,layerInfo:mn}=PN();qe(e,xe,mt=>n(31,I=mt)),qe(e,ln,mt=>n(32,P=mt)),qe(e,Ve,mt=>n(0,S=mt)),qe(e,Pe,mt=>n(34,R=mt)),qe(e,un,mt=>n(33,z=mt)),as(()=>{S&&I&&(mn.delete(S),I==null||I.removeLayer(S))});let gn;function An(mt){var At,Ze;if(!Ut||!S||!I||Gt&&Cn(mt)!==S)return;let Ct=mt.features??[],Ie=(Ze=(At=Ct[0])==null?void 0:At.properties)==null?void 0:Ze.cluster_id,kn={event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct};Re(mt.type,kn)}function vr(mt){var At,Ze;if(!Ut||!S||!I||Gt&&Cn(mt)!==S)return;ee&&(I.getCanvas().style.cursor=ee);let Ct=mt.features??[];n(6,bt=Ct[0]??null);let Ie=(Ze=(At=Ct[0])==null?void 0:At.properties)==null?void 0:Ze.cluster_id;Re("mouseenter",{event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct})}function Pr(mt){var At,Ze,Mr;if(!Ut||!I)return;if(Gt&&Cn(mt)!==S){n(6,bt=null),Kt&&gn!==void 0&&(I==null||I.setFeatureState({source:u,sourceLayer:q,id:gn},{hover:!1}),gn=void 0);return}I.getCanvas().style.cursor=ee;let Ct=mt.features??[],Ie=(Ze=(At=Ct[0])==null?void 0:At.properties)==null?void 0:Ze.cluster_id,kn=(Mr=Ct[0])==null?void 0:Mr.id;kn!==gn&&(Kt&&(gn!==void 0&&(I==null||I.setFeatureState({source:u,id:gn,sourceLayer:q},{hover:!1})),I==null||I.setFeatureState({source:u,id:kn,sourceLayer:q},{hover:!0})),gn=kn,n(6,bt=Ct[0]??null)),Re("mousemove",{event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct})}function br(mt){if(!(!Ut||!S||!I)){if(ee&&(I.getCanvas().style.cursor=""),n(6,bt=null),Kt&&gn!==void 0){const Ct={source:u,id:gn,sourceLayer:q};I==null||I.setFeatureState(Ct,{hover:!1}),gn=void 0}Re("mouseleave",{map:I,layer:S,source:u})}}let hr=!0;function Qt(mt){I&&(I.off("click",mt,An),I.off("dblclick",mt,An),I.off("contextmenu",mt,An),I.off("mouseenter",mt,vr),I.off("mousemove",mt,Pr),I.off("mouseleave",mt,br))}return as(()=>{I&&S&&Qt(S)}),e.$$set=mt=>{"id"in mt&&n(7,et=mt.id),"source"in mt&&n(8,B=mt.source),"sourceLayer"in mt&&n(9,q=mt.sourceLayer),"beforeId"in mt&&n(10,Y=mt.beforeId),"beforeLayerType"in mt&&n(11,lt=mt.beforeLayerType),"type"in mt&&n(12,dt=mt.type),"paint"in mt&&n(13,ut=mt.paint),"layout"in mt&&n(14,ft=mt.layout),"filter"in mt&&n(15,_t=mt.filter),"applyToClusters"in mt&&n(16,kt=mt.applyToClusters),"minzoom"in mt&&n(17,Q=mt.minzoom),"maxzoom"in mt&&n(18,yt=mt.maxzoom),"manageHoverState"in mt&&n(19,Kt=mt.manageHoverState),"hovered"in mt&&n(6,bt=mt.hovered),"interactive"in mt&&n(20,Ut=mt.interactive),"hoverCursor"in mt&&n(21,ee=mt.hoverCursor),"eventsIfTopMost"in mt&&n(22,Gt=mt.eventsIfTopMost),"$$scope"in mt&&n(35,X=mt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=kN(kt)),e.$$.dirty[0]&1073774592&&n(24,i=AN("all",r,_t)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,a=Q??R),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=yt??z),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=B||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&I&&S!==et&&u){S&&(Qt(S),mn.delete(S));let mt=Y;if(!Y&<){let Ct=I.getStyle().layers,Ie=typeof lt=="function"?lt:At=>At.type===lt,kn=Ct==null?void 0:Ct.find(Ie);kn&&(mt=kn.id)}Jn(Ve,S=et,S),I.addLayer(Oc({id:S,type:dt,source:u,"source-layer":q,filter:i,paint:ut,layout:ft,minzoom:a,maxzoom:h}),mt),n(23,hr=!0),I.on("click",S,An),I.on("dblclick",S,An),I.on("contextmenu",S,An),I.on("mouseenter",S,vr),I.on("mousemove",S,Pr),I.on("mouseleave",S,br)}e.$$.dirty[0]&1048577&&S&&mn.set(S,{interactive:Ut}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,y=S?L2((mt,Ct)=>I==null?void 0:I.setPaintProperty(S,mt,Ct)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?L2((mt,Ct)=>I==null?void 0:I.setLayoutProperty(S,mt,Ct)):void 0),e.$$.dirty[0]&268443648&&(y==null||y(ut)),e.$$.dirty[0]&134234112&&(w==null||w(ft)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(hr?n(23,hr=!1):I==null||I.setFilter(S,i))},[S,xe,ln,Ve,Pe,un,bt,et,B,q,Y,lt,dt,ut,ft,_t,kt,Q,yt,Kt,Ut,ee,Gt,hr,i,h,a,w,y,u,r,I,P,z,R,X,Z]}let o1=class extends an{constructor(t){super(),sn(this,t,RN,DN,He,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}};function NN(e){let t;const n=e[16].default,r=xi(n,e,e[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16777216)&&Si(r,n,i,i[24],t?wi(n,i[24],a,null):Ei(i[24]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function ON(e){let t,n,r;function i(h){e[17](h)}let a={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[NN]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new o1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.applyToClusters=h[9]),u&1024&&(y.minzoom=h[10]),u&2048&&(y.maxzoom=h[11]),u&4096&&(y.hoverCursor=h[12]),u&8192&&(y.manageHoverState=h[13]),u&16384&&(y.eventsIfTopMost=h[14]),u&32768&&(y.interactive=h[15]),u&16777216&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function zN(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Hd("circle")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{applyToClusters:z=void 0}=t,{minzoom:R=void 0}=t,{maxzoom:Z=void 0}=t,{hoverCursor:X=void 0}=t,{manageHoverState:et=!1}=t,{hovered:B=null}=t,{eventsIfTopMost:q=!1}=t,{interactive:Y=!0}=t;function lt(yt){B=yt,n(0,B)}function dt(yt){En.call(this,e,yt)}function ut(yt){En.call(this,e,yt)}function ft(yt){En.call(this,e,yt)}function _t(yt){En.call(this,e,yt)}function kt(yt){En.call(this,e,yt)}function Q(yt){En.call(this,e,yt)}return e.$$set=yt=>{"id"in yt&&n(1,a=yt.id),"source"in yt&&n(2,h=yt.source),"sourceLayer"in yt&&n(3,u=yt.sourceLayer),"beforeId"in yt&&n(4,y=yt.beforeId),"beforeLayerType"in yt&&n(5,w=yt.beforeLayerType),"paint"in yt&&n(6,S=yt.paint),"layout"in yt&&n(7,I=yt.layout),"filter"in yt&&n(8,P=yt.filter),"applyToClusters"in yt&&n(9,z=yt.applyToClusters),"minzoom"in yt&&n(10,R=yt.minzoom),"maxzoom"in yt&&n(11,Z=yt.maxzoom),"hoverCursor"in yt&&n(12,X=yt.hoverCursor),"manageHoverState"in yt&&n(13,et=yt.manageHoverState),"hovered"in yt&&n(0,B=yt.hovered),"eventsIfTopMost"in yt&&n(14,q=yt.eventsIfTopMost),"interactive"in yt&&n(15,Y=yt.interactive),"$$scope"in yt&&n(24,i=yt.$$scope)},[B,a,h,u,y,w,S,I,P,z,R,Z,X,et,q,Y,r,lt,dt,ut,ft,_t,kt,Q,i]}let s1=class extends an{constructor(t){super(),sn(this,t,zN,ON,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}};function FN(e){let t;const n=e[15].default,r=xi(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&Si(r,n,i,i[23],t?wi(n,i[23],a,null):Ei(i[23]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function BN(e){let t,n,r;function i(h){e[16](h)}let a={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[FN]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new o1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function VN(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Hd("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:X=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:q=!0}=t;function Y(Q){et=Q,n(0,et)}function lt(Q){En.call(this,e,Q)}function dt(Q){En.call(this,e,Q)}function ut(Q){En.call(this,e,Q)}function ft(Q){En.call(this,e,Q)}function _t(Q){En.call(this,e,Q)}function kt(Q){En.call(this,e,Q)}return e.$$set=Q=>{"id"in Q&&n(1,a=Q.id),"source"in Q&&n(2,h=Q.source),"sourceLayer"in Q&&n(3,u=Q.sourceLayer),"beforeId"in Q&&n(4,y=Q.beforeId),"beforeLayerType"in Q&&n(5,w=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,I=Q.layout),"filter"in Q&&n(8,P=Q.filter),"minzoom"in Q&&n(9,z=Q.minzoom),"maxzoom"in Q&&n(10,R=Q.maxzoom),"hoverCursor"in Q&&n(11,Z=Q.hoverCursor),"manageHoverState"in Q&&n(12,X=Q.manageHoverState),"hovered"in Q&&n(0,et=Q.hovered),"eventsIfTopMost"in Q&&n(13,B=Q.eventsIfTopMost),"interactive"in Q&&n(14,q=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[et,a,h,u,y,w,S,I,P,z,R,Z,X,B,q,r,Y,lt,dt,ut,ft,_t,kt,i]}let rC=class extends an{constructor(t){super(),sn(this,t,VN,BN,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}};function UN(e,t,n){let r;const{map:i}=qf();qe(e,i,y=>n(4,r=y));let{position:a="top-left"}=t,{container:h=void 0}=t,u=null;return as(()=>{r!=null&&r.loaded()&&u&&r.removeControl(u)}),e.$$set=y=>{"position"in y&&n(1,a=y.position),"container"in y&&n(2,h=y.container)},e.$$.update=()=>{if(e.$$.dirty&30&&r&&!u){let y;typeof h=="string"?y=document.querySelector(h)??void 0:y=h,n(3,u=new Es.FullscreenControl({container:y})),r.addControl(u,a)}},[i,a,h,u,r]}class GN extends an{constructor(t){super(),sn(this,t,UN,null,He,{position:1,container:2})}}function qN(e,t,n,r,i){let a=!1;e.getSource(t)&&(a=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),i())};if(a){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function jN(e,t,n){VS().then(()=>{let r=NS(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function A2(e){let t=e[0],n,r,i=k2(e);return{c(){i.c(),n=di()},m(a,h){i.m(a,h),Vt(a,n,h),r=!0},p(a,h){h&1&&He(t,t=a[0])?(Fn(),Mt(i,1,1,Se),Bn(),i=k2(a),i.c(),It(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(It(i),r=!0)},o(a){Mt(i),r=!1},d(a){a&&Bt(n),i.d(a)}}}function k2(e){let t;const n=e[15].default,r=xi(n,e,e[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16384)&&Si(r,n,i,i[14],t?wi(n,i[14],a,null):Ei(i[14]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function WN(e){let t,n,r=e[0]&&A2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&It(r,1)):(r=A2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),Mt(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){Mt(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function HN(e,t,n){let r,i,a,{$$slots:h={},$$scope:u}=t,{id:y=Hd("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:I=void 0}=t,{filter:P=void 0}=t,{lineMetrics:z=void 0}=t,{cluster:R=void 0}=t;const{map:Z,cluster:X,self:et}=LN();qe(e,Z,Y=>n(13,i=Y)),qe(e,X,Y=>n(16,a=Y)),qe(e,et,Y=>n(0,r=Y));let B,q=!0;return as(()=>{r&&B&&i&&(jN(Z,r,B),Jn(et,r=null,r),n(11,B=void 0))}),e.$$set=Y=>{"id"in Y&&n(4,y=Y.id),"data"in Y&&n(5,w=Y.data),"generateId"in Y&&n(6,S=Y.generateId),"promoteId"in Y&&n(7,I=Y.promoteId),"filter"in Y&&n(8,P=Y.filter),"lineMetrics"in Y&&n(9,z=Y.lineMetrics),"cluster"in Y&&n(10,R=Y.cluster),"$$scope"in Y&&n(14,u=Y.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Jn(X,a=R,a),e.$$.dirty&12273&&i&&r!==y&&(Jn(et,r=y,r),qN(i,r,Oc({type:"geojson",data:w,filter:P,lineMetrics:z,generateId:S,promoteId:I,cluster:!!R,clusterMinPoints:R==null?void 0:R.minPoints,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius,clusterProperties:R==null?void 0:R.properties}),Y=>i&&Y===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,q=!0))})),e.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(y))})),e.$$.dirty&6176&&B&&(q?n(12,q=!1):B.setData(w)),e.$$.dirty&3072&&(B==null||B.setClusterOptions(Oc({cluster:!!R,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius})))},[r,Z,X,et,y,w,S,I,P,z,R,B,q,i,u,h]}let zc=class extends an{constructor(t){super(),sn(this,t,HN,WN,He,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}};function ZN(e,t,n){let r;const{map:i}=qf();qe(e,i,P=>n(8,r=P));let{position:a="top-left"}=t,{positionOptions:h=void 0}=t,{fitBoundsOptions:u=void 0}=t,{trackUserLocation:y=!1}=t,{showAccuracyCircle:w=!0}=t,{showUserLocation:S=!0}=t,I=null;return as(()=>{r!=null&&r.loaded()&&I&&r.removeControl(I)}),e.$$set=P=>{"position"in P&&n(1,a=P.position),"positionOptions"in P&&n(2,h=P.positionOptions),"fitBoundsOptions"in P&&n(3,u=P.fitBoundsOptions),"trackUserLocation"in P&&n(4,y=P.trackUserLocation),"showAccuracyCircle"in P&&n(5,w=P.showAccuracyCircle),"showUserLocation"in P&&n(6,S=P.showUserLocation)},e.$$.update=()=>{e.$$.dirty&510&&r&&!I&&(n(7,I=new Es.GeolocateControl({positionOptions:h,fitBoundsOptions:u,trackUserLocation:y,showAccuracyCircle:w,showUserLocation:S})),r.addControl(I,a))},[i,a,h,u,y,w,S,I,r]}class XN extends an{constructor(t){super(),sn(this,t,ZN,null,He,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function YN(e){let t;const n=e[15].default,r=xi(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&Si(r,n,i,i[23],t?wi(n,i[23],a,null):Ei(i[23]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function KN(e){let t,n,r;function i(h){e[16](h)}let a={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[YN]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new o1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function JN(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Hd("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:X=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:q=!0}=t;function Y(Q){et=Q,n(0,et)}function lt(Q){En.call(this,e,Q)}function dt(Q){En.call(this,e,Q)}function ut(Q){En.call(this,e,Q)}function ft(Q){En.call(this,e,Q)}function _t(Q){En.call(this,e,Q)}function kt(Q){En.call(this,e,Q)}return e.$$set=Q=>{"id"in Q&&n(1,a=Q.id),"source"in Q&&n(2,h=Q.source),"sourceLayer"in Q&&n(3,u=Q.sourceLayer),"beforeId"in Q&&n(4,y=Q.beforeId),"beforeLayerType"in Q&&n(5,w=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,I=Q.layout),"filter"in Q&&n(8,P=Q.filter),"minzoom"in Q&&n(9,z=Q.minzoom),"maxzoom"in Q&&n(10,R=Q.maxzoom),"hoverCursor"in Q&&n(11,Z=Q.hoverCursor),"manageHoverState"in Q&&n(12,X=Q.manageHoverState),"hovered"in Q&&n(0,et=Q.hovered),"eventsIfTopMost"in Q&&n(13,B=Q.eventsIfTopMost),"interactive"in Q&&n(14,q=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[et,a,h,u,y,w,S,I,P,z,R,Z,X,B,q,r,Y,lt,dt,ut,ft,_t,kt,i]}let jf=class extends an{constructor(t){super(),sn(this,t,JN,KN,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}};function QN(e,t,n){let r;const i=Uu();let{layer:a=void 0}=t;const{map:h}=qf();qe(e,h,S=>n(2,r=S));function u(S){i(S.type,{...S,map:h})}const y=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return as(()=>{if(r)if(a)for(const S of y)r.off(S,a,u);else for(const S of w)r.off(S,u)}),e.$$set=S=>{"layer"in S&&n(1,a=S.layer)},e.$$.update=()=>{if(e.$$.dirty&6&&r)if(a)for(const S of y)r.on(S,a,u);else for(const S of w)r.on(S,u)},[h,a,r]}class $N extends an{constructor(t){super(),sn(this,t,QN,null,He,{layer:1})}}function tO(e){let t=e.getCenter(),n=Math.round(e.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),a=Math.round(t.lat*i)/i,h=Math.round(t.lng*i)/i,u=`${n}/${a}/${h}`,y=e.getBearing(),w=e.getPitch();return(y||w)&&(u+=`/${Math.round(y*10)/10}`),w&&(u+=`/${Math.round(w)}`),`#${u}`}function eO(e){return e.replace("#","").split("/").map(parseFloat)}function nO(e,t,n){let r;const{map:i}=qf();qe(e,i,S=>n(6,r=S));let{position:a="top-left"}=t,{showCompass:h=!0}=t,{showZoom:u=!0}=t,{visualizePitch:y=!1}=t,w=null;return as(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),e.$$set=S=>{"position"in S&&n(1,a=S.position),"showCompass"in S&&n(2,h=S.showCompass),"showZoom"in S&&n(3,u=S.showZoom),"visualizePitch"in S&&n(4,y=S.visualizePitch)},e.$$.update=()=>{e.$$.dirty&126&&r&&!w&&(n(5,w=new Es.NavigationControl({showCompass:h,showZoom:u,visualizePitch:y})),r.addControl(w,a))},[i,a,h,u,y,w,r]}class rO extends an{constructor(t){super(),sn(this,t,nO,null,He,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function iO(e,t,n){let r;const{map:i}=qf();qe(e,i,w=>n(5,r=w));let{position:a="bottom-left"}=t,{maxWidth:h=void 0}=t,{unit:u="metric"}=t,y=null;return as(()=>{r!=null&&r.loaded()&&y&&r.removeControl(y)}),e.$$set=w=>{"position"in w&&n(1,a=w.position),"maxWidth"in w&&n(2,h=w.maxWidth),"unit"in w&&n(3,u=w.unit)},e.$$.update=()=>{e.$$.dirty&62&&r&&!y&&(n(4,y=new Es.ScaleControl({maxWidth:h,unit:u})),r.addControl(y,a))},[i,a,h,u,y,r]}class oO extends an{constructor(t){super(),sn(this,t,iO,null,He,{position:1,maxWidth:2,unit:3})}}const{window:sO}=PL,aO=e=>({map:e[0]&16,loadedImages:e[0]&32,allImagesLoaded:e[0]&64}),D2=e=>({map:e[4],loadedImages:e[5],allImagesLoaded:e[6]});function R2(e){let t,n,r=e[3]&&N2(e);const i=e[39].default,a=xi(i,e,e[38],D2);return{c(){r&&r.c(),t=fe(),a&&a.c()},m(h,u){r&&r.m(h,u),Vt(h,t,u),a&&a.m(h,u),n=!0},p(h,u){h[3]?r?(r.p(h,u),u[0]&8&&It(r,1)):(r=N2(h),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),Mt(r,1,1,()=>{r=null}),Bn()),a&&a.p&&(!n||u[0]&112|u[1]&128)&&Si(a,i,h,h[38],n?wi(i,h[38],u,aO):Ei(h[38]),D2)},i(h){n||(It(r),It(a,h),n=!0)},o(h){Mt(r),Mt(a,h),n=!1},d(h){h&&Bt(t),r&&r.d(h),a&&a.d(h)}}}function N2(e){let t,n,r,i,a,h,u,y;return t=new rO({props:{position:e[7]}}),r=new XN({props:{position:e[7],fitBoundsOptions:{maxZoom:12}}}),a=new GN({props:{position:e[7]}}),u=new oO({props:{position:e[7]}}),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment),i=fe(),_e(a.$$.fragment),h=fe(),_e(u.$$.fragment)},m(w,S){de(t,w,S),Vt(w,n,S),de(r,w,S),Vt(w,i,S),de(a,w,S),Vt(w,h,S),de(u,w,S),y=!0},p(w,S){const I={};S[0]&128&&(I.position=w[7]),t.$set(I);const P={};S[0]&128&&(P.position=w[7]),r.$set(P);const z={};S[0]&128&&(z.position=w[7]),a.$set(z);const R={};S[0]&128&&(R.position=w[7]),u.$set(R)},i(w){y||(It(t.$$.fragment,w),It(r.$$.fragment,w),It(a.$$.fragment,w),It(u.$$.fragment,w),y=!0)},o(w){Mt(t.$$.fragment,w),Mt(r.$$.fragment,w),Mt(a.$$.fragment,w),Mt(u.$$.fragment,w),y=!1},d(w){w&&(Bt(n),Bt(i),Bt(h)),me(t,w),me(r,w),me(a,w),me(u,w)}}}function lO(e){let t,n,r,i,a,h=e[4]&&e[0]&&R2(e);return{c(){t=jt("div"),h&&h.c(),Zt(t,"class",n=Pg(e[2])+" svelte-p00lfq"),Zt(t,"data-testid","map-container"),il(t,"expand-map",!e[2])},m(u,y){Vt(u,t,y),h&&h.m(t,null),e[40](t),r=!0,i||(a=[Ye(sO,"hashchange",e[11]),y0(e[10].call(null,t))],i=!0)},p(u,y){u[4]&&u[0]?h?(h.p(u,y),y[0]&17&&It(h,1)):(h=R2(u),h.c(),It(h,1),h.m(t,null)):h&&(Fn(),Mt(h,1,1,()=>{h=null}),Bn()),(!r||y[0]&4&&n!==(n=Pg(u[2])+" svelte-p00lfq"))&&Zt(t,"class",n),(!r||y[0]&4)&&il(t,"expand-map",!u[2])},i(u){r||(It(h),r=!0)},o(u){Mt(h),r=!1},d(u){u&&Bt(t),h&&h.d(),e[40](null),i=!1,Ri(a)}}}function uO(e,t,n){let r,i,a,h,{$$slots:u={},$$scope:y}=t,{map:w=null}=t,{mapContainer:S=void 0}=t,{class:I=void 0}=t,{style:P}=t,{diffStyleUpdates:z=!1}=t,{center:R=void 0}=t,{zoom:Z=void 0}=t,{pitch:X=0}=t,{bearing:et=0}=t,{bounds:B=void 0}=t,{hash:q=!1}=t,{loaded:Y=!1}=t,{minZoom:lt=0}=t,{maxZoom:dt=22}=t,{antialias:ut=void 0}=t,{zoomOnDoubleClick:ft=!0}=t,{locale:_t=void 0}=t,{interactive:kt=!0}=t,{attributionControl:Q=!0}=t,{cooperativeGestures:yt=!1}=t,{preserveDrawingBuffer:Kt=!1}=t,{maxBounds:bt=void 0}=t,{images:Ut=[]}=t,{standardControls:ee=!1}=t,{filterLayers:Gt=void 0}=t,{transformRequest:Re=void 0}=t;const xe=Uu(),{map:ln,loadedImages:Ve}=TN();qe(e,ln,Qt=>n(4,a=Qt)),qe(e,Ve,Qt=>n(5,h=Qt));let Pe=new Set;async function un(Qt,mt=!1){if(a&&!(!a.loaded()&&!mt))if("url"in Qt){Pe.add(Qt.id);try{let Ct=await a.loadImage(Qt.url);a==null||a.addImage(Qt.id,Ct.data,Qt.options),h.add(Qt.id),Ve.set(h)}catch(Ct){xe("error",Ct)}finally{Pe.delete(Qt.id)}}else a.addImage(Qt.id,Qt.data,Qt.options),h.add(Qt.id),Ve.set(h)}let Cn,mn,gn,An;function vr(Qt){return br(),Jn(ln,a=new Es.Map(Oc({container:Qt,style:P,locale:_t,center:R,zoom:Z,pitch:X,bearing:et,minZoom:lt,maxZoom:dt,antialias:ut,interactive:kt,preserveDrawingBuffer:Kt,maxBounds:bt,bounds:B,attributionControl:Q,transformRequest:Re,cooperativeGestures:yt})),a),a.on("load",mt=>{mt.target.getContainer().setAttribute("data-testid","map"),mt.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,Y=!0),xe("load",a)}),a.on("error",mt=>xe("error",{...mt,map:a})),a.on("movestart",mt=>xe("movestart",{...mt,map:a})),a.on("moveend",mt=>{if(n(12,R=mt.target.getCenter()),n(13,Z=mt.target.getZoom()),n(14,B=mt.target.getBounds()),xe("moveend",{...mt,map:a}),q){let Ct=window.location.href.replace(/(#.+)?$/,tO(a));window.history.replaceState(window.history.state,"",Ct)}}),a.on("click",mt=>xe("click",{...mt,map:a})),a.on("dblclick",mt=>xe("dblclick",{...mt,map:a})),a.on("contextmenu",mt=>xe("contextmenu",{...mt,map:a})),a.on("zoomstart",mt=>xe("zoomstart",{...mt,map:a})),a.on("zoom",mt=>{n(13,Z=mt.target.getZoom()),xe("zoom",{...mt,map:a})}),a.on("zoomend",mt=>{n(13,Z=mt.target.getZoom()),xe("zoomend",{...mt,map:a})}),a.on("style.load",()=>{if(a){const mt=a.getStyle();if(n(35,Cn=mt.layers.map(Ct=>Ct.id)),n(36,mn=Object.keys(mt.sources)),An)for(const[Ct,Ie]of Object.entries(An))a.addSource(Ct,Ie);if(gn)for(const Ct of gn)a.addLayer(Ct);for(const Ct of Ut)un(Ct,!0)}}),a.on("styledata",mt=>{if(a&&Gt){const Ct=a.getStyle().layers;if(Ct)for(let Ie of Ct)Gt(Ie)||a.setLayoutProperty(Ie.id,"visibility","none")}xe("styledata",{...mt,map:a})}),{destroy(){n(0,Y=!1),a==null||a.remove(),Jn(ln,a=null,a)}}}let Pr=P;function br(){if(q){let Qt=eO(window.location.hash);Qt.length>=3&&(n(13,Z=Qt[0]),n(12,R=[Qt[2],Qt[1]])),Qt.length==5&&(n(17,et=Qt[3]),n(16,X=Qt[4]))}}function hr(Qt){rr[Qt?"unshift":"push"](()=>{S=Qt,n(1,S)})}return e.$$set=Qt=>{"map"in Qt&&n(15,w=Qt.map),"mapContainer"in Qt&&n(1,S=Qt.mapContainer),"class"in Qt&&n(2,I=Qt.class),"style"in Qt&&n(18,P=Qt.style),"diffStyleUpdates"in Qt&&n(19,z=Qt.diffStyleUpdates),"center"in Qt&&n(12,R=Qt.center),"zoom"in Qt&&n(13,Z=Qt.zoom),"pitch"in Qt&&n(16,X=Qt.pitch),"bearing"in Qt&&n(17,et=Qt.bearing),"bounds"in Qt&&n(14,B=Qt.bounds),"hash"in Qt&&n(20,q=Qt.hash),"loaded"in Qt&&n(0,Y=Qt.loaded),"minZoom"in Qt&&n(21,lt=Qt.minZoom),"maxZoom"in Qt&&n(22,dt=Qt.maxZoom),"antialias"in Qt&&n(23,ut=Qt.antialias),"zoomOnDoubleClick"in Qt&&n(24,ft=Qt.zoomOnDoubleClick),"locale"in Qt&&n(25,_t=Qt.locale),"interactive"in Qt&&n(26,kt=Qt.interactive),"attributionControl"in Qt&&n(27,Q=Qt.attributionControl),"cooperativeGestures"in Qt&&n(28,yt=Qt.cooperativeGestures),"preserveDrawingBuffer"in Qt&&n(29,Kt=Qt.preserveDrawingBuffer),"maxBounds"in Qt&&n(30,bt=Qt.maxBounds),"images"in Qt&&n(31,Ut=Qt.images),"standardControls"in Qt&&n(3,ee=Qt.standardControls),"filterLayers"in Qt&&n(32,Gt=Qt.filterLayers),"transformRequest"in Qt&&n(33,Re=Qt.transformRequest),"$$scope"in Qt&&n(38,y=Qt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&8&&n(7,r=typeof ee=="boolean"?void 0:ee),e.$$.dirty[0]&16&&n(15,w=a),e.$$.dirty[0]&786448|e.$$.dirty[1]&112&&a&&!fg(P,Pr)){const Qt=a.getStyle();if(Cn&&(gn=Qt.layers.filter(mt=>!Cn.includes(mt.id))),mn){const mt=Object.keys(Qt.sources).filter(Ct=>!mn.includes(Ct));An={};for(const Ct of mt)An[Ct]=Qt.sources[Ct]}n(37,Pr=P),a.setStyle(P,{diff:z}),Jn(Ve,h=new Set,h),n(34,Pe=new Set)}if(e.$$.dirty[0]&49|e.$$.dirty[1]&9&&Y&&a!=null&&a.loaded())for(let Qt of Ut)!h.has(Qt.id)&&!Pe.has(Qt.id)&&!a.hasImage(Qt.id)&&un(Qt);e.$$.dirty[0]&32|e.$$.dirty[1]&1&&n(6,i=Ut.every(Qt=>h.has(Qt.id))),e.$$.dirty[0]&4112&&R&&!fg(R,a==null?void 0:a.getCenter())&&(a==null||a.panTo(R)),e.$$.dirty[0]&8208&&Z&&!fg(Z,a==null?void 0:a.getZoom())&&(a==null||a.zoomTo(Z)),e.$$.dirty[0]&16400&&B&&!fg(B,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(B)),e.$$.dirty[0]&16777232&&(ft?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[Y,S,I,ee,a,h,i,r,ln,Ve,vr,br,R,Z,B,w,X,et,P,z,q,lt,dt,ut,ft,_t,kt,Q,yt,Kt,bt,Ut,Gt,Re,Pe,Cn,mn,Pr,y,u,hr]}class cO extends an{constructor(t){super(),sn(this,t,uO,lO,He,{map:15,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:16,bearing:17,bounds:14,hash:20,loaded:0,minZoom:21,maxZoom:22,antialias:23,zoomOnDoubleClick:24,locale:25,interactive:26,attributionControl:27,cooperativeGestures:28,preserveDrawingBuffer:29,maxBounds:30,images:31,standardControls:3,filterLayers:32,transformRequest:33},null,[-1,-1])}}const hO=e=>({marker:e&8}),O2=e=>({marker:e[3]});function fO(e){let t,n,r,i,a,h,u;const y=e[19].default,w=xi(y,e,e[18],O2);return{c(){t=jt("div"),w&&w.c(),Zt(t,"tabindex",n=e[1]?0:void 0),Zt(t,"role",r=e[1]?"button":void 0),Ui(t,"z-index",e[2])},m(S,I){Vt(S,t,I),w&&w.m(t,null),a=!0,h||(u=[y0(e[7].call(null,t)),y0(i=pO.call(null,t,e[0])),Ye(t,"click",B_(e[20])),Ye(t,"dblclick",B_(e[21])),Ye(t,"contextmenu",B_(e[22])),Ye(t,"mouseenter",e[23]),Ye(t,"mouseleave",e[24]),Ye(t,"mousemove",e[25]),Ye(t,"keydown",e[8])],h=!0)},p(S,[I]){w&&w.p&&(!a||I&262152)&&Si(w,y,S,S[18],a?wi(y,S[18],I,hO):Ei(S[18]),O2),(!a||I&2&&n!==(n=S[1]?0:void 0))&&Zt(t,"tabindex",n),(!a||I&2&&r!==(r=S[1]?"button":void 0))&&Zt(t,"role",r),i&&cy(i.update)&&I&1&&i.update.call(null,S[0]),I&4&&Ui(t,"z-index",S[2])},i(S){a||(It(w,S),a=!0)},o(S){Mt(w,S),a=!1},d(S){S&&Bt(t),w&&w.d(S),h=!1,Ri(u)}}}function pO(e,t){const n=e.className;function r(i){i?e.className=`${n} ${i}`:e.className=n}return r(t),{update:r}}function dO(e,t,n){let r,i,a,{$$slots:h={},$$scope:u}=t,{marker:y=void 0}=t,{lngLat:w}=t,{class:S=void 0}=t,{interactive:I=!0}=t,{asButton:P=!1}=t,{draggable:z=!1}=t,{feature:R=null}=t,{offset:Z=void 0}=t,{zIndex:X=void 0}=t,{rotation:et=0}=t,{opacity:B=1}=t;const q=Uu(),{map:Y,layerEvent:lt,self:dt}=MN();qe(e,Y,Gt=>n(27,a=Gt)),qe(e,lt,Gt=>n(26,r=Gt)),qe(e,dt,Gt=>n(3,i=Gt));function ut(Gt){Jn(dt,i=new Es.Marker({element:Gt,rotation:et,draggable:z,offset:Z,opacity:B.toString()}).setLngLat(w).addTo(a),i),n(11,y=i);const Re=()=>kt("dragstart"),xe=()=>{ft(),kt("drag")},ln=()=>{ft(),kt("dragend")};return z&&(i.on("dragstart",Re),i.on("drag",xe),i.on("dragend",ln)),{destroy(){z&&(i==null||i.off("dragstart",Re),i==null||i.off("drag",xe),i==null||i.off("dragend",ln)),n(11,y=void 0),i==null||i.remove()}}}function ft(){let Gt=i==null?void 0:i.getLngLat();Gt&&(Array.isArray(w)?n(10,w=[Gt.lng,Gt.lat]):w&&"lon"in w?n(10,w={lon:Gt.lng,lat:Gt.lat}):n(10,w=Gt))}function _t(Gt){Gt.key===" "&&(Gt.preventDefault(),Gt.stopPropagation(),kt("click"))}function kt(Gt){if(!I)return;let Re=i==null?void 0:i.getLngLat();if(!Re)return;const xe=[Re.lng,Re.lat];let ln={map:a,marker:i,lngLat:xe,features:[{type:"Feature",properties:(R==null?void 0:R.properties)??{},geometry:{type:"Point",coordinates:xe}}]};Jn(lt,r={...ln,layerType:"marker",type:Gt},r),q(Gt,ln)}const Q=()=>kt("click"),yt=()=>kt("dblclick"),Kt=()=>kt("contextmenu"),bt=Gt=>{kt("mouseenter")},Ut=()=>{kt("mouseleave")},ee=()=>kt("mousemove");return e.$$set=Gt=>{"marker"in Gt&&n(11,y=Gt.marker),"lngLat"in Gt&&n(10,w=Gt.lngLat),"class"in Gt&&n(0,S=Gt.class),"interactive"in Gt&&n(12,I=Gt.interactive),"asButton"in Gt&&n(1,P=Gt.asButton),"draggable"in Gt&&n(13,z=Gt.draggable),"feature"in Gt&&n(14,R=Gt.feature),"offset"in Gt&&n(15,Z=Gt.offset),"zIndex"in Gt&&n(2,X=Gt.zIndex),"rotation"in Gt&&n(16,et=Gt.rotation),"opacity"in Gt&&n(17,B=Gt.opacity),"$$scope"in Gt&&n(18,u=Gt.$$scope)},e.$$.update=()=>{e.$$.dirty&1032&&(i==null||i.setLngLat(w)),e.$$.dirty&32776&&(i==null||i.setOffset(Z??[0,0])),e.$$.dirty&65544&&(i==null||i.setRotation(et)),e.$$.dirty&131080&&(i==null||i.setOpacity(B.toString()))},[S,P,X,i,Y,lt,dt,ut,_t,kt,w,y,I,z,R,Z,et,B,u,h,Q,yt,Kt,bt,Ut,ee]}class kd extends an{constructor(t){super(),sn(this,t,dO,fO,He,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const mO=e=>({}),z2=e=>({}),gO=e=>({}),F2=e=>({});function yO(e){let t,n,r,i;const a=e[1].left,h=xi(a,e,e[0],F2),u=e[1].main,y=xi(u,e,e[0],z2);return{c(){t=jt("div"),h&&h.c(),n=fe(),r=jt("div"),y&&y.c(),Zt(t,"class","left svelte-k43lgc"),Zt(r,"class","main svelte-k43lgc")},m(w,S){Vt(w,t,S),h&&h.m(t,null),Vt(w,n,S),Vt(w,r,S),y&&y.m(r,null),i=!0},p(w,[S]){h&&h.p&&(!i||S&1)&&Si(h,a,w,w[0],i?wi(a,w[0],S,gO):Ei(w[0]),F2),y&&y.p&&(!i||S&1)&&Si(y,u,w,w[0],i?wi(u,w[0],S,mO):Ei(w[0]),z2)},i(w){i||(It(h,w),It(y,w),i=!0)},o(w){Mt(h,w),Mt(y,w),i=!1},d(w){w&&(Bt(t),Bt(n),Bt(r)),h&&h.d(w),y&&y.d(w)}}}function _O(e,t,n){let{$$slots:r={},$$scope:i}=t;return e.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class vO extends an{constructor(t){super(),sn(this,t,_O,yO,He,{})}}const bO=e=>({}),B2=e=>({}),xO=e=>({}),V2=e=>({});function wO(e){let t,n,r,i;const a=e[3].sidebar,h=xi(a,e,e[2],V2),u=e[3].map,y=xi(u,e,e[2],B2);return{c(){t=jt("div"),h&&h.c(),n=fe(),r=jt("div"),y&&y.c()},m(w,S){Vt(w,t,S),h&&h.m(t,null),e[4](t),Vt(w,n,S),Vt(w,r,S),y&&y.m(r,null),e[5](r),i=!0},p(w,[S]){h&&h.p&&(!i||S&4)&&Si(h,a,w,w[2],i?wi(a,w[2],S,xO):Ei(w[2]),V2),y&&y.p&&(!i||S&4)&&Si(y,u,w,w[2],i?wi(u,w[2],S,bO):Ei(w[2]),B2)},i(w){i||(It(h,w),It(y,w),i=!0)},o(w){Mt(h,w),Mt(y,w),i=!1},d(w){w&&(Bt(t),Bt(n),Bt(r)),h&&h.d(w),e[4](null),y&&y.d(w),e[5](null)}}}function SO(e,t,n){let r,i;qe(e,rv,w=>n(0,r=w)),qe(e,iv,w=>n(1,i=w));let{$$slots:a={},$$scope:h}=t;function u(w){rr[w?"unshift":"push"](()=>{r=w,rv.set(r)})}function y(w){rr[w?"unshift":"push"](()=>{i=w,iv.set(i)})}return e.$$set=w=>{"$$scope"in w&&n(2,h=w.$$scope)},[r,i,h,a,u,y]}class Zd extends an{constructor(t){super(),sn(this,t,SO,wO,He,{})}}let rv=$r(null),iv=$r(null);function EO(e){let t,n,r,i,a,h,u,y,w;return{c(){t=jt("label"),n=hn(`Mode: - `),r=jt("select"),i=jt("option"),i.textContent="Car",a=jt("option"),a.textContent="Bicycle",h=jt("option"),h.textContent="Foot",u=jt("option"),u.textContent="Public transit",i.__value="car",Ea(i,i.__value),a.__value="bicycle",Ea(a,a.__value),h.__value="foot",Ea(h,h.__value),u.__value="transit",Ea(u,u.__value),e[0]===void 0&&dd(()=>e[1].call(r))},m(S,I){Vt(S,t,I),Ot(t,n),Ot(t,r),Ot(r,i),Ot(r,a),Ot(r,h),Ot(r,u),Mg(r,e[0],!0),y||(w=Ye(r,"change",e[1]),y=!0)},p(S,[I]){I&1&&Mg(r,S[0])},i:Se,o:Se,d(S){S&&Bt(t),y=!1,w()}}}function IO(e,t,n){let{travelMode:r}=t;function i(){r=zS(this),n(0,r)}return e.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class a1 extends an{constructor(t){super(),sn(this,t,IO,EO,He,{travelMode:0})}}function U2(e,t,n){const r=e.slice();return r[2]=t[n][0],r[3]=t[n][1],r}function G2(e,t,n){const r=e.slice();return r[6]=t[n],r}function q2(e){let t,n,r=H2(e[6])+"",i,a;return{c(){t=jt("li"),n=jt("a"),i=hn(r),Zt(n,"href",a=e[6].properties.osm_id),Zt(n,"target","_blank")},m(h,u){Vt(h,t,u),Ot(t,n),Ot(n,i)},p(h,u){u&1&&r!==(r=H2(h[6])+"")&&Nr(i,r),u&1&&a!==(a=h[6].properties.osm_id)&&Zt(n,"href",a)},d(h){h&&Bt(t)}}}function j2(e){let t,n,r=e[2]+"",i,a,h=e[3].length+"",u,y,w,S,I,P=ti(e[3]),z=[];for(let R=0;Ri[1].length-r[1].length),n}function H2(e){let t=e.properties.name||`a ${e.properties.amenity_kind}`;return e.properties.brand&&(t+=` (${e.properties.brand})`),e.properties.cuisine&&(t+=` (${e.properties.cuisine})`),t}function TO(e,t,n){let r,{gj:i}=t;return e.$$set=a=>{"gj"in a&&n(1,i=a.gj)},e.$$.update=()=>{e.$$.dirty&2&&n(0,r=i.features.filter(a=>"amenity_kind"in a.properties))},[r,i]}class iC extends an{constructor(t){super(),sn(this,t,TO,CO,He,{gj:1})}}function LO(e){let t,n;return t=new pv({props:{properties:e[3]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&8&&(a.properties=r[3]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function PO(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[LO,({props:r})=>({3:r}),({props:r})=>r?8:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function MO(e){let t,n,r;function i(h){e[1](h)}let a={id:"amenities",paint:{"circle-radius":5,"circle-opacity":0,"circle-stroke-width":2,"circle-stroke-color":Ay("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[PO]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new s1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[2]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&16&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function AO(e,t,n){let{hovered:r=null}=t;function i(h){r=h,n(0,r)}const a=h=>window.open(Hl(h.detail.features[0].properties).osm_id,"_blank");return e.$$set=h=>{"hovered"in h&&n(0,r=h.hovered)},[r,i,a]}class oC extends an{constructor(t){super(),sn(this,t,AO,MO,He,{hovered:0})}}function Z2(e,t,n){const r=e.slice();return r[3]=t[n],r}function kO(e){let t=e[6].name+"",n,r,i=JSON.parse(e[6].next_steps).length+"",a,h;return{c(){n=hn(t),r=hn(" has "),a=hn(i),h=hn(" next steps (arrivals)")},m(u,y){Vt(u,n,y),Vt(u,r,y),Vt(u,a,y),Vt(u,h,y)},p(u,y){y&64&&t!==(t=u[6].name+"")&&Nr(n,t),y&64&&i!==(i=JSON.parse(u[6].next_steps).length+"")&&Nr(a,i)},d(u){u&&(Bt(n),Bt(r),Bt(a),Bt(h))}}}function DO(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[kO,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&192&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function X2(e){let t,n;return t=new US({props:{$$slots:{default:[RO]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&129&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function Y2(e){let t,n=JSON.stringify(e[3])+"",r;return{c(){t=jt("p"),r=hn(n)},m(i,a){Vt(i,t,a),Ot(t,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&Nr(r,n)},d(i){i&&Bt(t)}}}function RO(e){let t,n=ti(e[0]),r=[];for(let i=0;i{a=null}),Bn())},i(h){i||(It(t.$$.fragment,h),It(a),i=!0)},o(h){Mt(t.$$.fragment,h),Mt(a),i=!1},d(h){h&&(Bt(n),Bt(r)),me(t,h),a&&a.d(h)}}}function OO(e,t,n){let r=null;return[r,h=>n(0,r=JSON.parse(Hl(h.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class zO extends an{constructor(t){super(),sn(this,t,OO,NO,He,{})}}/** +`)}return e.toString()};Di.prototype.computeEdgeEndLabels=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.computeLabel(e)}};Di.prototype.computeLabelling=function(e){var t=this;this.computeEdgeEndLabels(e[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],r=this.iterator();r.hasNext();)for(var i=r.next(),a=i.getLabel(),h=0;h<2;h++)a.isLine(h)&&a.getLocation(h)===Dt.BOUNDARY&&(n[h]=!0);for(var u=this.iterator();u.hasNext();)for(var y=u.next(),w=y.getLabel(),S=0;S<2;S++)if(w.isAnyNull(S)){var I=Dt.NONE;if(n[S])I=Dt.EXTERIOR;else{var P=y.getCoordinate();I=t.getLocation(S,P,e)}w.setAllLocationsIfNull(S,I)}};Di.prototype.getDegree=function(){return this._edgeMap.size()};Di.prototype.insertEdgeEnd=function(e,t){this._edgeMap.put(e,t),this._edgeList=null};Di.prototype.interfaces_=function(){return[]};Di.prototype.getClass=function(){return Di};var AD=function(e){function t(){e.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var r=null,i=null,a=this._SCANNING_FOR_INCOMING,h=0;h=0;a--){var h=n._edgeList.get(a),u=h.getSym();i===null&&(i=u),r!==null&&u.setNext(r),r=h}i.setNext(r)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),a=r.getDepth(ie.LEFT),h=r.getDepth(ie.RIGHT),u=this.computeDepths(i+1,this._edgeList.size(),a),y=this.computeDepths(0,i,u);if(y!==h)throw new hl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],I=arguments[2],P=I,z=w;z=0;u--){var y=r._resultAreaEdgeList.get(u),w=y.getSym();switch(i===null&&y.getEdgeRing()===n&&(i=y),h){case r._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;a=w,h=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(y.getEdgeRing()!==n)continue;a.setNextMin(y),h=r._SCANNING_FOR_INCOMING;break}}h===this._LINKING_TO_OUTGOING&&(en.isTrue(i!==null,"found null for first outgoing dirEdge"),en.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),a.setNextMin(i))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var a=arguments[0],h=0,u=this.iterator();u.hasNext();){var y=u.next();y.getEdgeRing()===a&&h++}return h}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=Dt.NONE,r=this.iterator();r.hasNext();){var i=r.next(),a=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=Dt.INTERIOR;break}if(a.isInResult()){n=Dt.EXTERIOR;break}}}if(n===Dt.NONE)return null;for(var h=n,u=this.iterator();u.hasNext();){var y=u.next(),w=y.getSym();y.isLineEdge()?y.getEdge().setCovered(h===Dt.INTERIOR):(y.isInResult()&&(h=Dt.EXTERIOR),w.isInResult()&&(h=Dt.INTERIOR))}},t.prototype.computeLabelling=function(n){var r=this;e.prototype.computeLabelling.call(this,n),this._label=new Nn(Dt.NONE);for(var i=this.iterator();i.hasNext();)for(var a=i.next(),h=a.getEdge(),u=h.getLabel(),y=0;y<2;y++){var w=u.getLocation(y);(w===Dt.INTERIOR||w===Dt.BOUNDARY)&&r._label.setLocation(y,Dt.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Di),II=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new Ly(n,new AD)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(bf),Kl=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};Kl.prototype.compareTo=function(e){var t=e,n=Kl.compareOriented(this._pts,this._orientation,t._pts,t._orientation);return n};Kl.prototype.interfaces_=function(){return[hs]};Kl.prototype.getClass=function(){return Kl};Kl.orientation=function(e){return dn.increasingDirection(e)===1};Kl.compareOriented=function(e,t,n,r){for(var i=t?1:-1,a=r?1:-1,h=t?e.length:-1,u=r?n.length:-1,y=t?0:e.length-1,w=r?0:n.length-1;;){var S=e[y].compareTo(n[w]);if(S!==0)return S;y+=i,w+=a;var I=y===h,P=w===u;if(I&&!P)return-1;if(!I&&P)return 1;if(I&&P)return 0}};var As=function(){this._edges=new he,this._ocaMap=new Ai};As.prototype.print=function(e){var t=this;e.print("MULTILINESTRING ( ");for(var n=0;n0&&e.print(","),e.print("(");for(var i=r.getCoordinates(),a=0;a0&&e.print(","),e.print(i[a].x+" "+i[a].y);e.println(")")}e.print(") ")};As.prototype.addAll=function(e){for(var t=this,n=e.iterator();n.hasNext();)t.add(n.next())};As.prototype.findEdgeIndex=function(e){for(var t=this,n=0;n0||!t.coord.equals2D(i);a||r--;var h=new Array(r).fill(null),u=0;h[u++]=new Mt(e.coord);for(var y=e.segmentIndex+1;y<=t.segmentIndex;y++)h[u++]=n.edge.pts[y];return a&&(h[u]=t.coord),new Jg(h,new Nn(this.edge._label))};Da.prototype.add=function(e,t,n){var r=new sa(e,t,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Da.prototype.isIntersection=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();if(n.coord.equals(e))return!0}return!1};Da.prototype.interfaces_=function(){return[]};Da.prototype.getClass=function(){return Da};var Nu=function(){};Nu.prototype.getChainStartIndices=function(e){var t=this,n=0,r=new he;r.add(new ta(n));do{var i=t.findChainEnd(e,n);r.add(new ta(i)),n=i}while(nn?t:n};pl.prototype.getMinX=function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return tn&&(i=1),e._depth[t][r]=i}}};vi.prototype.getDelta=function(e){return this._depth[e][ie.RIGHT]-this._depth[e][ie.LEFT]};vi.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?Dt.EXTERIOR:Dt.INTERIOR};vi.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};vi.prototype.add=function(){var e=this;if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=t.getLocation(n,r);(i===Dt.EXTERIOR||i===Dt.INTERIOR)&&(e.isNull(n,r)?e._depth[n][r]=vi.depthAtLocation(i):e._depth[n][r]+=vi.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],h=arguments[1],u=arguments[2];u===Dt.INTERIOR&&this._depth[a][h]++}};vi.prototype.interfaces_=function(){return[]};vi.prototype.getClass=function(){return vi};vi.depthAtLocation=function(e){return e===Dt.EXTERIOR?0:e===Dt.INTERIOR?1:vi.NULL_VALUE};CI.NULL_VALUE.get=function(){return-1};Object.defineProperties(vi,CI);var Jg=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new Da(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new vi,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new t(n,Nn.toLineLabel(this._label));return r},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var r=this;if(!(n instanceof t))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var a=!0,h=!0,u=this.pts.length,y=0;y0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i0&&n.print(","),n.print(r.pts[i].x+" "+r.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(r.pts[i]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new pl(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new ke;for(var r=0;r0&&r.append(","),r.append(n.pts[i].x+" "+n.pts[i].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},t.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxya;if(h)return!1;var u=this.intersectsToleranceSquare(e,t);return en.isTrue(!(h&&u),"Found bad envelope test"),u};ao.prototype.initCorners=function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new Mt(this._maxx,this._maxy),this._corner[1]=new Mt(this._minx,this._maxy),this._corner[2]=new Mt(this._minx,this._miny),this._corner[3]=new Mt(this._maxx,this._miny)};ao.prototype.intersects=function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};ao.prototype.scale=function(e){return Math.round(e*this._scaleFactor)};ao.prototype.getCoordinate=function(){return this._originalPt};ao.prototype.copyScaled=function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)};ao.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=ao.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new ke(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv};ao.prototype.intersectsPixelClosure=function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.hasIntersection()))};ao.prototype.intersectsToleranceSquare=function(e,t){var n=!1,r=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||e.equals(this._pt)||t.equals(this._pt))};ao.prototype.addSnappedNode=function(e,t){var n=e.getCoordinate(t),r=e.getCoordinate(t+1);return this.intersects(n,r)?(e.addIntersection(this.getCoordinate(),t),!0):!1};ao.prototype.interfaces_=function(){return[]};ao.prototype.getClass=function(){return ao};LI.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(ao,LI);var Ld=function(){this.tempEnv1=new ke,this.selectedSegment=new De};Ld.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}};Ld.prototype.interfaces_=function(){return[]};Ld.prototype.getClass=function(){return Ld};var Ef=function(){this._index=null;var e=arguments[0];this._index=e},PI={HotPixelSnapAction:{configurable:!0}};Ef.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2],i=t.getSafeEnvelope(),a=new MI(t,n,r);return this._index.query(i,{interfaces_:function(){return[Xl]},visitItem:function(h){var u=h;u.select(i,a)}}),a.isNodeAdded()}};Ef.prototype.interfaces_=function(){return[]};Ef.prototype.getClass=function(){return Ef};PI.HotPixelSnapAction.get=function(){return MI};Object.defineProperties(Ef,PI);var MI=function(e){function t(){e.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getContext();if(this._parentEdge!==null&&i===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,r)}else return e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ld),Lc=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new he};Lc.prototype.processIntersections=function(e,t,n,r){var i=this;if(e===n&&t===r)return null;var a=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],y=n.getCoordinates()[r+1];if(this._li.computeIntersection(a,h,u,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;t--){try{e.bufferReducedPrecision(t)}catch(a){if(a instanceof hl)e._saveException=a;else throw a}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=_i.precisionScaleFactor(this._argGeom,this._distance,n),i=new Pn(r);this.bufferFixedPrecision(i)}};_i.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Pn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};_i.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};_i.prototype.bufferOriginalPrecision=function(){try{var e=new Wi(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(t instanceof ul)this._saveException=t;else throw t}finally{}};_i.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};_i.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};_i.prototype.interfaces_=function(){return[]};_i.prototype.getClass=function(){return _i};_i.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new _i(e),r=n.getResultGeometry(t);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Fe&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],h=arguments[2],u=new _i(i);u.setQuadrantSegments(h);var y=u.getResultGeometry(a);return y}else if(arguments[2]instanceof Ln&&arguments[0]instanceof Fe&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],I=arguments[2],P=new _i(w,I),z=P.getResultGeometry(S);return z}}else if(arguments.length===4){var R=arguments[0],Y=arguments[1],Z=arguments[2],et=arguments[3],B=new _i(R);B.setQuadrantSegments(Z),B.setEndCapStyle(et);var j=B.getResultGeometry(Y);return j}};_i.precisionScaleFactor=function(e,t,n){var r=e.getEnvelopeInternal(),i=qo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),a=t>0?t:0,h=i+2*a,u=Math.trunc(Math.log(h)/Math.log(10)+1),y=n-u,w=Math.pow(10,y);return w};Uf.CAP_ROUND.get=function(){return Ln.CAP_ROUND};Uf.CAP_BUTT.get=function(){return Ln.CAP_FLAT};Uf.CAP_FLAT.get=function(){return Ln.CAP_FLAT};Uf.CAP_SQUARE.get=function(){return Ln.CAP_SQUARE};Uf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(_i,Uf);var Gi=function(){this._pt=[new Mt,new Mt],this._distance=He.NaN,this._isNull=!0};Gi.prototype.getCoordinates=function(){return this._pt};Gi.prototype.getCoordinate=function(e){return this._pt[e]};Gi.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(t,n),null;var r=t.distance(n);rthis._distance&&this.initialize(t,n,r)}};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};var Sa=function(){};Sa.prototype.interfaces_=function(){return[]};Sa.prototype.getClass=function(){return Sa};Sa.computeDistance=function(){if(arguments[2]instanceof Gi&&arguments[0]instanceof yr&&arguments[1]instanceof Mt)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=e.getCoordinates(),i=new De,a=0;a0||this._isIn?Dt.INTERIOR:Dt.EXTERIOR)};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};var qi=function e(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],n=arguments[1];e.call(this,t,e.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._component=r,this._segIndex=i,this._pt=a}},AI={INSIDE_AREA:{configurable:!0}};qi.prototype.isInsideArea=function(){return this._segIndex===qi.INSIDE_AREA};qi.prototype.getCoordinate=function(){return this._pt};qi.prototype.getGeometryComponent=function(){return this._component};qi.prototype.getSegmentIndex=function(){return this._segIndex};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};AI.INSIDE_AREA.get=function(){return-1};Object.defineProperties(qi,AI);var jl=function(e){this._pts=e||null};jl.prototype.filter=function(e){e instanceof Eo&&this._pts.add(e)};jl.prototype.interfaces_=function(){return[na]};jl.prototype.getClass=function(){return jl};jl.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof Eo?Ms.singletonList(e):jl.getPoints(e,new he)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof Eo?n.add(t):t instanceof Hi&&t.apply(new jl(n)),n}};var Mc=function(){this._locations=null;var e=arguments[0];this._locations=e};Mc.prototype.filter=function(e){(e instanceof Eo||e instanceof yr||e instanceof Wr)&&this._locations.add(new qi(e,0,e.getCoordinate()))};Mc.prototype.interfaces_=function(){return[na]};Mc.prototype.getClass=function(){return Mc};Mc.getLocations=function(e){var t=new he;return e.apply(new Mc(t)),t};var Ii=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ks,this._minDistanceLocation=null,this._minDistance=He.MAX_VALUE,arguments.length===2){var e=arguments[0],t=arguments[1];this._geom=[e,t],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Ii.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,a=sl.getPolygons(this._geom[n]);if(a.size()>0){var h=Mc.getLocations(this._geom[i]);if(this.computeContainmentDistance(h,a,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Be(arguments[0],Cs)&&Be(arguments[1],Cs)){for(var u=arguments[0],y=arguments[1],w=arguments[2],S=0;Sthis._minDistance)return null;for(var i=t.getCoordinates(),a=n.getCoordinate(),h=0;hthis._minDistance)return null;for(var z=S.getCoordinates(),R=I.getCoordinates(),Y=0;Ythis._distance&&this.initialize(t,n,r)}};Mi.prototype.interfaces_=function(){return[]};Mi.prototype.getClass=function(){return Mi};var Ys=function(){};Ys.prototype.interfaces_=function(){return[]};Ys.prototype.getClass=function(){return Ys};Ys.computeDistance=function(){if(arguments[2]instanceof Mi&&arguments[0]instanceof yr&&arguments[1]instanceof Mt)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=new De,i=e.getCoordinates(),a=0;a1||e<=0)throw new ir("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e};ss.prototype.compute=function(e,t){this.computeOrientedDistance(e,t,this._ptDist),this.computeOrientedDistance(t,e,this._ptDist)};ss.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ss.prototype.computeOrientedDistance=function(e,t,n){var r=new Ac(t);if(e.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new $l(t,this._densifyFrac);e.apply(i),n.setMaximum(i.getMaxPointDistance())}};ss.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ss.prototype.interfaces_=function(){return[]};ss.prototype.getClass=function(){return ss};ss.distance=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new ss(e,t);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],h=new ss(r,i);return h.setDensifyFraction(a),h.distance()}};Xv.MaxPointDistanceFilter.get=function(){return Ac};Xv.MaxDensifiedByFractionDistanceFilter.get=function(){return $l};Object.defineProperties(ss,Xv);var Ac=function(){this._maxPtDist=new Mi,this._minPtDist=new Mi,this._euclideanDist=new Ys,this._geom=null;var e=arguments[0];this._geom=e};Ac.prototype.filter=function(e){this._minPtDist.initialize(),Ys.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Ac.prototype.getMaxPointDistance=function(){return this._maxPtDist};Ac.prototype.interfaces_=function(){return[Pa]};Ac.prototype.getClass=function(){return Ac};var $l=function(){this._maxPtDist=new Mi,this._minPtDist=new Mi,this._geom=null,this._numSubSegs=0;var e=arguments[0],t=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/t))};$l.prototype.filter=function(e,t){var n=this;if(t===0)return null;for(var r=e.getCoordinate(t-1),i=e.getCoordinate(t),a=(i.x-r.x)/this._numSubSegs,h=(i.y-r.y)/this._numSubSegs,u=0;un){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=e.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ts.toLineString(i[0],i[1])+")"}};xo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=xo.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-t,this._maxValidDistance=e+t,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),xo.VERBOSE&&bi.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};xo.prototype.checkNegativeValid=function(){if(!(this._input instanceof Wr||this._input instanceof Ta||this._input instanceof Hi))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)};xo.prototype.getErrorIndicator=function(){return this._errorIndicator};xo.prototype.checkMinimumDistance=function(e,t,n){var r=new Ii(e,t,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&e>t&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Ci.prototype.report=function(e){if(!Ci.VERBOSE)return null;bi.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};Ci.prototype.getErrorMessage=function(){return this._errorMsg};Ci.prototype.interfaces_=function(){return[]};Ci.prototype.getClass=function(){return Ci};Ci.isValidMsg=function(e,t,n){var r=new Ci(e,t,n);return r.isValid()?null:r.getErrorMessage()};Ci.isValid=function(e,t,n){var r=new Ci(e,t,n);return!!r.isValid()};Kv.VERBOSE.get=function(){return!1};Kv.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Ci,Kv);var la=function(){this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};la.prototype.getCoordinates=function(){return this._pts};la.prototype.size=function(){return this._pts.length};la.prototype.getCoordinate=function(e){return this._pts[e]};la.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};la.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:Cc.octant(this.getCoordinate(e),this.getCoordinate(e+1))};la.prototype.setData=function(e){this._data=e};la.prototype.getData=function(){return this._data};la.prototype.toString=function(){return Ts.toLineString(new Ir(this._pts))};la.prototype.interfaces_=function(){return[ka]};la.prototype.getClass=function(){return la};var fi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new he,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};fi.prototype.getInteriorIntersection=function(){return this._interiorIntersection};fi.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};fi.prototype.getIntersectionSegments=function(){return this._intSegments};fi.prototype.count=function(){return this._intersectionCount};fi.prototype.getIntersections=function(){return this._intersections};fi.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};fi.prototype.setKeepIntersections=function(e){this._keepIntersections=e};fi.prototype.processIntersections=function(e,t,n,r){if(!this._findAllIntersections&&this.hasIntersection()||e===n&&t===r)return null;if(this._isCheckEndSegmentsOnly){var i=this.isEndSegment(e,t)||this.isEndSegment(n,r);if(!i)return null}var a=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],y=n.getCoordinates()[r+1];this._li.computeIntersection(a,h,u,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=a,this._intSegments[1]=h,this._intSegments[2]=u,this._intSegments[3]=y,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};fi.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};fi.prototype.hasIntersection=function(){return this._interiorIntersection!==null};fi.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};fi.prototype.interfaces_=function(){return[Ru]};fi.prototype.getClass=function(){return fi};fi.createAllIntersectionsFinder=function(e){var t=new fi(e);return t.setFindAllIntersections(!0),t};fi.createAnyIntersectionFinder=function(e){return new fi(e)};fi.createIntersectionCounter=function(e){var t=new fi(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Ds=function(){this._li=new ju,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Ds.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Ds.prototype.getIntersections=function(){return this._segInt.getIntersections()};Ds.prototype.isValid=function(){return this.execute(),this._isValid};Ds.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Ds.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new fi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new Hv;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Ds.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new hl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Ds.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ts.toLineString(e[0],e[1])+" and "+Ts.toLineString(e[2],e[3])};Ds.prototype.interfaces_=function(){return[]};Ds.prototype.getClass=function(){return Ds};Ds.computeIntersections=function(e){var t=new Ds(e);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()};var zu=function e(){this._nv=null;var t=arguments[0];this._nv=new Ds(e.toSegmentStrings(t))};zu.prototype.checkValid=function(){this._nv.checkValid()};zu.prototype.interfaces_=function(){return[]};zu.prototype.getClass=function(){return zu};zu.toSegmentStrings=function(e){for(var t=new he,n=e.iterator();n.hasNext();){var r=n.next();t.add(new la(r.getCoordinates(),r))}return t};zu.checkValid=function(e){var t=new zu(e);t.checkValid()};var kc=function(e){this._mapOp=e};kc.prototype.map=function(e){for(var t=this,n=new he,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};lo.prototype.interfaces_=function(){return[]};lo.prototype.getClass=function(){return lo};var Na=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new De,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof yr&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];e.call(this,t.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=e.isClosed(r),this._snapTolerance=i}};Na.prototype.snapVertices=function(e,t){for(var n=this,r=this._isClosed?e.size()-1:e.size(),i=0;i=0&&e.add(h+1,new Mt(a),!1)}};Na.prototype.findSegmentIndexToSnap=function(e,t){for(var n=this,r=He.MAX_VALUE,i=-1,a=0;at&&(t=r)}return t}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return Math.min(Cr.computeOverlaySnapTolerance(i),Cr.computeOverlaySnapTolerance(a))}};Cr.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),r=n*Cr.SNAP_PRECISION_FACTOR;return r};Cr.snapToSelf=function(e,t,n){var r=new Cr(e);return r.snapToSelf(t,n)};kI.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Cr,kI);var DI=function(e){function t(n,r,i){e.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,r){var i=new Na(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},t.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),a=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(a)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(lo),Vi=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Vi.prototype.getCommon=function(){return He.longBitsToDouble(this._commonBits)};Vi.prototype.add=function(e){var t=He.doubleToLongBits(e);if(this._isFirst)return this._commonBits=t,this._commonSignExp=Vi.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Vi.signExpBits(t);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Vi.numCommonMostSigMantissaBits(this._commonBits,t),this._commonBits=Vi.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Vi.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],t=He.longBitsToDouble(e),n=He.toBinaryString(e),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),a=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+t+" ]";return a}};Vi.prototype.interfaces_=function(){return[]};Vi.prototype.getClass=function(){return Vi};Vi.getBit=function(e,t){var n=1<>52};Vi.zeroLowerBits=function(e,t){var n=(1<=0;r--){if(Vi.getBit(e,r)!==Vi.getBit(t,r))return n;n++}return 52};var tu=function(){this._commonCoord=null,this._ccFilter=new Rc},Jv={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};tu.prototype.addCommonBits=function(e){var t=new eu(this._commonCoord);e.apply(t),e.geometryChanged()};tu.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var t=new Mt(this._commonCoord);t.x=-t.x,t.y=-t.y;var n=new eu(t);return e.apply(n),e.geometryChanged(),e};tu.prototype.getCommonCoordinate=function(){return this._commonCoord};tu.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};tu.prototype.interfaces_=function(){return[]};tu.prototype.getClass=function(){return tu};Jv.CommonCoordinateFilter.get=function(){return Rc};Jv.Translater.get=function(){return eu};Object.defineProperties(tu,Jv);var Rc=function(){this._commonBitsX=new Vi,this._commonBitsY=new Vi};Rc.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)};Rc.prototype.getCommonCoordinate=function(){return new Mt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Rc.prototype.interfaces_=function(){return[Pa]};Rc.prototype.getClass=function(){return Rc};var eu=function(){this.trans=null;var e=arguments[0];this.trans=e};eu.prototype.filter=function(e,t){var n=e.getOrdinate(t,0)+this.trans.x,r=e.getOrdinate(t,1)+this.trans.y;e.setOrdinate(t,0,n),e.setOrdinate(t,1,r)};eu.prototype.isDone=function(){return!1};eu.prototype.isGeometryChanged=function(){return!0};eu.prototype.interfaces_=function(){return[Ls]};eu.prototype.getClass=function(){return eu};var pi=function(e,t){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=t,this.computeSnapTolerance()};pi.prototype.selfSnap=function(e){var t=new Cr(e),n=t.snapTo(e,this._snapTolerance);return n};pi.prototype.removeCommonBits=function(e){this._cbr=new tu,this._cbr.add(e[0]),this._cbr.add(e[1]);var t=new Array(2).fill(null);return t[0]=this._cbr.removeCommonBits(e[0].copy()),t[1]=this._cbr.removeCommonBits(e[1].copy()),t};pi.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};pi.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=Je.overlayOp(t[0],t[1],e);return this.prepareResult(n)};pi.prototype.checkValid=function(e){e.isValid()||bi.out.println("Snapped geometry is invalid")};pi.prototype.computeSnapTolerance=function(){this._snapTolerance=Cr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};pi.prototype.snap=function(e){var t=this.removeCommonBits(e),n=Cr.snap(t[0],t[1],this._snapTolerance);return n};pi.prototype.interfaces_=function(){return[]};pi.prototype.getClass=function(){return pi};pi.overlayOp=function(e,t,n){var r=new pi(e,t);return r.getResultGeometry(n)};pi.union=function(e,t){return pi.overlayOp(e,t,Je.UNION)};pi.intersection=function(e,t){return pi.overlayOp(e,t,Je.INTERSECTION)};pi.symDifference=function(e,t){return pi.overlayOp(e,t,Je.SYMDIFFERENCE)};pi.difference=function(e,t){return pi.overlayOp(e,t,Je.DIFFERENCE)};var Yi=function(e,t){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=t};Yi.prototype.getResultGeometry=function(e){var t=null,n=!1,r=null;try{t=Je.overlayOp(this._geom[0],this._geom[1],e);var i=!0;i&&(n=!0)}catch(a){if(a instanceof ul)r=a;else throw a}finally{}if(!n)try{t=pi.overlayOp(this._geom[0],this._geom[1],e)}catch(a){throw a instanceof ul?r:a}finally{}return t};Yi.prototype.interfaces_=function(){return[]};Yi.prototype.getClass=function(){return Yi};Yi.overlayOp=function(e,t,n){var r=new Yi(e,t);return r.getResultGeometry(n)};Yi.union=function(e,t){return Yi.overlayOp(e,t,Je.UNION)};Yi.intersection=function(e,t){return Yi.overlayOp(e,t,Je.INTERSECTION)};Yi.symDifference=function(e,t){return Yi.overlayOp(e,t,Je.SYMDIFFERENCE)};Yi.difference=function(e,t){return Yi.overlayOp(e,t,Je.DIFFERENCE)};var Pd=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],t=arguments[1];this.mce=e,this.chainIndex=t};Pd.prototype.computeIntersections=function(e,t){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,t)};Pd.prototype.interfaces_=function(){return[]};Pd.prototype.getClass=function(){return Pd};var To=function e(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],n=arguments[1];this._eventType=e.DELETE,this._xValue=t,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._eventType=e.INSERT,this._label=r,this._xValue=i,this._obj=a}},Qv={INSERT:{configurable:!0},DELETE:{configurable:!0}};To.prototype.isDelete=function(){return this._eventType===To.DELETE};To.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};To.prototype.getObject=function(){return this._obj};To.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};To.prototype.getInsertEvent=function(){return this._insertEvent};To.prototype.isInsert=function(){return this._eventType===To.INSERT};To.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};To.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};To.prototype.interfaces_=function(){return[hs]};To.prototype.getClass=function(){return To};Qv.INSERT.get=function(){return 1};Qv.DELETE.get=function(){return 2};Object.defineProperties(To,Qv);var Qg=function(){};Qg.prototype.interfaces_=function(){return[]};Qg.prototype.getClass=function(){return Qg};var Ti=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._li=e,this._includeProper=t,this._recordIsolated=n};Ti.prototype.isTrivialIntersection=function(e,t,n,r){if(e===n&&this._li.getIntersectionNum()===1){if(Ti.isAdjacentSegments(t,r))return!0;if(e.isClosed()){var i=e.getNumPoints()-1;if(t===0&&r===i||r===0&&t===i)return!0}}return!1};Ti.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Ti.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};Ti.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Ti.prototype.isBoundaryPointInternal=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(e.isIntersection(i))return!0}return!1};Ti.prototype.hasProperIntersection=function(){return this._hasProper};Ti.prototype.hasIntersection=function(){return this._hasIntersection};Ti.prototype.isDone=function(){return this._isDone};Ti.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};Ti.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};Ti.prototype.addIntersections=function(e,t,n,r){if(e===n&&t===r)return null;this.numTests++;var i=e.getCoordinates()[t],a=e.getCoordinates()[t+1],h=n.getCoordinates()[r],u=n.getCoordinates()[r+1];this._li.computeIntersection(i,a,h,u),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,t,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,t,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};Ti.prototype.interfaces_=function(){return[]};Ti.prototype.getClass=function(){return Ti};Ti.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var kD=function(e){function t(){e.call(this),this.events=new he,this.nOverlaps=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;Ms.sort(this.events);for(var r=0;rt||this._maxa?1:0};Md.prototype.interfaces_=function(){return[ff]};Md.prototype.getClass=function(){return Md};var DD=function(e){function t(){e.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Oa),RD=function(e){function t(){e.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},t.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,i),this._node2!==null&&this._node2.query(n,r,i)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Oa),za=function(){this._leaves=new he,this._root=null,this._level=0};za.prototype.buildTree=function(){var e=this;Ms.sort(this._leaves,new Oa.NodeComparator);for(var t=this._leaves,n=null,r=new he;;){if(e.buildLevel(t,r),r.size()===1)return r.get(0);n=t,t=r,r=n}};za.prototype.insert=function(e,t,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new DD(e,t,n))};za.prototype.query=function(e,t,n){this.init(),this._root.query(e,t,n)};za.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};za.prototype.printNode=function(e){bi.out.println(Ts.toLineString(new Mt(e._min,this._level),new Mt(e._max,this._level)))};za.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};za.prototype.buildLevel=function(e,t){this._level++,t.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,a=n.iterator();a.hasNext();){var h=a.next();r[i++]=h.getCoordinate().copy()}return r},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===Dt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},t.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var a=dn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var h=r,u=i;be.isCCW(a)&&(h=i,u=r);var y=new Jg(a,new Nn(this._argIndex,Dt.BOUNDARY,h,u));this._lineEdgeMap.put(n,y),this.insertEdge(y),this.insertPoint(this._argIndex,a[0],Dt.BOUNDARY)},t.prototype.insertPoint=function(n,r,i){var a=this._nodes.addNode(r),h=a.getLabel();h===null?a._label=new Nn(n,i):h.setLocation(n,i)},t.prototype.createEdgeSetIntersector=function(){return new kD},t.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var a=i.next(),h=a.getLabel().getLocation(n),u=a.eiList.iterator();u.hasNext();){var y=u.next();r.addSelfIntersectionNode(n,y.coord,h)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Ta&&(this._useBoundaryDeterminationRule=!1),n instanceof Wr)this.addPolygon(n);else if(n instanceof yr)this.addLineString(n);else if(n instanceof Eo)this.addPoint(n);else if(n instanceof vf)this.addCollection(n);else if(n instanceof Au)this.addCollection(n);else if(n instanceof Ta)this.addCollection(n);else if(n instanceof Hi)this.addCollection(n);else throw new Error(n.getClass().getName())}else return e.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new Cf(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return e.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,r){return n.isInBoundary(r)?Dt.BOUNDARY:Dt.INTERIOR},t}(cr),Lf=function(){if(this._li=new ju,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Kp(0,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=ls.OGC_SFS_BOUNDARY_RULE;t.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Kp(0,t,r),this._arg[1]=new Kp(1,n,r)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],h=arguments[2];i.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Kp(0,i,h),this._arg[1]=new Kp(1,a,h)}};Lf.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()};Lf.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)};Lf.prototype.interfaces_=function(){return[]};Lf.prototype.getClass=function(){return Lf};var Pu=function(){};Pu.prototype.interfaces_=function(){return[]};Pu.prototype.getClass=function(){return Pu};Pu.map=function(){if(arguments[0]instanceof Fe&&Be(arguments[1],Pu.MapOp)){for(var e=arguments[0],t=arguments[1],n=new he,r=0;r=e.size()?null:e.get(t)};Rr.union=function(e){var t=new Rr(e);return t.union()};OI.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Rr,OI);var $g=function(){};$g.prototype.interfaces_=function(){return[]};$g.prototype.getClass=function(){return $g};$g.union=function(e,t){if(e.isEmpty()||t.isEmpty()){if(e.isEmpty()&&t.isEmpty())return Je.createEmptyResult(Je.UNION,e,t,e.getFactory());if(e.isEmpty())return t.copy();if(t.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(t),Yi.overlayOp(e,t,Je.UNION)};function Wu(){return new ty}function ty(){this.reset()}ty.prototype={constructor:ty,reset:function(){this.s=this.t=0},add:function(e){qw(sg,e,this.t),qw(this,sg.s,this.s),this.s?this.t+=sg.t:this.s=sg.t},valueOf:function(){return this.s}};var sg=new ty;function qw(e,t,n){var r=e.s=t+n,i=r-t,a=r-i;e.t=t-a+(n-i)}var gr=1e-6,qn=Math.PI,ol=qn/2,jw=qn/4,dl=qn*2,Su=180/qn,Zs=qn/180,ji=Math.abs,ND=Math.atan,Mf=Math.atan2,Gr=Math.cos,qr=Math.sin,Gf=Math.sqrt;function zI(e){return e>1?0:e<-1?qn:Math.acos(e)}function Nc(e){return e>1?ol:e<-1?-ol:Math.asin(e)}function ed(){}function ey(e,t){e&&Hw.hasOwnProperty(e.type)&&Hw[e.type](e,t)}var Ww={Feature:function(e,t){ey(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++rqn?e-dl:e<-qn?e+dl:e,t]}ev.invert=ev;function zD(e,t,n){return(e%=dl)?t||n?FI(Yw(e),Kw(t,n)):Yw(e):t||n?Kw(t,n):ev}function Xw(e){return function(t,n){return t+=e,[t>qn?t-dl:t<-qn?t+dl:t,n]}}function Yw(e){var t=Xw(e);return t.invert=Xw(-e),t}function Kw(e,t){var n=Gr(e),r=qr(e),i=Gr(t),a=qr(t);function h(u,y){var w=Gr(y),S=Gr(u)*w,I=qr(u)*w,P=qr(y),z=P*n+S*r;return[Mf(I*i-z*a,S*n-P*r),Nc(z*i+I*a)]}return h.invert=function(u,y){var w=Gr(y),S=Gr(u)*w,I=qr(u)*w,P=qr(y),z=P*i-I*a;return[Mf(I*i+P*a,S*n+z*r),Nc(z*n-S*r)]},h}function FD(e,t,n,r,i,a){if(n){var h=Gr(t),u=qr(t),y=r*n;i==null?(i=t+r*dl,a=t-y/2):(i=Jw(h,i),a=Jw(h,a),(r>0?ia)&&(i+=r*dl));for(var w,S=i;r>0?S>a:S1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function BD(e,t,n,r,i,a){var h=e[0],u=e[1],y=t[0],w=t[1],S=0,I=1,P=y-h,z=w-u,R;if(R=n-h,!(!P&&R>0)){if(R/=P,P<0){if(R0){if(R>I)return;R>S&&(S=R)}if(R=i-h,!(!P&&R<0)){if(R/=P,P<0){if(R>I)return;R>S&&(S=R)}else if(P>0){if(R0)){if(R/=z,z<0){if(R0){if(R>I)return;R>S&&(S=R)}if(R=a-u,!(!z&&R<0)){if(R/=z,z<0){if(R>I)return;R>S&&(S=R)}else if(z>0){if(R0&&(e[0]=h+S*P,e[1]=u+S*z),I<1&&(t[0]=h+I*P,t[1]=u+I*z),!0}}}}}function Eg(e,t){return ji(e[0]-t[0])=0;--u)i.point((I=S[u])[0],I[1]);else r(P.x,P.p.x,-1,i);P=P.p}P=P.o,S=P.z,z=!z}while(!P.v);i.lineEnd()}}}function Qw(e){if(t=e.length){for(var t,n=0,r=e[0],i;++nt?1:e>=t?0:NaN}function VD(e){return e.length===1&&(e=UD(e)),{left:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[a],n)<0?r=a+1:i=a}return r},right:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[a],n)>0?i=a:r=a+1}return r}}}function UD(e){return function(t,n){return UI(e(t),n)}}VD(UI);function GI(e){for(var t=e.length,n,r=-1,i=0,a,h;++r=0;)for(h=e[t],n=h.length;--n>=0;)a[--i]=h[n];return a}var nd=1e9,cg=-nd;function GD(e,t,n,r){function i(w,S){return e<=w&&w<=n&&t<=S&&S<=r}function a(w,S,I,P){var z=0,R=0;if(w==null||(z=h(w,I))!==(R=h(S,I))||y(w,S)<0^I>0)do P.point(z===0||z===3?e:n,z>1?r:t);while((z=(z+I+4)%4)!==R);else P.point(S[0],S[1])}function h(w,S){return ji(w[0]-e)0?0:3:ji(w[0]-n)0?2:1:ji(w[1]-t)0?1:0:S>0?3:2}function u(w,S){return y(w.x,S.x)}function y(w,S){var I=h(w,1),P=h(S,1);return I!==P?I-P:I===0?S[1]-w[1]:I===1?w[0]-S[0]:I===2?w[1]-S[1]:S[0]-w[0]}return function(w){var S=w,I=BI(),P,z,R,Y,Z,et,B,j,q,ct,_t,lt={point:ht,lineStart:gt,lineEnd:Kt,polygonStart:Tt,polygonEnd:Q};function ht(Ut,ee){i(Ut,ee)&&S.point(Ut,ee)}function pt(){for(var Ut=0,ee=0,Gt=z.length;eer&&(Cn-Pe)*(r-cn)>(mn-cn)*(e-Pe)&&++Ut:mn<=r&&(Cn-Pe)*(r-cn)<(mn-cn)*(e-Pe)&&--Ut;return Ut}function Tt(){S=I,P=[],z=[],_t=!0}function Q(){var Ut=pt(),ee=_t&&Ut,Gt=(P=GI(P)).length;(ee||Gt)&&(w.polygonStart(),ee&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),Gt&&VI(P,u,Ut,a,w),w.polygonEnd()),S=w,P=z=R=null}function gt(){lt.point=bt,z&&z.push(R=[]),ct=!0,q=!1,B=j=NaN}function Kt(){P&&(bt(Y,Z),et&&q&&I.rejoin(),P.push(I.result())),lt.point=ht,q&&S.lineEnd()}function bt(Ut,ee){var Gt=i(Ut,ee);if(z&&R.push([Ut,ee]),ct)Y=Ut,Z=ee,et=Gt,ct=!1,Gt&&(S.lineStart(),S.point(Ut,ee));else if(Gt&&q)S.point(Ut,ee);else{var Re=[B=Math.max(cg,Math.min(nd,B)),j=Math.max(cg,Math.min(nd,j))],xe=[Ut=Math.max(cg,Math.min(nd,Ut)),ee=Math.max(cg,Math.min(nd,ee))];BD(Re,xe,e,t,n,r)?(q||(S.lineStart(),S.point(Re[0],Re[1])),S.point(xe[0],xe[1]),Gt||S.lineEnd(),_t=!1):Gt&&(S.lineStart(),S.point(Ut,ee),_t=!1)}B=Ut,j=ee,q=Gt}return lt}}var h0=Wu();function qD(e,t){var n=t[0],r=t[1],i=[qr(n),-Gr(n),0],a=0,h=0;h0.reset();for(var u=0,y=e.length;u=0?1:-1,ht=lt*_t,pt=ht>qn,Tt=R*q;if(h0.add(Mf(Tt*lt*qr(ht),Y*ct+Tt*Gr(ht))),a+=pt?_t+lt*dl:_t,pt^P>=n^B>=n){var Q=ny(Af(I),Af(et));tv(Q);var gt=ny(i,Q);tv(gt);var Kt=(pt^_t>=0?-1:1)*Nc(gt[2]);(r>Kt||r===Kt&&(Q[0]||Q[1]))&&(h+=pt^_t>=0?1:-1)}}return(a<-gr||aAd&&(Ad=e),tiy&&(iy=t)}Wu();function qI(e,t,n,r){return function(i,a){var h=t(a),u=i.invert(r[0],r[1]),y=BI(),w=t(y),S=!1,I,P,z,R={point:Y,lineStart:et,lineEnd:B,polygonStart:function(){R.point=j,R.lineStart=q,R.lineEnd=ct,P=[],I=[]},polygonEnd:function(){R.point=Y,R.lineStart=et,R.lineEnd=B,P=GI(P);var _t=qD(I,u);P.length?(S||(a.polygonStart(),S=!0),VI(P,HD,_t,n,a)):_t&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),P=I=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function Y(_t,lt){var ht=i(_t,lt);e(_t=ht[0],lt=ht[1])&&a.point(_t,lt)}function Z(_t,lt){var ht=i(_t,lt);h.point(ht[0],ht[1])}function et(){R.point=Z,h.lineStart()}function B(){R.point=Y,h.lineEnd()}function j(_t,lt){z.push([_t,lt]);var ht=i(_t,lt);w.point(ht[0],ht[1])}function q(){w.lineStart(),z=[]}function ct(){j(z[0][0],z[0][1]),w.lineEnd();var _t=w.clean(),lt=y.result(),ht,pt=lt.length,Tt,Q,gt;if(z.pop(),I.push(z),z=null,!!pt){if(_t&1){if(Q=lt[0],(Tt=Q.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),ht=0;ht1&&_t&2&<.push(lt.pop().concat(lt.shift())),P.push(lt.filter(WD))}}return R}}function WD(e){return e.length>1}function HD(e,t){return((e=e.x)[0]<0?e[1]-ol-gr:ol-e[1])-((t=t.x)[0]<0?t[1]-ol-gr:ol-t[1])}const e2=qI(function(){return!0},ZD,YD,[-qn,-ol]);function ZD(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,h){var u=a>0?qn:-qn,y=ji(a-t);ji(y-qn)0?ol:-ol),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(u,n),e.point(a,n),i=0):r!==u&&y>=qn&&(ji(t-r)gr?ND((qr(t)*(a=Gr(r))*qr(n)-qr(r)*(i=Gr(t))*qr(e))/(i*a*h)):(t+r)/2}function YD(e,t,n,r){var i;if(e==null)i=n*ol,r.point(-qn,i),r.point(0,i),r.point(qn,i),r.point(qn,0),r.point(qn,-i),r.point(0,-i),r.point(-qn,-i),r.point(-qn,0),r.point(-qn,i);else if(ji(e[0]-t[0])>gr){var a=e[0]0,i=ji(n)>gr;function a(S,I,P,z){FD(z,e,t,P,S,I)}function h(S,I){return Gr(S)*Gr(I)>n}function u(S){var I,P,z,R,Y;return{lineStart:function(){R=z=!1,Y=1},point:function(Z,et){var B=[Z,et],j,q=h(Z,et),ct=r?q?0:w(Z,et):q?w(Z+(Z<0?qn:-qn),et):0;if(!I&&(R=z=q)&&S.lineStart(),q!==z&&(j=y(I,B),(!j||Eg(I,j)||Eg(B,j))&&(B[0]+=gr,B[1]+=gr,q=h(B[0],B[1]))),q!==z)Y=0,q?(S.lineStart(),j=y(B,I),S.point(j[0],j[1])):(j=y(I,B),S.point(j[0],j[1]),S.lineEnd()),I=j;else if(i&&I&&r^q){var _t;!(ct&P)&&(_t=y(B,I,!0))&&(Y=0,r?(S.lineStart(),S.point(_t[0][0],_t[0][1]),S.point(_t[1][0],_t[1][1]),S.lineEnd()):(S.point(_t[1][0],_t[1][1]),S.lineEnd(),S.lineStart(),S.point(_t[0][0],_t[0][1])))}q&&(!I||!Eg(I,B))&&S.point(B[0],B[1]),I=B,z=q,P=ct},lineEnd:function(){z&&S.lineEnd(),I=null},clean:function(){return Y|(R&&z)<<1}}}function y(S,I,P){var z=Af(S),R=Af(I),Y=[1,0,0],Z=ny(z,R),et=ag(Z,Z),B=Z[0],j=et-B*B;if(!j)return!P&&S;var q=n*et/j,ct=-n*B/j,_t=ny(Y,Z),lt=lg(Y,q),ht=lg(Z,ct);c0(lt,ht);var pt=_t,Tt=ag(lt,pt),Q=ag(pt,pt),gt=Tt*Tt-Q*(ag(lt,lt)-1);if(!(gt<0)){var Kt=Gf(gt),bt=lg(pt,(-Tt-Kt)/Q);if(c0(bt,lt),bt=$0(bt),!P)return bt;var Ut=S[0],ee=I[0],Gt=S[1],Re=I[1],xe;ee0^bt[1]<(ji(bt[0]-Ut)qn^(Ut<=bt[0]&&bt[0]<=ee)){var cn=lg(pt,(-Tt+Kt)/Q);return c0(cn,lt),[bt,$0(cn)]}}}function w(S,I){var P=r?e:qn-e,z=0;return S<-P?z|=1:S>P&&(z|=2),I<-P?z|=4:I>P&&(z|=8),z}return qI(h,u,a,r?[0,-e]:[-qn,e-qn])}function jI(e){return function(t){var n=new nv;for(var r in e)n[r]=e[r];return n.stream=t,n}}function nv(){}nv.prototype={constructor:nv,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function WI(e,t,n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),a!=null&&e.clipExtent(null),OD(n,e.stream(t2));var h=t2.result(),u=Math.min(r/(h[1][0]-h[0][0]),i/(h[1][1]-h[0][1])),y=+t[0][0]+(r-u*(h[1][0]+h[0][0]))/2,w=+t[0][1]+(i-u*(h[1][1]+h[0][1]))/2;return a!=null&&e.clipExtent(a),e.scale(u*150).translate([y,w])}function JD(e,t,n){return WI(e,[[0,0],t],n)}var n2=16,QD=Gr(30*Zs);function r2(e,t){return+t?tR(e,t):$D(e)}function $D(e){return jI({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function tR(e,t){function n(r,i,a,h,u,y,w,S,I,P,z,R,Y,Z){var et=w-r,B=S-i,j=et*et+B*B;if(j>4*t&&Y--){var q=h+P,ct=u+z,_t=y+R,lt=Gf(q*q+ct*ct+_t*_t),ht=Nc(_t/=lt),pt=ji(ji(_t)-1)t||ji((et*Kt+B*bt)/j-.5)>.3||h*P+u*z+y*R2?bt[2]%360*Zs:0,gt()):[w*Su,S*Su,I*Su]},pt.precision=function(bt){return arguments.length?(_t=r2(Q,ct=bt*bt),Kt()):Gf(ct)},pt.fitExtent=function(bt,Ut){return WI(pt,bt,Ut)},pt.fitSize=function(bt,Ut){return JD(pt,bt,Ut)};function gt(){z=FI(P=zD(w,S,I),t);var bt=t(u,y);return a=r-bt[0]*n,h=i+bt[1]*n,Kt()}function Kt(){return lt=ht=null,pt}return function(){return t=e.apply(this,arguments),pt.invert=t.invert&&Tt,gt()}}function HI(e){return function(t,n){var r=Gr(t),i=Gr(n),a=e(r*i);return[a*i*qr(t),a*qr(n)]}}function ZI(e){return function(t,n){var r=Gf(t*t+n*n),i=e(r),a=qr(i),h=Gr(i);return[Mf(t*a,r*h),Nc(r&&n*a/r)]}}var iR=HI(function(e){return Gf(2/(1+e))});iR.invert=ZI(function(e){return 2*Nc(e/2)});var XI=HI(function(e){return(e=zI(e))&&e/qr(e)});XI.invert=ZI(function(e){return e});function oR(){return nR(XI).scale(79.4188).clipAngle(180-.001)}function i2(e,t){return[e,t]}i2.invert=i2;function sR(e,t,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!e)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var a=[];switch(e.type){case"GeometryCollection":return uI(e,function(h){var u=Ig(h,t,r,i);u&&a.push(u)}),Y0(a);case"FeatureCollection":return Fw(e,function(h){var u=Ig(h,t,r,i);u&&Fw(u,function(y){y&&a.push(y)})}),Y0(a)}return Ig(e,t,r,i)}function Ig(e,t,n,r){var i=e.properties||{},a=e.type==="Feature"?e.geometry:e;if(a.type==="GeometryCollection"){var h=[];return uI(e,function(Y){var Z=Ig(Y,t,n,r);Z&&h.push(Z)}),Y0(h)}var u=aR(a),y={type:a.type,coordinates:KI(a.coordinates,u)},w=new Wv,S=w.read(y),I=dD(mD(t,n),"meters"),P=_i.bufferOp(S,I,r),z=new vI;if(P=z.write(P),!YI(P.coordinates)){var R={type:P.type,coordinates:JI(P.coordinates,u)};return yy(R,i)}}function YI(e){return Array.isArray(e[0])?YI(e[0]):isNaN(e[0])}function KI(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return KI(n,t)})}function JI(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return JI(n,t)})}function aR(e){var t=yD(e).geometry.coordinates,n=[-t[0],-t[1]];return oR().rotate(n).scale(Fo)}function lR(e,t){var n=Xg(e),r=Xg(t),i=e.properties||{},a=iI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?sI(a[0],i):aI(a,i)}function o2(e){let t;for(const n of e)t&&n[0]-t[0]>=180?n[0]-=360:t&&n[0]-t[0]<-180&&(n[0]+=360),t=n}function s2(e,t){const n=lR({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const r=sR(e,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)o2(i);else for(const i of r.geometry.coordinates)for(const a of i)o2(a);t({type:"FeatureCollection",features:[r,n]})}let a2={type:"FeatureCollection",features:[]};function uR(e,t,n=!0,r=!0,i={},a={},h={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let u,y=[],w,S;function I(){(h!=null&&h.fill||h!=null&&h.line)&&e.addSource("full-geom",{type:"geojson",data:a2}),h!=null&&h.fill&&e.addLayer({...h==null?void 0:h.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),h!=null&&h.line&&e.addLayer({...h==null?void 0:h.line,id:"full-geom-line",type:"line",source:"full-geom"})}e.loaded()?I():e.once("load",()=>{I()});const P=R=>{u==null||u({type:"mapClick",coordinates:[R.lngLat.lng,R.lngLat.lat]})};function z(R=!1){if(!t)throw new Error;const Y=document.createElement("div");return R&&Y.classList.add("marker-interactive"),new F4({props:{displayIn:"maplibre"},target:Y}),new t.Marker({element:Y,offset:[1,-13]})}return{setEventHandler(R){R?(u=R,e.on("click",P)):(u=void 0,e.off("click",P))},flyTo(R,Y){e.flyTo({center:R,zoom:Y,...i})},fitBounds(R,Y,Z){e.fitBounds([[R[0],R[1]],[R[2],R[3]]],{padding:Y,maxZoom:Z,...a})},indicateReverse(R){e.getCanvasContainer().style.cursor=R?"crosshair":""},setReverseMarker(R){!t||!n||(S?R?S.setLngLat(R):(S.remove(),S=void 0):R&&(S=(typeof n=="object"?new t.Marker(n):z()).setLngLat(R).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(R,Y){if(!n)return;function Z(et){var B;(B=e.getSource("full-geom"))==null||B.setData(et)}for(const et of y)et.remove();if(y.length=0,Z(a2),!!t){if(Y){let et=!1;if(Y.geometry.type==="GeometryCollection"){const B=Y.geometry.geometries.filter(j=>j.type==="Polygon"||j.type==="MultiPolygon");if(B.length>0){let j=B.pop();for(const q of B)j=gD(j,q);s2({...Y,geometry:j},Z),et=!0}else{const j=Y.geometry.geometries.filter(q=>q.type==="LineString"||q.type==="MultiLineString");j.length>0&&(Z({...Y,geometry:{type:"GeometryCollection",geometries:j}}),et=!0)}}if(!et){if(Y.geometry.type==="Polygon"||Y.geometry.type==="MultiPolygon")s2(Y,Z);else if(Y.geometry.type==="LineString"||Y.geometry.type==="MultiLineString"){Z(Y);return}}n&&y.push((typeof n=="object"?new t.Marker(n):z()).setLngLat(Y.center).addTo(e))}if(r)for(const et of R??[]){if(et===Y)continue;const B=(typeof r=="object"?new t.Marker(r):z(!0)).setLngLat(et.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(et.place_type[0]==="reverse"?et.place_name:et.place_name.replace(/,.*/,""))).addTo(e),j=B.getElement();j.addEventListener("click",q=>{q.stopPropagation(),u==null||u({type:"markerClick",id:et.id})}),j.addEventListener("mouseenter",()=>{u==null||u({type:"markerMouseEnter",id:et.id}),B.togglePopup()}),j.addEventListener("mouseleave",()=>{u==null||u({type:"markerMouseLeave",id:et.id}),B.togglePopup()}),y.push(B)}}},setSelectedMarker(R){w&&w.getElement().classList.toggle("marker-selected",!1),w=R>-1?y[R]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const R=e.getCenter();return[e.getZoom(),R.lng,R.lat]}}}function cR(e){let t,n;return{c(){t=ql("svg"),n=ql("path"),Zt(n,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),Zt(t,"viewBox","0 0 14 14"),Zt(t,"width","13"),Zt(t,"height","13"),Zt(t,"class","svelte-en2qvf")},m(r,i){Vt(r,t,i),Ot(t,n)},p:Se,i:Se,o:Se,d(r){r&&Bt(t)}}}class QI extends an{constructor(t){super(),sn(this,t,null,cR,Ze,{})}}function hR(e){let t,n;return{c(){t=ql("svg"),n=ql("path"),Zt(n,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),Zt(t,"viewBox","0 0 30 30"),Zt(t,"fill","none"),Zt(t,"xmlns","http://www.w3.org/2000/svg"),Zt(t,"class","svelte-d2loi5")},m(r,i){Vt(r,t,i),Ot(t,n)},p:Se,i:Se,o:Se,d(r){r&&Bt(t)}}}class $I extends an{constructor(t){super(),sn(this,t,null,hR,Ze,{})}}function fR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"area.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"area.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function pR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"reverse.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"reverse.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function dR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"poi.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"poi.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function mR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"postal_code.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"postal_code.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function gR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"street.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"street.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function yR(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"road.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"road.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function _R(e){let t,n;return{c(){t=jt("img"),wo(t.src,n=e[3]+"housenumber.svg")||Zt(t,"src",n),Zt(t,"alt",e[6]),Zt(t,"class","svelte-ltkwvy")},m(r,i){Vt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"housenumber.svg")&&Zt(t,"src",n),i&64&&Zt(t,"alt",r[6])},d(r){r&&Bt(t)}}}function vR(e){let t,n,r,i;return{c(){t=jt("img"),wo(t.src,n=e[5])||Zt(t,"src",n),Zt(t,"alt",e[4]),Zt(t,"class","svelte-ltkwvy")},m(a,h){Vt(a,t,h),r||(i=We(t,"error",e[14]),r=!0)},p(a,h){h&32&&!wo(t.src,n=a[5])&&Zt(t,"src",n),h&16&&Zt(t,"alt",a[4])},d(a){a&&Bt(t),r=!1,i()}}}function l2(e){let t,n;return{c(){t=jt("span"),n=un(e[6]),Zt(t,"class","secondary svelte-ltkwvy")},m(r,i){Vt(r,t,i),Ot(t,n)},p(r,i){i&64&&Nr(n,r[6])},d(r){r&&Bt(t)}}}function bR(e){var lt,ht;let t,n,r,i,a,h,u,y,w=(e[7]?e[0].place_name:e[0].place_name.replace(/,.*/,""))+"",S,I,P=e[2]==="always"||e[2]&&!e[0].address&&((lt=e[0].properties)==null?void 0:lt.kind)!=="road"&&((ht=e[0].properties)==null?void 0:ht.kind)!=="road_relation"&&!e[0].id.startsWith("address.")&&!e[0].id.startsWith("postal_code.")&&(!e[0].id.startsWith("poi.")||!e[5])&&!e[7],z,R,Y=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",Z,et,B;function j(pt,Tt){var Q,gt;return Tt&1&&(n=null),Tt&1&&(r=null),Tt&1&&(i=null),pt[5]?vR:pt[0].address?_R:((Q=pt[0].properties)==null?void 0:Q.kind)==="road"||((gt=pt[0].properties)==null?void 0:gt.kind)==="road_relation"?yR:(n==null&&(n=!!pt[0].id.startsWith("address.")),n?gR:(r==null&&(r=!!pt[0].id.startsWith("postal_code.")),r?mR:(i==null&&(i=!!pt[0].id.startsWith("poi.")),i?dR:pt[7]?pR:fR)))}let q=j(e,-1),ct=q(e),_t=P&&l2(e);return{c(){t=jt("li"),ct.c(),a=fe(),h=jt("span"),u=jt("span"),y=jt("span"),S=un(w),I=fe(),_t&&_t.c(),z=fe(),R=jt("span"),Z=un(Y),Zt(y,"class","primary svelte-ltkwvy"),Zt(u,"class","svelte-ltkwvy"),Zt(R,"class","line2 svelte-ltkwvy"),Zt(h,"class","texts svelte-ltkwvy"),Zt(t,"tabindex","0"),Zt(t,"data-selected",e[1]),Zt(t,"class","svelte-ltkwvy"),il(t,"selected",e[1])},m(pt,Tt){Vt(pt,t,Tt),ct.m(t,null),Ot(t,a),Ot(t,h),Ot(h,u),Ot(u,y),Ot(y,S),Ot(u,I),_t&&_t.m(u,null),Ot(h,z),Ot(h,R),Ot(R,Z),et||(B=[We(t,"mouseenter",e[12]),We(t,"focus",e[13])],et=!0)},p(pt,[Tt]){var Q,gt;q===(q=j(pt,Tt))&&ct?ct.p(pt,Tt):(ct.d(1),ct=q(pt),ct&&(ct.c(),ct.m(t,a))),Tt&1&&w!==(w=(pt[7]?pt[0].place_name:pt[0].place_name.replace(/,.*/,""))+"")&&Nr(S,w),Tt&37&&(P=pt[2]==="always"||pt[2]&&!pt[0].address&&((Q=pt[0].properties)==null?void 0:Q.kind)!=="road"&&((gt=pt[0].properties)==null?void 0:gt.kind)!=="road_relation"&&!pt[0].id.startsWith("address.")&&!pt[0].id.startsWith("postal_code.")&&(!pt[0].id.startsWith("poi.")||!pt[5])&&!pt[7]),P?_t?_t.p(pt,Tt):(_t=l2(pt),_t.c(),_t.m(u,null)):_t&&(_t.d(1),_t=null),Tt&1&&Y!==(Y=(pt[7]?"":pt[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Nr(Z,Y),Tt&2&&Zt(t,"data-selected",pt[1]),Tt&2&&il(t,"selected",pt[1])},i:Se,o:Se,d(pt){pt&&Bt(t),ct.d(),_t&&_t.d(),et=!1,Ri(B)}}}function xR(e,t,n){var j;let r,i,{feature:a}=t,{selected:h=!1}=t,{showPlaceType:u}=t,{missingIconsCache:y}=t,{iconsBaseUrl:w}=t;const S=(j=a.properties)==null?void 0:j.categories;let I,P,z=0,R=a.place_type[0]==="reverse";function Y(q){P&&y.add(P),n(10,z++,z)}function Z(q){En.call(this,e,q)}function et(q){En.call(this,e,q)}const B=q=>Y(q.currentTarget);return e.$$set=q=>{"feature"in q&&n(0,a=q.feature),"selected"in q&&n(1,h=q.selected),"showPlaceType"in q&&n(2,u=q.showPlaceType),"missingIconsCache"in q&&n(9,y=q.missingIconsCache),"iconsBaseUrl"in q&&n(3,w=q.iconsBaseUrl)},e.$$.update=()=>{var q,ct,_t,lt;if(e.$$.dirty&3640)do n(11,r--,r),n(4,I=S==null?void 0:S[r]),n(5,P=I?w+I.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!P||y.has(P)));e.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?(ct=(q=a.properties)==null?void 0:q.categories)==null?void 0:ct.join(", "):((lt=(_t=a.properties)==null?void 0:_t.place_type_name)==null?void 0:lt[0])??a.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[a,h,u,w,I,P,i,R,Y,y,z,r,Z,et,B]}class wR extends an{constructor(t){super(),sn(this,t,xR,bR,Ze,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function SR(e){let t;return{c(){t=jt("div"),t.innerHTML='',Zt(t,"class","svelte-7cmwmc")},m(n,r){Vt(n,t,r)},p:Se,i:Se,o:Se,d(n){n&&Bt(t)}}}class ER extends an{constructor(t){super(),sn(this,t,null,SR,Ze,{})}}function IR(e){let t,n;return{c(){t=ql("svg"),n=ql("path"),Zt(n,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),Zt(t,"viewBox","0 0 60.006 21.412"),Zt(t,"width","14"),Zt(t,"height","20"),Zt(t,"class","svelte-en2qvf")},m(r,i){Vt(r,t,i),Ot(t,n)},p:Se,i:Se,o:Se,d(r){r&&Bt(t)}}}class CR extends an{constructor(t){super(),sn(this,t,null,IR,Ze,{})}}function TR(e){let t,n,r;return{c(){t=ql("svg"),n=ql("circle"),r=ql("path"),Zt(n,"cx","4.789"),Zt(n,"cy","4.787"),Zt(n,"r","3.85"),Ui(n,"stroke-width","1.875"),Ui(n,"fill","none"),Zt(r,"d","M12.063 12.063 7.635 7.635"),Ui(r,"stroke-width","1.875"),Ui(r,"stroke-linecap","round"),Zt(t,"xmlns","http://www.w3.org/2000/svg"),Zt(t,"width","13"),Zt(t,"height","13"),Zt(t,"viewBox","0 0 13 13"),Zt(t,"class","svelte-1bpbt60")},m(i,a){Vt(i,t,a),Ot(t,n),Ot(t,r)},p:Se,i:Se,o:Se,d(i){i&&Bt(t)}}}class LR extends an{constructor(t){super(),sn(this,t,null,TR,Ze,{})}}function PR(e,t,n){const r=t[1],i=t[0],a=r-i;return e===r&&n?e:((e-i)%a+a)%a+i}function u2(e){const t=[...e];return t[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!Jp.coords)break t;return Jp.coords}let a;try{return a=await new Promise((h,u)=>{n.signal.addEventListener("abort",()=>{u(Error("aborted"))}),navigator.geolocation.getCurrentPosition(y=>{h([y.coords.longitude,y.coords.latitude].map(w=>w.toFixed(6)).join(","))},y=>{u(y)},i)}),a}catch{}finally{i.cachedLocationExpiry&&(Jp={time:Date.now(),coords:a})}if(n.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const c2=/(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?/i,h2=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?/i,f2=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?/i,p2=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?/i;function AR(e){if(!["DMS","DM","DD"].includes(e))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(e=="DD")return this.decimalCoordinates;const t=this.decimalCoordinates.split(",").map(h=>Number(h.trim()));let n=d2(t[0],e),r=d2(t[1],e);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const i=t[0]>=0?" N":" S",a=t[1]>=0?" E":" W";return`${n+i}, ${r+a}`}else throw new Error("no decimal coordinates to convert")}function d2(e,t){const n=Math.abs(e),r=Math.floor(n),i=(n-r)*60;if(t=="DM"){let u=kR(i,3).toFixed(3).padStart(6,"0");return`${r}° ${u}'`}let a=Math.floor(i),h=((i-a)*60).toFixed(1).padStart(4,"0");return a=a.toString().padStart(2,"0"),`${r}° ${a}' ${h}"`}function kR(e,t){const n=Math.pow(10,t);return Math.round((e+Number.EPSILON)*n)/n}function t1(e,t){t||(t=5),e=e.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",h=[],u=!1;if(c2.test(e))if(h=c2.exec(e),u=hg(h),u){if(n=h[2],r=h[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");h[1]?(i=h[1],a=h[5]):h[4]&&(i=h[4],a=h[8])}else throw new Error("invalid decimal coordinate format");else if(h2.test(e))if(h=h2.exec(e),u=hg(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6].replace(",",".")/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[9])),h[11]&&(r+=h[11]/60),h[13]&&(r+=h[13].replace(",",".")/3600),parseInt(h[9])<0&&(r=-1*r),h[1]?(i=h[1],a=h[8]):h[7]&&(i=h[7],a=h[14]);else throw new Error("invalid DMS coordinates format");else if(f2.test(e))if(h=f2.exec(e),u=hg(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(i=h[1],a=h[9]):h[8]&&(i=h[8],a=h[16]);else throw new Error("invalid DMS coordinates format");else if(p2.test(e))if(h=p2.exec(e),u=hg(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(i=h[1],a=h[9]):h[8]&&(i=h[8],a=h[16]);else throw new Error("invalid coordinates format");if(u){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||a)&&(!i||!a))throw new Error("invalid coordinates format");if(i&&i==a)throw new Error("invalid coordinates format");let y=/S|SOUTH/i;y.test(i)&&n>0&&(n=-1*n),y=/W|WEST/i,y.test(a)&&r>0&&(r=-1*r);const w=h[0].trim();let S,I;const P=/[,/;\u0020]/g,z=w.match(P);if(z==null){const Z=Math.floor(e.length/2);S=w.substring(0,Z).trim(),I=w.substring(Z).trim()}else{let Z;z.length%2==1?Z=Math.floor(z.length/2):Z=z.length/2-1;let et=0;if(Z==0)et=w.indexOf(z[0]),S=w.substring(0,et).trim(),I=w.substring(et+1).trim();else{let B=0,j=0;for(;B<=Z;)et=w.indexOf(z[B],j),j=et+1,B++;S=w.substring(0,et).trim(),I=w.substring(et+1).trim()}}const R=S.split(".");if(R.length==2&&R[1]==0&&R[1].length!=2)throw new Error("invalid coordinates format");const Y=I.split(".");if(Y.length==2&&Y[1]==0&&Y[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(I))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(t)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(t)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:S,verbatimLongitude:I,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:DR,toCoordinateFormat:AR})}else throw new Error("coordinates pattern match failed")}function hg(e){if(!isNaN(e[0]))return!1;const t=[...e];if(t.shift(),t.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,i=t.length/2;for(let a=0;a{t.decimalLatitude?e.push(t):e.push({...t,...OR})}),[...e,...zR,...FR]}const VR=BR();t1.formats=VR.map(e=>e.verbatimCoordinates);const UR=t1;function g2(e,t,n){const r=e.slice();return r[81]=t[n],r[83]=n,r}function y2(e){let t,n;return t=new ER({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function _2(e){let t,n,r,i,a;return n=new CR({}),{c(){t=jt("button"),_e(n.$$.fragment),Zt(t,"type","button"),Zt(t,"title",e[9]),Zt(t,"class","svelte-zh3kmv"),il(t,"active",e[0])},m(h,u){Vt(h,t,u),de(n,t,null),r=!0,i||(a=We(t,"click",e[67]),i=!0)},p(h,u){(!r||u[0]&512)&&Zt(t,"title",h[9]),(!r||u[0]&1)&&il(t,"active",h[0])},i(h){r||(It(n.$$.fragment,h),r=!0)},o(h){At(n.$$.fragment,h),r=!1},d(h){h&&Bt(t),me(n),i=!1,a()}}}function GR(e){let t,n=[],r=new Map,i,a,h,u=ti(e[14]);const y=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{lt=null}),Bn()),(!j||Ut[0]&2)&&il(w,"displayable",bt[1]!==""),bt[5]===!0?ht?(ht.p(bt,Ut),Ut[0]&32&&It(ht,1)):(ht=_2(bt),ht.c(),It(ht,1),ht.m(r,R)):ht&&(Fn(),At(ht,1,1,()=>{ht=null}),Bn()),Tt&&Tt.p&&(!j||Ut[1]&134217728)&&Si(Tt,pt,bt,bt[58],j?wi(pt,bt[58],Ut,null):Ei(bt[58]),null);let ee=Z;Z=Kt(bt),Z===ee?~Z&>[Z].p(bt,Ut):(et&&(Fn(),At(gt[ee],1,1,()=>{gt[ee]=null}),Bn()),~Z?(et=gt[Z],et?et.p(bt,Ut):(et=gt[Z]=Q[Z](bt),et.c()),It(et,1),et.m(n,null)):et=null),(!j||Ut[0]&4&&B!==(B=Pg(bt[2])+" svelte-zh3kmv"))&&Zt(n,"class",B),(!j||Ut[0]&22)&&il(n,"can-collapse",bt[4]&&bt[1]==="")},i(bt){j||(It(_t),It(a.$$.fragment,bt),It(I.$$.fragment,bt),It(lt),It(ht),It(Tt,bt),It(et),j=!0)},o(bt){At(_t),At(a.$$.fragment,bt),At(I.$$.fragment,bt),At(lt),At(ht),At(Tt,bt),At(et),j=!1},d(bt){bt&&(Bt(t),Bt(n)),me(a),e[61](null),me(I),lt&<.d(),ht&&ht.d(),Tt&&Tt.d(bt),~Z&>[Z].d(),q=!1,Ri(ct)}}}function ZR(e,t,n){let r,{$$slots:i={},$$scope:a}=t,{class:h=void 0}=t,{apiKey:u}=t,{bbox:y=void 0}=t,{clearButtonTitle:w="clear"}=t,{clearOnBlur:S=!1}=t,{collapsed:I=!1}=t,{country:P=void 0}=t,{debounceSearch:z=200}=t,{enableReverse:R=!1}=t,{errorMessage:Y="Something went wrong…"}=t,{filter:Z=()=>!0}=t,{flyTo:et=!0}=t,{fuzzyMatch:B=!0}=t,{language:j=void 0}=t,{limit:q=void 0}=t,{mapController:ct=void 0}=t,{minLength:_t=2}=t,{noResultsMessage:lt="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=t,{placeholder:ht="Search"}=t,{proximity:pt=[{type:"server-geolocation"}]}=t,{reverseActive:Tt=R==="always"}=t,{reverseButtonTitle:Q="toggle reverse geocoding"}=t,{searchValue:gt=""}=t,{showFullGeometry:Kt=!0}=t,{showPlaceType:bt="ifNeeded"}=t,{showResultsWhileTyping:Ut=!0}=t,{selectFirst:ee=!0}=t,{flyToSelected:Gt=!1}=t,{markerOnSelected:Re=!0}=t,{types:xe=void 0}=t,{excludeTypes:ln=!1}=t,{zoom:Ve=16}=t,{maxZoom:Pe=18}=t,{apiUrl:cn="https://api.maptiler.com/geocoding"}=t,{fetchParameters:Cn={}}=t,{iconsBaseUrl:mn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=t,{adjustUrlQuery:gn=J=>{}}=t;function An(){kt.focus()}function vr(){kt.blur()}function Pr(J,wt=!0){n(1,gt=J),wt?(n(15,Xe=-1),vl()):(Hr(),setTimeout(()=>{kt.focus(),kt.select()}))}function br(){n(14,mt=void 0),n(55,Ie=void 0),n(15,Xe=-1)}function hr(){n(54,Ct=[]),n(55,Ie=void 0)}let Qt=!1,mt,Ct,Ie,kn="",kt,Xe=-1,Mr,on=[],Kn,Lo,ps,Os;const Ba=new Set,Li=Uu();as(()=>{ct&&(ct.setEventHandler(void 0),ct.indicateReverse(!1),ct.setSelectedMarker(-1),ct.setMarkers(void 0,void 0))});function vl(J){if(Lo&&(clearTimeout(Lo),Lo=void 0),Xe>-1&&mt)n(55,Ie=mt[Xe]),n(1,gt=Ie.place_type[0]==="reverse"?Ie.place_name:Ie.place_name.replace(/,.*/,"")),n(18,Mr=void 0),n(54,Ct=void 0),n(15,Xe=-1);else if(gt){const wt=J||!ds(gt);re(gt,{exact:!0}).then(()=>{n(54,Ct=mt),n(55,Ie=void 0),wt&&Ko()}).catch(dt=>n(18,Mr=dt))}}function ds(J){try{return UR(J,6)}catch{return!1}}async function re(J,{byId:wt=!1,exact:dt=!1}={}){n(18,Mr=void 0),Kn==null||Kn.abort();const Lt=new AbortController;n(19,Kn=Lt);try{const zt=ds(J),Wt=new URLSearchParams;if(j!==void 0&&Wt.set("language",Array.isArray(j)?j.join(","):j??""),xe&&Wt.set("types",xe.join(",")),ln&&Wt.set("excludeTypes",String(ln)),y&&Wt.set("bbox",y.map(Ge=>Ge.toFixed(6)).join(",")),P&&Wt.set("country",Array.isArray(P)?P.join(","):P),!wt&&!zt){const Ge=await MR(ct,pt,Lt);Ge&&Wt.set("proximity",Ge),(dt||!Ut)&&Wt.set("autocomplete","false"),Wt.set("fuzzyMatch",String(B))}q!==void 0&&(!zt||(xe==null?void 0:xe.length)===1)&&Wt.set("limit",String(q)),Wt.set("key",u),gn(Wt);const Xt=cn+"/"+encodeURIComponent(zt?zt.decimalLongitude+","+zt.decimalLatitude:J)+".json?"+Wt.toString();if(Xt===kn){wt?(n(14,mt=void 0),n(55,Ie=on[0])):n(14,mt=on);return}kn=Xt;const Te=await fetch(Xt,{signal:Lt.signal,...Cn});if(!Te.ok)throw new Error(await Te.text());const Ae=await Te.json();Li("response",{url:Xt,featureCollection:Ae}),wt?(n(14,mt=void 0),n(55,Ie=Ae.features[0]),on=[Ie]):(n(14,mt=Ae.features.filter(Z)),zt&&mt.unshift({type:"Feature",properties:{},id:"reverse_"+zt.decimalLongitude+"_"+zt.decimalLatitude,text:zt.decimalLatitude+", "+zt.decimalLongitude,place_name:zt.decimalLatitude+", "+zt.decimalLongitude,place_type:["reverse"],center:[zt.decimalLongitude,zt.decimalLatitude],bbox:[zt.decimalLongitude,zt.decimalLatitude,zt.decimalLongitude,zt.decimalLatitude],geometry:{type:"Point",coordinates:[zt.decimalLongitude,zt.decimalLatitude]}}),on=mt,zt&&kt.focus())}catch(zt){if(zt&&typeof zt=="object"&&"name"in zt&&zt.name==="AbortError")return;throw zt}finally{Lt===Kn&&n(19,Kn=void 0)}}function Ko(){var dt;if(!(Ct!=null&&Ct.length)||!et)return;const J=[180,90,-180,-90],wt=!Ct.some(Lt=>!Lt.matching_text);for(const Lt of Ct)if(wt||!Lt.matching_text)for(const zt of[0,1,2,3])J[zt]=Math[zt<2?"min":"max"](J[zt],((dt=Lt.bbox)==null?void 0:dt[zt])??Lt.center[zt%2]);ct&&Ct.length>0&&(Ie&&J[0]===J[2]&&J[1]===J[3]?ct.flyTo(Ie.center,Ve):ct.fitBounds(u2(J),50,Pe))}function Ki(J){n(0,Tt=R==="always"),n(14,mt=void 0),n(55,Ie=void 0),n(15,Xe=-1),Pr(J[1].toFixed(6)+", "+PR(J[0],[-180,180],!0).toFixed(6),!1)}function bl(J){if(!mt)return;let wt=J.key==="ArrowDown"?1:J.key==="ArrowUp"?-1:0;wt&&(Xe===(ee?0:-1)&&wt===-1&&n(15,Xe=mt.length),n(15,Xe+=wt),Xe>=mt.length&&n(15,Xe=-1),Xe<0&&ee&&n(15,Xe=0),J.preventDefault())}function Hr(J=!0){if(n(18,Mr=void 0),Ut){if(Lo&&clearTimeout(Lo),gt.length<_t)return;const wt=gt;Lo=window.setTimeout(()=>{re(wt).catch(dt=>n(18,Mr=dt))},J?z:0)}else n(14,mt=void 0),n(18,Mr=void 0)}function ae(J){n(55,Ie=J),n(1,gt=J.place_name),n(15,Xe=-1)}const Qe=()=>kt.focus();function Ke(J){rr[J?"unshift":"push"](()=>{kt=J,n(17,kt)})}function Ar(){gt=this.value,n(1,gt),n(13,Qt),n(27,S)}const Jo=()=>n(13,Qt=!0),Ye=()=>n(13,Qt=!1),ma=()=>Hr(),zr=()=>{n(1,gt=""),kt.focus()},st=()=>n(0,Tt=!Tt),V=()=>n(18,Mr=void 0),G=J=>n(15,Xe=J),K=J=>ae(J),nt=()=>{ee||n(15,Xe=-1)},xt=()=>{};return e.$$set=J=>{"class"in J&&n(2,h=J.class),"apiKey"in J&&n(25,u=J.apiKey),"bbox"in J&&n(26,y=J.bbox),"clearButtonTitle"in J&&n(3,w=J.clearButtonTitle),"clearOnBlur"in J&&n(27,S=J.clearOnBlur),"collapsed"in J&&n(4,I=J.collapsed),"country"in J&&n(28,P=J.country),"debounceSearch"in J&&n(29,z=J.debounceSearch),"enableReverse"in J&&n(5,R=J.enableReverse),"errorMessage"in J&&n(6,Y=J.errorMessage),"filter"in J&&n(30,Z=J.filter),"flyTo"in J&&n(31,et=J.flyTo),"fuzzyMatch"in J&&n(32,B=J.fuzzyMatch),"language"in J&&n(33,j=J.language),"limit"in J&&n(34,q=J.limit),"mapController"in J&&n(35,ct=J.mapController),"minLength"in J&&n(36,_t=J.minLength),"noResultsMessage"in J&&n(7,lt=J.noResultsMessage),"placeholder"in J&&n(8,ht=J.placeholder),"proximity"in J&&n(37,pt=J.proximity),"reverseActive"in J&&n(0,Tt=J.reverseActive),"reverseButtonTitle"in J&&n(9,Q=J.reverseButtonTitle),"searchValue"in J&&n(1,gt=J.searchValue),"showFullGeometry"in J&&n(38,Kt=J.showFullGeometry),"showPlaceType"in J&&n(10,bt=J.showPlaceType),"showResultsWhileTyping"in J&&n(39,Ut=J.showResultsWhileTyping),"selectFirst"in J&&n(11,ee=J.selectFirst),"flyToSelected"in J&&n(40,Gt=J.flyToSelected),"markerOnSelected"in J&&n(41,Re=J.markerOnSelected),"types"in J&&n(42,xe=J.types),"excludeTypes"in J&&n(43,ln=J.excludeTypes),"zoom"in J&&n(44,Ve=J.zoom),"maxZoom"in J&&n(45,Pe=J.maxZoom),"apiUrl"in J&&n(46,cn=J.apiUrl),"fetchParameters"in J&&n(47,Cn=J.fetchParameters),"iconsBaseUrl"in J&&n(12,mn=J.iconsBaseUrl),"adjustUrlQuery"in J&&n(48,gn=J.adjustUrlQuery),"$$scope"in J&&n(58,a=J.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,ps=Qt),S&&!Qt&&n(1,gt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&>.length<_t&&(n(55,Ie=void 0),n(14,mt=void 0),n(18,Mr=void 0),n(54,Ct=mt)),e.$$.dirty[1]&16777344&&Kt&&Ie&&!Ie.address&&Ie.geometry.type==="Point"&&Ie.place_type[0]!=="reverse"&&re(Ie.id,{byId:!0}).catch(J=>n(18,Mr=J)),e.$$.dirty[1]&50356241&&(ct&&Ie&&Ie.id!==Os&&et&&(!Ie.bbox||Ie.bbox[0]===Ie.bbox[2]&&Ie.bbox[1]===Ie.bbox[3]?ct.flyTo(Ie.center,Ie.id.startsWith("poi.")||Ie.id.startsWith("address.")?Pe:Ve):ct.fitBounds(u2(Ie.bbox),50,Pe),n(14,mt=void 0),n(54,Ct=void 0),n(15,Xe=-1)),n(56,Os=Ie==null?void 0:Ie.id)),e.$$.dirty[0]&18432&&ee&&mt!=null&&mt.length&&n(15,Xe=0),e.$$.dirty[0]&2050&&(ee||n(15,Xe=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&Ct!==mt&&n(54,Ct=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&ct&&ct.setEventHandler(J=>{switch(J.type){case"mapClick":Tt&&Ki(J.coordinates);break;case"markerClick":{const wt=mt==null?void 0:mt.find(dt=>dt.id===J.id);wt&&ae(wt)}break;case"markerMouseEnter":Ct&&n(15,Xe=ps?(mt==null?void 0:mt.findIndex(wt=>wt.id===J.id))??-1:-1);break;case"markerMouseLeave":Ct&&n(15,Xe=-1);break}}),e.$$.dirty[0]&49152&&n(57,r=mt==null?void 0:mt[Xe]),e.$$.dirty[1]&67133969&&ct&&r&&et&&Gt&&ct.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Pe:Ve),e.$$.dirty[1]&1040&&(Re||ct==null||ct.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&ct&&Re&&!Ct&&(ct.setMarkers(r?[r]:void 0,void 0),ct.setSelectedMarker(r?0:-1)),e.$$.dirty[1]&25165840&&ct&&ct.setMarkers(Ct,Ie),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&Ct&&ct&&ct.setSelectedMarker(Xe),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&ct){const J=ds(gt);ct.setReverseMarker(J?[J.decimalLongitude,J.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&Li("select",r),e.$$.dirty[1]&16777216&&Li("pick",Ie),e.$$.dirty[0]&81920&&Li("optionsVisibilityChange",ps&&!!mt),e.$$.dirty[0]&16384&&Li("featuresListed",mt),e.$$.dirty[1]&8388608&&Li("featuresMarked",Ct),e.$$.dirty[0]&1&&Li("reverseToggle",Tt),e.$$.dirty[0]&2&&Li("queryChange",gt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&ct&&ct.indicateReverse(Tt)},[Tt,gt,h,w,I,R,Y,lt,ht,Q,bt,ee,mn,Qt,mt,Xe,ps,kt,Mr,Kn,Ba,vl,bl,Hr,ae,u,y,S,P,z,Z,et,B,j,q,ct,_t,pt,Kt,Ut,Gt,Re,xe,ln,Ve,Pe,cn,Cn,gn,An,vr,Pr,br,hr,Ct,Ie,Os,r,a,i,Qe,Ke,Ar,Jo,Ye,ma,zr,st,V,G,K,nt,xt]}class XR extends an{constructor(t){super(),sn(this,t,ZR,HR,Ze,{class:2,apiKey:25,bbox:26,clearButtonTitle:3,clearOnBlur:27,collapsed:4,country:28,debounceSearch:29,enableReverse:5,errorMessage:6,filter:30,flyTo:31,fuzzyMatch:32,language:33,limit:34,mapController:35,minLength:36,noResultsMessage:7,placeholder:8,proximity:37,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:38,showPlaceType:10,showResultsWhileTyping:39,selectFirst:11,flyToSelected:40,markerOnSelected:41,types:42,excludeTypes:43,zoom:44,maxZoom:45,apiUrl:46,fetchParameters:47,iconsBaseUrl:12,adjustUrlQuery:48,focus:49,blur:50,setQuery:51,clearList:52,clearMap:53},null,[-1,-1,-1])}get focus(){return this.$$.ctx[49]}get blur(){return this.$$.ctx[50]}get setQuery(){return this.$$.ctx[51]}get clearList(){return this.$$.ctx[52]}get clearMap(){return this.$$.ctx[53]}}function b2(e){let t,n,r;return n=new XR({props:{mapController:e[1],apiKey:e[0]}}),{c(){t=jt("div"),_e(n.$$.fragment),Zt(t,"class","svelte-ixhnie")},m(i,a){Vt(i,t,a),de(n,t,null),r=!0},p(i,a){const h={};a&2&&(h.mapController=i[1]),a&1&&(h.apiKey=i[0]),n.$set(h)},i(i){r||(It(n.$$.fragment,i),r=!0)},o(i){At(n.$$.fragment,i),r=!1},d(i){i&&Bt(t),me(n)}}}function YR(e){let t,n,r=e[1]&&b2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&It(r,1)):(r=b2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),At(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){At(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function KR(e,t,n){let r,{apiKey:i}=t,{map:a}=t;return e.$$set=h=>{"apiKey"in h&&n(0,i=h.apiKey),"map"in h&&n(2,a=h.map)},e.$$.update=()=>{e.$$.dirty&4&&n(1,r=a?uR(a,Es):null)},[i,r,a]}class JR extends an{constructor(t){super(),sn(this,t,KR,YR,Ze,{apiKey:0,map:2})}}const Xh=[];function f0(e,t){return{subscribe:$r(e,t).subscribe}}function $r(e,t=Se){let n;const r=new Set;function i(u){if(Ze(e,u)&&(e=u,n)){const y=!Xh.length;for(const w of r)w[1](),Xh.push(w,e);if(y){for(let w=0;w{r.delete(w),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:h}}const QR=Symbol.for("svelte-maplibre");function $R(){return hv(QR)}function tN(e){return"layerType"in e&&e.layerType==="deckgl"}var Oc=eN;function eN(e){var t,n,r;if(e){if(Array.isArray(e)){for(t=[],n=e.length,r=0;r({features:e[0]&16,data:e[0]&16,map:e[0]&4,close:e[0]&1}),w2=e=>{var t;return{features:e[4],data:(t=e[4])==null?void 0:t[0],map:e[2],close:e[31]}};function S2(e){let t,n,r=(e[4]||e[3]instanceof Es.Marker)&&E2(e);return{c(){t=jt("div"),r&&r.c()},m(i,a){Vt(i,t,a),r&&r.m(t,null),e[32](t),n=!0},p(i,a){i[4]||i[3]instanceof Es.Marker?r?(r.p(i,a),a[0]&24&&It(r,1)):(r=E2(i),r.c(),It(r,1),r.m(t,null)):r&&(Fn(),At(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){At(r),n=!1},d(i){i&&Bt(t),r&&r.d(),e[32](null)}}}function E2(e){let t;const n=e[30].default,r=xi(n,e,e[29],w2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a[0]&536870933)&&Si(r,n,i,i[29],t?wi(n,i[29],a,iN):Ei(i[29]),w2)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function oN(e){let t,n,r=e[9].default&&S2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&It(r,1)):(r=S2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),At(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){At(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function sN(e,t,n){let r,i,a,h,u,y,{$$slots:w={},$$scope:S}=t;const I=LL(w);let{closeButton:P=void 0}=t,{closeOnClickOutside:z=!0}=t,{closeOnClickInside:R=!1}=t,{closeOnMove:Y=!1}=t,{openOn:Z="click"}=t,{openIfTopMost:et=!0}=t,{focusAfterOpen:B=!0}=t,{anchor:j=void 0}=t,{offset:q=void 0}=t,{popupClass:ct=void 0}=t,{maxWidth:_t=void 0}=t,{lngLat:lt=void 0}=t,{html:ht=void 0}=t,{open:pt=!1}=t;const Tt=Uu(),{map:Q,popupTarget:gt,layerEvent:Kt,layer:bt,eventTopMost:Ut}=$R();qe(e,Q,Ct=>n(2,a=Ct)),qe(e,gt,Ct=>n(3,u=Ct)),qe(e,Kt,Ct=>n(28,h=Ct)),qe(e,bt,Ct=>n(35,y=Ct));const ee=["click","dblclick","contextmenu"];let Gt,Re=!1,xe;function ln(){if(!Gt)return;let Ct=Gt.getElement();!Ct||Ct===xe||(xe=Ct,Z==="hover"&&(xe.style.pointerEvents="none"),xe.addEventListener("mouseenter",()=>{n(24,Re=!0)},{passive:!0}),xe.addEventListener("mouseleave",()=>{n(24,Re=!1)},{passive:!0}),xe.addEventListener("click",()=>{R&&n(0,pt=!1)},{passive:!0}))}Vu(()=>{if(a)return a.on("click",br),a.on("contextmenu",br),typeof u=="string"&&(a.on("click",u,Cn),a.on("dblclick",u,Cn),a.on("contextmenu",u,Cn),a.on("mousemove",u,Pr),a.on("mouseleave",u,vr),a.on("touchstart",u,gn),a.on("touchend",u,An)),()=>{a!=null&&a.loaded()&&(Gt==null||Gt.remove(),a.off("click",br),a.off("contextmenu",br),u instanceof Es.Marker?u.getPopup()===Gt&&u.setPopup(void 0):typeof u=="string"&&(a.off("click",u,Cn),a.off("dblclick",u,Cn),a.off("contextmenu",u,Cn),a.off("mousemove",u,Pr),a.off("mouseleave",u,vr),a.off("touchstart",u,gn),a.off("touchend",u,An)))}});function Ve(Ct){return et?!("marker"in Ct)&&!tN(Ct)&&Ut(Ct)!==y:!1}let Pe=null,cn="normal";function Cn(Ct){Ct.type===Z&&(Ve(Ct)||("layerType"in Ct?Ct.layerType==="deckgl"?(n(10,lt=Ct.coordinate),n(4,Pe=Ct.object?[Ct.object]:null)):(n(10,lt=Ct.lngLat),n(4,Pe=Ct.features??[])):(n(10,lt=Ct.lngLat),n(4,Pe=Ct.features??[])),setTimeout(()=>n(0,pt=!0))))}let mn=null;function gn(Ct){mn=Ct.point}function An(Ct){if(!mn||Z!=="hover")return;let Ie=mn.dist(Ct.point);mn=null,Ie<3&&(n(10,lt=Ct.lngLat),n(4,Pe=Ct.features??[]),Gt.isOpen()?n(25,cn="justOpened"):(n(25,cn="opening"),n(0,pt=!0)))}function vr(Ct){Z!=="hover"||mn||cn!=="normal"||(n(0,pt=!1),n(4,Pe=null))}function Pr(Ct){if(!(Z!=="hover"||mn||cn!=="normal")){if(Ve(Ct)){n(0,pt=!1),n(4,Pe=null);return}n(0,pt=!0),n(4,Pe=Ct.features??[]),n(10,lt=Ct.lngLat)}}function br(Ct){if(cn==="justOpened"){n(25,cn="normal");return}if(!z)return;let Ie=[xe,u instanceof Es.Marker?u==null?void 0:u.getElement():null];pt&&Gt.isOpen()&&!Ie.some(kn=>kn==null?void 0:kn.contains(Ct.originalEvent.target))&&(Ct.type==="contextmenu"&&Z==="contextmenu"||Ct.type!=="contextmenu")&&n(0,pt=!1)}as(()=>{a&&(Gt!=null&&Gt.isOpen())&&Gt.remove()});let hr;const Qt=()=>n(0,pt=!1);function mt(Ct){rr[Ct?"unshift":"push"](()=>{hr=Ct,n(1,hr)})}return e.$$set=Ct=>{"closeButton"in Ct&&n(11,P=Ct.closeButton),"closeOnClickOutside"in Ct&&n(12,z=Ct.closeOnClickOutside),"closeOnClickInside"in Ct&&n(13,R=Ct.closeOnClickInside),"closeOnMove"in Ct&&n(14,Y=Ct.closeOnMove),"openOn"in Ct&&n(15,Z=Ct.openOn),"openIfTopMost"in Ct&&n(16,et=Ct.openIfTopMost),"focusAfterOpen"in Ct&&n(17,B=Ct.focusAfterOpen),"anchor"in Ct&&n(18,j=Ct.anchor),"offset"in Ct&&n(19,q=Ct.offset),"popupClass"in Ct&&n(20,ct=Ct.popupClass),"maxWidth"in Ct&&n(21,_t=Ct.maxWidth),"lngLat"in Ct&&n(10,lt=Ct.lngLat),"html"in Ct&&n(22,ht=Ct.html),"open"in Ct&&n(0,pt=Ct.open),"$$scope"in Ct&&n(29,S=Ct.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,r=P??(!z&&!R)),e.$$.dirty[0]&146685952&&(Gt||(n(23,Gt=new Es.Popup({closeButton:r,closeOnClick:!1,closeOnMove:Y,focusAfterOpen:B,maxWidth:_t,className:ct,anchor:j,offset:q})),xe=Gt.getElement(),Gt.on("open",()=>{n(0,pt=!0),ln(),Tt("open",Gt)}),Gt.on("close",()=>{n(0,pt=!1),Tt("close",Gt)}),Gt.on("hover",()=>{Tt("hover",Gt)}))),e.$$.dirty[0]&8421384&&Gt&&u instanceof Es.Marker&&(Z==="click"?u.setPopup(Gt):u.getPopup()===Gt&&u.setPopup(void 0)),e.$$.dirty[0]&268468224&&ee.includes(Z)&&(h==null?void 0:h.type)===Z&&(Cn(h),Jn(Kt,h=null,h)),e.$$.dirty[0]&268468224&&n(26,i=Z==="hover"&&((h==null?void 0:h.type)==="mousemove"||(h==null?void 0:h.type)==="mouseenter")),e.$$.dirty[0]&352354304&&Z==="hover"&&Kt&&(i&&h&&(h.layerType==="deckgl"?(n(10,lt=h.coordinate),n(4,Pe=h.object?[h.object]:null)):(n(10,lt=h.lngLat),n(4,Pe=h.features??[]))),n(0,pt=(i||Re)??!1)),e.$$.dirty[0]&12582914&&(hr?Gt.setDOMContent(hr):ht&&Gt.setHTML(ht)),e.$$.dirty[0]&8389632&<&&Gt.setLngLat(lt),e.$$.dirty[0]&41943045&&a){let Ct=Gt.isOpen();pt&&!Ct?(Gt.addTo(a),cn==="opening"&&n(25,cn="justOpened")):!pt&&Ct&&Gt.remove()}},[pt,hr,a,u,Pe,Q,gt,Kt,bt,I,lt,P,z,R,Y,Z,et,B,j,q,ct,_t,ht,Gt,Re,cn,i,r,h,S,w,Qt,mt]}class aN extends an{constructor(t){super(),sn(this,t,sN,oN,Ze,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}var jd=Uint8Array,tC=Uint16Array,lN=Int32Array,uN=new jd([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cN=new jd([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),eC=function(e,t){for(var n=new tC(31),r=0;r<31;++r)n[r]=t+=1<>1|(Xn&21845)<<1,Ol=(Ol&52428)>>2|(Ol&13107)<<2,Ol=(Ol&61680)>>4|(Ol&3855)<<4,pN[Xn]=((Ol&65280)>>8|(Ol&255)<<8)>>1;var Ol,Xn,My=new jd(288);for(Xn=0;Xn<144;++Xn)My[Xn]=8;var Xn;for(Xn=144;Xn<256;++Xn)My[Xn]=9;var Xn;for(Xn=256;Xn<280;++Xn)My[Xn]=7;var Xn;for(Xn=280;Xn<288;++Xn)My[Xn]=8;var Xn,dN=new jd(32);for(Xn=0;Xn<32;++Xn)dN[Xn]=5;var Xn,mN=new jd(0),gN=typeof TextDecoder<"u"&&new TextDecoder,yN=0;try{gN.decode(mN,{stream:!0}),yN=1}catch{}const _N=e=>({props:e&8}),I2=e=>({props:xN(e[3])});function vN(e){let t;const n=e[1].default,r=xi(n,e,e[2],I2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&12)&&Si(r,n,i,i[2],t?wi(n,i[2],a,_N):Ei(i[2]),I2)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function bN(e){let t,n;return t=new aN({props:{openOn:e[0],$$slots:{default:[vN,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.openOn=r[0]),i&12&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function xN(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function wN(e,t,n){let{$$slots:r={},$$scope:i}=t,{openOn:a="hover"}=t;return e.$$set=h=>{"openOn"in h&&n(0,a=h.openOn),"$$scope"in h&&n(2,i=h.$$scope)},[a,r,i]}class Wd extends an{constructor(t){super(),sn(this,t,wN,bN,Ze,{openOn:0})}}const SN=["==",["geometry-type"],"Polygon"],EN=["==",["geometry-type"],"LineString"];function n1(e,t,n){let r=["match",e];for(let[i,a]of Object.entries(t))r.push(i),r.push(a);return r.push(n),r}function C2(e,t,n){let r=["step",e];for(let i=1;i{var h;let r=t.get(n.originalEvent);if(r!==void 0)return r;let a=(h=n.target.queryRenderedFeatures(n.point).find(u=>{var y;return(y=e.get(u.layer.id))==null?void 0:y.interactive}))==null?void 0:h.layer.id;return t.set(n.originalEvent,a),a}}function TN(){let e=new Map;return cv(r1,{map:$r(null),source:f0(null),layer:f0(null),popupTarget:f0(null),cluster:$r(),loadedImages:$r(new Set),minzoom:$r(0),maxzoom:$r(24),layerEvent:$r(null),layerInfo:e,eventTopMost:CN(e)})}function T2(e){return{subscribe:e.subscribe}}function i1({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=qf(),a=$r(null),h=T2(a),u={...i,[e]:T2(a)};if(t&&(u.popupTarget=h),r){let y=$r(null);u.layerEvent=y,i.layerEvent=y}return n&&(u.cluster=$r()),cv(r1,u),{...i,self:a}}function LN(){return i1({key:"source",setCluster:!0})}function PN(e=!0){return i1({key:"layer",setPopupTarget:e,setMouseEvent:e})}function MN(){return i1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function L2(e){let t;return n=>{if(n)for(let r in n){let i=t==null?void 0:t[r],a=n[r];i!==a&&e(r,a,i)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function AN(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function kN(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function Ay(e,t){return["case",["boolean",["feature-state","hover"],!1],t,e]}function P2(e){let t=e[0],n,r,i=M2(e);return{c(){i.c(),n=di()},m(a,h){i.m(a,h),Vt(a,n,h),r=!0},p(a,h){h[0]&1&&Ze(t,t=a[0])?(Fn(),At(i,1,1,Se),Bn(),i=M2(a),i.c(),It(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(It(i),r=!0)},o(a){At(i),r=!1},d(a){a&&Bt(n),i.d(a)}}}function M2(e){let t;const n=e[36].default,r=xi(n,e,e[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a[1]&16)&&Si(r,n,i,i[35],t?wi(n,i[35],a,null):Ei(i[35]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function DN(e){let t,n,r=e[0]&&P2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&It(r,1)):(r=P2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),At(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){At(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function RN(e,t,n){let r,i,a,h,u,y,w,S,I,P,z,R,{$$slots:Y={},$$scope:Z}=t,{id:et=Hd("layer")}=t,{source:B=void 0}=t,{sourceLayer:j=void 0}=t,{beforeId:q=void 0}=t,{beforeLayerType:ct=void 0}=t,{type:_t}=t,{paint:lt=void 0}=t,{layout:ht=void 0}=t,{filter:pt=void 0}=t,{applyToClusters:Tt=void 0}=t,{minzoom:Q=void 0}=t,{maxzoom:gt=void 0}=t,{manageHoverState:Kt=!1}=t,{hovered:bt=null}=t,{interactive:Ut=!0}=t,{hoverCursor:ee=void 0}=t,{eventsIfTopMost:Gt=!1}=t;const Re=Uu(),{map:xe,source:ln,self:Ve,minzoom:Pe,maxzoom:cn,eventTopMost:Cn,layerInfo:mn}=PN();qe(e,xe,mt=>n(31,I=mt)),qe(e,ln,mt=>n(32,P=mt)),qe(e,Ve,mt=>n(0,S=mt)),qe(e,Pe,mt=>n(34,R=mt)),qe(e,cn,mt=>n(33,z=mt)),as(()=>{S&&I&&(mn.delete(S),I==null||I.removeLayer(S))});let gn;function An(mt){var kt,Xe;if(!Ut||!S||!I||Gt&&Cn(mt)!==S)return;let Ct=mt.features??[],Ie=(Xe=(kt=Ct[0])==null?void 0:kt.properties)==null?void 0:Xe.cluster_id,kn={event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct};Re(mt.type,kn)}function vr(mt){var kt,Xe;if(!Ut||!S||!I||Gt&&Cn(mt)!==S)return;ee&&(I.getCanvas().style.cursor=ee);let Ct=mt.features??[];n(6,bt=Ct[0]??null);let Ie=(Xe=(kt=Ct[0])==null?void 0:kt.properties)==null?void 0:Xe.cluster_id;Re("mouseenter",{event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct})}function Pr(mt){var kt,Xe,Mr;if(!Ut||!I)return;if(Gt&&Cn(mt)!==S){n(6,bt=null),Kt&&gn!==void 0&&(I==null||I.setFeatureState({source:u,sourceLayer:j,id:gn},{hover:!1}),gn=void 0);return}I.getCanvas().style.cursor=ee;let Ct=mt.features??[],Ie=(Xe=(kt=Ct[0])==null?void 0:kt.properties)==null?void 0:Xe.cluster_id,kn=(Mr=Ct[0])==null?void 0:Mr.id;kn!==gn&&(Kt&&(gn!==void 0&&(I==null||I.setFeatureState({source:u,id:gn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:u,id:kn,sourceLayer:j},{hover:!0})),gn=kn,n(6,bt=Ct[0]??null)),Re("mousemove",{event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct})}function br(mt){if(!(!Ut||!S||!I)){if(ee&&(I.getCanvas().style.cursor=""),n(6,bt=null),Kt&&gn!==void 0){const Ct={source:u,id:gn,sourceLayer:j};I==null||I.setFeatureState(Ct,{hover:!1}),gn=void 0}Re("mouseleave",{map:I,layer:S,source:u})}}let hr=!0;function Qt(mt){I&&(I.off("click",mt,An),I.off("dblclick",mt,An),I.off("contextmenu",mt,An),I.off("mouseenter",mt,vr),I.off("mousemove",mt,Pr),I.off("mouseleave",mt,br))}return as(()=>{I&&S&&Qt(S)}),e.$$set=mt=>{"id"in mt&&n(7,et=mt.id),"source"in mt&&n(8,B=mt.source),"sourceLayer"in mt&&n(9,j=mt.sourceLayer),"beforeId"in mt&&n(10,q=mt.beforeId),"beforeLayerType"in mt&&n(11,ct=mt.beforeLayerType),"type"in mt&&n(12,_t=mt.type),"paint"in mt&&n(13,lt=mt.paint),"layout"in mt&&n(14,ht=mt.layout),"filter"in mt&&n(15,pt=mt.filter),"applyToClusters"in mt&&n(16,Tt=mt.applyToClusters),"minzoom"in mt&&n(17,Q=mt.minzoom),"maxzoom"in mt&&n(18,gt=mt.maxzoom),"manageHoverState"in mt&&n(19,Kt=mt.manageHoverState),"hovered"in mt&&n(6,bt=mt.hovered),"interactive"in mt&&n(20,Ut=mt.interactive),"hoverCursor"in mt&&n(21,ee=mt.hoverCursor),"eventsIfTopMost"in mt&&n(22,Gt=mt.eventsIfTopMost),"$$scope"in mt&&n(35,Z=mt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=kN(Tt)),e.$$.dirty[0]&1073774592&&n(24,i=AN("all",r,pt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,a=Q??R),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=gt??z),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=B||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&I&&S!==et&&u){S&&(Qt(S),mn.delete(S));let mt=q;if(!q&&ct){let Ct=I.getStyle().layers,Ie=typeof ct=="function"?ct:kt=>kt.type===ct,kn=Ct==null?void 0:Ct.find(Ie);kn&&(mt=kn.id)}Jn(Ve,S=et,S),I.addLayer(Oc({id:S,type:_t,source:u,"source-layer":j,filter:i,paint:lt,layout:ht,minzoom:a,maxzoom:h}),mt),n(23,hr=!0),I.on("click",S,An),I.on("dblclick",S,An),I.on("contextmenu",S,An),I.on("mouseenter",S,vr),I.on("mousemove",S,Pr),I.on("mouseleave",S,br)}e.$$.dirty[0]&1048577&&S&&mn.set(S,{interactive:Ut}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,y=S?L2((mt,Ct)=>I==null?void 0:I.setPaintProperty(S,mt,Ct)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?L2((mt,Ct)=>I==null?void 0:I.setLayoutProperty(S,mt,Ct)):void 0),e.$$.dirty[0]&268443648&&(y==null||y(lt)),e.$$.dirty[0]&134234112&&(w==null||w(ht)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(hr?n(23,hr=!1):I==null||I.setFilter(S,i))},[S,xe,ln,Ve,Pe,cn,bt,et,B,j,q,ct,_t,lt,ht,pt,Tt,Q,gt,Kt,Ut,ee,Gt,hr,i,h,a,w,y,u,r,I,P,z,R,Z,Y]}let o1=class extends an{constructor(t){super(),sn(this,t,RN,DN,Ze,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}};function NN(e){let t;const n=e[16].default,r=xi(n,e,e[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16777216)&&Si(r,n,i,i[24],t?wi(n,i[24],a,null):Ei(i[24]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function ON(e){let t,n,r;function i(h){e[17](h)}let a={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[NN]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new o1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.applyToClusters=h[9]),u&1024&&(y.minzoom=h[10]),u&2048&&(y.maxzoom=h[11]),u&4096&&(y.hoverCursor=h[12]),u&8192&&(y.manageHoverState=h[13]),u&16384&&(y.eventsIfTopMost=h[14]),u&32768&&(y.interactive=h[15]),u&16777216&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function zN(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Hd("circle")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{applyToClusters:z=void 0}=t,{minzoom:R=void 0}=t,{maxzoom:Y=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:et=!1}=t,{hovered:B=null}=t,{eventsIfTopMost:j=!1}=t,{interactive:q=!0}=t;function ct(gt){B=gt,n(0,B)}function _t(gt){En.call(this,e,gt)}function lt(gt){En.call(this,e,gt)}function ht(gt){En.call(this,e,gt)}function pt(gt){En.call(this,e,gt)}function Tt(gt){En.call(this,e,gt)}function Q(gt){En.call(this,e,gt)}return e.$$set=gt=>{"id"in gt&&n(1,a=gt.id),"source"in gt&&n(2,h=gt.source),"sourceLayer"in gt&&n(3,u=gt.sourceLayer),"beforeId"in gt&&n(4,y=gt.beforeId),"beforeLayerType"in gt&&n(5,w=gt.beforeLayerType),"paint"in gt&&n(6,S=gt.paint),"layout"in gt&&n(7,I=gt.layout),"filter"in gt&&n(8,P=gt.filter),"applyToClusters"in gt&&n(9,z=gt.applyToClusters),"minzoom"in gt&&n(10,R=gt.minzoom),"maxzoom"in gt&&n(11,Y=gt.maxzoom),"hoverCursor"in gt&&n(12,Z=gt.hoverCursor),"manageHoverState"in gt&&n(13,et=gt.manageHoverState),"hovered"in gt&&n(0,B=gt.hovered),"eventsIfTopMost"in gt&&n(14,j=gt.eventsIfTopMost),"interactive"in gt&&n(15,q=gt.interactive),"$$scope"in gt&&n(24,i=gt.$$scope)},[B,a,h,u,y,w,S,I,P,z,R,Y,Z,et,j,q,r,ct,_t,lt,ht,pt,Tt,Q,i]}let s1=class extends an{constructor(t){super(),sn(this,t,zN,ON,Ze,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}};function FN(e){let t;const n=e[15].default,r=xi(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&Si(r,n,i,i[23],t?wi(n,i[23],a,null):Ei(i[23]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function BN(e){let t,n,r;function i(h){e[16](h)}let a={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[FN]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new o1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function VN(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Hd("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:Y=void 0}=t,{manageHoverState:Z=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:j=!0}=t;function q(Q){et=Q,n(0,et)}function ct(Q){En.call(this,e,Q)}function _t(Q){En.call(this,e,Q)}function lt(Q){En.call(this,e,Q)}function ht(Q){En.call(this,e,Q)}function pt(Q){En.call(this,e,Q)}function Tt(Q){En.call(this,e,Q)}return e.$$set=Q=>{"id"in Q&&n(1,a=Q.id),"source"in Q&&n(2,h=Q.source),"sourceLayer"in Q&&n(3,u=Q.sourceLayer),"beforeId"in Q&&n(4,y=Q.beforeId),"beforeLayerType"in Q&&n(5,w=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,I=Q.layout),"filter"in Q&&n(8,P=Q.filter),"minzoom"in Q&&n(9,z=Q.minzoom),"maxzoom"in Q&&n(10,R=Q.maxzoom),"hoverCursor"in Q&&n(11,Y=Q.hoverCursor),"manageHoverState"in Q&&n(12,Z=Q.manageHoverState),"hovered"in Q&&n(0,et=Q.hovered),"eventsIfTopMost"in Q&&n(13,B=Q.eventsIfTopMost),"interactive"in Q&&n(14,j=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[et,a,h,u,y,w,S,I,P,z,R,Y,Z,B,j,r,q,ct,_t,lt,ht,pt,Tt,i]}let rC=class extends an{constructor(t){super(),sn(this,t,VN,BN,Ze,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}};function UN(e,t,n){let r;const{map:i}=qf();qe(e,i,y=>n(4,r=y));let{position:a="top-left"}=t,{container:h=void 0}=t,u=null;return as(()=>{r!=null&&r.loaded()&&u&&r.removeControl(u)}),e.$$set=y=>{"position"in y&&n(1,a=y.position),"container"in y&&n(2,h=y.container)},e.$$.update=()=>{if(e.$$.dirty&30&&r&&!u){let y;typeof h=="string"?y=document.querySelector(h)??void 0:y=h,n(3,u=new Es.FullscreenControl({container:y})),r.addControl(u,a)}},[i,a,h,u,r]}class GN extends an{constructor(t){super(),sn(this,t,UN,null,Ze,{position:1,container:2})}}function qN(e,t,n,r,i){let a=!1;e.getSource(t)&&(a=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),i())};if(a){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function jN(e,t,n){VS().then(()=>{let r=NS(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function A2(e){let t=e[0],n,r,i=k2(e);return{c(){i.c(),n=di()},m(a,h){i.m(a,h),Vt(a,n,h),r=!0},p(a,h){h&1&&Ze(t,t=a[0])?(Fn(),At(i,1,1,Se),Bn(),i=k2(a),i.c(),It(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(It(i),r=!0)},o(a){At(i),r=!1},d(a){a&&Bt(n),i.d(a)}}}function k2(e){let t;const n=e[15].default,r=xi(n,e,e[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16384)&&Si(r,n,i,i[14],t?wi(n,i[14],a,null):Ei(i[14]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function WN(e){let t,n,r=e[0]&&A2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&It(r,1)):(r=A2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),At(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){At(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function HN(e,t,n){let r,i,a,{$$slots:h={},$$scope:u}=t,{id:y=Hd("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:I=void 0}=t,{filter:P=void 0}=t,{lineMetrics:z=void 0}=t,{cluster:R=void 0}=t;const{map:Y,cluster:Z,self:et}=LN();qe(e,Y,q=>n(13,i=q)),qe(e,Z,q=>n(16,a=q)),qe(e,et,q=>n(0,r=q));let B,j=!0;return as(()=>{r&&B&&i&&(jN(Y,r,B),Jn(et,r=null,r),n(11,B=void 0))}),e.$$set=q=>{"id"in q&&n(4,y=q.id),"data"in q&&n(5,w=q.data),"generateId"in q&&n(6,S=q.generateId),"promoteId"in q&&n(7,I=q.promoteId),"filter"in q&&n(8,P=q.filter),"lineMetrics"in q&&n(9,z=q.lineMetrics),"cluster"in q&&n(10,R=q.cluster),"$$scope"in q&&n(14,u=q.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Jn(Z,a=R,a),e.$$.dirty&12273&&i&&r!==y&&(Jn(et,r=y,r),qN(i,r,Oc({type:"geojson",data:w,filter:P,lineMetrics:z,generateId:S,promoteId:I,cluster:!!R,clusterMinPoints:R==null?void 0:R.minPoints,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius,clusterProperties:R==null?void 0:R.properties}),q=>i&&q===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,j=!0))})),e.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(y))})),e.$$.dirty&6176&&B&&(j?n(12,j=!1):B.setData(w)),e.$$.dirty&3072&&(B==null||B.setClusterOptions(Oc({cluster:!!R,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius})))},[r,Y,Z,et,y,w,S,I,P,z,R,B,j,i,u,h]}let zc=class extends an{constructor(t){super(),sn(this,t,HN,WN,Ze,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}};function ZN(e,t,n){let r;const{map:i}=qf();qe(e,i,P=>n(8,r=P));let{position:a="top-left"}=t,{positionOptions:h=void 0}=t,{fitBoundsOptions:u=void 0}=t,{trackUserLocation:y=!1}=t,{showAccuracyCircle:w=!0}=t,{showUserLocation:S=!0}=t,I=null;return as(()=>{r!=null&&r.loaded()&&I&&r.removeControl(I)}),e.$$set=P=>{"position"in P&&n(1,a=P.position),"positionOptions"in P&&n(2,h=P.positionOptions),"fitBoundsOptions"in P&&n(3,u=P.fitBoundsOptions),"trackUserLocation"in P&&n(4,y=P.trackUserLocation),"showAccuracyCircle"in P&&n(5,w=P.showAccuracyCircle),"showUserLocation"in P&&n(6,S=P.showUserLocation)},e.$$.update=()=>{e.$$.dirty&510&&r&&!I&&(n(7,I=new Es.GeolocateControl({positionOptions:h,fitBoundsOptions:u,trackUserLocation:y,showAccuracyCircle:w,showUserLocation:S})),r.addControl(I,a))},[i,a,h,u,y,w,S,I,r]}class XN extends an{constructor(t){super(),sn(this,t,ZN,null,Ze,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function YN(e){let t;const n=e[15].default,r=xi(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&Si(r,n,i,i[23],t?wi(n,i[23],a,null):Ei(i[23]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function KN(e){let t,n,r;function i(h){e[16](h)}let a={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[YN]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new o1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function JN(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Hd("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:Y=void 0}=t,{manageHoverState:Z=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:j=!0}=t;function q(Q){et=Q,n(0,et)}function ct(Q){En.call(this,e,Q)}function _t(Q){En.call(this,e,Q)}function lt(Q){En.call(this,e,Q)}function ht(Q){En.call(this,e,Q)}function pt(Q){En.call(this,e,Q)}function Tt(Q){En.call(this,e,Q)}return e.$$set=Q=>{"id"in Q&&n(1,a=Q.id),"source"in Q&&n(2,h=Q.source),"sourceLayer"in Q&&n(3,u=Q.sourceLayer),"beforeId"in Q&&n(4,y=Q.beforeId),"beforeLayerType"in Q&&n(5,w=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,I=Q.layout),"filter"in Q&&n(8,P=Q.filter),"minzoom"in Q&&n(9,z=Q.minzoom),"maxzoom"in Q&&n(10,R=Q.maxzoom),"hoverCursor"in Q&&n(11,Y=Q.hoverCursor),"manageHoverState"in Q&&n(12,Z=Q.manageHoverState),"hovered"in Q&&n(0,et=Q.hovered),"eventsIfTopMost"in Q&&n(13,B=Q.eventsIfTopMost),"interactive"in Q&&n(14,j=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[et,a,h,u,y,w,S,I,P,z,R,Y,Z,B,j,r,q,ct,_t,lt,ht,pt,Tt,i]}let jf=class extends an{constructor(t){super(),sn(this,t,JN,KN,Ze,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}};function QN(e,t,n){let r;const i=Uu();let{layer:a=void 0}=t;const{map:h}=qf();qe(e,h,S=>n(2,r=S));function u(S){i(S.type,{...S,map:h})}const y=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return as(()=>{if(r)if(a)for(const S of y)r.off(S,a,u);else for(const S of w)r.off(S,u)}),e.$$set=S=>{"layer"in S&&n(1,a=S.layer)},e.$$.update=()=>{if(e.$$.dirty&6&&r)if(a)for(const S of y)r.on(S,a,u);else for(const S of w)r.on(S,u)},[h,a,r]}class $N extends an{constructor(t){super(),sn(this,t,QN,null,Ze,{layer:1})}}function tO(e){let t=e.getCenter(),n=Math.round(e.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),a=Math.round(t.lat*i)/i,h=Math.round(t.lng*i)/i,u=`${n}/${a}/${h}`,y=e.getBearing(),w=e.getPitch();return(y||w)&&(u+=`/${Math.round(y*10)/10}`),w&&(u+=`/${Math.round(w)}`),`#${u}`}function eO(e){return e.replace("#","").split("/").map(parseFloat)}function nO(e,t,n){let r;const{map:i}=qf();qe(e,i,S=>n(6,r=S));let{position:a="top-left"}=t,{showCompass:h=!0}=t,{showZoom:u=!0}=t,{visualizePitch:y=!1}=t,w=null;return as(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),e.$$set=S=>{"position"in S&&n(1,a=S.position),"showCompass"in S&&n(2,h=S.showCompass),"showZoom"in S&&n(3,u=S.showZoom),"visualizePitch"in S&&n(4,y=S.visualizePitch)},e.$$.update=()=>{e.$$.dirty&126&&r&&!w&&(n(5,w=new Es.NavigationControl({showCompass:h,showZoom:u,visualizePitch:y})),r.addControl(w,a))},[i,a,h,u,y,w,r]}class rO extends an{constructor(t){super(),sn(this,t,nO,null,Ze,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function iO(e,t,n){let r;const{map:i}=qf();qe(e,i,w=>n(5,r=w));let{position:a="bottom-left"}=t,{maxWidth:h=void 0}=t,{unit:u="metric"}=t,y=null;return as(()=>{r!=null&&r.loaded()&&y&&r.removeControl(y)}),e.$$set=w=>{"position"in w&&n(1,a=w.position),"maxWidth"in w&&n(2,h=w.maxWidth),"unit"in w&&n(3,u=w.unit)},e.$$.update=()=>{e.$$.dirty&62&&r&&!y&&(n(4,y=new Es.ScaleControl({maxWidth:h,unit:u})),r.addControl(y,a))},[i,a,h,u,y,r]}class oO extends an{constructor(t){super(),sn(this,t,iO,null,Ze,{position:1,maxWidth:2,unit:3})}}const{window:sO}=PL,aO=e=>({map:e[0]&16,loadedImages:e[0]&32,allImagesLoaded:e[0]&64}),D2=e=>({map:e[4],loadedImages:e[5],allImagesLoaded:e[6]});function R2(e){let t,n,r=e[3]&&N2(e);const i=e[39].default,a=xi(i,e,e[38],D2);return{c(){r&&r.c(),t=fe(),a&&a.c()},m(h,u){r&&r.m(h,u),Vt(h,t,u),a&&a.m(h,u),n=!0},p(h,u){h[3]?r?(r.p(h,u),u[0]&8&&It(r,1)):(r=N2(h),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),At(r,1,1,()=>{r=null}),Bn()),a&&a.p&&(!n||u[0]&112|u[1]&128)&&Si(a,i,h,h[38],n?wi(i,h[38],u,aO):Ei(h[38]),D2)},i(h){n||(It(r),It(a,h),n=!0)},o(h){At(r),At(a,h),n=!1},d(h){h&&Bt(t),r&&r.d(h),a&&a.d(h)}}}function N2(e){let t,n,r,i,a,h,u,y;return t=new rO({props:{position:e[7]}}),r=new XN({props:{position:e[7],fitBoundsOptions:{maxZoom:12}}}),a=new GN({props:{position:e[7]}}),u=new oO({props:{position:e[7]}}),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment),i=fe(),_e(a.$$.fragment),h=fe(),_e(u.$$.fragment)},m(w,S){de(t,w,S),Vt(w,n,S),de(r,w,S),Vt(w,i,S),de(a,w,S),Vt(w,h,S),de(u,w,S),y=!0},p(w,S){const I={};S[0]&128&&(I.position=w[7]),t.$set(I);const P={};S[0]&128&&(P.position=w[7]),r.$set(P);const z={};S[0]&128&&(z.position=w[7]),a.$set(z);const R={};S[0]&128&&(R.position=w[7]),u.$set(R)},i(w){y||(It(t.$$.fragment,w),It(r.$$.fragment,w),It(a.$$.fragment,w),It(u.$$.fragment,w),y=!0)},o(w){At(t.$$.fragment,w),At(r.$$.fragment,w),At(a.$$.fragment,w),At(u.$$.fragment,w),y=!1},d(w){w&&(Bt(n),Bt(i),Bt(h)),me(t,w),me(r,w),me(a,w),me(u,w)}}}function lO(e){let t,n,r,i,a,h=e[4]&&e[0]&&R2(e);return{c(){t=jt("div"),h&&h.c(),Zt(t,"class",n=Pg(e[2])+" svelte-p00lfq"),Zt(t,"data-testid","map-container"),il(t,"expand-map",!e[2])},m(u,y){Vt(u,t,y),h&&h.m(t,null),e[40](t),r=!0,i||(a=[We(sO,"hashchange",e[11]),y0(e[10].call(null,t))],i=!0)},p(u,y){u[4]&&u[0]?h?(h.p(u,y),y[0]&17&&It(h,1)):(h=R2(u),h.c(),It(h,1),h.m(t,null)):h&&(Fn(),At(h,1,1,()=>{h=null}),Bn()),(!r||y[0]&4&&n!==(n=Pg(u[2])+" svelte-p00lfq"))&&Zt(t,"class",n),(!r||y[0]&4)&&il(t,"expand-map",!u[2])},i(u){r||(It(h),r=!0)},o(u){At(h),r=!1},d(u){u&&Bt(t),h&&h.d(),e[40](null),i=!1,Ri(a)}}}function uO(e,t,n){let r,i,a,h,{$$slots:u={},$$scope:y}=t,{map:w=null}=t,{mapContainer:S=void 0}=t,{class:I=void 0}=t,{style:P}=t,{diffStyleUpdates:z=!1}=t,{center:R=void 0}=t,{zoom:Y=void 0}=t,{pitch:Z=0}=t,{bearing:et=0}=t,{bounds:B=void 0}=t,{hash:j=!1}=t,{loaded:q=!1}=t,{minZoom:ct=0}=t,{maxZoom:_t=22}=t,{antialias:lt=void 0}=t,{zoomOnDoubleClick:ht=!0}=t,{locale:pt=void 0}=t,{interactive:Tt=!0}=t,{attributionControl:Q=!0}=t,{cooperativeGestures:gt=!1}=t,{preserveDrawingBuffer:Kt=!1}=t,{maxBounds:bt=void 0}=t,{images:Ut=[]}=t,{standardControls:ee=!1}=t,{filterLayers:Gt=void 0}=t,{transformRequest:Re=void 0}=t;const xe=Uu(),{map:ln,loadedImages:Ve}=TN();qe(e,ln,Qt=>n(4,a=Qt)),qe(e,Ve,Qt=>n(5,h=Qt));let Pe=new Set;async function cn(Qt,mt=!1){if(a&&!(!a.loaded()&&!mt))if("url"in Qt){Pe.add(Qt.id);try{let Ct=await a.loadImage(Qt.url);a==null||a.addImage(Qt.id,Ct.data,Qt.options),h.add(Qt.id),Ve.set(h)}catch(Ct){xe("error",Ct)}finally{Pe.delete(Qt.id)}}else a.addImage(Qt.id,Qt.data,Qt.options),h.add(Qt.id),Ve.set(h)}let Cn,mn,gn,An;function vr(Qt){return br(),Jn(ln,a=new Es.Map(Oc({container:Qt,style:P,locale:pt,center:R,zoom:Y,pitch:Z,bearing:et,minZoom:ct,maxZoom:_t,antialias:lt,interactive:Tt,preserveDrawingBuffer:Kt,maxBounds:bt,bounds:B,attributionControl:Q,transformRequest:Re,cooperativeGestures:gt})),a),a.on("load",mt=>{mt.target.getContainer().setAttribute("data-testid","map"),mt.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,q=!0),xe("load",a)}),a.on("error",mt=>xe("error",{...mt,map:a})),a.on("movestart",mt=>xe("movestart",{...mt,map:a})),a.on("moveend",mt=>{if(n(12,R=mt.target.getCenter()),n(13,Y=mt.target.getZoom()),n(14,B=mt.target.getBounds()),xe("moveend",{...mt,map:a}),j){let Ct=window.location.href.replace(/(#.+)?$/,tO(a));window.history.replaceState(window.history.state,"",Ct)}}),a.on("click",mt=>xe("click",{...mt,map:a})),a.on("dblclick",mt=>xe("dblclick",{...mt,map:a})),a.on("contextmenu",mt=>xe("contextmenu",{...mt,map:a})),a.on("zoomstart",mt=>xe("zoomstart",{...mt,map:a})),a.on("zoom",mt=>{n(13,Y=mt.target.getZoom()),xe("zoom",{...mt,map:a})}),a.on("zoomend",mt=>{n(13,Y=mt.target.getZoom()),xe("zoomend",{...mt,map:a})}),a.on("style.load",()=>{if(a){const mt=a.getStyle();if(n(35,Cn=mt.layers.map(Ct=>Ct.id)),n(36,mn=Object.keys(mt.sources)),An)for(const[Ct,Ie]of Object.entries(An))a.addSource(Ct,Ie);if(gn)for(const Ct of gn)a.addLayer(Ct);for(const Ct of Ut)cn(Ct,!0)}}),a.on("styledata",mt=>{if(a&&Gt){const Ct=a.getStyle().layers;if(Ct)for(let Ie of Ct)Gt(Ie)||a.setLayoutProperty(Ie.id,"visibility","none")}xe("styledata",{...mt,map:a})}),{destroy(){n(0,q=!1),a==null||a.remove(),Jn(ln,a=null,a)}}}let Pr=P;function br(){if(j){let Qt=eO(window.location.hash);Qt.length>=3&&(n(13,Y=Qt[0]),n(12,R=[Qt[2],Qt[1]])),Qt.length==5&&(n(17,et=Qt[3]),n(16,Z=Qt[4]))}}function hr(Qt){rr[Qt?"unshift":"push"](()=>{S=Qt,n(1,S)})}return e.$$set=Qt=>{"map"in Qt&&n(15,w=Qt.map),"mapContainer"in Qt&&n(1,S=Qt.mapContainer),"class"in Qt&&n(2,I=Qt.class),"style"in Qt&&n(18,P=Qt.style),"diffStyleUpdates"in Qt&&n(19,z=Qt.diffStyleUpdates),"center"in Qt&&n(12,R=Qt.center),"zoom"in Qt&&n(13,Y=Qt.zoom),"pitch"in Qt&&n(16,Z=Qt.pitch),"bearing"in Qt&&n(17,et=Qt.bearing),"bounds"in Qt&&n(14,B=Qt.bounds),"hash"in Qt&&n(20,j=Qt.hash),"loaded"in Qt&&n(0,q=Qt.loaded),"minZoom"in Qt&&n(21,ct=Qt.minZoom),"maxZoom"in Qt&&n(22,_t=Qt.maxZoom),"antialias"in Qt&&n(23,lt=Qt.antialias),"zoomOnDoubleClick"in Qt&&n(24,ht=Qt.zoomOnDoubleClick),"locale"in Qt&&n(25,pt=Qt.locale),"interactive"in Qt&&n(26,Tt=Qt.interactive),"attributionControl"in Qt&&n(27,Q=Qt.attributionControl),"cooperativeGestures"in Qt&&n(28,gt=Qt.cooperativeGestures),"preserveDrawingBuffer"in Qt&&n(29,Kt=Qt.preserveDrawingBuffer),"maxBounds"in Qt&&n(30,bt=Qt.maxBounds),"images"in Qt&&n(31,Ut=Qt.images),"standardControls"in Qt&&n(3,ee=Qt.standardControls),"filterLayers"in Qt&&n(32,Gt=Qt.filterLayers),"transformRequest"in Qt&&n(33,Re=Qt.transformRequest),"$$scope"in Qt&&n(38,y=Qt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&8&&n(7,r=typeof ee=="boolean"?void 0:ee),e.$$.dirty[0]&16&&n(15,w=a),e.$$.dirty[0]&786448|e.$$.dirty[1]&112&&a&&!fg(P,Pr)){const Qt=a.getStyle();if(Cn&&(gn=Qt.layers.filter(mt=>!Cn.includes(mt.id))),mn){const mt=Object.keys(Qt.sources).filter(Ct=>!mn.includes(Ct));An={};for(const Ct of mt)An[Ct]=Qt.sources[Ct]}n(37,Pr=P),a.setStyle(P,{diff:z}),Jn(Ve,h=new Set,h),n(34,Pe=new Set)}if(e.$$.dirty[0]&49|e.$$.dirty[1]&9&&q&&a!=null&&a.loaded())for(let Qt of Ut)!h.has(Qt.id)&&!Pe.has(Qt.id)&&!a.hasImage(Qt.id)&&cn(Qt);e.$$.dirty[0]&32|e.$$.dirty[1]&1&&n(6,i=Ut.every(Qt=>h.has(Qt.id))),e.$$.dirty[0]&4112&&R&&!fg(R,a==null?void 0:a.getCenter())&&(a==null||a.panTo(R)),e.$$.dirty[0]&8208&&Y&&!fg(Y,a==null?void 0:a.getZoom())&&(a==null||a.zoomTo(Y)),e.$$.dirty[0]&16400&&B&&!fg(B,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(B)),e.$$.dirty[0]&16777232&&(ht?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[q,S,I,ee,a,h,i,r,ln,Ve,vr,br,R,Y,B,w,Z,et,P,z,j,ct,_t,lt,ht,pt,Tt,Q,gt,Kt,bt,Ut,Gt,Re,Pe,Cn,mn,Pr,y,u,hr]}class cO extends an{constructor(t){super(),sn(this,t,uO,lO,Ze,{map:15,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:16,bearing:17,bounds:14,hash:20,loaded:0,minZoom:21,maxZoom:22,antialias:23,zoomOnDoubleClick:24,locale:25,interactive:26,attributionControl:27,cooperativeGestures:28,preserveDrawingBuffer:29,maxBounds:30,images:31,standardControls:3,filterLayers:32,transformRequest:33},null,[-1,-1])}}const hO=e=>({marker:e&8}),O2=e=>({marker:e[3]});function fO(e){let t,n,r,i,a,h,u;const y=e[19].default,w=xi(y,e,e[18],O2);return{c(){t=jt("div"),w&&w.c(),Zt(t,"tabindex",n=e[1]?0:void 0),Zt(t,"role",r=e[1]?"button":void 0),Ui(t,"z-index",e[2])},m(S,I){Vt(S,t,I),w&&w.m(t,null),a=!0,h||(u=[y0(e[7].call(null,t)),y0(i=pO.call(null,t,e[0])),We(t,"click",B_(e[20])),We(t,"dblclick",B_(e[21])),We(t,"contextmenu",B_(e[22])),We(t,"mouseenter",e[23]),We(t,"mouseleave",e[24]),We(t,"mousemove",e[25]),We(t,"keydown",e[8])],h=!0)},p(S,[I]){w&&w.p&&(!a||I&262152)&&Si(w,y,S,S[18],a?wi(y,S[18],I,hO):Ei(S[18]),O2),(!a||I&2&&n!==(n=S[1]?0:void 0))&&Zt(t,"tabindex",n),(!a||I&2&&r!==(r=S[1]?"button":void 0))&&Zt(t,"role",r),i&&cy(i.update)&&I&1&&i.update.call(null,S[0]),I&4&&Ui(t,"z-index",S[2])},i(S){a||(It(w,S),a=!0)},o(S){At(w,S),a=!1},d(S){S&&Bt(t),w&&w.d(S),h=!1,Ri(u)}}}function pO(e,t){const n=e.className;function r(i){i?e.className=`${n} ${i}`:e.className=n}return r(t),{update:r}}function dO(e,t,n){let r,i,a,{$$slots:h={},$$scope:u}=t,{marker:y=void 0}=t,{lngLat:w}=t,{class:S=void 0}=t,{interactive:I=!0}=t,{asButton:P=!1}=t,{draggable:z=!1}=t,{feature:R=null}=t,{offset:Y=void 0}=t,{zIndex:Z=void 0}=t,{rotation:et=0}=t,{opacity:B=1}=t;const j=Uu(),{map:q,layerEvent:ct,self:_t}=MN();qe(e,q,Gt=>n(27,a=Gt)),qe(e,ct,Gt=>n(26,r=Gt)),qe(e,_t,Gt=>n(3,i=Gt));function lt(Gt){Jn(_t,i=new Es.Marker({element:Gt,rotation:et,draggable:z,offset:Y,opacity:B.toString()}).setLngLat(w).addTo(a),i),n(11,y=i);const Re=()=>Tt("dragstart"),xe=()=>{ht(),Tt("drag")},ln=()=>{ht(),Tt("dragend")};return z&&(i.on("dragstart",Re),i.on("drag",xe),i.on("dragend",ln)),{destroy(){z&&(i==null||i.off("dragstart",Re),i==null||i.off("drag",xe),i==null||i.off("dragend",ln)),n(11,y=void 0),i==null||i.remove()}}}function ht(){let Gt=i==null?void 0:i.getLngLat();Gt&&(Array.isArray(w)?n(10,w=[Gt.lng,Gt.lat]):w&&"lon"in w?n(10,w={lon:Gt.lng,lat:Gt.lat}):n(10,w=Gt))}function pt(Gt){Gt.key===" "&&(Gt.preventDefault(),Gt.stopPropagation(),Tt("click"))}function Tt(Gt){if(!I)return;let Re=i==null?void 0:i.getLngLat();if(!Re)return;const xe=[Re.lng,Re.lat];let ln={map:a,marker:i,lngLat:xe,features:[{type:"Feature",properties:(R==null?void 0:R.properties)??{},geometry:{type:"Point",coordinates:xe}}]};Jn(ct,r={...ln,layerType:"marker",type:Gt},r),j(Gt,ln)}const Q=()=>Tt("click"),gt=()=>Tt("dblclick"),Kt=()=>Tt("contextmenu"),bt=Gt=>{Tt("mouseenter")},Ut=()=>{Tt("mouseleave")},ee=()=>Tt("mousemove");return e.$$set=Gt=>{"marker"in Gt&&n(11,y=Gt.marker),"lngLat"in Gt&&n(10,w=Gt.lngLat),"class"in Gt&&n(0,S=Gt.class),"interactive"in Gt&&n(12,I=Gt.interactive),"asButton"in Gt&&n(1,P=Gt.asButton),"draggable"in Gt&&n(13,z=Gt.draggable),"feature"in Gt&&n(14,R=Gt.feature),"offset"in Gt&&n(15,Y=Gt.offset),"zIndex"in Gt&&n(2,Z=Gt.zIndex),"rotation"in Gt&&n(16,et=Gt.rotation),"opacity"in Gt&&n(17,B=Gt.opacity),"$$scope"in Gt&&n(18,u=Gt.$$scope)},e.$$.update=()=>{e.$$.dirty&1032&&(i==null||i.setLngLat(w)),e.$$.dirty&32776&&(i==null||i.setOffset(Y??[0,0])),e.$$.dirty&65544&&(i==null||i.setRotation(et)),e.$$.dirty&131080&&(i==null||i.setOpacity(B.toString()))},[S,P,Z,i,q,ct,_t,lt,pt,Tt,w,y,I,z,R,Y,et,B,u,h,Q,gt,Kt,bt,Ut,ee]}class kd extends an{constructor(t){super(),sn(this,t,dO,fO,Ze,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const mO=e=>({}),z2=e=>({}),gO=e=>({}),F2=e=>({});function yO(e){let t,n,r,i;const a=e[1].left,h=xi(a,e,e[0],F2),u=e[1].main,y=xi(u,e,e[0],z2);return{c(){t=jt("div"),h&&h.c(),n=fe(),r=jt("div"),y&&y.c(),Zt(t,"class","left svelte-k43lgc"),Zt(r,"class","main svelte-k43lgc")},m(w,S){Vt(w,t,S),h&&h.m(t,null),Vt(w,n,S),Vt(w,r,S),y&&y.m(r,null),i=!0},p(w,[S]){h&&h.p&&(!i||S&1)&&Si(h,a,w,w[0],i?wi(a,w[0],S,gO):Ei(w[0]),F2),y&&y.p&&(!i||S&1)&&Si(y,u,w,w[0],i?wi(u,w[0],S,mO):Ei(w[0]),z2)},i(w){i||(It(h,w),It(y,w),i=!0)},o(w){At(h,w),At(y,w),i=!1},d(w){w&&(Bt(t),Bt(n),Bt(r)),h&&h.d(w),y&&y.d(w)}}}function _O(e,t,n){let{$$slots:r={},$$scope:i}=t;return e.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class vO extends an{constructor(t){super(),sn(this,t,_O,yO,Ze,{})}}const bO=e=>({}),B2=e=>({}),xO=e=>({}),V2=e=>({});function wO(e){let t,n,r,i;const a=e[3].sidebar,h=xi(a,e,e[2],V2),u=e[3].map,y=xi(u,e,e[2],B2);return{c(){t=jt("div"),h&&h.c(),n=fe(),r=jt("div"),y&&y.c()},m(w,S){Vt(w,t,S),h&&h.m(t,null),e[4](t),Vt(w,n,S),Vt(w,r,S),y&&y.m(r,null),e[5](r),i=!0},p(w,[S]){h&&h.p&&(!i||S&4)&&Si(h,a,w,w[2],i?wi(a,w[2],S,xO):Ei(w[2]),V2),y&&y.p&&(!i||S&4)&&Si(y,u,w,w[2],i?wi(u,w[2],S,bO):Ei(w[2]),B2)},i(w){i||(It(h,w),It(y,w),i=!0)},o(w){At(h,w),At(y,w),i=!1},d(w){w&&(Bt(t),Bt(n),Bt(r)),h&&h.d(w),e[4](null),y&&y.d(w),e[5](null)}}}function SO(e,t,n){let r,i;qe(e,rv,w=>n(0,r=w)),qe(e,iv,w=>n(1,i=w));let{$$slots:a={},$$scope:h}=t;function u(w){rr[w?"unshift":"push"](()=>{r=w,rv.set(r)})}function y(w){rr[w?"unshift":"push"](()=>{i=w,iv.set(i)})}return e.$$set=w=>{"$$scope"in w&&n(2,h=w.$$scope)},[r,i,h,a,u,y]}class Zd extends an{constructor(t){super(),sn(this,t,SO,wO,Ze,{})}}let rv=$r(null),iv=$r(null);function EO(e){let t,n,r,i,a,h,u,y,w;return{c(){t=jt("label"),n=un(`Mode: + `),r=jt("select"),i=jt("option"),i.textContent="Car",a=jt("option"),a.textContent="Bicycle",h=jt("option"),h.textContent="Foot",u=jt("option"),u.textContent="Public transit",i.__value="car",Ea(i,i.__value),a.__value="bicycle",Ea(a,a.__value),h.__value="foot",Ea(h,h.__value),u.__value="transit",Ea(u,u.__value),e[0]===void 0&&dd(()=>e[1].call(r))},m(S,I){Vt(S,t,I),Ot(t,n),Ot(t,r),Ot(r,i),Ot(r,a),Ot(r,h),Ot(r,u),Mg(r,e[0],!0),y||(w=We(r,"change",e[1]),y=!0)},p(S,[I]){I&1&&Mg(r,S[0])},i:Se,o:Se,d(S){S&&Bt(t),y=!1,w()}}}function IO(e,t,n){let{travelMode:r}=t;function i(){r=zS(this),n(0,r)}return e.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class a1 extends an{constructor(t){super(),sn(this,t,IO,EO,Ze,{travelMode:0})}}function U2(e,t,n){const r=e.slice();return r[2]=t[n][0],r[3]=t[n][1],r}function G2(e,t,n){const r=e.slice();return r[6]=t[n],r}function q2(e){let t,n,r=H2(e[6])+"",i,a;return{c(){t=jt("li"),n=jt("a"),i=un(r),Zt(n,"href",a=e[6].properties.osm_id),Zt(n,"target","_blank")},m(h,u){Vt(h,t,u),Ot(t,n),Ot(n,i)},p(h,u){u&1&&r!==(r=H2(h[6])+"")&&Nr(i,r),u&1&&a!==(a=h[6].properties.osm_id)&&Zt(n,"href",a)},d(h){h&&Bt(t)}}}function j2(e){let t,n,r=e[2]+"",i,a,h=e[3].length+"",u,y,w,S,I,P=ti(e[3]),z=[];for(let R=0;Ri[1].length-r[1].length),n}function H2(e){let t=e.properties.name||`a ${e.properties.amenity_kind}`;return e.properties.brand&&(t+=` (${e.properties.brand})`),e.properties.cuisine&&(t+=` (${e.properties.cuisine})`),t}function TO(e,t,n){let r,{gj:i}=t;return e.$$set=a=>{"gj"in a&&n(1,i=a.gj)},e.$$.update=()=>{e.$$.dirty&2&&n(0,r=i.features.filter(a=>"amenity_kind"in a.properties))},[r,i]}class iC extends an{constructor(t){super(),sn(this,t,TO,CO,Ze,{gj:1})}}function LO(e){let t,n;return t=new pv({props:{properties:e[3]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&8&&(a.properties=r[3]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function PO(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[LO,({props:r})=>({3:r}),({props:r})=>r?8:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function MO(e){let t,n,r;function i(h){e[1](h)}let a={id:"amenities",paint:{"circle-radius":5,"circle-opacity":0,"circle-stroke-width":2,"circle-stroke-color":Ay("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[PO]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new s1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[2]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&16&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function AO(e,t,n){let{hovered:r=null}=t;function i(h){r=h,n(0,r)}const a=h=>window.open(Hl(h.detail.features[0].properties).osm_id,"_blank");return e.$$set=h=>{"hovered"in h&&n(0,r=h.hovered)},[r,i,a]}class oC extends an{constructor(t){super(),sn(this,t,AO,MO,Ze,{hovered:0})}}function Z2(e,t,n){const r=e.slice();return r[3]=t[n],r}function kO(e){let t=e[6].name+"",n,r,i=JSON.parse(e[6].next_steps).length+"",a,h;return{c(){n=un(t),r=un(" has "),a=un(i),h=un(" next steps (arrivals)")},m(u,y){Vt(u,n,y),Vt(u,r,y),Vt(u,a,y),Vt(u,h,y)},p(u,y){y&64&&t!==(t=u[6].name+"")&&Nr(n,t),y&64&&i!==(i=JSON.parse(u[6].next_steps).length+"")&&Nr(a,i)},d(u){u&&(Bt(n),Bt(r),Bt(a),Bt(h))}}}function DO(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[kO,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&192&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function X2(e){let t,n;return t=new US({props:{$$slots:{default:[RO]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&129&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function Y2(e){let t,n=JSON.stringify(e[3])+"",r;return{c(){t=jt("p"),r=un(n)},m(i,a){Vt(i,t,a),Ot(t,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&Nr(r,n)},d(i){i&&Bt(t)}}}function RO(e){let t,n=ti(e[0]),r=[];for(let i=0;i{a=null}),Bn())},i(h){i||(It(t.$$.fragment,h),It(a),i=!0)},o(h){At(t.$$.fragment,h),At(a),i=!1},d(h){h&&(Bt(n),Bt(r)),me(t,h),a&&a.d(h)}}}function OO(e,t,n){let r=null;return[r,h=>n(0,r=JSON.parse(Hl(h.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class zO extends an{constructor(t){super(),sn(this,t,OO,NO,Ze,{})}}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */const sC=Symbol("Comlink.proxy"),FO=Symbol("Comlink.endpoint"),BO=Symbol("Comlink.releaseProxy"),p0=Symbol("Comlink.finalizer"),Cg=Symbol("Comlink.thrown"),aC=e=>typeof e=="object"&&e!==null||typeof e=="function",VO={canHandle:e=>aC(e)&&e[sC],serialize(e){const{port1:t,port2:n}=new MessageChannel;return l1(e,t),[n,[n]]},deserialize(e){return e.start(),cC(e)}},UO={canHandle:e=>aC(e)&&Cg in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},lC=new Map([["proxy",VO],["throw",UO]]);function GO(e,t){for(const n of e)if(t===n||n==="*"||n instanceof RegExp&&n.test(t))return!0;return!1}function l1(e,t=globalThis,n=["*"]){t.addEventListener("message",function r(i){if(!i||!i.data)return;if(!GO(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:h,path:u}=Object.assign({path:[]},i.data),y=(i.data.argumentList||[]).map(_c);let w;try{const S=u.slice(0,-1).reduce((P,z)=>P[z],e),I=u.reduce((P,z)=>P[z],e);switch(h){case"GET":w=I;break;case"SET":S[u.slice(-1)[0]]=_c(i.data.value),w=!0;break;case"APPLY":w=I.apply(S,y);break;case"CONSTRUCT":{const P=new I(...y);w=pC(P)}break;case"ENDPOINT":{const{port1:P,port2:z}=new MessageChannel;l1(e,z),w=ZO(P,[P])}break;case"RELEASE":w=void 0;break;default:return}}catch(S){w={value:S,[Cg]:0}}Promise.resolve(w).catch(S=>({value:S,[Cg]:0})).then(S=>{const[I,P]=ay(S);t.postMessage(Object.assign(Object.assign({},I),{id:a}),P),h==="RELEASE"&&(t.removeEventListener("message",r),uC(t),p0 in e&&typeof e[p0]=="function"&&e[p0]())}).catch(S=>{const[I,P]=ay({value:new TypeError("Unserializable return value"),[Cg]:0});t.postMessage(Object.assign(Object.assign({},I),{id:a}),P)})}),t.start&&t.start()}function qO(e){return e.constructor.name==="MessagePort"}function uC(e){qO(e)&&e.close()}function cC(e,t){return ov(e,[],t)}function pg(e){if(e)throw new Error("Proxy has been released and is not useable")}function hC(e){return tf(e,{type:"RELEASE"}).then(()=>{uC(e)})}const oy=new WeakMap,sy="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(oy.get(e)||0)-1;oy.set(e,t),t===0&&hC(e)});function jO(e,t){const n=(oy.get(t)||0)+1;oy.set(t,n),sy&&sy.register(e,t,e)}function WO(e){sy&&sy.unregister(e)}function ov(e,t=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(a,h){if(pg(r),h===BO)return()=>{WO(i),hC(e),r=!0};if(h==="then"){if(t.length===0)return{then:()=>i};const u=tf(e,{type:"GET",path:t.map(y=>y.toString())}).then(_c);return u.then.bind(u)}return ov(e,[...t,h])},set(a,h,u){pg(r);const[y,w]=ay(u);return tf(e,{type:"SET",path:[...t,h].map(S=>S.toString()),value:y},w).then(_c)},apply(a,h,u){pg(r);const y=t[t.length-1];if(y===FO)return tf(e,{type:"ENDPOINT"}).then(_c);if(y==="bind")return ov(e,t.slice(0,-1));const[w,S]=K2(u);return tf(e,{type:"APPLY",path:t.map(I=>I.toString()),argumentList:w},S).then(_c)},construct(a,h){pg(r);const[u,y]=K2(h);return tf(e,{type:"CONSTRUCT",path:t.map(w=>w.toString()),argumentList:u},y).then(_c)}});return jO(i,e),i}function HO(e){return Array.prototype.concat.apply([],e)}function K2(e){const t=e.map(ay);return[t.map(n=>n[0]),HO(t.map(n=>n[1]))]}const fC=new WeakMap;function ZO(e,t){return fC.set(e,t),e}function pC(e){return Object.assign(e,{[sC]:!0})}function ay(e){for(const[t,n]of lC)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},fC.get(e)||[]]}function _c(e){switch(e.type){case"HANDLER":return lC.get(e.name).deserialize(e.value);case"RAW":return e.value}}function tf(e,t,n){return new Promise(r=>{const i=XO();e.addEventListener("message",function a(h){!h.data||!h.data.id||h.data.id!==i||(e.removeEventListener("message",a),r(h.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)})}function XO(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let yn;const Fl=new Array(128).fill(void 0);Fl.push(void 0,null,!0,!1);function On(e){return Fl[e]}let hd=Fl.length;function YO(e){e<132||(Fl[e]=hd,hd=e)}function ef(e){const t=On(e);return YO(e),t}const dC=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&dC.decode();let rd=null;function fd(){return(rd===null||rd.byteLength===0)&&(rd=new Uint8Array(yn.memory.buffer)),rd}function Bl(e,t){return e=e>>>0,dC.decode(fd().subarray(e,e+t))}function gi(e){hd===Fl.length&&Fl.push(Fl.length+1);const t=hd;return hd=Fl[t],Fl[t]=e,t}let wc=0;const Tg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},KO=typeof Tg.encodeInto=="function"?function(e,t){return Tg.encodeInto(e,t)}:function(e,t){const n=Tg.encode(e);return t.set(n),{read:e.length,written:n.length}};function d0(e,t,n){if(n===void 0){const u=Tg.encode(e),y=t(u.length,1)>>>0;return fd().subarray(y,y+u.length).set(u),wc=u.length,y}let r=e.length,i=t(r,1)>>>0;const a=fd();let h=0;for(;h127)break;a[i+h]=u}if(h!==r){h!==0&&(e=e.slice(h)),i=n(i,r,r=h+e.length*3,1)>>>0;const u=fd().subarray(i+h,i+r),y=KO(e,u);h+=y.written,i=n(i,r,h,1)>>>0}return wc=h,i}function Lg(e){return e==null}let id=null;function nr(){return(id===null||id.byteLength===0)&&(id=new Int32Array(yn.memory.buffer)),id}let od=null;function mC(){return(od===null||od.byteLength===0)&&(od=new Float64Array(yn.memory.buffer)),od}function sv(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){const i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){const i=e.length;let a="[";i>0&&(a+=sv(e[0]));for(let h=1;h1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} -${e.stack}`:r}function JO(e,t){const n=t(e.length*1,1)>>>0;return fd().set(e,n/1),wc=e.length,n}function QO(e,t){return e=e>>>0,mC().subarray(e/8,e/8+t)}function Yh(e,t){try{return e.apply(this,t)}catch(n){yn.__wbindgen_exn_store(gi(n))}}const $O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>yn.__wbg_mapmodel_free(e>>>0));class J2{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,$O.unregister(this),t}free(){const t=this.__destroy_into_raw();yn.__wbg_mapmodel_free(t)}constructor(t,n,r){try{const u=yn.__wbindgen_add_to_stack_pointer(-16),y=JO(t,yn.__wbindgen_malloc),w=wc;yn.mapmodel_new(u,y,w,n,Lg(r)?0:gi(r));var i=nr()[u/4+0],a=nr()[u/4+1],h=nr()[u/4+2];if(h)throw ef(a);return this.__wbg_ptr=i>>>0,this}finally{yn.__wbindgen_add_to_stack_pointer(16)}}renderDebug(){let t,n;try{const w=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_renderDebug(w,this.__wbg_ptr);var r=nr()[w/4+0],i=nr()[w/4+1],a=nr()[w/4+2],h=nr()[w/4+3],u=r,y=i;if(h)throw u=0,y=0,ef(a);return t=u,n=y,Bl(u,y)}finally{yn.__wbindgen_add_to_stack_pointer(16),yn.__wbindgen_free(t,n,1)}}getInvertedBoundary(){let t,n;try{const w=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=nr()[w/4+0],i=nr()[w/4+1],a=nr()[w/4+2],h=nr()[w/4+3],u=r,y=i;if(h)throw u=0,y=0,ef(a);return t=u,n=y,Bl(u,y)}finally{yn.__wbindgen_add_to_stack_pointer(16),yn.__wbindgen_free(t,n,1)}}getBounds(){try{const i=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_getBounds(i,this.__wbg_ptr);var t=nr()[i/4+0],n=nr()[i/4+1],r=QO(t,n).slice();return yn.__wbindgen_free(t,n*8,8),r}finally{yn.__wbindgen_add_to_stack_pointer(16)}}isochrone(t){let n,r;try{const S=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_isochrone(S,this.__wbg_ptr,gi(t));var i=nr()[S/4+0],a=nr()[S/4+1],h=nr()[S/4+2],u=nr()[S/4+3],y=i,w=a;if(u)throw y=0,w=0,ef(h);return n=y,r=w,Bl(y,w)}finally{yn.__wbindgen_add_to_stack_pointer(16),yn.__wbindgen_free(n,r,1)}}route(t){let n,r;try{const S=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_route(S,this.__wbg_ptr,gi(t));var i=nr()[S/4+0],a=nr()[S/4+1],h=nr()[S/4+2],u=nr()[S/4+3],y=i,w=a;if(u)throw y=0,w=0,ef(h);return n=y,r=w,Bl(y,w)}finally{yn.__wbindgen_add_to_stack_pointer(16),yn.__wbindgen_free(n,r,1)}}}async function t5(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function e5(){const e={};return e.wbg={},e.wbg.__wbindgen_object_drop_ref=function(t){ef(t)},e.wbg.__wbindgen_string_new=function(t,n){const r=Bl(t,n);return gi(r)},e.wbg.__wbindgen_boolean_get=function(t){const n=On(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_string_get=function(t,n){const r=On(n),i=typeof r=="string"?r:void 0;var a=Lg(i)?0:d0(i,yn.__wbindgen_malloc,yn.__wbindgen_realloc),h=wc;nr()[t/4+1]=h,nr()[t/4+0]=a},e.wbg.__wbindgen_error_new=function(t,n){const r=new Error(Bl(t,n));return gi(r)},e.wbg.__wbindgen_is_object=function(t){const n=On(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return On(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return On(t)in On(n)},e.wbg.__wbindgen_number_get=function(t,n){const r=On(n),i=typeof r=="number"?r:void 0;mC()[t/8+1]=Lg(i)?0:i,nr()[t/4+0]=!Lg(i)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return On(t)==On(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const r=On(t)[On(n)];return gi(r)},e.wbg.__wbindgen_object_clone_ref=function(t){const n=On(t);return gi(n)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(On(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(On(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(On(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(On(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(On(t))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return gi(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const r=On(n).stack,i=d0(r,yn.__wbindgen_malloc,yn.__wbindgen_realloc),a=wc;nr()[t/4+1]=a,nr()[t/4+0]=i},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let r,i;try{r=t,i=n,console.error(Bl(t,n))}finally{yn.__wbindgen_free(r,i,1)}},e.wbg.__wbg_performance_a1b8bde2ee512264=function(t){const n=On(t).performance;return gi(n)},e.wbg.__wbg_now_abd80e969af37148=function(t){return On(t).now()},e.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(t,n){const r=new Function(Bl(t,n));return gi(r)},e.wbg.__wbg_call_27c0f87801dedf93=function(){return Yh(function(t,n){const r=On(t).call(On(n));return gi(r)},arguments)},e.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return Yh(function(){const t=self.self;return gi(t)},arguments)},e.wbg.__wbg_window_c6fb939a7f436783=function(){return Yh(function(){const t=window.window;return gi(t)},arguments)},e.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return Yh(function(){const t=globalThis.globalThis;return gi(t)},arguments)},e.wbg.__wbg_global_207b558942527489=function(){return Yh(function(){const t=global.global;return gi(t)},arguments)},e.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(t){let n;try{n=On(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return Yh(function(t,n,r){const i=On(t).call(On(n),On(r));return gi(i)},arguments)},e.wbg.__wbg_buffer_12d079cc21e14bdb=function(t){const n=On(t).buffer;return gi(n)},e.wbg.__wbg_new_63b92bc8671ed464=function(t){const n=new Uint8Array(On(t));return gi(n)},e.wbg.__wbg_set_a47bac70306a19a7=function(t,n,r){On(t).set(On(n),r>>>0)},e.wbg.__wbg_length_c20a40f15020d68a=function(t){return On(t).length},e.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(t){let n;try{n=On(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_debug_string=function(t,n){const r=sv(On(n)),i=d0(r,yn.__wbindgen_malloc,yn.__wbindgen_realloc),a=wc;nr()[t/4+1]=a,nr()[t/4+0]=i},e.wbg.__wbindgen_throw=function(t,n){throw new Error(Bl(t,n))},e.wbg.__wbindgen_memory=function(){const t=yn.memory;return gi(t)},e}function n5(e,t){return yn=e.exports,av.__wbindgen_wasm_module=t,od=null,id=null,rd=null,yn}async function av(e){if(yn!==void 0)return yn;typeof e>"u"&&(e="/15m/assets/backend_bg.wasm");const t=e5();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:r}=await t5(await e,t);return n5(n,r)}class r5{constructor(){ci(this,"inner");this.inner=null}async loadOsmFile(t,n){await av(),this.inner=new J2(t,!0,n)}async loadGraphFile(t){await av(),this.inner=new J2(t,!1,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}isochrone(t){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:t.start.lng,y:t.start.lat,mode:t.mode,contours:t.contours}))}route(t){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:t.start.lng,y1:t.start.lat,x2:t.end[0],y2:t.end[1],mode:t.mode,debug_search:t.debugSearch}))}}l1(r5);let gC="MZEJTanw3WpxRvt7qDfo",Vo=$r({kind:"title"}),ky=$r(null),m0=$r(!0);function Q2(e){return["!=",["get",`access_${e}`],"None"]}let Fc=$r(null),lf=$r(!1);function $2(e){let t,n;return t=new Zd({props:{$$slots:{map:[l5],sidebar:[i5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&519&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function i5(e){let t,n,r,i,a,h,u,y,w,S,I,P,z,R,Z,X,et;function B(Y){e[6](Y)}let q={};return e[0]!==void 0&&(q.travelMode=e[0]),I=new a1({props:q}),rr.push(()=>Yo(I,"travelMode",B)),R=new iC({props:{gj:e[1]}}),{c(){t=jt("div"),n=jt("h2"),n.textContent="Debug mode",r=fe(),i=jt("div"),a=jt("button"),a.textContent="Change study area",h=fe(),u=jt("button"),u.textContent="Isochrones",y=fe(),w=jt("p"),w.textContent="Hover to see a segment's properties, and click to open OSM",S=fe(),_e(I.$$.fragment),z=fe(),_e(R.$$.fragment),Zt(t,"slot","sidebar")},m(Y,lt){Vt(Y,t,lt),Ot(t,n),Ot(t,r),Ot(t,i),Ot(i,a),Ot(i,h),Ot(i,u),Ot(t,y),Ot(t,w),Ot(t,S),de(I,t,null),Ot(t,z),de(R,t,null),Z=!0,X||(et=[Ye(a,"click",e[4]),Ye(u,"click",e[5])],X=!0)},p(Y,lt){const dt={};!P&<&1&&(P=!0,dt.travelMode=Y[0],Xo(()=>P=!1)),I.$set(dt);const ut={};lt&2&&(ut.gj=Y[1]),R.$set(ut)},i(Y){Z||(It(I.$$.fragment,Y),It(R.$$.fragment,Y),Z=!0)},o(Y){Mt(I.$$.fragment,Y),Mt(R.$$.fragment,Y),Z=!1},d(Y){Y&&Bt(t),me(I),me(R),X=!1,Ri(et)}}}function o5(e){let t,n;return t=new pv({props:{properties:e[8]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&256&&(a.properties=r[8]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function s5(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[o5,({props:r})=>({8:r}),({props:r})=>r?256:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&768&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function a5(e){let t,n,r,i,a,h;return t=new jf({props:{id:"network",paint:{"line-width":Ay(5,7),"line-color":"black"},filter:Q2(e[0]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[s5]},$$scope:{ctx:e}}}),t.$on("click",e[3]),r=new oC({}),a=new zO({}),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment),i=fe(),_e(a.$$.fragment)},m(u,y){de(t,u,y),Vt(u,n,y),de(r,u,y),Vt(u,i,y),de(a,u,y),h=!0},p(u,y){const w={};y&1&&(w.filter=Q2(u[0])),y&512&&(w.$$scope={dirty:y,ctx:u}),t.$set(w)},i(u){h||(It(t.$$.fragment,u),It(r.$$.fragment,u),It(a.$$.fragment,u),h=!0)},o(u){Mt(t.$$.fragment,u),Mt(r.$$.fragment,u),Mt(a.$$.fragment,u),h=!1},d(u){u&&(Bt(n),Bt(i)),me(t,u),me(r,u),me(a,u)}}}function l5(e){let t,n,r;return n=new zc({props:{data:e[1],generateId:!0,$$slots:{default:[a5]},$$scope:{ctx:e}}}),{c(){t=jt("div"),_e(n.$$.fragment),Zt(t,"slot","map")},m(i,a){Vt(i,t,a),de(n,t,null),r=!0},p(i,a){const h={};a&2&&(h.data=i[1]),a&513&&(h.$$scope={dirty:a,ctx:i}),n.$set(h)},i(i){r||(It(n.$$.fragment,i),r=!0)},o(i){Mt(n.$$.fragment,i),r=!1},d(i){i&&Bt(t),me(n)}}}function u5(e){let t,n,r=e[1]&&$2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&It(r,1)):(r=$2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),Mt(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){Mt(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function c5(e,t,n){let r,i;qe(e,Fc,I=>n(7,r=I)),qe(e,Vo,I=>n(2,i=I));let a="foot",h=null;Vu(async()=>{n(1,h=await r.renderDebug())});const u=I=>window.open(Hl(I.detail.features[0].properties).way,"_blank"),y=()=>Jn(Vo,i={kind:"title"},i),w=()=>Jn(Vo,i={kind:"isochrone"},i);function S(I){a=I,n(0,a)}return[a,h,i,u,y,w,S]}class h5 extends an{constructor(t){super(),sn(this,t,c5,u5,He,{})}}const lv=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"];function tS(e){let t,n;return{c(){t=jt("p"),n=hn(e[6])},m(r,i){Vt(r,t,i),Ot(t,n)},p(r,i){i&64&&Nr(n,r[6])},d(r){r&&Bt(t)}}}function eS(e){let t,n;return t=new iC({props:{gj:e[4]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&16&&(a.gj=r[4]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function f5(e){let t,n,r,i,a,h,u,y,w,S,I,P,z,R,Z,X,et,B,q,Y,lt,dt,ut,ft,_t;function kt(bt){e[15](bt)}let Q={};e[0]!==void 0&&(Q.travelMode=e[0]),z=new a1({props:Q}),rr.push(()=>Yo(z,"travelMode",kt)),Y=new KL({props:{colorScale:lv,limits:e[8]}});let yt=e[6]&&tS(e),Kt=e[4]&&eS(e);return{c(){t=jt("div"),n=jt("h2"),n.textContent="Isochrone mode",r=fe(),i=jt("div"),a=jt("button"),a.textContent="Change study area",h=fe(),u=jt("button"),u.textContent="Route",y=fe(),w=jt("button"),w.textContent="Debug OSM",S=fe(),I=jt("p"),I.textContent=`Move the pin to calculate an isochrone from that start. The cost is time - in seconds.`,P=fe(),_e(z.$$.fragment),Z=fe(),X=jt("label"),et=jt("input"),B=hn("Contours"),q=fe(),_e(Y.$$.fragment),lt=fe(),yt&&yt.c(),dt=fe(),Kt&&Kt.c(),Zt(et,"type","checkbox"),Zt(t,"slot","sidebar")},m(bt,Ut){Vt(bt,t,Ut),Ot(t,n),Ot(t,r),Ot(t,i),Ot(i,a),Ot(i,h),Ot(i,u),Ot(i,y),Ot(i,w),Ot(t,S),Ot(t,I),Ot(t,P),de(z,t,null),Ot(t,Z),Ot(t,X),Ot(X,et),et.checked=e[2],Ot(X,B),Ot(t,q),de(Y,t,null),Ot(t,lt),yt&&yt.m(t,null),Ot(t,dt),Kt&&Kt.m(t,null),ut=!0,ft||(_t=[Ye(a,"click",e[12]),Ye(u,"click",e[13]),Ye(w,"click",e[14]),Ye(et,"change",e[16])],ft=!0)},p(bt,Ut){const ee={};!R&&Ut&1&&(R=!0,ee.travelMode=bt[0],Xo(()=>R=!1)),z.$set(ee),Ut&4&&(et.checked=bt[2]),bt[6]?yt?yt.p(bt,Ut):(yt=tS(bt),yt.c(),yt.m(t,dt)):yt&&(yt.d(1),yt=null),bt[4]?Kt?(Kt.p(bt,Ut),Ut&16&&It(Kt,1)):(Kt=eS(bt),Kt.c(),It(Kt,1),Kt.m(t,null)):Kt&&(Fn(),Mt(Kt,1,1,()=>{Kt=null}),Bn())},i(bt){ut||(It(z.$$.fragment,bt),It(Y.$$.fragment,bt),It(Kt),ut=!0)},o(bt){Mt(z.$$.fragment,bt),Mt(Y.$$.fragment,bt),Mt(Kt),ut=!1},d(bt){bt&&Bt(t),me(z),me(Y),yt&&yt.d(),Kt&&Kt.d(),ft=!1,Ri(_t)}}}function nS(e){let t,n,r;function i(h){e[10](h)}let a={draggable:!0,$$slots:{default:[p5]},$$scope:{ctx:e}};return e[1]!==void 0&&(a.lngLat=e[1]),t=new kd({props:a}),rr.push(()=>Yo(t,"lngLat",i)),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,u){const y={};u&2097152&&(y.$$scope={dirty:u,ctx:h}),!n&&u&2&&(n=!0,y.lngLat=h[1],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function p5(e){let t;return{c(){t=jt("span"),t.textContent="X",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function rS(e){let t,n;return t=new zc({props:{data:e[4],$$slots:{default:[g5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&16&&(a.data=r[4]),i&2097160&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function d5(e){let t=(e[20].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=hn(t),r=hn(" minutes away")},m(i,a){Vt(i,n,a),Vt(i,r,a)},p(i,a){a&1048576&&t!==(t=(i[20].cost_seconds/60).toFixed(1)+"")&&Nr(n,t)},d(i){i&&(Bt(n),Bt(r))}}}function m5(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[d5,({props:r})=>({20:r}),({props:r})=>r?1048576:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&3145728&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function g5(e){let t,n,r,i,a,h,u;t=new jf({props:{id:"isochrone",filter:EN,paint:{"line-width":20,"line-color":C2(["get","cost_seconds"],e[9],lv),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[m5]},$$scope:{ctx:e}}}),r=new rC({props:{id:"isochrone-contours",filter:SN,paint:{"fill-color":C2(["get","min_seconds"],e[9],lv),"fill-opacity":.5}}});function y(S){e[11](S)}let w={};return e[3]!==void 0&&(w.hovered=e[3]),a=new oC({props:w}),rr.push(()=>Yo(a,"hovered",y)),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment),i=fe(),_e(a.$$.fragment)},m(S,I){de(t,S,I),Vt(S,n,I),de(r,S,I),Vt(S,i,I),de(a,S,I),u=!0},p(S,I){const P={};I&2097152&&(P.$$scope={dirty:I,ctx:S}),t.$set(P);const z={};!h&&I&8&&(h=!0,z.hovered=S[3],Xo(()=>h=!1)),a.$set(z)},i(S){u||(It(t.$$.fragment,S),It(r.$$.fragment,S),It(a.$$.fragment,S),u=!0)},o(S){Mt(t.$$.fragment,S),Mt(r.$$.fragment,S),Mt(a.$$.fragment,S),u=!1},d(S){S&&(Bt(n),Bt(i)),me(t,S),me(r,S),me(a,S)}}}function iS(e){let t,n;return t=new zc({props:{data:e[5],$$slots:{default:[y5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&2097152&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function y5(e){let t,n;return t=new jf({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function _5(e){let t,n,r,i,a=e[1]&&nS(e),h=e[4]&&rS(e),u=e[5]&&iS(e);return{c(){t=jt("div"),a&&a.c(),n=fe(),h&&h.c(),r=fe(),u&&u.c(),Zt(t,"slot","map")},m(y,w){Vt(y,t,w),a&&a.m(t,null),Ot(t,n),h&&h.m(t,null),Ot(t,r),u&&u.m(t,null),i=!0},p(y,w){y[1]?a?(a.p(y,w),w&2&&It(a,1)):(a=nS(y),a.c(),It(a,1),a.m(t,n)):a&&(Fn(),Mt(a,1,1,()=>{a=null}),Bn()),y[4]?h?(h.p(y,w),w&16&&It(h,1)):(h=rS(y),h.c(),It(h,1),h.m(t,r)):h&&(Fn(),Mt(h,1,1,()=>{h=null}),Bn()),y[5]?u?(u.p(y,w),w&32&&It(u,1)):(u=iS(y),u.c(),It(u,1),u.m(t,null)):u&&(Fn(),Mt(u,1,1,()=>{u=null}),Bn())},i(y){i||(It(a),It(h),It(u),i=!0)},o(y){Mt(a),Mt(h),Mt(u),i=!1},d(y){y&&Bt(t),a&&a.d(),h&&h.d(),u&&u.d()}}}function v5(e){let t,n;return t=new Zd({props:{$$slots:{map:[_5],sidebar:[f5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&2097407&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function oS(e,t,n){return t+e*(n-t)}function b5(e,t,n){let r,i;qe(e,Fc,ut=>n(17,r=ut)),qe(e,Vo,ut=>n(7,i=ut));let a="foot",h=null;Vu(async()=>{let ut=await r.getBounds();n(1,h={lng:oS(.5,ut[0],ut[2]),lat:oS(.5,ut[1],ut[3])})});let u=!0,y=null,w=null,S="",I;async function P(ut,ft,_t){if(h)try{n(4,y=await r.isochrone({start:h,mode:a,contours:u})),n(6,S="")}catch(kt){n(4,y=null),kt=kt.toString()}}async function z(ut,ft){if(h&&I)try{n(5,w=await r.route({start:h,end:I.geometry.coordinates,mode:a,debugSearch:!1})),n(6,S="")}catch(_t){n(5,w=null),_t=_t.toString()}else n(5,w=null)}let R=[0,3,6,9,12,15],Z=R.map(ut=>ut*60);function X(ut){h=ut,n(1,h)}function et(ut){I=ut,n(3,I)}const B=()=>Jn(Vo,i={kind:"title"},i),q=()=>Jn(Vo,i={kind:"route"},i),Y=()=>Jn(Vo,i={kind:"debug"},i);function lt(ut){a=ut,n(0,a)}function dt(){u=this.checked,n(2,u)}return e.$$.update=()=>{e.$$.dirty&7&&P(),e.$$.dirty&10&&z()},[a,h,u,I,y,w,S,i,R,Z,X,et,B,q,Y,lt,dt]}class x5 extends an{constructor(t){super(),sn(this,t,b5,v5,He,{})}}function sS(e,t,n){const r=e.slice();r[16]=t[n];const i=Hl(r[16].properties);return r[15]=i,r}function w5(e){let t,n,r,i,a,h=ti(e[3].features),u=[];for(let y=0;yYo(w,"travelMode",et));function q(dt,ut){if(dt[4])return S5;if(dt[3])return w5}let Y=q(e),lt=Y&&Y(e);return{c(){t=jt("div"),n=jt("h2"),n.textContent="Route mode",r=fe(),i=jt("div"),a=jt("button"),a.textContent="Change study area",h=fe(),u=jt("button"),u.textContent="Isochrone mode",y=fe(),_e(w.$$.fragment),I=fe(),P=jt("p"),P.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to - set the first pin somewhere.)`,z=fe(),lt&<.c(),Zt(t,"slot","sidebar")},m(dt,ut){Vt(dt,t,ut),Ot(t,n),Ot(t,r),Ot(t,i),Ot(i,a),Ot(i,h),Ot(i,u),Ot(t,y),de(w,t,null),Ot(t,I),Ot(t,P),Ot(t,z),lt&<.m(t,null),R=!0,Z||(X=[Ye(a,"click",e[10]),Ye(u,"click",e[11])],Z=!0)},p(dt,ut){const ft={};!S&&ut&1&&(S=!0,ft.travelMode=dt[0],Xo(()=>S=!1)),w.$set(ft),Y===(Y=q(dt))&<?lt.p(dt,ut):(lt&<.d(1),lt=Y&&Y(dt),lt&&(lt.c(),lt.m(t,null)))},i(dt){R||(It(w.$$.fragment,dt),R=!0)},o(dt){Mt(w.$$.fragment,dt),R=!1},d(dt){dt&&Bt(t),me(w),lt&<.d(),Z=!1,Ri(X)}}}function lS(e){let t,n,r;function i(h){e[8](h)}let a={draggable:!0,$$slots:{default:[T5]},$$scope:{ctx:e}};return e[1]!==void 0&&(a.lngLat=e[1]),t=new kd({props:a}),rr.push(()=>Yo(t,"lngLat",i)),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,u){const y={};u&524288&&(y.$$scope={dirty:u,ctx:h}),!n&&u&2&&(n=!0,y.lngLat=h[1],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function T5(e){let t;return{c(){t=jt("span"),t.textContent="A",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function uS(e){let t,n,r;function i(h){e[9](h)}let a={draggable:!0,$$slots:{default:[L5]},$$scope:{ctx:e}};return e[2]!==void 0&&(a.lngLat=e[2]),t=new kd({props:a}),rr.push(()=>Yo(t,"lngLat",i)),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,u){const y={};u&524288&&(y.$$scope={dirty:u,ctx:h}),!n&&u&4&&(n=!0,y.lngLat=h[2],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function L5(e){let t;return{c(){t=jt("span"),t.textContent="B",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function cS(e){let t,n;return t=new zc({props:{data:e[3],generateId:!0,$$slots:{default:[A5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&8&&(a.data=r[3]),i&524288&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function P5(e){let t,n;return t=new pv({props:{properties:e[15]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&32768&&(a.properties=r[15]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function M5(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[P5,({props:r})=>({15:r}),({props:r})=>r?32768:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&557056&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function A5(e){let t,n;return t=new jf({props:{id:"route",paint:{"line-width":20,"line-color":n1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":Ay(.5,1)},manageHoverState:!0,$$slots:{default:[M5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&524288&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function k5(e){let t,n,r,i,a,h;n=new $N({}),n.$on("contextmenu",e[6]);let u=e[1]&&lS(e),y=e[2]&&uS(e),w=e[3]&&cS(e);return{c(){t=jt("div"),_e(n.$$.fragment),r=fe(),u&&u.c(),i=fe(),y&&y.c(),a=fe(),w&&w.c(),Zt(t,"slot","map")},m(S,I){Vt(S,t,I),de(n,t,null),Ot(t,r),u&&u.m(t,null),Ot(t,i),y&&y.m(t,null),Ot(t,a),w&&w.m(t,null),h=!0},p(S,I){S[1]?u?(u.p(S,I),I&2&&It(u,1)):(u=lS(S),u.c(),It(u,1),u.m(t,i)):u&&(Fn(),Mt(u,1,1,()=>{u=null}),Bn()),S[2]?y?(y.p(S,I),I&4&&It(y,1)):(y=uS(S),y.c(),It(y,1),y.m(t,a)):y&&(Fn(),Mt(y,1,1,()=>{y=null}),Bn()),S[3]?w?(w.p(S,I),I&8&&It(w,1)):(w=cS(S),w.c(),It(w,1),w.m(t,null)):w&&(Fn(),Mt(w,1,1,()=>{w=null}),Bn())},i(S){h||(It(n.$$.fragment,S),It(u),It(y),It(w),h=!0)},o(S){Mt(n.$$.fragment,S),Mt(u),Mt(y),Mt(w),h=!1},d(S){S&&Bt(t),me(n),u&&u.d(),y&&y.d(),w&&w.d()}}}function D5(e){let t,n;return t=new Zd({props:{$$slots:{map:[k5],sidebar:[C5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&524351&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function dg(e,t,n){return t+e*(n-t)}function R5(e,t,n){let r,i;qe(e,Vo,B=>n(5,r=B)),qe(e,Fc,B=>n(13,i=B));let a="foot",h=null,u=null;Vu(async()=>{let B=await i.getBounds();n(1,h={lng:dg(.4,B[0],B[2]),lat:dg(.4,B[1],B[3])}),n(2,u={lng:dg(.6,B[0],B[2]),lat:dg(.6,B[1],B[3])})});let y=null,w="";async function S(B,q,Y){if(h&&u)try{n(3,y=await i.route({start:h,end:[u.lng,u.lat],mode:Y,debugSearch:!1})),n(4,w="")}catch(lt){n(3,y=null),n(4,w=lt.toString())}}function I(B){n(1,h=B.detail.lngLat)}async function P(){try{let B=await i.route({start:h,end:[u.lng,u.lat],mode:a,debugSearch:!0});Jn(Vo,r={kind:"debug-route",debugGj:B,start:h,end:u,routeGj:y},r)}catch(B){n(4,w=B.toString())}}function z(B){h=B,n(1,h)}function R(B){u=B,n(2,u)}const Z=()=>Jn(Vo,r={kind:"title"},r),X=()=>Jn(Vo,r={kind:"isochrone"},r);function et(B){a=B,n(0,a)}return e.$$.update=()=>{e.$$.dirty&7&&S(h,u,a)},[a,h,u,y,w,r,I,P,z,R,Z,X,et]}class N5 extends an{constructor(t){super(),sn(this,t,R5,D5,He,{})}}function O5(e){let t,n,r,i,a,h,u,y,w,S,I,P,z=Hl(e[4].features[e[4].features.length-1].properties).time+"",R,Z,X;return{c(){t=jt("div"),n=jt("h2"),n.textContent="Debugging a route",r=fe(),i=jt("div"),a=jt("button"),a.textContent="Back",h=fe(),u=jt("p"),u.textContent=`${e[6]} total nodes searched`,y=fe(),w=jt("input"),S=fe(),I=jt("p"),P=hn("Search is currently at "),R=hn(z),Zt(w,"type","range"),Zt(w,"min","1"),Zt(w,"max",e[6]),Zt(t,"slot","sidebar")},m(et,B){Vt(et,t,B),Ot(t,n),Ot(t,r),Ot(t,i),Ot(i,a),Ot(t,h),Ot(t,u),Ot(t,y),Ot(t,w),Ea(w,e[3]),Ot(t,S),Ot(t,I),Ot(I,P),Ot(I,R),Z||(X=[Ye(a,"click",e[9]),Ye(w,"change",e[10]),Ye(w,"input",e[10])],Z=!0)},p(et,B){B&8&&Ea(w,et[3]),B&16&&z!==(z=Hl(et[4].features[et[4].features.length-1].properties).time+"")&&Nr(R,z)},d(et){et&&Bt(t),Z=!1,Ri(X)}}}function z5(e){let t;return{c(){t=jt("span"),t.textContent="A",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function F5(e){let t;return{c(){t=jt("span"),t.textContent="B",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function B5(e){let t,n;return t=new jf({props:{paint:{"line-width":20,"line-color":n1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function V5(e){let t,n,r,i;return t=new s1({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new jf({props:{paint:{"line-width":5,"line-color":n1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment)},m(a,h){de(t,a,h),Vt(a,n,h),de(r,a,h),i=!0},p:Se,i(a){i||(It(t.$$.fragment,a),It(r.$$.fragment,a),i=!0)},o(a){Mt(t.$$.fragment,a),Mt(r.$$.fragment,a),i=!1},d(a){a&&Bt(n),me(t,a),me(r,a)}}}function U5(e){let t,n,r,i,a,h,u,y,w;return n=new kd({props:{lngLat:e[0],$$slots:{default:[z5]},$$scope:{ctx:e}}}),i=new kd({props:{lngLat:e[1],$$slots:{default:[F5]},$$scope:{ctx:e}}}),h=new zc({props:{data:e[2],$$slots:{default:[B5]},$$scope:{ctx:e}}}),y=new zc({props:{data:e[4],generateId:!0,$$slots:{default:[V5]},$$scope:{ctx:e}}}),{c(){t=jt("div"),_e(n.$$.fragment),r=fe(),_e(i.$$.fragment),a=fe(),_e(h.$$.fragment),u=fe(),_e(y.$$.fragment),Zt(t,"slot","map")},m(S,I){Vt(S,t,I),de(n,t,null),Ot(t,r),de(i,t,null),Ot(t,a),de(h,t,null),Ot(t,u),de(y,t,null),w=!0},p(S,I){const P={};I&1&&(P.lngLat=S[0]),I&4096&&(P.$$scope={dirty:I,ctx:S}),n.$set(P);const z={};I&2&&(z.lngLat=S[1]),I&4096&&(z.$$scope={dirty:I,ctx:S}),i.$set(z);const R={};I&4&&(R.data=S[2]),I&4096&&(R.$$scope={dirty:I,ctx:S}),h.$set(R);const Z={};I&16&&(Z.data=S[4]),I&4096&&(Z.$$scope={dirty:I,ctx:S}),y.$set(Z)},i(S){w||(It(n.$$.fragment,S),It(i.$$.fragment,S),It(h.$$.fragment,S),It(y.$$.fragment,S),w=!0)},o(S){Mt(n.$$.fragment,S),Mt(i.$$.fragment,S),Mt(h.$$.fragment,S),Mt(y.$$.fragment,S),w=!1},d(S){S&&Bt(t),me(n),me(i),me(h),me(y)}}}function G5(e){let t,n,r,i;return t=new Zd({props:{$$slots:{map:[U5],sidebar:[O5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(a,h){de(t,a,h),n=!0,r||(i=Ye(window,"keydown",e[7]),r=!0)},p(a,[h]){const u={};h&4159&&(u.$$scope={dirty:h,ctx:a}),t.$set(u)},i(a){n||(It(t.$$.fragment,a),n=!0)},o(a){Mt(t.$$.fragment,a),n=!1},d(a){me(t,a),r=!1,i()}}}function q5(e,t,n){let r,i,a;qe(e,ky,Z=>n(11,i=Z)),qe(e,Vo,Z=>n(5,a=Z));let{debugGj:h}=t,{start:u}=t,{end:y}=t,{routeGj:w}=t,S=h.features.length/2,I=1;function P(Z){Z.key=="ArrowLeft"&&I>1&&(Z.stopPropagation(),n(3,I--,I)),Z.key=="ArrowRight"&&I{i==null||i.keyboard.disable()}),as(()=>{i==null||i.keyboard.enable()});const z=()=>Jn(Vo,a={kind:"route"},a);function R(){I=AL(this.value),n(3,I)}return e.$$set=Z=>{"debugGj"in Z&&n(8,h=Z.debugGj),"start"in Z&&n(0,u=Z.start),"end"in Z&&n(1,y=Z.end),"routeGj"in Z&&n(2,w=Z.routeGj)},e.$$.update=()=>{e.$$.dirty&264&&n(4,r={type:"FeatureCollection",features:h.features.slice(0,2*I)})},[u,y,w,I,r,a,S,P,h,z,R]}class j5 extends an{constructor(t){super(),sn(this,t,q5,G5,He,{debugGj:8,start:0,end:1,routeGj:2})}}var bo=63710088e-1,u1={centimeters:bo*100,centimetres:bo*100,degrees:bo/111325,feet:bo*3.28084,inches:bo*39.37,kilometers:bo/1e3,kilometres:bo/1e3,meters:bo,metres:bo,miles:bo/1609.344,millimeters:bo*1e3,millimetres:bo*1e3,nauticalmiles:bo/1852,radians:1,yards:bo*1.0936},W5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/bo,yards:1.0936133},uv={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ca(e,t,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function H5(e,t,n){switch(e){case"Point":return rs(t).geometry;case"LineString":return Ks(t).geometry;case"Polygon":return c1(t).geometry;case"MultiPoint":return _C(t).geometry;case"MultiLineString":return yC(t).geometry;case"MultiPolygon":return vC(t).geometry;default:throw new Error(e+" is invalid")}}function rs(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ly(e[0])||!ly(e[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:e};return ca(r,t,n)}function Z5(e,t,n){return n===void 0&&(n={}),Bc(e.map(function(r){return rs(r,t)}),n)}function c1(e,t,n){n===void 0&&(n={});for(var r=0,i=e;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n}function h1(e,t){t===void 0&&(t="kilometers");var n=u1[t];if(!n)throw new Error(t+" units is invalid");return e*n}function Dy(e,t){t===void 0&&(t="kilometers");var n=u1[t];if(!n)throw new Error(t+" units is invalid");return e/n}function Q5(e,t){return Dd(Dy(e,t))}function $5(e){var t=e%360;return t<0&&(t+=360),t}function Dd(e){var t=e%(2*Math.PI);return t*180/Math.PI}function Js(e){var t=e%360;return t*Math.PI/180}function tz(e,t,n){if(t===void 0&&(t="kilometers"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return h1(Dy(e,t),n)}function ez(e,t,n){if(t===void 0&&(t="meters"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var r=uv[t];if(!r)throw new Error("invalid original units");var i=uv[n];if(!i)throw new Error("invalid final units");return e/r*i}function ly(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function f1(e){return!!e&&e.constructor===Object}function nz(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!ly(t))throw new Error("bbox must only contain numbers")})}function rz(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}const iz=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:uv,bearingToAzimuth:$5,convertArea:ez,convertLength:tz,degreesToRadians:Js,earthRadius:bo,factors:u1,feature:ca,featureCollection:Bc,geometry:H5,geometryCollection:K5,isNumber:ly,isObject:f1,lengthToDegrees:Q5,lengthToRadians:Dy,lineString:Ks,lineStrings:Y5,multiLineString:yC,multiPoint:_C,multiPolygon:vC,point:rs,points:Z5,polygon:c1,polygons:X5,radiansToDegrees:Dd,radiansToLength:h1,round:J5,unitsFactors:W5,validateBBox:nz,validateId:rz},Symbol.toStringTag,{value:"Module"}));function Rd(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Df(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function bC(e,t,n){if(n===void 0&&(n={}),n.final===!0)return oz(e,t);var r=Rd(e),i=Rd(t),a=Js(r[0]),h=Js(i[0]),u=Js(r[1]),y=Js(i[1]),w=Math.sin(h-a)*Math.cos(y),S=Math.cos(u)*Math.sin(y)-Math.sin(u)*Math.cos(y)*Math.cos(h-a);return Dd(Math.atan2(w,S))}function oz(e,t){var n=bC(t,e);return n=(n+180)%360,n}function Qp(e,t,n){n===void 0&&(n={});var r=Rd(e),i=Rd(t),a=Js(i[1]-r[1]),h=Js(i[0]-r[0]),u=Js(r[1]),y=Js(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(u)*Math.cos(y);return h1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function hS(e,t,n,r){r===void 0&&(r={});var i=Rd(e),a=Js(i[0]),h=Js(i[1]),u=Js(n),y=Dy(t,r.units),w=Math.asin(Math.sin(h)*Math.cos(y)+Math.cos(h)*Math.sin(y)*Math.cos(u)),S=a+Math.atan2(Math.sin(u)*Math.sin(y)*Math.cos(h),Math.cos(y)-Math.sin(h)*Math.sin(w)),I=Dd(S),P=Dd(w);return rs([I,P],r.properties)}function Xd(e,t,n){if(e!==null)for(var r,i,a,h,u,y,w,S=0,I=0,P,z=e.type,R=z==="FeatureCollection",Z=z==="Feature",X=R?e.features.length:1,et=0;ety||R>w||Z>S){u=I,y=r,w=R,S=Z,a=0;return}var X=Ks([u,I],n.properties);if(t(X,r,i,Z,a)===!1)return!1;a++,u=I})===!1)return!1}}})}function fz(e,t,n){var r=n,i=!1;return wC(e,function(a,h,u,y,w){i===!1&&n===void 0?r=a:r=t(r,a,h,u,y,w),i=!0}),r}function SC(e,t){if(!e)throw new Error("geojson is required");Wf(e,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,h=n.geometry.coordinates;switch(a){case"LineString":if(t(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;ui?n:i,w=r>a?r:a;return[h,u,y,w]}var d1={exports:{}},EC={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Nd,function(){function n(B,q,Y,lt,dt){(function ut(ft,_t,kt,Q,yt){for(;Q>kt;){if(Q-kt>600){var Kt=Q-kt+1,bt=_t-kt+1,Ut=Math.log(Kt),ee=.5*Math.exp(2*Ut/3),Gt=.5*Math.sqrt(Ut*ee*(Kt-ee)/Kt)*(bt-Kt/2<0?-1:1),Re=Math.max(kt,Math.floor(_t-bt*ee/Kt+Gt)),xe=Math.min(Q,Math.floor(_t+(Kt-bt)*ee/Kt+Gt));ut(ft,_t,Re,xe,yt)}var ln=ft[_t],Ve=kt,Pe=Q;for(r(ft,kt,_t),yt(ft[Q],ln)>0&&r(ft,kt,Q);Ve0;)Pe--}yt(ft[kt],ln)===0?r(ft,kt,Pe):r(ft,++Pe,Q),Pe<=_t&&(kt=Pe+1),_t<=Pe&&(Q=Pe-1)}})(B,q,Y||0,lt||B.length-1,dt||i)}function r(B,q,Y){var lt=B[q];B[q]=B[Y],B[Y]=lt}function i(B,q){return Bq?1:0}var a=function(B){B===void 0&&(B=9),this._maxEntries=Math.max(4,B),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function h(B,q,Y){if(!Y)return q.indexOf(B);for(var lt=0;lt=B.minX&&q.maxY>=B.minY}function X(B){return{children:B,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function et(B,q,Y,lt,dt){for(var ut=[q,Y];ut.length;)if(!((Y=ut.pop())-(q=ut.pop())<=lt)){var ft=q+Math.ceil((Y-q)/lt/2)*lt;n(B,ft,q,Y,dt),ut.push(q,ft,ft,Y)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(B){var q=this.data,Y=[];if(!Z(B,q))return Y;for(var lt=this.toBBox,dt=[];q;){for(var ut=0;ut=0&&dt[q].children.length>this._maxEntries;)this._split(dt,q),q--;this._adjustParentBBoxes(lt,dt,q)},a.prototype._split=function(B,q){var Y=B[q],lt=Y.children.length,dt=this._minEntries;this._chooseSplitAxis(Y,dt,lt);var ut=this._chooseSplitIndex(Y,dt,lt),ft=X(Y.children.splice(ut,Y.children.length-ut));ft.height=Y.height,ft.leaf=Y.leaf,u(Y,this.toBBox),u(ft,this.toBBox),q?B[q-1].children.push(ft):this._splitRoot(Y,ft)},a.prototype._splitRoot=function(B,q){this.data=X([B,q]),this.data.height=B.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(B,q,Y){for(var lt,dt,ut,ft,_t,kt,Q,yt=1/0,Kt=1/0,bt=q;bt<=Y-q;bt++){var Ut=y(B,0,bt,this.toBBox),ee=y(B,bt,Y,this.toBBox),Gt=(dt=Ut,ut=ee,ft=void 0,_t=void 0,kt=void 0,Q=void 0,ft=Math.max(dt.minX,ut.minX),_t=Math.max(dt.minY,ut.minY),kt=Math.min(dt.maxX,ut.maxX),Q=Math.min(dt.maxY,ut.maxY),Math.max(0,kt-ft)*Math.max(0,Q-_t)),Re=P(Ut)+P(ee);Gt=q;yt--){var Kt=B.children[yt];w(ft,B.leaf?dt(Kt):Kt),_t+=z(ft)}return _t},a.prototype._adjustParentBBoxes=function(B,q,Y){for(var lt=Y;lt>=0;lt--)w(q[lt],B)},a.prototype._condense=function(B){for(var q=B.length-1,Y=void 0;q>=0;q--)B[q].children.length===0?q>0?(Y=B[q-1].children).splice(Y.indexOf(B[q]),1):this.clear():u(B[q],this.toBBox)},a})})(EC);var bz=EC.exports;const xz=hy(iz),wz=hy(gz),Sz=hy(m4);var Qa=bz,IC=xz,CC=wz,Kh=Sz.default,Ez=CC.featureEach;CC.coordEach;IC.polygon;var pS=IC.featureCollection;function TC(e){var t=new Qa(e);return t.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Kh(n),Qa.prototype.insert.call(this,n)},t.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Kh(i),r.push(i)}):Ez(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Kh(i),r.push(i)}),Qa.prototype.load.call(this,r)},t.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Kh(n),Qa.prototype.remove.call(this,n,r)},t.clear=function(){return Qa.prototype.clear.call(this)},t.search=function(n){var r=Qa.prototype.search.call(this,this.toBBox(n));return pS(r)},t.collides=function(n){return Qa.prototype.collides.call(this,this.toBBox(n))},t.all=function(){var n=Qa.prototype.all.call(this);return pS(n)},t.toJSON=function(){return Qa.prototype.toJSON.call(this)},t.fromJSON=function(n){return Qa.prototype.fromJSON.call(this,n)},t.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=Kh(n);else if(n.type==="FeatureCollection")r=Kh(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},t}d1.exports=TC;d1.exports.default=TC;var Iz=d1.exports;const Cz=dv(Iz);function Tz(e,t){var n={},r=[];if(e.type==="LineString"&&(e=ca(e)),t.type==="LineString"&&(t=ca(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var i=dS(e,t);return i&&r.push(i),Bc(r)}var a=Cz();return a.load(fS(t)),uy(fS(e),function(h){uy(a.search(h),function(u){var y=dS(h,u);if(y){var w=Df(y).join(",");n[w]||(n[w]=!0,r.push(y))}})}),Bc(r)}function dS(e,t){var n=Df(e),r=Df(t);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],y=r[0][0],w=r[0][1],S=r[1][0],I=r[1][1],P=(I-w)*(h-i)-(S-y)*(u-a),z=(S-y)*(a-w)-(I-w)*(i-y),R=(h-i)*(a-w)-(u-a)*(i-y);if(P===0)return null;var Z=z/P,X=R/P;if(Z>=0&&Z<=1&&X>=0&&X<=1){var et=i+Z*(h-i),B=a+Z*(u-a);return rs([et,B])}return null}function Lz(e,t,n){n===void 0&&(n={});var r=rs([1/0,1/0],{dist:1/0}),i=0;return Wf(e,function(a){for(var h=Df(a),u=0;u0&&(X=Z.features[0],X.properties.dist=Qp(t,X,n),X.properties.location=i+Qp(y,X,n)),y.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-t.lngLat.lng,r=this.dragFrom[1]-t.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=r}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});ci(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(mS(this.points).forEach((r,i)=>{n.push([i+1,Lz(r,this.cursor).properties.dist])}),n.sort((r,i)=>r[1]-i[1]),n.length>0){let r=n[0][0];this.points.splice(r,0,this.cursor.geometry.coordinates),this.hover=r}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(t))});ci(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=g0(t.lngLat.toArray()),this.onClick(t),this.finish())});ci(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});ci(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});ci(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});ci(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersSuccess)n(t);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((i,a)=>{let h=g0(i);h.properties.hover=this.hover==a,h.properties.idx=a,t.features.push(h)}),t.features=t.features.concat(mS(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",t.features.push(n)),PC.set(t);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,MC.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersUpdated)n(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=g0(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(LC),n=[JSON.parse(JSON.stringify(t))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>kz&&this.previousStates.shift()}}function mS(e){let t=[];for(let n=0;n=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[e[e.length-1],e[0]]},properties:{}}),t}function Rz(e){let t,n,r;return{c(){t=hn("Undo ("),n=hn(e[1]),r=hn(")")},m(i,a){Vt(i,t,a),Vt(i,n,a),Vt(i,r,a)},p(i,a){a&2&&Nr(n,i[1])},d(i){i&&(Bt(t),Bt(n),Bt(r))}}}function Nz(e){let t;return{c(){t=hn("Undo")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function Oz(e){let t,n,r,i,a,h,u,y,w,S,I;function P(Z,X){return Z[1]==0?Nz:Rz}let z=P(e),R=z(e);return{c(){t=jt("div"),n=jt("button"),n.textContent="Finish",r=fe(),i=jt("button"),i.textContent="Cancel",a=fe(),h=jt("button"),R.c(),y=fe(),w=jt("ul"),w.innerHTML=`
  • Click +${e.stack}`:r}function JO(e,t){const n=t(e.length*1,1)>>>0;return fd().set(e,n/1),wc=e.length,n}function QO(e,t){return e=e>>>0,mC().subarray(e/8,e/8+t)}function Yh(e,t){try{return e.apply(this,t)}catch(n){yn.__wbindgen_exn_store(gi(n))}}const $O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>yn.__wbg_mapmodel_free(e>>>0));class J2{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,$O.unregister(this),t}free(){const t=this.__destroy_into_raw();yn.__wbg_mapmodel_free(t)}constructor(t,n,r){try{const u=yn.__wbindgen_add_to_stack_pointer(-16),y=JO(t,yn.__wbindgen_malloc),w=wc;yn.mapmodel_new(u,y,w,n,Lg(r)?0:gi(r));var i=nr()[u/4+0],a=nr()[u/4+1],h=nr()[u/4+2];if(h)throw ef(a);return this.__wbg_ptr=i>>>0,this}finally{yn.__wbindgen_add_to_stack_pointer(16)}}renderDebug(){let t,n;try{const w=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_renderDebug(w,this.__wbg_ptr);var r=nr()[w/4+0],i=nr()[w/4+1],a=nr()[w/4+2],h=nr()[w/4+3],u=r,y=i;if(h)throw u=0,y=0,ef(a);return t=u,n=y,Bl(u,y)}finally{yn.__wbindgen_add_to_stack_pointer(16),yn.__wbindgen_free(t,n,1)}}getInvertedBoundary(){let t,n;try{const w=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=nr()[w/4+0],i=nr()[w/4+1],a=nr()[w/4+2],h=nr()[w/4+3],u=r,y=i;if(h)throw u=0,y=0,ef(a);return t=u,n=y,Bl(u,y)}finally{yn.__wbindgen_add_to_stack_pointer(16),yn.__wbindgen_free(t,n,1)}}getBounds(){try{const i=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_getBounds(i,this.__wbg_ptr);var t=nr()[i/4+0],n=nr()[i/4+1],r=QO(t,n).slice();return yn.__wbindgen_free(t,n*8,8),r}finally{yn.__wbindgen_add_to_stack_pointer(16)}}isochrone(t){let n,r;try{const S=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_isochrone(S,this.__wbg_ptr,gi(t));var i=nr()[S/4+0],a=nr()[S/4+1],h=nr()[S/4+2],u=nr()[S/4+3],y=i,w=a;if(u)throw y=0,w=0,ef(h);return n=y,r=w,Bl(y,w)}finally{yn.__wbindgen_add_to_stack_pointer(16),yn.__wbindgen_free(n,r,1)}}route(t){let n,r;try{const S=yn.__wbindgen_add_to_stack_pointer(-16);yn.mapmodel_route(S,this.__wbg_ptr,gi(t));var i=nr()[S/4+0],a=nr()[S/4+1],h=nr()[S/4+2],u=nr()[S/4+3],y=i,w=a;if(u)throw y=0,w=0,ef(h);return n=y,r=w,Bl(y,w)}finally{yn.__wbindgen_add_to_stack_pointer(16),yn.__wbindgen_free(n,r,1)}}}async function t5(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function e5(){const e={};return e.wbg={},e.wbg.__wbindgen_object_drop_ref=function(t){ef(t)},e.wbg.__wbindgen_boolean_get=function(t){const n=On(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_string_new=function(t,n){const r=Bl(t,n);return gi(r)},e.wbg.__wbindgen_string_get=function(t,n){const r=On(n),i=typeof r=="string"?r:void 0;var a=Lg(i)?0:d0(i,yn.__wbindgen_malloc,yn.__wbindgen_realloc),h=wc;nr()[t/4+1]=h,nr()[t/4+0]=a},e.wbg.__wbindgen_error_new=function(t,n){const r=new Error(Bl(t,n));return gi(r)},e.wbg.__wbindgen_is_object=function(t){const n=On(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return On(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return On(t)in On(n)},e.wbg.__wbindgen_number_get=function(t,n){const r=On(n),i=typeof r=="number"?r:void 0;mC()[t/8+1]=Lg(i)?0:i,nr()[t/4+0]=!Lg(i)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return On(t)==On(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const r=On(t)[On(n)];return gi(r)},e.wbg.__wbindgen_object_clone_ref=function(t){const n=On(t);return gi(n)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(On(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(On(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(On(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(On(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(On(t))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return gi(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const r=On(n).stack,i=d0(r,yn.__wbindgen_malloc,yn.__wbindgen_realloc),a=wc;nr()[t/4+1]=a,nr()[t/4+0]=i},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let r,i;try{r=t,i=n,console.error(Bl(t,n))}finally{yn.__wbindgen_free(r,i,1)}},e.wbg.__wbg_performance_a1b8bde2ee512264=function(t){const n=On(t).performance;return gi(n)},e.wbg.__wbg_now_abd80e969af37148=function(t){return On(t).now()},e.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(t,n){const r=new Function(Bl(t,n));return gi(r)},e.wbg.__wbg_call_27c0f87801dedf93=function(){return Yh(function(t,n){const r=On(t).call(On(n));return gi(r)},arguments)},e.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return Yh(function(){const t=self.self;return gi(t)},arguments)},e.wbg.__wbg_window_c6fb939a7f436783=function(){return Yh(function(){const t=window.window;return gi(t)},arguments)},e.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return Yh(function(){const t=globalThis.globalThis;return gi(t)},arguments)},e.wbg.__wbg_global_207b558942527489=function(){return Yh(function(){const t=global.global;return gi(t)},arguments)},e.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(t){let n;try{n=On(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return Yh(function(t,n,r){const i=On(t).call(On(n),On(r));return gi(i)},arguments)},e.wbg.__wbg_buffer_12d079cc21e14bdb=function(t){const n=On(t).buffer;return gi(n)},e.wbg.__wbg_new_63b92bc8671ed464=function(t){const n=new Uint8Array(On(t));return gi(n)},e.wbg.__wbg_set_a47bac70306a19a7=function(t,n,r){On(t).set(On(n),r>>>0)},e.wbg.__wbg_length_c20a40f15020d68a=function(t){return On(t).length},e.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(t){let n;try{n=On(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_debug_string=function(t,n){const r=sv(On(n)),i=d0(r,yn.__wbindgen_malloc,yn.__wbindgen_realloc),a=wc;nr()[t/4+1]=a,nr()[t/4+0]=i},e.wbg.__wbindgen_throw=function(t,n){throw new Error(Bl(t,n))},e.wbg.__wbindgen_memory=function(){const t=yn.memory;return gi(t)},e}function n5(e,t){return yn=e.exports,av.__wbindgen_wasm_module=t,od=null,id=null,rd=null,yn}async function av(e){if(yn!==void 0)return yn;typeof e>"u"&&(e="/15m/assets/backend_bg.wasm");const t=e5();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:r}=await t5(await e,t);return n5(n,r)}class r5{constructor(){ci(this,"inner");this.inner=null}async loadOsmFile(t,n){await av(),this.inner=new J2(t,!0,n)}async loadGraphFile(t){await av(),this.inner=new J2(t,!1,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}isochrone(t){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:t.start.lng,y:t.start.lat,mode:t.mode,contours:t.contours}))}route(t){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:t.start.lng,y1:t.start.lat,x2:t.end[0],y2:t.end[1],mode:t.mode,debug_search:t.debugSearch,use_heuristic:t.useHeuristic}))}}l1(r5);let gC="MZEJTanw3WpxRvt7qDfo",Vo=$r({kind:"title"}),ky=$r(null),m0=$r(!0);function Q2(e){return["!=",["get",`access_${e}`],"None"]}let Fc=$r(null),lf=$r(!1);function $2(e){let t,n;return t=new Zd({props:{$$slots:{map:[l5],sidebar:[i5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&519&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function i5(e){let t,n,r,i,a,h,u,y,w,S,I,P,z,R,Y,Z,et;function B(q){e[6](q)}let j={};return e[0]!==void 0&&(j.travelMode=e[0]),I=new a1({props:j}),rr.push(()=>Yo(I,"travelMode",B)),R=new iC({props:{gj:e[1]}}),{c(){t=jt("div"),n=jt("h2"),n.textContent="Debug mode",r=fe(),i=jt("div"),a=jt("button"),a.textContent="Change study area",h=fe(),u=jt("button"),u.textContent="Isochrones",y=fe(),w=jt("p"),w.textContent="Hover to see a segment's properties, and click to open OSM",S=fe(),_e(I.$$.fragment),z=fe(),_e(R.$$.fragment),Zt(t,"slot","sidebar")},m(q,ct){Vt(q,t,ct),Ot(t,n),Ot(t,r),Ot(t,i),Ot(i,a),Ot(i,h),Ot(i,u),Ot(t,y),Ot(t,w),Ot(t,S),de(I,t,null),Ot(t,z),de(R,t,null),Y=!0,Z||(et=[We(a,"click",e[4]),We(u,"click",e[5])],Z=!0)},p(q,ct){const _t={};!P&&ct&1&&(P=!0,_t.travelMode=q[0],Xo(()=>P=!1)),I.$set(_t);const lt={};ct&2&&(lt.gj=q[1]),R.$set(lt)},i(q){Y||(It(I.$$.fragment,q),It(R.$$.fragment,q),Y=!0)},o(q){At(I.$$.fragment,q),At(R.$$.fragment,q),Y=!1},d(q){q&&Bt(t),me(I),me(R),Z=!1,Ri(et)}}}function o5(e){let t,n;return t=new pv({props:{properties:e[8]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&256&&(a.properties=r[8]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function s5(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[o5,({props:r})=>({8:r}),({props:r})=>r?256:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&768&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function a5(e){let t,n,r,i,a,h;return t=new jf({props:{id:"network",paint:{"line-width":Ay(5,7),"line-color":"black"},filter:Q2(e[0]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[s5]},$$scope:{ctx:e}}}),t.$on("click",e[3]),r=new oC({}),a=new zO({}),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment),i=fe(),_e(a.$$.fragment)},m(u,y){de(t,u,y),Vt(u,n,y),de(r,u,y),Vt(u,i,y),de(a,u,y),h=!0},p(u,y){const w={};y&1&&(w.filter=Q2(u[0])),y&512&&(w.$$scope={dirty:y,ctx:u}),t.$set(w)},i(u){h||(It(t.$$.fragment,u),It(r.$$.fragment,u),It(a.$$.fragment,u),h=!0)},o(u){At(t.$$.fragment,u),At(r.$$.fragment,u),At(a.$$.fragment,u),h=!1},d(u){u&&(Bt(n),Bt(i)),me(t,u),me(r,u),me(a,u)}}}function l5(e){let t,n,r;return n=new zc({props:{data:e[1],generateId:!0,$$slots:{default:[a5]},$$scope:{ctx:e}}}),{c(){t=jt("div"),_e(n.$$.fragment),Zt(t,"slot","map")},m(i,a){Vt(i,t,a),de(n,t,null),r=!0},p(i,a){const h={};a&2&&(h.data=i[1]),a&513&&(h.$$scope={dirty:a,ctx:i}),n.$set(h)},i(i){r||(It(n.$$.fragment,i),r=!0)},o(i){At(n.$$.fragment,i),r=!1},d(i){i&&Bt(t),me(n)}}}function u5(e){let t,n,r=e[1]&&$2(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&It(r,1)):(r=$2(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),At(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){At(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function c5(e,t,n){let r,i;qe(e,Fc,I=>n(7,r=I)),qe(e,Vo,I=>n(2,i=I));let a="foot",h=null;Vu(async()=>{n(1,h=await r.renderDebug())});const u=I=>window.open(Hl(I.detail.features[0].properties).way,"_blank"),y=()=>Jn(Vo,i={kind:"title"},i),w=()=>Jn(Vo,i={kind:"isochrone"},i);function S(I){a=I,n(0,a)}return[a,h,i,u,y,w,S]}class h5 extends an{constructor(t){super(),sn(this,t,c5,u5,Ze,{})}}const lv=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"];function tS(e){let t,n;return{c(){t=jt("p"),n=un(e[6])},m(r,i){Vt(r,t,i),Ot(t,n)},p(r,i){i&64&&Nr(n,r[6])},d(r){r&&Bt(t)}}}function eS(e){let t,n;return t=new iC({props:{gj:e[4]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&16&&(a.gj=r[4]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function f5(e){let t,n,r,i,a,h,u,y,w,S,I,P,z,R,Y,Z,et,B,j,q,ct,_t,lt,ht,pt;function Tt(bt){e[15](bt)}let Q={};e[0]!==void 0&&(Q.travelMode=e[0]),z=new a1({props:Q}),rr.push(()=>Yo(z,"travelMode",Tt)),q=new KL({props:{colorScale:lv,limits:e[8]}});let gt=e[6]&&tS(e),Kt=e[4]&&eS(e);return{c(){t=jt("div"),n=jt("h2"),n.textContent="Isochrone mode",r=fe(),i=jt("div"),a=jt("button"),a.textContent="Change study area",h=fe(),u=jt("button"),u.textContent="Route",y=fe(),w=jt("button"),w.textContent="Debug OSM",S=fe(),I=jt("p"),I.textContent=`Move the pin to calculate an isochrone from that start. The cost is time + in seconds.`,P=fe(),_e(z.$$.fragment),Y=fe(),Z=jt("label"),et=jt("input"),B=un("Contours"),j=fe(),_e(q.$$.fragment),ct=fe(),gt&>.c(),_t=fe(),Kt&&Kt.c(),Zt(et,"type","checkbox"),Zt(t,"slot","sidebar")},m(bt,Ut){Vt(bt,t,Ut),Ot(t,n),Ot(t,r),Ot(t,i),Ot(i,a),Ot(i,h),Ot(i,u),Ot(i,y),Ot(i,w),Ot(t,S),Ot(t,I),Ot(t,P),de(z,t,null),Ot(t,Y),Ot(t,Z),Ot(Z,et),et.checked=e[2],Ot(Z,B),Ot(t,j),de(q,t,null),Ot(t,ct),gt&>.m(t,null),Ot(t,_t),Kt&&Kt.m(t,null),lt=!0,ht||(pt=[We(a,"click",e[12]),We(u,"click",e[13]),We(w,"click",e[14]),We(et,"change",e[16])],ht=!0)},p(bt,Ut){const ee={};!R&&Ut&1&&(R=!0,ee.travelMode=bt[0],Xo(()=>R=!1)),z.$set(ee),Ut&4&&(et.checked=bt[2]),bt[6]?gt?gt.p(bt,Ut):(gt=tS(bt),gt.c(),gt.m(t,_t)):gt&&(gt.d(1),gt=null),bt[4]?Kt?(Kt.p(bt,Ut),Ut&16&&It(Kt,1)):(Kt=eS(bt),Kt.c(),It(Kt,1),Kt.m(t,null)):Kt&&(Fn(),At(Kt,1,1,()=>{Kt=null}),Bn())},i(bt){lt||(It(z.$$.fragment,bt),It(q.$$.fragment,bt),It(Kt),lt=!0)},o(bt){At(z.$$.fragment,bt),At(q.$$.fragment,bt),At(Kt),lt=!1},d(bt){bt&&Bt(t),me(z),me(q),gt&>.d(),Kt&&Kt.d(),ht=!1,Ri(pt)}}}function nS(e){let t,n,r;function i(h){e[10](h)}let a={draggable:!0,$$slots:{default:[p5]},$$scope:{ctx:e}};return e[1]!==void 0&&(a.lngLat=e[1]),t=new kd({props:a}),rr.push(()=>Yo(t,"lngLat",i)),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,u){const y={};u&2097152&&(y.$$scope={dirty:u,ctx:h}),!n&&u&2&&(n=!0,y.lngLat=h[1],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function p5(e){let t;return{c(){t=jt("span"),t.textContent="X",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function rS(e){let t,n;return t=new zc({props:{data:e[4],$$slots:{default:[g5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&16&&(a.data=r[4]),i&2097160&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function d5(e){let t=(e[20].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=un(t),r=un(" minutes away")},m(i,a){Vt(i,n,a),Vt(i,r,a)},p(i,a){a&1048576&&t!==(t=(i[20].cost_seconds/60).toFixed(1)+"")&&Nr(n,t)},d(i){i&&(Bt(n),Bt(r))}}}function m5(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[d5,({props:r})=>({20:r}),({props:r})=>r?1048576:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&3145728&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function g5(e){let t,n,r,i,a,h,u;t=new jf({props:{id:"isochrone",filter:EN,paint:{"line-width":20,"line-color":C2(["get","cost_seconds"],e[9],lv),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[m5]},$$scope:{ctx:e}}}),r=new rC({props:{id:"isochrone-contours",filter:SN,paint:{"fill-color":C2(["get","min_seconds"],e[9],lv),"fill-opacity":.5}}});function y(S){e[11](S)}let w={};return e[3]!==void 0&&(w.hovered=e[3]),a=new oC({props:w}),rr.push(()=>Yo(a,"hovered",y)),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment),i=fe(),_e(a.$$.fragment)},m(S,I){de(t,S,I),Vt(S,n,I),de(r,S,I),Vt(S,i,I),de(a,S,I),u=!0},p(S,I){const P={};I&2097152&&(P.$$scope={dirty:I,ctx:S}),t.$set(P);const z={};!h&&I&8&&(h=!0,z.hovered=S[3],Xo(()=>h=!1)),a.$set(z)},i(S){u||(It(t.$$.fragment,S),It(r.$$.fragment,S),It(a.$$.fragment,S),u=!0)},o(S){At(t.$$.fragment,S),At(r.$$.fragment,S),At(a.$$.fragment,S),u=!1},d(S){S&&(Bt(n),Bt(i)),me(t,S),me(r,S),me(a,S)}}}function iS(e){let t,n;return t=new zc({props:{data:e[5],$$slots:{default:[y5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&2097152&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function y5(e){let t,n;return t=new jf({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function _5(e){let t,n,r,i,a=e[1]&&nS(e),h=e[4]&&rS(e),u=e[5]&&iS(e);return{c(){t=jt("div"),a&&a.c(),n=fe(),h&&h.c(),r=fe(),u&&u.c(),Zt(t,"slot","map")},m(y,w){Vt(y,t,w),a&&a.m(t,null),Ot(t,n),h&&h.m(t,null),Ot(t,r),u&&u.m(t,null),i=!0},p(y,w){y[1]?a?(a.p(y,w),w&2&&It(a,1)):(a=nS(y),a.c(),It(a,1),a.m(t,n)):a&&(Fn(),At(a,1,1,()=>{a=null}),Bn()),y[4]?h?(h.p(y,w),w&16&&It(h,1)):(h=rS(y),h.c(),It(h,1),h.m(t,r)):h&&(Fn(),At(h,1,1,()=>{h=null}),Bn()),y[5]?u?(u.p(y,w),w&32&&It(u,1)):(u=iS(y),u.c(),It(u,1),u.m(t,null)):u&&(Fn(),At(u,1,1,()=>{u=null}),Bn())},i(y){i||(It(a),It(h),It(u),i=!0)},o(y){At(a),At(h),At(u),i=!1},d(y){y&&Bt(t),a&&a.d(),h&&h.d(),u&&u.d()}}}function v5(e){let t,n;return t=new Zd({props:{$$slots:{map:[_5],sidebar:[f5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&2097407&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function oS(e,t,n){return t+e*(n-t)}function b5(e,t,n){let r,i;qe(e,Fc,lt=>n(17,r=lt)),qe(e,Vo,lt=>n(7,i=lt));let a="foot",h=null;Vu(async()=>{let lt=await r.getBounds();n(1,h={lng:oS(.5,lt[0],lt[2]),lat:oS(.5,lt[1],lt[3])})});let u=!0,y=null,w=null,S="",I;async function P(lt,ht,pt){if(h)try{n(4,y=await r.isochrone({start:h,mode:a,contours:u})),n(6,S="")}catch(Tt){n(4,y=null),Tt=Tt.toString()}}async function z(lt,ht){if(h&&I)try{n(5,w=await r.route({start:h,end:I.geometry.coordinates,mode:a,debugSearch:!1,useHeuristic:!1})),n(6,S="")}catch(pt){n(5,w=null),pt=pt.toString()}else n(5,w=null)}let R=[0,3,6,9,12,15],Y=R.map(lt=>lt*60);function Z(lt){h=lt,n(1,h)}function et(lt){I=lt,n(3,I)}const B=()=>Jn(Vo,i={kind:"title"},i),j=()=>Jn(Vo,i={kind:"route"},i),q=()=>Jn(Vo,i={kind:"debug"},i);function ct(lt){a=lt,n(0,a)}function _t(){u=this.checked,n(2,u)}return e.$$.update=()=>{e.$$.dirty&7&&P(),e.$$.dirty&10&&z()},[a,h,u,I,y,w,S,i,R,Y,Z,et,B,j,q,ct,_t]}class x5 extends an{constructor(t){super(),sn(this,t,b5,v5,Ze,{})}}function sS(e,t,n){const r=e.slice();r[18]=t[n];const i=Hl(r[18].properties);return r[17]=i,r}function w5(e){let t,n,r,i,a,h=ti(e[4].features),u=[];for(let y=0;yYo(w,"travelMode",ct));function lt(Tt,Q){if(Tt[5])return S5;if(Tt[4])return w5}let ht=lt(e),pt=ht&&ht(e);return{c(){t=jt("div"),n=jt("h2"),n.textContent="Route mode",r=fe(),i=jt("div"),a=jt("button"),a.textContent="Change study area",h=fe(),u=jt("button"),u.textContent="Isochrone mode",y=fe(),_e(w.$$.fragment),I=fe(),P=jt("label"),z=jt("input"),R=un(` + Use heuristic`),Y=fe(),Z=jt("p"),Z.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to + set the first pin somewhere.)`,et=fe(),pt&&pt.c(),Zt(z,"type","checkbox"),Zt(t,"slot","sidebar")},m(Tt,Q){Vt(Tt,t,Q),Ot(t,n),Ot(t,r),Ot(t,i),Ot(i,a),Ot(i,h),Ot(i,u),Ot(t,y),de(w,t,null),Ot(t,I),Ot(t,P),Ot(P,z),z.checked=e[1],Ot(P,R),Ot(t,Y),Ot(t,Z),Ot(t,et),pt&&pt.m(t,null),B=!0,j||(q=[We(a,"click",e[11]),We(u,"click",e[12]),We(z,"change",e[14])],j=!0)},p(Tt,Q){const gt={};!S&&Q&1&&(S=!0,gt.travelMode=Tt[0],Xo(()=>S=!1)),w.$set(gt),Q&2&&(z.checked=Tt[1]),ht===(ht=lt(Tt))&&pt?pt.p(Tt,Q):(pt&&pt.d(1),pt=ht&&ht(Tt),pt&&(pt.c(),pt.m(t,null)))},i(Tt){B||(It(w.$$.fragment,Tt),B=!0)},o(Tt){At(w.$$.fragment,Tt),B=!1},d(Tt){Tt&&Bt(t),me(w),pt&&pt.d(),j=!1,Ri(q)}}}function lS(e){let t,n,r;function i(h){e[9](h)}let a={draggable:!0,$$slots:{default:[T5]},$$scope:{ctx:e}};return e[2]!==void 0&&(a.lngLat=e[2]),t=new kd({props:a}),rr.push(()=>Yo(t,"lngLat",i)),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,u){const y={};u&2097152&&(y.$$scope={dirty:u,ctx:h}),!n&&u&4&&(n=!0,y.lngLat=h[2],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function T5(e){let t;return{c(){t=jt("span"),t.textContent="A",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function uS(e){let t,n,r;function i(h){e[10](h)}let a={draggable:!0,$$slots:{default:[L5]},$$scope:{ctx:e}};return e[3]!==void 0&&(a.lngLat=e[3]),t=new kd({props:a}),rr.push(()=>Yo(t,"lngLat",i)),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,u){const y={};u&2097152&&(y.$$scope={dirty:u,ctx:h}),!n&&u&8&&(n=!0,y.lngLat=h[3],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function L5(e){let t;return{c(){t=jt("span"),t.textContent="B",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function cS(e){let t,n;return t=new zc({props:{data:e[4],generateId:!0,$$slots:{default:[A5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&16&&(a.data=r[4]),i&2097152&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function P5(e){let t,n;return t=new pv({props:{properties:e[17]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&131072&&(a.properties=r[17]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function M5(e){let t,n;return t=new Wd({props:{openOn:"hover",$$slots:{default:[P5,({props:r})=>({17:r}),({props:r})=>r?131072:0]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&2228224&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function A5(e){let t,n;return t=new jf({props:{id:"route",paint:{"line-width":20,"line-color":n1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":Ay(.5,1)},manageHoverState:!0,$$slots:{default:[M5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&2097152&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function k5(e){let t,n,r,i,a,h;n=new $N({}),n.$on("contextmenu",e[7]);let u=e[2]&&lS(e),y=e[3]&&uS(e),w=e[4]&&cS(e);return{c(){t=jt("div"),_e(n.$$.fragment),r=fe(),u&&u.c(),i=fe(),y&&y.c(),a=fe(),w&&w.c(),Zt(t,"slot","map")},m(S,I){Vt(S,t,I),de(n,t,null),Ot(t,r),u&&u.m(t,null),Ot(t,i),y&&y.m(t,null),Ot(t,a),w&&w.m(t,null),h=!0},p(S,I){S[2]?u?(u.p(S,I),I&4&&It(u,1)):(u=lS(S),u.c(),It(u,1),u.m(t,i)):u&&(Fn(),At(u,1,1,()=>{u=null}),Bn()),S[3]?y?(y.p(S,I),I&8&&It(y,1)):(y=uS(S),y.c(),It(y,1),y.m(t,a)):y&&(Fn(),At(y,1,1,()=>{y=null}),Bn()),S[4]?w?(w.p(S,I),I&16&&It(w,1)):(w=cS(S),w.c(),It(w,1),w.m(t,null)):w&&(Fn(),At(w,1,1,()=>{w=null}),Bn())},i(S){h||(It(n.$$.fragment,S),It(u),It(y),It(w),h=!0)},o(S){At(n.$$.fragment,S),At(u),At(y),At(w),h=!1},d(S){S&&Bt(t),me(n),u&&u.d(),y&&y.d(),w&&w.d()}}}function D5(e){let t,n;return t=new Zd({props:{$$slots:{map:[k5],sidebar:[C5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&2097279&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function dg(e,t,n){return t+e*(n-t)}function R5(e,t,n){let r,i;qe(e,Vo,q=>n(6,r=q)),qe(e,Fc,q=>n(15,i=q));let a="foot",h=!0,u=null,y=null;Vu(async()=>{let q=await i.getBounds();n(2,u={lng:dg(.4,q[0],q[2]),lat:dg(.4,q[1],q[3])}),n(3,y={lng:dg(.6,q[0],q[2]),lat:dg(.6,q[1],q[3])})});let w=null,S="";async function I(q,ct,_t,lt){if(u&&y)try{n(4,w=await i.route({start:u,end:[y.lng,y.lat],mode:_t,debugSearch:!1,useHeuristic:h})),n(5,S="")}catch(ht){n(4,w=null),n(5,S=ht.toString())}}function P(q){n(2,u=q.detail.lngLat)}async function z(){try{let q=await i.route({start:u,end:[y.lng,y.lat],mode:a,debugSearch:!0,useHeuristic:h});Jn(Vo,r={kind:"debug-route",debugGj:q,start:u,end:y,routeGj:w},r)}catch(q){n(5,S=q.toString())}}function R(q){u=q,n(2,u)}function Y(q){y=q,n(3,y)}const Z=()=>Jn(Vo,r={kind:"title"},r),et=()=>Jn(Vo,r={kind:"isochrone"},r);function B(q){a=q,n(0,a)}function j(){h=this.checked,n(1,h)}return e.$$.update=()=>{e.$$.dirty&15&&I(u,y,a)},[a,h,u,y,w,S,r,P,z,R,Y,Z,et,B,j]}class N5 extends an{constructor(t){super(),sn(this,t,R5,D5,Ze,{})}}function O5(e){let t,n,r,i,a,h,u,y,w,S,I,P,z=Hl(e[4].features[e[4].features.length-1].properties).time+"",R,Y,Z;return{c(){t=jt("div"),n=jt("h2"),n.textContent="Debugging a route",r=fe(),i=jt("div"),a=jt("button"),a.textContent="Back",h=fe(),u=jt("p"),u.textContent=`${e[6]} total nodes searched`,y=fe(),w=jt("input"),S=fe(),I=jt("p"),P=un("Search is currently at "),R=un(z),Zt(w,"type","range"),Zt(w,"min","1"),Zt(w,"max",e[6]),Zt(t,"slot","sidebar")},m(et,B){Vt(et,t,B),Ot(t,n),Ot(t,r),Ot(t,i),Ot(i,a),Ot(t,h),Ot(t,u),Ot(t,y),Ot(t,w),Ea(w,e[3]),Ot(t,S),Ot(t,I),Ot(I,P),Ot(I,R),Y||(Z=[We(a,"click",e[9]),We(w,"change",e[10]),We(w,"input",e[10])],Y=!0)},p(et,B){B&8&&Ea(w,et[3]),B&16&&z!==(z=Hl(et[4].features[et[4].features.length-1].properties).time+"")&&Nr(R,z)},d(et){et&&Bt(t),Y=!1,Ri(Z)}}}function z5(e){let t;return{c(){t=jt("span"),t.textContent="A",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function F5(e){let t;return{c(){t=jt("span"),t.textContent="B",Zt(t,"class","dot svelte-1ej0v4r")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function B5(e){let t,n;return t=new jf({props:{paint:{"line-width":20,"line-color":n1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function V5(e){let t,n,r,i;return t=new s1({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new jf({props:{paint:{"line-width":5,"line-color":n1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment)},m(a,h){de(t,a,h),Vt(a,n,h),de(r,a,h),i=!0},p:Se,i(a){i||(It(t.$$.fragment,a),It(r.$$.fragment,a),i=!0)},o(a){At(t.$$.fragment,a),At(r.$$.fragment,a),i=!1},d(a){a&&Bt(n),me(t,a),me(r,a)}}}function U5(e){let t,n,r,i,a,h,u,y,w;return n=new kd({props:{lngLat:e[0],$$slots:{default:[z5]},$$scope:{ctx:e}}}),i=new kd({props:{lngLat:e[1],$$slots:{default:[F5]},$$scope:{ctx:e}}}),h=new zc({props:{data:e[2],$$slots:{default:[B5]},$$scope:{ctx:e}}}),y=new zc({props:{data:e[4],generateId:!0,$$slots:{default:[V5]},$$scope:{ctx:e}}}),{c(){t=jt("div"),_e(n.$$.fragment),r=fe(),_e(i.$$.fragment),a=fe(),_e(h.$$.fragment),u=fe(),_e(y.$$.fragment),Zt(t,"slot","map")},m(S,I){Vt(S,t,I),de(n,t,null),Ot(t,r),de(i,t,null),Ot(t,a),de(h,t,null),Ot(t,u),de(y,t,null),w=!0},p(S,I){const P={};I&1&&(P.lngLat=S[0]),I&4096&&(P.$$scope={dirty:I,ctx:S}),n.$set(P);const z={};I&2&&(z.lngLat=S[1]),I&4096&&(z.$$scope={dirty:I,ctx:S}),i.$set(z);const R={};I&4&&(R.data=S[2]),I&4096&&(R.$$scope={dirty:I,ctx:S}),h.$set(R);const Y={};I&16&&(Y.data=S[4]),I&4096&&(Y.$$scope={dirty:I,ctx:S}),y.$set(Y)},i(S){w||(It(n.$$.fragment,S),It(i.$$.fragment,S),It(h.$$.fragment,S),It(y.$$.fragment,S),w=!0)},o(S){At(n.$$.fragment,S),At(i.$$.fragment,S),At(h.$$.fragment,S),At(y.$$.fragment,S),w=!1},d(S){S&&Bt(t),me(n),me(i),me(h),me(y)}}}function G5(e){let t,n,r,i;return t=new Zd({props:{$$slots:{map:[U5],sidebar:[O5]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(a,h){de(t,a,h),n=!0,r||(i=We(window,"keydown",e[7]),r=!0)},p(a,[h]){const u={};h&4159&&(u.$$scope={dirty:h,ctx:a}),t.$set(u)},i(a){n||(It(t.$$.fragment,a),n=!0)},o(a){At(t.$$.fragment,a),n=!1},d(a){me(t,a),r=!1,i()}}}function q5(e,t,n){let r,i,a;qe(e,ky,Y=>n(11,i=Y)),qe(e,Vo,Y=>n(5,a=Y));let{debugGj:h}=t,{start:u}=t,{end:y}=t,{routeGj:w}=t,S=h.features.length/2,I=1;function P(Y){Y.key=="ArrowLeft"&&I>1&&(Y.stopPropagation(),n(3,I--,I)),Y.key=="ArrowRight"&&I{i==null||i.keyboard.disable()}),as(()=>{i==null||i.keyboard.enable()});const z=()=>Jn(Vo,a={kind:"route"},a);function R(){I=AL(this.value),n(3,I)}return e.$$set=Y=>{"debugGj"in Y&&n(8,h=Y.debugGj),"start"in Y&&n(0,u=Y.start),"end"in Y&&n(1,y=Y.end),"routeGj"in Y&&n(2,w=Y.routeGj)},e.$$.update=()=>{e.$$.dirty&264&&n(4,r={type:"FeatureCollection",features:h.features.slice(0,2*I)})},[u,y,w,I,r,a,S,P,h,z,R]}class j5 extends an{constructor(t){super(),sn(this,t,q5,G5,Ze,{debugGj:8,start:0,end:1,routeGj:2})}}var bo=63710088e-1,u1={centimeters:bo*100,centimetres:bo*100,degrees:bo/111325,feet:bo*3.28084,inches:bo*39.37,kilometers:bo/1e3,kilometres:bo/1e3,meters:bo,metres:bo,miles:bo/1609.344,millimeters:bo*1e3,millimetres:bo*1e3,nauticalmiles:bo/1852,radians:1,yards:bo*1.0936},W5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/bo,yards:1.0936133},uv={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ca(e,t,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function H5(e,t,n){switch(e){case"Point":return rs(t).geometry;case"LineString":return Ks(t).geometry;case"Polygon":return c1(t).geometry;case"MultiPoint":return _C(t).geometry;case"MultiLineString":return yC(t).geometry;case"MultiPolygon":return vC(t).geometry;default:throw new Error(e+" is invalid")}}function rs(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ly(e[0])||!ly(e[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:e};return ca(r,t,n)}function Z5(e,t,n){return n===void 0&&(n={}),Bc(e.map(function(r){return rs(r,t)}),n)}function c1(e,t,n){n===void 0&&(n={});for(var r=0,i=e;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n}function h1(e,t){t===void 0&&(t="kilometers");var n=u1[t];if(!n)throw new Error(t+" units is invalid");return e*n}function Dy(e,t){t===void 0&&(t="kilometers");var n=u1[t];if(!n)throw new Error(t+" units is invalid");return e/n}function Q5(e,t){return Dd(Dy(e,t))}function $5(e){var t=e%360;return t<0&&(t+=360),t}function Dd(e){var t=e%(2*Math.PI);return t*180/Math.PI}function Js(e){var t=e%360;return t*Math.PI/180}function tz(e,t,n){if(t===void 0&&(t="kilometers"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return h1(Dy(e,t),n)}function ez(e,t,n){if(t===void 0&&(t="meters"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var r=uv[t];if(!r)throw new Error("invalid original units");var i=uv[n];if(!i)throw new Error("invalid final units");return e/r*i}function ly(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function f1(e){return!!e&&e.constructor===Object}function nz(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!ly(t))throw new Error("bbox must only contain numbers")})}function rz(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}const iz=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:uv,bearingToAzimuth:$5,convertArea:ez,convertLength:tz,degreesToRadians:Js,earthRadius:bo,factors:u1,feature:ca,featureCollection:Bc,geometry:H5,geometryCollection:K5,isNumber:ly,isObject:f1,lengthToDegrees:Q5,lengthToRadians:Dy,lineString:Ks,lineStrings:Y5,multiLineString:yC,multiPoint:_C,multiPolygon:vC,point:rs,points:Z5,polygon:c1,polygons:X5,radiansToDegrees:Dd,radiansToLength:h1,round:J5,unitsFactors:W5,validateBBox:nz,validateId:rz},Symbol.toStringTag,{value:"Module"}));function Rd(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Df(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function bC(e,t,n){if(n===void 0&&(n={}),n.final===!0)return oz(e,t);var r=Rd(e),i=Rd(t),a=Js(r[0]),h=Js(i[0]),u=Js(r[1]),y=Js(i[1]),w=Math.sin(h-a)*Math.cos(y),S=Math.cos(u)*Math.sin(y)-Math.sin(u)*Math.cos(y)*Math.cos(h-a);return Dd(Math.atan2(w,S))}function oz(e,t){var n=bC(t,e);return n=(n+180)%360,n}function Qp(e,t,n){n===void 0&&(n={});var r=Rd(e),i=Rd(t),a=Js(i[1]-r[1]),h=Js(i[0]-r[0]),u=Js(r[1]),y=Js(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(u)*Math.cos(y);return h1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function hS(e,t,n,r){r===void 0&&(r={});var i=Rd(e),a=Js(i[0]),h=Js(i[1]),u=Js(n),y=Dy(t,r.units),w=Math.asin(Math.sin(h)*Math.cos(y)+Math.cos(h)*Math.sin(y)*Math.cos(u)),S=a+Math.atan2(Math.sin(u)*Math.sin(y)*Math.cos(h),Math.cos(y)-Math.sin(h)*Math.sin(w)),I=Dd(S),P=Dd(w);return rs([I,P],r.properties)}function Xd(e,t,n){if(e!==null)for(var r,i,a,h,u,y,w,S=0,I=0,P,z=e.type,R=z==="FeatureCollection",Y=z==="Feature",Z=R?e.features.length:1,et=0;ety||R>w||Y>S){u=I,y=r,w=R,S=Y,a=0;return}var Z=Ks([u,I],n.properties);if(t(Z,r,i,Y,a)===!1)return!1;a++,u=I})===!1)return!1}}})}function fz(e,t,n){var r=n,i=!1;return wC(e,function(a,h,u,y,w){i===!1&&n===void 0?r=a:r=t(r,a,h,u,y,w),i=!0}),r}function SC(e,t){if(!e)throw new Error("geojson is required");Wf(e,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,h=n.geometry.coordinates;switch(a){case"LineString":if(t(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;ui?n:i,w=r>a?r:a;return[h,u,y,w]}var d1={exports:{}},EC={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Nd,function(){function n(B,j,q,ct,_t){(function lt(ht,pt,Tt,Q,gt){for(;Q>Tt;){if(Q-Tt>600){var Kt=Q-Tt+1,bt=pt-Tt+1,Ut=Math.log(Kt),ee=.5*Math.exp(2*Ut/3),Gt=.5*Math.sqrt(Ut*ee*(Kt-ee)/Kt)*(bt-Kt/2<0?-1:1),Re=Math.max(Tt,Math.floor(pt-bt*ee/Kt+Gt)),xe=Math.min(Q,Math.floor(pt+(Kt-bt)*ee/Kt+Gt));lt(ht,pt,Re,xe,gt)}var ln=ht[pt],Ve=Tt,Pe=Q;for(r(ht,Tt,pt),gt(ht[Q],ln)>0&&r(ht,Tt,Q);Ve0;)Pe--}gt(ht[Tt],ln)===0?r(ht,Tt,Pe):r(ht,++Pe,Q),Pe<=pt&&(Tt=Pe+1),pt<=Pe&&(Q=Pe-1)}})(B,j,q||0,ct||B.length-1,_t||i)}function r(B,j,q){var ct=B[j];B[j]=B[q],B[q]=ct}function i(B,j){return Bj?1:0}var a=function(B){B===void 0&&(B=9),this._maxEntries=Math.max(4,B),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function h(B,j,q){if(!q)return j.indexOf(B);for(var ct=0;ct=B.minX&&j.maxY>=B.minY}function Z(B){return{children:B,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function et(B,j,q,ct,_t){for(var lt=[j,q];lt.length;)if(!((q=lt.pop())-(j=lt.pop())<=ct)){var ht=j+Math.ceil((q-j)/ct/2)*ct;n(B,ht,j,q,_t),lt.push(j,ht,ht,q)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(B){var j=this.data,q=[];if(!Y(B,j))return q;for(var ct=this.toBBox,_t=[];j;){for(var lt=0;lt=0&&_t[j].children.length>this._maxEntries;)this._split(_t,j),j--;this._adjustParentBBoxes(ct,_t,j)},a.prototype._split=function(B,j){var q=B[j],ct=q.children.length,_t=this._minEntries;this._chooseSplitAxis(q,_t,ct);var lt=this._chooseSplitIndex(q,_t,ct),ht=Z(q.children.splice(lt,q.children.length-lt));ht.height=q.height,ht.leaf=q.leaf,u(q,this.toBBox),u(ht,this.toBBox),j?B[j-1].children.push(ht):this._splitRoot(q,ht)},a.prototype._splitRoot=function(B,j){this.data=Z([B,j]),this.data.height=B.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(B,j,q){for(var ct,_t,lt,ht,pt,Tt,Q,gt=1/0,Kt=1/0,bt=j;bt<=q-j;bt++){var Ut=y(B,0,bt,this.toBBox),ee=y(B,bt,q,this.toBBox),Gt=(_t=Ut,lt=ee,ht=void 0,pt=void 0,Tt=void 0,Q=void 0,ht=Math.max(_t.minX,lt.minX),pt=Math.max(_t.minY,lt.minY),Tt=Math.min(_t.maxX,lt.maxX),Q=Math.min(_t.maxY,lt.maxY),Math.max(0,Tt-ht)*Math.max(0,Q-pt)),Re=P(Ut)+P(ee);Gt=j;gt--){var Kt=B.children[gt];w(ht,B.leaf?_t(Kt):Kt),pt+=z(ht)}return pt},a.prototype._adjustParentBBoxes=function(B,j,q){for(var ct=q;ct>=0;ct--)w(j[ct],B)},a.prototype._condense=function(B){for(var j=B.length-1,q=void 0;j>=0;j--)B[j].children.length===0?j>0?(q=B[j-1].children).splice(q.indexOf(B[j]),1):this.clear():u(B[j],this.toBBox)},a})})(EC);var bz=EC.exports;const xz=hy(iz),wz=hy(gz),Sz=hy(m4);var Qa=bz,IC=xz,CC=wz,Kh=Sz.default,Ez=CC.featureEach;CC.coordEach;IC.polygon;var pS=IC.featureCollection;function TC(e){var t=new Qa(e);return t.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Kh(n),Qa.prototype.insert.call(this,n)},t.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Kh(i),r.push(i)}):Ez(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Kh(i),r.push(i)}),Qa.prototype.load.call(this,r)},t.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Kh(n),Qa.prototype.remove.call(this,n,r)},t.clear=function(){return Qa.prototype.clear.call(this)},t.search=function(n){var r=Qa.prototype.search.call(this,this.toBBox(n));return pS(r)},t.collides=function(n){return Qa.prototype.collides.call(this,this.toBBox(n))},t.all=function(){var n=Qa.prototype.all.call(this);return pS(n)},t.toJSON=function(){return Qa.prototype.toJSON.call(this)},t.fromJSON=function(n){return Qa.prototype.fromJSON.call(this,n)},t.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=Kh(n);else if(n.type==="FeatureCollection")r=Kh(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},t}d1.exports=TC;d1.exports.default=TC;var Iz=d1.exports;const Cz=dv(Iz);function Tz(e,t){var n={},r=[];if(e.type==="LineString"&&(e=ca(e)),t.type==="LineString"&&(t=ca(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var i=dS(e,t);return i&&r.push(i),Bc(r)}var a=Cz();return a.load(fS(t)),uy(fS(e),function(h){uy(a.search(h),function(u){var y=dS(h,u);if(y){var w=Df(y).join(",");n[w]||(n[w]=!0,r.push(y))}})}),Bc(r)}function dS(e,t){var n=Df(e),r=Df(t);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],y=r[0][0],w=r[0][1],S=r[1][0],I=r[1][1],P=(I-w)*(h-i)-(S-y)*(u-a),z=(S-y)*(a-w)-(I-w)*(i-y),R=(h-i)*(a-w)-(u-a)*(i-y);if(P===0)return null;var Y=z/P,Z=R/P;if(Y>=0&&Y<=1&&Z>=0&&Z<=1){var et=i+Y*(h-i),B=a+Y*(u-a);return rs([et,B])}return null}function Lz(e,t,n){n===void 0&&(n={});var r=rs([1/0,1/0],{dist:1/0}),i=0;return Wf(e,function(a){for(var h=Df(a),u=0;u0&&(Z=Y.features[0],Z.properties.dist=Qp(t,Z,n),Z.properties.location=i+Qp(y,Z,n)),y.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-t.lngLat.lng,r=this.dragFrom[1]-t.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=r}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});ci(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(mS(this.points).forEach((r,i)=>{n.push([i+1,Lz(r,this.cursor).properties.dist])}),n.sort((r,i)=>r[1]-i[1]),n.length>0){let r=n[0][0];this.points.splice(r,0,this.cursor.geometry.coordinates),this.hover=r}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(t))});ci(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=g0(t.lngLat.toArray()),this.onClick(t),this.finish())});ci(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});ci(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});ci(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});ci(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersSuccess)n(t);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((i,a)=>{let h=g0(i);h.properties.hover=this.hover==a,h.properties.idx=a,t.features.push(h)}),t.features=t.features.concat(mS(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",t.features.push(n)),PC.set(t);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,MC.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersUpdated)n(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=g0(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(LC),n=[JSON.parse(JSON.stringify(t))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>kz&&this.previousStates.shift()}}function mS(e){let t=[];for(let n=0;n=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[e[e.length-1],e[0]]},properties:{}}),t}function Rz(e){let t,n,r;return{c(){t=un("Undo ("),n=un(e[1]),r=un(")")},m(i,a){Vt(i,t,a),Vt(i,n,a),Vt(i,r,a)},p(i,a){a&2&&Nr(n,i[1])},d(i){i&&(Bt(t),Bt(n),Bt(r))}}}function Nz(e){let t;return{c(){t=un("Undo")},m(n,r){Vt(n,t,r)},p:Se,d(n){n&&Bt(t)}}}function Oz(e){let t,n,r,i,a,h,u,y,w,S,I;function P(Y,Z){return Y[1]==0?Nz:Rz}let z=P(e),R=z(e);return{c(){t=jt("div"),n=jt("button"),n.textContent="Finish",r=fe(),i=jt("button"),i.textContent="Cancel",a=fe(),h=jt("button"),R.c(),y=fe(),w=jt("ul"),w.innerHTML=`
  • Click the map to add a vertex
  • Click a vertex to delete it
  • Drag a vertex or the polygon to move it
  • Press Control+Z @@ -622,11 +623,11 @@ ${e.stack}`:r}function JO(e,t){const n=t(e.length*1,1)>>>0;return fd().set(e,n/1 or double click to finish
  • Press Escape - to cancel
  • `,h.disabled=u=e[1]==0,Ui(t,"display","flex"),Ui(t,"justify-content","space-between")},m(Z,X){Vt(Z,t,X),Ot(t,n),Ot(t,r),Ot(t,i),Ot(t,a),Ot(t,h),R.m(h,null),Vt(Z,y,X),Vt(Z,w,X),S||(I=[Ye(n,"click",e[2]),Ye(i,"click",e[3]),Ye(h,"click",e[4])],S=!0)},p(Z,[X]){z===(z=P(Z))&&R?R.p(Z,X):(R.d(1),R=z(Z),R&&(R.c(),R.m(h,null))),X&2&&u!==(u=Z[1]==0)&&(h.disabled=u)},i:Se,o:Se,d(Z){Z&&(Bt(t),Bt(y),Bt(w)),R.d(),S=!1,Ri(I)}}}function zz(e,t,n){let r;qe(e,MC,y=>n(1,r=y));let{polygonTool:i}=t;const a=()=>i.finish(),h=()=>i.cancel(),u=()=>i.undo();return e.$$set=y=>{"polygonTool"in y&&n(0,i=y.polygonTool)},[i,r,a,h,u]}class Fz extends an{constructor(t){super(),sn(this,t,zz,Oz,He,{polygonTool:0})}}let Bz=Date.now();function Yd(e){return`${e}-${Bz++}`}const AC=Symbol.for("svelte-maplibre");function Vz(){return hv(AC)}function gS(e){return{subscribe:e.subscribe}}function kC({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=Vz(),a=$r(null),h=gS(a),u={...i,[e]:gS(a)};if(t&&(u.popupTarget=h),r){let y=$r(null);u.layerEvent=y,i.layerEvent=y}return n&&(u.cluster=$r()),cv(AC,u),{...i,self:a}}function Uz(){return kC({key:"source",setCluster:!0})}function Gz(e=!0){return kC({key:"layer",setPopupTarget:e,setMouseEvent:e})}function yS(e){let t;return n=>{if(n)for(let r in n){let i=t==null?void 0:t[r],a=n[r];i!==a&&e(r,a,i)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function qz(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function jz(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function _S(e){let t=e[0],n,r,i=vS(e);return{c(){i.c(),n=di()},m(a,h){i.m(a,h),Vt(a,n,h),r=!0},p(a,h){h[0]&1&&He(t,t=a[0])?(Fn(),Mt(i,1,1,Se),Bn(),i=vS(a),i.c(),It(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(It(i),r=!0)},o(a){Mt(i),r=!1},d(a){a&&Bt(n),i.d(a)}}}function vS(e){let t;const n=e[36].default,r=xi(n,e,e[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a[1]&16)&&Si(r,n,i,i[35],t?wi(n,i[35],a,null):Ei(i[35]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function Wz(e){let t,n,r=e[0]&&_S(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&It(r,1)):(r=_S(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),Mt(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){Mt(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function Hz(e,t,n){let r,i,a,h,u,y,w,S,I,P,z,R,{$$slots:Z={},$$scope:X}=t,{id:et=Yd("layer")}=t,{source:B=void 0}=t,{sourceLayer:q=void 0}=t,{beforeId:Y=void 0}=t,{beforeLayerType:lt=void 0}=t,{type:dt}=t,{paint:ut=void 0}=t,{layout:ft=void 0}=t,{filter:_t=void 0}=t,{applyToClusters:kt=void 0}=t,{minzoom:Q=void 0}=t,{maxzoom:yt=void 0}=t,{manageHoverState:Kt=!1}=t,{hovered:bt=null}=t,{interactive:Ut=!0}=t,{hoverCursor:ee=void 0}=t,{eventsIfTopMost:Gt=!1}=t;const Re=Uu(),{map:xe,source:ln,self:Ve,minzoom:Pe,maxzoom:un,eventTopMost:Cn,layerInfo:mn}=Gz();qe(e,xe,mt=>n(31,I=mt)),qe(e,ln,mt=>n(32,P=mt)),qe(e,Ve,mt=>n(0,S=mt)),qe(e,Pe,mt=>n(34,R=mt)),qe(e,un,mt=>n(33,z=mt)),as(()=>{S&&I&&(mn.delete(S),I==null||I.removeLayer(S))});let gn;function An(mt){var At,Ze;if(!Ut||!S||!I||Gt&&Cn(mt)!==S)return;let Ct=mt.features??[],Ie=(Ze=(At=Ct[0])==null?void 0:At.properties)==null?void 0:Ze.cluster_id,kn={event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct};Re(mt.type,kn)}function vr(mt){var At,Ze;if(!Ut||!S||!I||Gt&&Cn(mt)!==S)return;ee&&(I.getCanvas().style.cursor=ee);let Ct=mt.features??[];n(6,bt=Ct[0]??null);let Ie=(Ze=(At=Ct[0])==null?void 0:At.properties)==null?void 0:Ze.cluster_id;Re("mouseenter",{event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct})}function Pr(mt){var At,Ze,Mr;if(!Ut||!I)return;if(Gt&&Cn(mt)!==S){n(6,bt=null),Kt&&gn!==void 0&&(I==null||I.setFeatureState({source:u,sourceLayer:q,id:gn},{hover:!1}),gn=void 0);return}I.getCanvas().style.cursor=ee;let Ct=mt.features??[],Ie=(Ze=(At=Ct[0])==null?void 0:At.properties)==null?void 0:Ze.cluster_id,kn=(Mr=Ct[0])==null?void 0:Mr.id;kn!==gn&&(Kt&&(gn!==void 0&&(I==null||I.setFeatureState({source:u,id:gn,sourceLayer:q},{hover:!1})),I==null||I.setFeatureState({source:u,id:kn,sourceLayer:q},{hover:!0})),gn=kn,n(6,bt=Ct[0]??null)),Re("mousemove",{event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct})}function br(mt){if(!(!Ut||!S||!I)){if(ee&&(I.getCanvas().style.cursor=""),n(6,bt=null),Kt&&gn!==void 0){const Ct={source:u,id:gn,sourceLayer:q};I==null||I.setFeatureState(Ct,{hover:!1}),gn=void 0}Re("mouseleave",{map:I,layer:S,source:u})}}let hr=!0;function Qt(mt){I&&(I.off("click",mt,An),I.off("dblclick",mt,An),I.off("contextmenu",mt,An),I.off("mouseenter",mt,vr),I.off("mousemove",mt,Pr),I.off("mouseleave",mt,br))}return as(()=>{I&&S&&Qt(S)}),e.$$set=mt=>{"id"in mt&&n(7,et=mt.id),"source"in mt&&n(8,B=mt.source),"sourceLayer"in mt&&n(9,q=mt.sourceLayer),"beforeId"in mt&&n(10,Y=mt.beforeId),"beforeLayerType"in mt&&n(11,lt=mt.beforeLayerType),"type"in mt&&n(12,dt=mt.type),"paint"in mt&&n(13,ut=mt.paint),"layout"in mt&&n(14,ft=mt.layout),"filter"in mt&&n(15,_t=mt.filter),"applyToClusters"in mt&&n(16,kt=mt.applyToClusters),"minzoom"in mt&&n(17,Q=mt.minzoom),"maxzoom"in mt&&n(18,yt=mt.maxzoom),"manageHoverState"in mt&&n(19,Kt=mt.manageHoverState),"hovered"in mt&&n(6,bt=mt.hovered),"interactive"in mt&&n(20,Ut=mt.interactive),"hoverCursor"in mt&&n(21,ee=mt.hoverCursor),"eventsIfTopMost"in mt&&n(22,Gt=mt.eventsIfTopMost),"$$scope"in mt&&n(35,X=mt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=jz(kt)),e.$$.dirty[0]&1073774592&&n(24,i=qz("all",r,_t)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,a=Q??R),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=yt??z),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=B||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&I&&S!==et&&u){S&&(Qt(S),mn.delete(S));let mt=Y;if(!Y&<){let Ct=I.getStyle().layers,Ie=typeof lt=="function"?lt:At=>At.type===lt,kn=Ct==null?void 0:Ct.find(Ie);kn&&(mt=kn.id)}Jn(Ve,S=et,S),I.addLayer(Oc({id:S,type:dt,source:u,"source-layer":q,filter:i,paint:ut,layout:ft,minzoom:a,maxzoom:h}),mt),n(23,hr=!0),I.on("click",S,An),I.on("dblclick",S,An),I.on("contextmenu",S,An),I.on("mouseenter",S,vr),I.on("mousemove",S,Pr),I.on("mouseleave",S,br)}e.$$.dirty[0]&1048577&&S&&mn.set(S,{interactive:Ut}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,y=S?yS((mt,Ct)=>I==null?void 0:I.setPaintProperty(S,mt,Ct)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?yS((mt,Ct)=>I==null?void 0:I.setLayoutProperty(S,mt,Ct)):void 0),e.$$.dirty[0]&268443648&&(y==null||y(ut)),e.$$.dirty[0]&134234112&&(w==null||w(ft)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(hr?n(23,hr=!1):I==null||I.setFilter(S,i))},[S,xe,ln,Ve,Pe,un,bt,et,B,q,Y,lt,dt,ut,ft,_t,kt,Q,yt,Kt,Ut,ee,Gt,hr,i,h,a,w,y,u,r,I,P,z,R,X,Z]}class m1 extends an{constructor(t){super(),sn(this,t,Hz,Wz,He,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function Zz(e){let t;const n=e[16].default,r=xi(n,e,e[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16777216)&&Si(r,n,i,i[24],t?wi(n,i[24],a,null):Ei(i[24]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function Xz(e){let t,n,r;function i(h){e[17](h)}let a={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[Zz]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new m1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.applyToClusters=h[9]),u&1024&&(y.minzoom=h[10]),u&2048&&(y.maxzoom=h[11]),u&4096&&(y.hoverCursor=h[12]),u&8192&&(y.manageHoverState=h[13]),u&16384&&(y.eventsIfTopMost=h[14]),u&32768&&(y.interactive=h[15]),u&16777216&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function Yz(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Yd("circle")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{applyToClusters:z=void 0}=t,{minzoom:R=void 0}=t,{maxzoom:Z=void 0}=t,{hoverCursor:X=void 0}=t,{manageHoverState:et=!1}=t,{hovered:B=null}=t,{eventsIfTopMost:q=!1}=t,{interactive:Y=!0}=t;function lt(yt){B=yt,n(0,B)}function dt(yt){En.call(this,e,yt)}function ut(yt){En.call(this,e,yt)}function ft(yt){En.call(this,e,yt)}function _t(yt){En.call(this,e,yt)}function kt(yt){En.call(this,e,yt)}function Q(yt){En.call(this,e,yt)}return e.$$set=yt=>{"id"in yt&&n(1,a=yt.id),"source"in yt&&n(2,h=yt.source),"sourceLayer"in yt&&n(3,u=yt.sourceLayer),"beforeId"in yt&&n(4,y=yt.beforeId),"beforeLayerType"in yt&&n(5,w=yt.beforeLayerType),"paint"in yt&&n(6,S=yt.paint),"layout"in yt&&n(7,I=yt.layout),"filter"in yt&&n(8,P=yt.filter),"applyToClusters"in yt&&n(9,z=yt.applyToClusters),"minzoom"in yt&&n(10,R=yt.minzoom),"maxzoom"in yt&&n(11,Z=yt.maxzoom),"hoverCursor"in yt&&n(12,X=yt.hoverCursor),"manageHoverState"in yt&&n(13,et=yt.manageHoverState),"hovered"in yt&&n(0,B=yt.hovered),"eventsIfTopMost"in yt&&n(14,q=yt.eventsIfTopMost),"interactive"in yt&&n(15,Y=yt.interactive),"$$scope"in yt&&n(24,i=yt.$$scope)},[B,a,h,u,y,w,S,I,P,z,R,Z,X,et,q,Y,r,lt,dt,ut,ft,_t,kt,Q,i]}class Kz extends an{constructor(t){super(),sn(this,t,Yz,Xz,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function Jz(e){let t;const n=e[15].default,r=xi(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&Si(r,n,i,i[23],t?wi(n,i[23],a,null):Ei(i[23]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function Qz(e){let t,n,r;function i(h){e[16](h)}let a={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[Jz]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new m1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function $z(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Yd("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:X=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:q=!0}=t;function Y(Q){et=Q,n(0,et)}function lt(Q){En.call(this,e,Q)}function dt(Q){En.call(this,e,Q)}function ut(Q){En.call(this,e,Q)}function ft(Q){En.call(this,e,Q)}function _t(Q){En.call(this,e,Q)}function kt(Q){En.call(this,e,Q)}return e.$$set=Q=>{"id"in Q&&n(1,a=Q.id),"source"in Q&&n(2,h=Q.source),"sourceLayer"in Q&&n(3,u=Q.sourceLayer),"beforeId"in Q&&n(4,y=Q.beforeId),"beforeLayerType"in Q&&n(5,w=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,I=Q.layout),"filter"in Q&&n(8,P=Q.filter),"minzoom"in Q&&n(9,z=Q.minzoom),"maxzoom"in Q&&n(10,R=Q.maxzoom),"hoverCursor"in Q&&n(11,Z=Q.hoverCursor),"manageHoverState"in Q&&n(12,X=Q.manageHoverState),"hovered"in Q&&n(0,et=Q.hovered),"eventsIfTopMost"in Q&&n(13,B=Q.eventsIfTopMost),"interactive"in Q&&n(14,q=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[et,a,h,u,y,w,S,I,P,z,R,Z,X,B,q,r,Y,lt,dt,ut,ft,_t,kt,i]}class tF extends an{constructor(t){super(),sn(this,t,$z,Qz,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function eF(e,t,n,r,i){let a=!1;e.getSource(t)&&(a=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),i())};if(a){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function nF(e,t,n){VS().then(()=>{let r=NS(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function bS(e){let t=e[0],n,r,i=xS(e);return{c(){i.c(),n=di()},m(a,h){i.m(a,h),Vt(a,n,h),r=!0},p(a,h){h&1&&He(t,t=a[0])?(Fn(),Mt(i,1,1,Se),Bn(),i=xS(a),i.c(),It(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(It(i),r=!0)},o(a){Mt(i),r=!1},d(a){a&&Bt(n),i.d(a)}}}function xS(e){let t;const n=e[15].default,r=xi(n,e,e[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16384)&&Si(r,n,i,i[14],t?wi(n,i[14],a,null):Ei(i[14]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function rF(e){let t,n,r=e[0]&&bS(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&It(r,1)):(r=bS(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),Mt(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){Mt(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function iF(e,t,n){let r,i,a,{$$slots:h={},$$scope:u}=t,{id:y=Yd("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:I=void 0}=t,{filter:P=void 0}=t,{lineMetrics:z=void 0}=t,{cluster:R=void 0}=t;const{map:Z,cluster:X,self:et}=Uz();qe(e,Z,Y=>n(13,i=Y)),qe(e,X,Y=>n(16,a=Y)),qe(e,et,Y=>n(0,r=Y));let B,q=!0;return as(()=>{r&&B&&i&&(nF(Z,r,B),Jn(et,r=null,r),n(11,B=void 0))}),e.$$set=Y=>{"id"in Y&&n(4,y=Y.id),"data"in Y&&n(5,w=Y.data),"generateId"in Y&&n(6,S=Y.generateId),"promoteId"in Y&&n(7,I=Y.promoteId),"filter"in Y&&n(8,P=Y.filter),"lineMetrics"in Y&&n(9,z=Y.lineMetrics),"cluster"in Y&&n(10,R=Y.cluster),"$$scope"in Y&&n(14,u=Y.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Jn(X,a=R,a),e.$$.dirty&12273&&i&&r!==y&&(Jn(et,r=y,r),eF(i,r,Oc({type:"geojson",data:w,filter:P,lineMetrics:z,generateId:S,promoteId:I,cluster:!!R,clusterMinPoints:R==null?void 0:R.minPoints,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius,clusterProperties:R==null?void 0:R.properties}),Y=>i&&Y===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,q=!0))})),e.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(y))})),e.$$.dirty&6176&&B&&(q?n(12,q=!1):B.setData(w)),e.$$.dirty&3072&&(B==null||B.setClusterOptions(Oc({cluster:!!R,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius})))},[r,Z,X,et,y,w,S,I,P,z,R,B,q,i,u,h]}class oF extends an{constructor(t){super(),sn(this,t,iF,rF,He,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function sF(e){let t;const n=e[15].default,r=xi(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&Si(r,n,i,i[23],t?wi(n,i[23],a,null):Ei(i[23]),null)},i(i){t||(It(r,i),t=!0)},o(i){Mt(r,i),t=!1},d(i){r&&r.d(i)}}}function aF(e){let t,n,r;function i(h){e[16](h)}let a={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[sF]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new m1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){Mt(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function lF(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Yd("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:X=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:q=!0}=t;function Y(Q){et=Q,n(0,et)}function lt(Q){En.call(this,e,Q)}function dt(Q){En.call(this,e,Q)}function ut(Q){En.call(this,e,Q)}function ft(Q){En.call(this,e,Q)}function _t(Q){En.call(this,e,Q)}function kt(Q){En.call(this,e,Q)}return e.$$set=Q=>{"id"in Q&&n(1,a=Q.id),"source"in Q&&n(2,h=Q.source),"sourceLayer"in Q&&n(3,u=Q.sourceLayer),"beforeId"in Q&&n(4,y=Q.beforeId),"beforeLayerType"in Q&&n(5,w=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,I=Q.layout),"filter"in Q&&n(8,P=Q.filter),"minzoom"in Q&&n(9,z=Q.minzoom),"maxzoom"in Q&&n(10,R=Q.maxzoom),"hoverCursor"in Q&&n(11,Z=Q.hoverCursor),"manageHoverState"in Q&&n(12,X=Q.manageHoverState),"hovered"in Q&&n(0,et=Q.hovered),"eventsIfTopMost"in Q&&n(13,B=Q.eventsIfTopMost),"interactive"in Q&&n(14,q=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[et,a,h,u,y,w,S,I,P,z,R,Z,X,B,q,r,Y,lt,dt,ut,ft,_t,kt,i]}class uF extends an{constructor(t){super(),sn(this,t,lF,aF,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function cF(e){let t,n,r,i,a,h;return t=new tF({props:{id:"edit-polygon-fill",filter:Pz,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new uF({props:{id:"edit-polygon-lines",filter:Mz,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new Kz({props:{id:"edit-polygon-vertices",filter:Az,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment),i=fe(),_e(a.$$.fragment)},m(u,y){de(t,u,y),Vt(u,n,y),de(r,u,y),Vt(u,i,y),de(a,u,y),h=!0},p:Se,i(u){h||(It(t.$$.fragment,u),It(r.$$.fragment,u),It(a.$$.fragment,u),h=!0)},o(u){Mt(t.$$.fragment,u),Mt(r.$$.fragment,u),Mt(a.$$.fragment,u),h=!1},d(u){u&&(Bt(n),Bt(i)),me(t,u),me(r,u),me(a,u)}}}function hF(e){let t,n;return t=new oF({props:{data:e[0],$$slots:{default:[cF]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&2&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function fF(e,t,n){let r;return qe(e,PC,i=>n(0,r=i)),[r]}class pF extends an{constructor(t){super(),sn(this,t,fF,hF,He,{})}}function dF(e){let t,n,r,i,a,h,u;return{c(){t=jt("button"),t.textContent="Import current view",n=fe(),r=jt("i"),r.textContent="or...",i=fe(),a=jt("button"),a.textContent="Draw an area to import on the map",Zt(t,"type","button"),Zt(a,"type","button")},m(y,w){Vt(y,t,w),Vt(y,n,w),Vt(y,r,w),Vt(y,i,w),Vt(y,a,w),h||(u=[Ye(t,"click",e[1]),Ye(a,"click",e[2])],h=!0)},p:Se,i:Se,o:Se,d(y){y&&(Bt(t),Bt(n),Bt(r),Bt(i),Bt(a)),h=!1,Ri(u)}}}function mF(e){let t,n;return t=new Fz({props:{polygonTool:e[0]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&1&&(a.polygonTool=r[0]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function gF(e){let t,n,r,i;const a=[mF,dF],h=[];function u(y,w){return y[0]?0:1}return t=u(e),n=h[t]=a[t](e),{c(){n.c(),r=di()},m(y,w){h[t].m(y,w),Vt(y,r,w),i=!0},p(y,[w]){let S=t;t=u(y),t===S?h[t].p(y,w):(Fn(),Mt(h[S],1,1,()=>{h[S]=null}),Bn(),n=h[t],n?n.p(y,w):(n=h[t]=a[t](y),n.c()),It(n,1),n.m(r.parentNode,r))},i(y){i||(It(n),i=!0)},o(y){Mt(n),i=!1},d(y){y&&Bt(r),h[t].d(y)}}}function $p(e){return[e.lng,e.lat]}function yF(e,t,n){let{map:r}=t;const i=Uu();let a=null;async function h(S){try{i("loading","Loading from Overpass");let P=await(await fetch(vF(S))).text();i("gotXml",P)}catch(I){i("error",I.toString())}}function u(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[$p(S.getSouthWest()),$p(S.getNorthWest()),$p(S.getNorthEast()),$p(S.getSouthEast()),$p(S.getSouthWest())]],type:"Polygon"}}}async function y(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await h(u())}}function w(){r&&(n(0,a=new Dz(r)),a.startNew(),a.addEventListenerSuccess(async S=>{n(0,a=null),await h(S)}),a.addEventListenerFailure(()=>{n(0,a=null)}))}return e.$$set=S=>{"map"in S&&n(3,r=S.map)},[a,y,w,r]}class _F extends an{constructor(t){super(),sn(this,t,yF,gF,He,{map:3})}}function vF(e){let t='poly:"';for(let[r,i]of e.geometry.coordinates[0])t+=`${i} ${r} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}function wS(e,t,n){const r=e.slice();return r[3]=t[n],r}function SS(e){let t,n,r=ti(e[0]),i=[];for(let a=0;a0&&SS(e);return{c(){n&&n.c(),t=di()},m(r,i){n&&n.m(r,i),Vt(r,t,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=SS(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:Se,o:Se,d(r){r&&Bt(t),n&&n.d(r)}}}function xF(e,t,n){let{loading:r}=t,i;function a(h){rr[h?"unshift":"push"](()=>{i=h,n(1,i),n(0,r)})}return e.$$set=h=>{"loading"in h&&n(0,r=h.loading)},e.$$.update=()=>{e.$$.dirty&3&&r.length>0&&i&&n(1,i.scrollTop=i.scrollHeight,i)},[r,i,a]}class wF extends an{constructor(t){super(),sn(this,t,xF,bF,He,{loading:0})}}function IS(e,t,n){const r=e.slice();return r[21]=t[n][0],r[22]=t[n][1],r}function CS(e,t,n){const r=e.slice();return r[25]=t[n][0],r[26]=t[n][1],r}function TS(e){let t,n=e[26]+"",r,i;return{c(){t=jt("option"),r=hn(n),t.__value=i=e[25],Ea(t,t.__value)},m(a,h){Vt(a,t,h),Ot(t,r)},p(a,h){h&4&&n!==(n=a[26]+"")&&Nr(r,n),h&4&&i!==(i=a[25])&&(t.__value=i,Ea(t,t.__value))},d(a){a&&Bt(t)}}}function LS(e){let t,n,r=ti(e[22]),i=[];for(let a=0;ae[9].call(h)),Zt(R,"type","file"),Zt(_t,"type","file")},m(Ut,ee){de(t,Ut,ee),Vt(Ut,n,ee),Vt(Ut,r,ee),Ot(r,i),Ot(i,a),Ot(i,h),Ot(h,u);for(let Gt=0;Gtn(15,r=ft)),qe(e,Fc,ft=>n(16,i=ft)),qe(e,ky,ft=>n(5,a=ft));let h="",u=[],y=!1,w=[];Vu(async()=>{try{let ft=await fetch("/osm/areas.json");if(ft.ok)y=!0,console.log("Using local cache, not od2net.org"),n(2,w=await ft.json());else{let _t=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await _t.json())}}catch{}});let S;async function I(ft){try{await R(await S.files[0].arrayBuffer()),n(0,h="")}catch(_t){window.alert(`Couldn't open this file: ${_t}`)}n(1,u=[])}let P;async function z(ft){try{n(1,u=["Loading pre-built file"]);let _t=await P.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array(_t)),console.timeEnd("load"),Jn(lf,r=!0,r),n(0,h="")}catch(_t){window.alert(`Couldn't open this file: ${_t}`)}n(1,u=[])}async function R(ft){n(1,u=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(ft),pC(Z)),console.timeEnd("load"),Jn(lf,r=!0,r)}function Z(ft){n(1,u=[...u,ft])}async function X(ft){try{await R(new TextEncoder().encode(ft.detail)),n(0,h="")}catch(_t){window.alert(`Couldn't import from Overpass: ${_t}`)}n(1,u=[])}async function et(ft){ft!=""&&(y?await B(`/osm/${ft}.pbf`):await B(`https://assets.od2net.org/severance_pbfs/${ft}.pbf`))}async function B(ft){try{n(1,u=[`Downloading ${ft}`]);let _t=await fetch(ft);await R(await _t.arrayBuffer())}catch(_t){window.alert(`Couldn't open from URL ${ft}: ${_t}`)}n(1,u=[])}function q(){h=zS(this),n(0,h),n(2,w)}function Y(ft){rr[ft?"unshift":"push"](()=>{S=ft,n(3,S)})}const lt=ft=>n(1,u=[...u,ft.detail]),dt=ft=>window.alert(ft.detail);function ut(ft){rr[ft?"unshift":"push"](()=>{P=ft,n(4,P)})}return e.$$.update=()=>{e.$$.dirty&1&&et(h)},[h,u,w,S,P,a,I,z,X,q,Y,lt,dt,ut]}class IF extends an{constructor(t){super(),sn(this,t,EF,SF,He,{})}}function PS(e){let t,n;return t=new US({props:{$$slots:{default:[CF,({dialog:r})=>({7:r}),({dialog:r})=>r?128:0]},$$scope:{ctx:e}}}),t.$on("close",e[3]),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&384&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function CF(e){let t,n,r,i,a,h,u,y,w,S;function I(){return e[2](e[7])}return{c(){t=jt("h1"),t.textContent="15-minute neighborhood tool",n=fe(),r=jt("p"),r.textContent="TODO. Extremely early in development.",i=fe(),a=jt("p"),a.innerHTML=`This open source + to cancel`,h.disabled=u=e[1]==0,Ui(t,"display","flex"),Ui(t,"justify-content","space-between")},m(Y,Z){Vt(Y,t,Z),Ot(t,n),Ot(t,r),Ot(t,i),Ot(t,a),Ot(t,h),R.m(h,null),Vt(Y,y,Z),Vt(Y,w,Z),S||(I=[We(n,"click",e[2]),We(i,"click",e[3]),We(h,"click",e[4])],S=!0)},p(Y,[Z]){z===(z=P(Y))&&R?R.p(Y,Z):(R.d(1),R=z(Y),R&&(R.c(),R.m(h,null))),Z&2&&u!==(u=Y[1]==0)&&(h.disabled=u)},i:Se,o:Se,d(Y){Y&&(Bt(t),Bt(y),Bt(w)),R.d(),S=!1,Ri(I)}}}function zz(e,t,n){let r;qe(e,MC,y=>n(1,r=y));let{polygonTool:i}=t;const a=()=>i.finish(),h=()=>i.cancel(),u=()=>i.undo();return e.$$set=y=>{"polygonTool"in y&&n(0,i=y.polygonTool)},[i,r,a,h,u]}class Fz extends an{constructor(t){super(),sn(this,t,zz,Oz,Ze,{polygonTool:0})}}let Bz=Date.now();function Yd(e){return`${e}-${Bz++}`}const AC=Symbol.for("svelte-maplibre");function Vz(){return hv(AC)}function gS(e){return{subscribe:e.subscribe}}function kC({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=Vz(),a=$r(null),h=gS(a),u={...i,[e]:gS(a)};if(t&&(u.popupTarget=h),r){let y=$r(null);u.layerEvent=y,i.layerEvent=y}return n&&(u.cluster=$r()),cv(AC,u),{...i,self:a}}function Uz(){return kC({key:"source",setCluster:!0})}function Gz(e=!0){return kC({key:"layer",setPopupTarget:e,setMouseEvent:e})}function yS(e){let t;return n=>{if(n)for(let r in n){let i=t==null?void 0:t[r],a=n[r];i!==a&&e(r,a,i)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function qz(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function jz(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function _S(e){let t=e[0],n,r,i=vS(e);return{c(){i.c(),n=di()},m(a,h){i.m(a,h),Vt(a,n,h),r=!0},p(a,h){h[0]&1&&Ze(t,t=a[0])?(Fn(),At(i,1,1,Se),Bn(),i=vS(a),i.c(),It(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(It(i),r=!0)},o(a){At(i),r=!1},d(a){a&&Bt(n),i.d(a)}}}function vS(e){let t;const n=e[36].default,r=xi(n,e,e[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a[1]&16)&&Si(r,n,i,i[35],t?wi(n,i[35],a,null):Ei(i[35]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function Wz(e){let t,n,r=e[0]&&_S(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&It(r,1)):(r=_S(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),At(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){At(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function Hz(e,t,n){let r,i,a,h,u,y,w,S,I,P,z,R,{$$slots:Y={},$$scope:Z}=t,{id:et=Yd("layer")}=t,{source:B=void 0}=t,{sourceLayer:j=void 0}=t,{beforeId:q=void 0}=t,{beforeLayerType:ct=void 0}=t,{type:_t}=t,{paint:lt=void 0}=t,{layout:ht=void 0}=t,{filter:pt=void 0}=t,{applyToClusters:Tt=void 0}=t,{minzoom:Q=void 0}=t,{maxzoom:gt=void 0}=t,{manageHoverState:Kt=!1}=t,{hovered:bt=null}=t,{interactive:Ut=!0}=t,{hoverCursor:ee=void 0}=t,{eventsIfTopMost:Gt=!1}=t;const Re=Uu(),{map:xe,source:ln,self:Ve,minzoom:Pe,maxzoom:cn,eventTopMost:Cn,layerInfo:mn}=Gz();qe(e,xe,mt=>n(31,I=mt)),qe(e,ln,mt=>n(32,P=mt)),qe(e,Ve,mt=>n(0,S=mt)),qe(e,Pe,mt=>n(34,R=mt)),qe(e,cn,mt=>n(33,z=mt)),as(()=>{S&&I&&(mn.delete(S),I==null||I.removeLayer(S))});let gn;function An(mt){var kt,Xe;if(!Ut||!S||!I||Gt&&Cn(mt)!==S)return;let Ct=mt.features??[],Ie=(Xe=(kt=Ct[0])==null?void 0:kt.properties)==null?void 0:Xe.cluster_id,kn={event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct};Re(mt.type,kn)}function vr(mt){var kt,Xe;if(!Ut||!S||!I||Gt&&Cn(mt)!==S)return;ee&&(I.getCanvas().style.cursor=ee);let Ct=mt.features??[];n(6,bt=Ct[0]??null);let Ie=(Xe=(kt=Ct[0])==null?void 0:kt.properties)==null?void 0:Xe.cluster_id;Re("mouseenter",{event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct})}function Pr(mt){var kt,Xe,Mr;if(!Ut||!I)return;if(Gt&&Cn(mt)!==S){n(6,bt=null),Kt&&gn!==void 0&&(I==null||I.setFeatureState({source:u,sourceLayer:j,id:gn},{hover:!1}),gn=void 0);return}I.getCanvas().style.cursor=ee;let Ct=mt.features??[],Ie=(Xe=(kt=Ct[0])==null?void 0:kt.properties)==null?void 0:Xe.cluster_id,kn=(Mr=Ct[0])==null?void 0:Mr.id;kn!==gn&&(Kt&&(gn!==void 0&&(I==null||I.setFeatureState({source:u,id:gn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:u,id:kn,sourceLayer:j},{hover:!0})),gn=kn,n(6,bt=Ct[0]??null)),Re("mousemove",{event:mt,map:I,clusterId:Ie,layer:S,source:u,features:Ct})}function br(mt){if(!(!Ut||!S||!I)){if(ee&&(I.getCanvas().style.cursor=""),n(6,bt=null),Kt&&gn!==void 0){const Ct={source:u,id:gn,sourceLayer:j};I==null||I.setFeatureState(Ct,{hover:!1}),gn=void 0}Re("mouseleave",{map:I,layer:S,source:u})}}let hr=!0;function Qt(mt){I&&(I.off("click",mt,An),I.off("dblclick",mt,An),I.off("contextmenu",mt,An),I.off("mouseenter",mt,vr),I.off("mousemove",mt,Pr),I.off("mouseleave",mt,br))}return as(()=>{I&&S&&Qt(S)}),e.$$set=mt=>{"id"in mt&&n(7,et=mt.id),"source"in mt&&n(8,B=mt.source),"sourceLayer"in mt&&n(9,j=mt.sourceLayer),"beforeId"in mt&&n(10,q=mt.beforeId),"beforeLayerType"in mt&&n(11,ct=mt.beforeLayerType),"type"in mt&&n(12,_t=mt.type),"paint"in mt&&n(13,lt=mt.paint),"layout"in mt&&n(14,ht=mt.layout),"filter"in mt&&n(15,pt=mt.filter),"applyToClusters"in mt&&n(16,Tt=mt.applyToClusters),"minzoom"in mt&&n(17,Q=mt.minzoom),"maxzoom"in mt&&n(18,gt=mt.maxzoom),"manageHoverState"in mt&&n(19,Kt=mt.manageHoverState),"hovered"in mt&&n(6,bt=mt.hovered),"interactive"in mt&&n(20,Ut=mt.interactive),"hoverCursor"in mt&&n(21,ee=mt.hoverCursor),"eventsIfTopMost"in mt&&n(22,Gt=mt.eventsIfTopMost),"$$scope"in mt&&n(35,Z=mt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=jz(Tt)),e.$$.dirty[0]&1073774592&&n(24,i=qz("all",r,pt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,a=Q??R),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=gt??z),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=B||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&I&&S!==et&&u){S&&(Qt(S),mn.delete(S));let mt=q;if(!q&&ct){let Ct=I.getStyle().layers,Ie=typeof ct=="function"?ct:kt=>kt.type===ct,kn=Ct==null?void 0:Ct.find(Ie);kn&&(mt=kn.id)}Jn(Ve,S=et,S),I.addLayer(Oc({id:S,type:_t,source:u,"source-layer":j,filter:i,paint:lt,layout:ht,minzoom:a,maxzoom:h}),mt),n(23,hr=!0),I.on("click",S,An),I.on("dblclick",S,An),I.on("contextmenu",S,An),I.on("mouseenter",S,vr),I.on("mousemove",S,Pr),I.on("mouseleave",S,br)}e.$$.dirty[0]&1048577&&S&&mn.set(S,{interactive:Ut}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,y=S?yS((mt,Ct)=>I==null?void 0:I.setPaintProperty(S,mt,Ct)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?yS((mt,Ct)=>I==null?void 0:I.setLayoutProperty(S,mt,Ct)):void 0),e.$$.dirty[0]&268443648&&(y==null||y(lt)),e.$$.dirty[0]&134234112&&(w==null||w(ht)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(hr?n(23,hr=!1):I==null||I.setFilter(S,i))},[S,xe,ln,Ve,Pe,cn,bt,et,B,j,q,ct,_t,lt,ht,pt,Tt,Q,gt,Kt,Ut,ee,Gt,hr,i,h,a,w,y,u,r,I,P,z,R,Z,Y]}class m1 extends an{constructor(t){super(),sn(this,t,Hz,Wz,Ze,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function Zz(e){let t;const n=e[16].default,r=xi(n,e,e[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16777216)&&Si(r,n,i,i[24],t?wi(n,i[24],a,null):Ei(i[24]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function Xz(e){let t,n,r;function i(h){e[17](h)}let a={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[Zz]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new m1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.applyToClusters=h[9]),u&1024&&(y.minzoom=h[10]),u&2048&&(y.maxzoom=h[11]),u&4096&&(y.hoverCursor=h[12]),u&8192&&(y.manageHoverState=h[13]),u&16384&&(y.eventsIfTopMost=h[14]),u&32768&&(y.interactive=h[15]),u&16777216&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function Yz(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Yd("circle")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{applyToClusters:z=void 0}=t,{minzoom:R=void 0}=t,{maxzoom:Y=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:et=!1}=t,{hovered:B=null}=t,{eventsIfTopMost:j=!1}=t,{interactive:q=!0}=t;function ct(gt){B=gt,n(0,B)}function _t(gt){En.call(this,e,gt)}function lt(gt){En.call(this,e,gt)}function ht(gt){En.call(this,e,gt)}function pt(gt){En.call(this,e,gt)}function Tt(gt){En.call(this,e,gt)}function Q(gt){En.call(this,e,gt)}return e.$$set=gt=>{"id"in gt&&n(1,a=gt.id),"source"in gt&&n(2,h=gt.source),"sourceLayer"in gt&&n(3,u=gt.sourceLayer),"beforeId"in gt&&n(4,y=gt.beforeId),"beforeLayerType"in gt&&n(5,w=gt.beforeLayerType),"paint"in gt&&n(6,S=gt.paint),"layout"in gt&&n(7,I=gt.layout),"filter"in gt&&n(8,P=gt.filter),"applyToClusters"in gt&&n(9,z=gt.applyToClusters),"minzoom"in gt&&n(10,R=gt.minzoom),"maxzoom"in gt&&n(11,Y=gt.maxzoom),"hoverCursor"in gt&&n(12,Z=gt.hoverCursor),"manageHoverState"in gt&&n(13,et=gt.manageHoverState),"hovered"in gt&&n(0,B=gt.hovered),"eventsIfTopMost"in gt&&n(14,j=gt.eventsIfTopMost),"interactive"in gt&&n(15,q=gt.interactive),"$$scope"in gt&&n(24,i=gt.$$scope)},[B,a,h,u,y,w,S,I,P,z,R,Y,Z,et,j,q,r,ct,_t,lt,ht,pt,Tt,Q,i]}class Kz extends an{constructor(t){super(),sn(this,t,Yz,Xz,Ze,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function Jz(e){let t;const n=e[15].default,r=xi(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&Si(r,n,i,i[23],t?wi(n,i[23],a,null):Ei(i[23]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function Qz(e){let t,n,r;function i(h){e[16](h)}let a={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[Jz]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new m1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function $z(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Yd("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:Y=void 0}=t,{manageHoverState:Z=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:j=!0}=t;function q(Q){et=Q,n(0,et)}function ct(Q){En.call(this,e,Q)}function _t(Q){En.call(this,e,Q)}function lt(Q){En.call(this,e,Q)}function ht(Q){En.call(this,e,Q)}function pt(Q){En.call(this,e,Q)}function Tt(Q){En.call(this,e,Q)}return e.$$set=Q=>{"id"in Q&&n(1,a=Q.id),"source"in Q&&n(2,h=Q.source),"sourceLayer"in Q&&n(3,u=Q.sourceLayer),"beforeId"in Q&&n(4,y=Q.beforeId),"beforeLayerType"in Q&&n(5,w=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,I=Q.layout),"filter"in Q&&n(8,P=Q.filter),"minzoom"in Q&&n(9,z=Q.minzoom),"maxzoom"in Q&&n(10,R=Q.maxzoom),"hoverCursor"in Q&&n(11,Y=Q.hoverCursor),"manageHoverState"in Q&&n(12,Z=Q.manageHoverState),"hovered"in Q&&n(0,et=Q.hovered),"eventsIfTopMost"in Q&&n(13,B=Q.eventsIfTopMost),"interactive"in Q&&n(14,j=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[et,a,h,u,y,w,S,I,P,z,R,Y,Z,B,j,r,q,ct,_t,lt,ht,pt,Tt,i]}class tF extends an{constructor(t){super(),sn(this,t,$z,Qz,Ze,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function eF(e,t,n,r,i){let a=!1;e.getSource(t)&&(a=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),i())};if(a){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function nF(e,t,n){VS().then(()=>{let r=NS(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function bS(e){let t=e[0],n,r,i=xS(e);return{c(){i.c(),n=di()},m(a,h){i.m(a,h),Vt(a,n,h),r=!0},p(a,h){h&1&&Ze(t,t=a[0])?(Fn(),At(i,1,1,Se),Bn(),i=xS(a),i.c(),It(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(It(i),r=!0)},o(a){At(i),r=!1},d(a){a&&Bt(n),i.d(a)}}}function xS(e){let t;const n=e[15].default,r=xi(n,e,e[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16384)&&Si(r,n,i,i[14],t?wi(n,i[14],a,null):Ei(i[14]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function rF(e){let t,n,r=e[0]&&bS(e);return{c(){r&&r.c(),t=di()},m(i,a){r&&r.m(i,a),Vt(i,t,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&It(r,1)):(r=bS(i),r.c(),It(r,1),r.m(t.parentNode,t)):r&&(Fn(),At(r,1,1,()=>{r=null}),Bn())},i(i){n||(It(r),n=!0)},o(i){At(r),n=!1},d(i){i&&Bt(t),r&&r.d(i)}}}function iF(e,t,n){let r,i,a,{$$slots:h={},$$scope:u}=t,{id:y=Yd("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:I=void 0}=t,{filter:P=void 0}=t,{lineMetrics:z=void 0}=t,{cluster:R=void 0}=t;const{map:Y,cluster:Z,self:et}=Uz();qe(e,Y,q=>n(13,i=q)),qe(e,Z,q=>n(16,a=q)),qe(e,et,q=>n(0,r=q));let B,j=!0;return as(()=>{r&&B&&i&&(nF(Y,r,B),Jn(et,r=null,r),n(11,B=void 0))}),e.$$set=q=>{"id"in q&&n(4,y=q.id),"data"in q&&n(5,w=q.data),"generateId"in q&&n(6,S=q.generateId),"promoteId"in q&&n(7,I=q.promoteId),"filter"in q&&n(8,P=q.filter),"lineMetrics"in q&&n(9,z=q.lineMetrics),"cluster"in q&&n(10,R=q.cluster),"$$scope"in q&&n(14,u=q.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Jn(Z,a=R,a),e.$$.dirty&12273&&i&&r!==y&&(Jn(et,r=y,r),eF(i,r,Oc({type:"geojson",data:w,filter:P,lineMetrics:z,generateId:S,promoteId:I,cluster:!!R,clusterMinPoints:R==null?void 0:R.minPoints,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius,clusterProperties:R==null?void 0:R.properties}),q=>i&&q===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,j=!0))})),e.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(y))})),e.$$.dirty&6176&&B&&(j?n(12,j=!1):B.setData(w)),e.$$.dirty&3072&&(B==null||B.setClusterOptions(Oc({cluster:!!R,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius})))},[r,Y,Z,et,y,w,S,I,P,z,R,B,j,i,u,h]}class oF extends an{constructor(t){super(),sn(this,t,iF,rF,Ze,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function sF(e){let t;const n=e[15].default,r=xi(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&Si(r,n,i,i[23],t?wi(n,i[23],a,null):Ei(i[23]),null)},i(i){t||(It(r,i),t=!0)},o(i){At(r,i),t=!1},d(i){r&&r.d(i)}}}function aF(e){let t,n,r;function i(h){e[16](h)}let a={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[sF]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new m1({props:a}),rr.push(()=>Yo(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){_e(t.$$.fragment)},m(h,u){de(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Xo(()=>n=!1)),t.$set(y)},i(h){r||(It(t.$$.fragment,h),r=!0)},o(h){At(t.$$.fragment,h),r=!1},d(h){me(t,h)}}}function lF(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Yd("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:Y=void 0}=t,{manageHoverState:Z=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:j=!0}=t;function q(Q){et=Q,n(0,et)}function ct(Q){En.call(this,e,Q)}function _t(Q){En.call(this,e,Q)}function lt(Q){En.call(this,e,Q)}function ht(Q){En.call(this,e,Q)}function pt(Q){En.call(this,e,Q)}function Tt(Q){En.call(this,e,Q)}return e.$$set=Q=>{"id"in Q&&n(1,a=Q.id),"source"in Q&&n(2,h=Q.source),"sourceLayer"in Q&&n(3,u=Q.sourceLayer),"beforeId"in Q&&n(4,y=Q.beforeId),"beforeLayerType"in Q&&n(5,w=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,I=Q.layout),"filter"in Q&&n(8,P=Q.filter),"minzoom"in Q&&n(9,z=Q.minzoom),"maxzoom"in Q&&n(10,R=Q.maxzoom),"hoverCursor"in Q&&n(11,Y=Q.hoverCursor),"manageHoverState"in Q&&n(12,Z=Q.manageHoverState),"hovered"in Q&&n(0,et=Q.hovered),"eventsIfTopMost"in Q&&n(13,B=Q.eventsIfTopMost),"interactive"in Q&&n(14,j=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[et,a,h,u,y,w,S,I,P,z,R,Y,Z,B,j,r,q,ct,_t,lt,ht,pt,Tt,i]}class uF extends an{constructor(t){super(),sn(this,t,lF,aF,Ze,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function cF(e){let t,n,r,i,a,h;return t=new tF({props:{id:"edit-polygon-fill",filter:Pz,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new uF({props:{id:"edit-polygon-lines",filter:Mz,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new Kz({props:{id:"edit-polygon-vertices",filter:Az,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){_e(t.$$.fragment),n=fe(),_e(r.$$.fragment),i=fe(),_e(a.$$.fragment)},m(u,y){de(t,u,y),Vt(u,n,y),de(r,u,y),Vt(u,i,y),de(a,u,y),h=!0},p:Se,i(u){h||(It(t.$$.fragment,u),It(r.$$.fragment,u),It(a.$$.fragment,u),h=!0)},o(u){At(t.$$.fragment,u),At(r.$$.fragment,u),At(a.$$.fragment,u),h=!1},d(u){u&&(Bt(n),Bt(i)),me(t,u),me(r,u),me(a,u)}}}function hF(e){let t,n;return t=new oF({props:{data:e[0],$$slots:{default:[cF]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&2&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function fF(e,t,n){let r;return qe(e,PC,i=>n(0,r=i)),[r]}class pF extends an{constructor(t){super(),sn(this,t,fF,hF,Ze,{})}}function dF(e){let t,n,r,i,a,h,u;return{c(){t=jt("button"),t.textContent="Import current view",n=fe(),r=jt("i"),r.textContent="or...",i=fe(),a=jt("button"),a.textContent="Draw an area to import on the map",Zt(t,"type","button"),Zt(a,"type","button")},m(y,w){Vt(y,t,w),Vt(y,n,w),Vt(y,r,w),Vt(y,i,w),Vt(y,a,w),h||(u=[We(t,"click",e[1]),We(a,"click",e[2])],h=!0)},p:Se,i:Se,o:Se,d(y){y&&(Bt(t),Bt(n),Bt(r),Bt(i),Bt(a)),h=!1,Ri(u)}}}function mF(e){let t,n;return t=new Fz({props:{polygonTool:e[0]}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&1&&(a.polygonTool=r[0]),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function gF(e){let t,n,r,i;const a=[mF,dF],h=[];function u(y,w){return y[0]?0:1}return t=u(e),n=h[t]=a[t](e),{c(){n.c(),r=di()},m(y,w){h[t].m(y,w),Vt(y,r,w),i=!0},p(y,[w]){let S=t;t=u(y),t===S?h[t].p(y,w):(Fn(),At(h[S],1,1,()=>{h[S]=null}),Bn(),n=h[t],n?n.p(y,w):(n=h[t]=a[t](y),n.c()),It(n,1),n.m(r.parentNode,r))},i(y){i||(It(n),i=!0)},o(y){At(n),i=!1},d(y){y&&Bt(r),h[t].d(y)}}}function $p(e){return[e.lng,e.lat]}function yF(e,t,n){let{map:r}=t;const i=Uu();let a=null;async function h(S){try{i("loading","Loading from Overpass");let P=await(await fetch(vF(S))).text();i("gotXml",P)}catch(I){i("error",I.toString())}}function u(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[$p(S.getSouthWest()),$p(S.getNorthWest()),$p(S.getNorthEast()),$p(S.getSouthEast()),$p(S.getSouthWest())]],type:"Polygon"}}}async function y(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await h(u())}}function w(){r&&(n(0,a=new Dz(r)),a.startNew(),a.addEventListenerSuccess(async S=>{n(0,a=null),await h(S)}),a.addEventListenerFailure(()=>{n(0,a=null)}))}return e.$$set=S=>{"map"in S&&n(3,r=S.map)},[a,y,w,r]}class _F extends an{constructor(t){super(),sn(this,t,yF,gF,Ze,{map:3})}}function vF(e){let t='poly:"';for(let[r,i]of e.geometry.coordinates[0])t+=`${i} ${r} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}function wS(e,t,n){const r=e.slice();return r[3]=t[n],r}function SS(e){let t,n,r=ti(e[0]),i=[];for(let a=0;a0&&SS(e);return{c(){n&&n.c(),t=di()},m(r,i){n&&n.m(r,i),Vt(r,t,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=SS(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:Se,o:Se,d(r){r&&Bt(t),n&&n.d(r)}}}function xF(e,t,n){let{loading:r}=t,i;function a(h){rr[h?"unshift":"push"](()=>{i=h,n(1,i),n(0,r)})}return e.$$set=h=>{"loading"in h&&n(0,r=h.loading)},e.$$.update=()=>{e.$$.dirty&3&&r.length>0&&i&&n(1,i.scrollTop=i.scrollHeight,i)},[r,i,a]}class wF extends an{constructor(t){super(),sn(this,t,xF,bF,Ze,{loading:0})}}function IS(e,t,n){const r=e.slice();return r[21]=t[n][0],r[22]=t[n][1],r}function CS(e,t,n){const r=e.slice();return r[25]=t[n][0],r[26]=t[n][1],r}function TS(e){let t,n=e[26]+"",r,i;return{c(){t=jt("option"),r=un(n),t.__value=i=e[25],Ea(t,t.__value)},m(a,h){Vt(a,t,h),Ot(t,r)},p(a,h){h&4&&n!==(n=a[26]+"")&&Nr(r,n),h&4&&i!==(i=a[25])&&(t.__value=i,Ea(t,t.__value))},d(a){a&&Bt(t)}}}function LS(e){let t,n,r=ti(e[22]),i=[];for(let a=0;ae[9].call(h)),Zt(R,"type","file"),Zt(pt,"type","file")},m(Ut,ee){de(t,Ut,ee),Vt(Ut,n,ee),Vt(Ut,r,ee),Ot(r,i),Ot(i,a),Ot(i,h),Ot(h,u);for(let Gt=0;Gtn(15,r=ht)),qe(e,Fc,ht=>n(16,i=ht)),qe(e,ky,ht=>n(5,a=ht));let h="",u=[],y=!1,w=[];Vu(async()=>{try{let ht=await fetch("/osm/areas.json");if(ht.ok)y=!0,console.log("Using local cache, not od2net.org"),n(2,w=await ht.json());else{let pt=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await pt.json())}}catch{}});let S;async function I(ht){try{await R(await S.files[0].arrayBuffer()),n(0,h="")}catch(pt){window.alert(`Couldn't open this file: ${pt}`)}n(1,u=[])}let P;async function z(ht){try{n(1,u=["Loading pre-built file"]);let pt=await P.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array(pt)),console.timeEnd("load"),Jn(lf,r=!0,r),n(0,h="")}catch(pt){window.alert(`Couldn't open this file: ${pt}`)}n(1,u=[])}async function R(ht){n(1,u=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(ht),pC(Y)),console.timeEnd("load"),Jn(lf,r=!0,r)}function Y(ht){n(1,u=[...u,ht])}async function Z(ht){try{await R(new TextEncoder().encode(ht.detail)),n(0,h="")}catch(pt){window.alert(`Couldn't import from Overpass: ${pt}`)}n(1,u=[])}async function et(ht){ht!=""&&(y?await B(`/osm/${ht}.pbf`):await B(`https://assets.od2net.org/severance_pbfs/${ht}.pbf`))}async function B(ht){try{n(1,u=[`Downloading ${ht}`]);let pt=await fetch(ht);await R(await pt.arrayBuffer())}catch(pt){window.alert(`Couldn't open from URL ${ht}: ${pt}`)}n(1,u=[])}function j(){h=zS(this),n(0,h),n(2,w)}function q(ht){rr[ht?"unshift":"push"](()=>{S=ht,n(3,S)})}const ct=ht=>n(1,u=[...u,ht.detail]),_t=ht=>window.alert(ht.detail);function lt(ht){rr[ht?"unshift":"push"](()=>{P=ht,n(4,P)})}return e.$$.update=()=>{e.$$.dirty&1&&et(h)},[h,u,w,S,P,a,I,z,Z,j,q,ct,_t,lt]}class IF extends an{constructor(t){super(),sn(this,t,EF,SF,Ze,{})}}function PS(e){let t,n;return t=new US({props:{$$slots:{default:[CF,({dialog:r})=>({7:r}),({dialog:r})=>r?128:0]},$$scope:{ctx:e}}}),t.$on("close",e[3]),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&384&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function CF(e){let t,n,r,i,a,h,u,y,w,S;function I(){return e[2](e[7])}return{c(){t=jt("h1"),t.textContent="15-minute neighborhood tool",n=fe(),r=jt("p"),r.textContent="TODO. Extremely early in development.",i=fe(),a=jt("p"),a.innerHTML=`This open source tool is created by Dustin Carlino and relies heavily on - OpenStreetMap data.`,h=fe(),u=jt("center"),y=jt("button"),y.textContent="Start!"},m(P,z){Vt(P,t,z),Vt(P,n,z),Vt(P,r,z),Vt(P,i,z),Vt(P,a,z),Vt(P,h,z),Vt(P,u,z),Ot(u,y),w||(S=Ye(y,"click",I),w=!0)},p(P,z){e=P},d(P){P&&(Bt(t),Bt(n),Bt(r),Bt(i),Bt(a),Bt(h),Bt(u)),w=!1,S()}}}function TF(e){let t;return{c(){t=jt("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){Vt(n,t,r)},i:Se,o:Se,d(n){n&&Bt(t)}}}function LF(e){let t,n;return t=new IF({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function PF(e){let t,n,r,i,a,h,u,y,w,S,I,P,z,R=e[0]&&PS(e);const Z=[LF,TF],X=[];function et(B,q){return B[1]?0:1}return w=et(e),S=X[w]=Z[w](e),{c(){t=jt("div"),R&&R.c(),n=fe(),r=jt("h2"),r.textContent="Choose your study area",i=fe(),a=jt("button"),a.textContent="About this tool",h=fe(),u=jt("hr"),y=fe(),S.c(),Zt(t,"slot","sidebar")},m(B,q){Vt(B,t,q),R&&R.m(t,null),Ot(t,n),Ot(t,r),Ot(t,i),Ot(t,a),Ot(t,h),Ot(t,u),Ot(t,y),X[w].m(t,null),I=!0,P||(z=Ye(a,"click",e[4]),P=!0)},p(B,q){B[0]?R?(R.p(B,q),q&1&&It(R,1)):(R=PS(B),R.c(),It(R,1),R.m(t,n)):R&&(Fn(),Mt(R,1,1,()=>{R=null}),Bn());let Y=w;w=et(B),w!==Y&&(Fn(),Mt(X[Y],1,1,()=>{X[Y]=null}),Bn(),S=X[w],S||(S=X[w]=Z[w](B),S.c()),It(S,1),S.m(t,null))},i(B){I||(It(R),It(S),I=!0)},o(B){Mt(R),Mt(S),I=!1},d(B){B&&Bt(t),R&&R.d(),X[w].d(),P=!1,z()}}}function MF(e){let t,n,r;return n=new pF({}),{c(){t=jt("div"),_e(n.$$.fragment),Zt(t,"slot","map")},m(i,a){Vt(i,t,a),de(n,t,null),r=!0},p:Se,i(i){r||(It(n.$$.fragment,i),r=!0)},o(i){Mt(n.$$.fragment,i),r=!1},d(i){i&&Bt(t),me(n)}}}function AF(e){let t,n;return t=new Zd({props:{$$slots:{map:[MF],sidebar:[PF]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&259&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function kF(e,t,n){let r,i,a,h;return qe(e,Fc,S=>n(5,r=S)),qe(e,lf,S=>n(6,i=S)),qe(e,m0,S=>n(0,a=S)),qe(e,ky,S=>n(1,h=S)),Vu(async()=>{Jn(lf,i=!1,i),await r.unset()}),[a,h,S=>Hl(S).close(),()=>Jn(m0,a=!1,a),()=>Jn(m0,a=!0,a)]}class DF extends an{constructor(t){super(),sn(this,t,kF,AF,He,{})}}function RF(){return new Worker("/15m/assets/worker-573e7145.js")}function MS(e){let t,n,r,i,a,h;return{c(){t=jt("hr"),n=fe(),r=jt("div"),i=jt("button"),i.textContent="Zoom to fit"},m(u,y){Vt(u,t,y),Vt(u,n,y),Vt(u,r,y),Ot(r,i),a||(h=Ye(i,"click",e[6]),a=!0)},p:Se,d(u){u&&(Bt(t),Bt(n),Bt(r)),a=!1,h()}}}function NF(e){let t,n,r,i,a,h=e[4].kind!="title"&&MS(e);return{c(){t=jt("div"),n=jt("h1"),n.textContent="15-minute neighbourhood tool",r=fe(),i=jt("div"),a=fe(),h&&h.c(),Zt(t,"slot","left")},m(u,y){Vt(u,t,y),Ot(t,n),Ot(t,r),Ot(t,i),e[11](i),Ot(t,a),h&&h.m(t,null)},p(u,y){u[4].kind!="title"?h?h.p(u,y):(h=MS(u),h.c(),h.m(t,null)):h&&(h.d(1),h=null)},d(u){u&&Bt(t),e[11](null),h&&h.d()}}}function AS(e){let t,n;return t=new DF({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function kS(e){let t,n,r,i,a,h,u={ctx:e,current:null,token:null,hasCatch:!1,pending:BF,then:zF,catch:OF,value:13,blocks:[,,,]};Hb(t=Hl(e[5]).getInvertedBoundary(),u);const y=[qF,GF,UF,VF],w=[];function S(I,P){return I[4].kind=="debug"?0:I[4].kind=="isochrone"?1:I[4].kind=="route"?2:I[4].kind=="debug-route"?3:-1}return~(r=S(e))&&(i=w[r]=y[r](e)),{c(){u.block.c(),n=fe(),i&&i.c(),a=di()},m(I,P){u.block.m(I,u.anchor=P),u.mount=()=>n.parentNode,u.anchor=n,Vt(I,n,P),~r&&w[r].m(I,P),Vt(I,a,P),h=!0},p(I,P){e=I,u.ctx=e,P&32&&t!==(t=Hl(e[5]).getInvertedBoundary())&&Hb(t,u)||OL(u,e,P);let z=r;r=S(e),r===z?~r&&w[r].p(e,P):(i&&(Fn(),Mt(w[z],1,1,()=>{w[z]=null}),Bn()),~r?(i=w[r],i?i.p(e,P):(i=w[r]=y[r](e),i.c()),It(i,1),i.m(a.parentNode,a)):i=null)},i(I){h||(It(u.block),It(i),h=!0)},o(I){for(let P=0;P<3;P+=1){const z=u.blocks[P];Mt(z)}Mt(i),h=!1},d(I){I&&(Bt(n),Bt(a)),u.block.d(I),u.token=null,u=null,~r&&w[r].d(I)}}}function OF(e){return{c:Se,m:Se,p:Se,i:Se,o:Se,d:Se}}function zF(e){let t,n;return t=new zc({props:{data:e[13],$$slots:{default:[FF]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[13]),i&16384&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function FF(e){let t,n;return t=new rC({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function BF(e){return{c:Se,m:Se,p:Se,i:Se,o:Se,d:Se}}function VF(e){let t,n;return t=new j5({props:{debugGj:e[4].debugGj,start:e[4].start,end:e[4].end,routeGj:e[4].routeGj}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&16&&(a.debugGj=r[4].debugGj),i&16&&(a.start=r[4].start),i&16&&(a.end=r[4].end),i&16&&(a.routeGj=r[4].routeGj),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function UF(e){let t,n;return t=new N5({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function GF(e){let t,n;return t=new x5({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function qF(e){let t,n;return t=new h5({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function jF(e){let t,n,r,i,a,h,u;t=new JR({props:{map:e[0],apiKey:gC}});let y=e[4].kind=="title"&&AS(),w=e[3]&&kS(e);return{c(){_e(t.$$.fragment),n=fe(),r=jt("div"),i=fe(),y&&y.c(),a=fe(),w&&w.c(),h=di()},m(S,I){de(t,S,I),Vt(S,n,I),Vt(S,r,I),e[9](r),Vt(S,i,I),y&&y.m(S,I),Vt(S,a,I),w&&w.m(S,I),Vt(S,h,I),u=!0},p(S,I){const P={};I&1&&(P.map=S[0]),t.$set(P),S[4].kind=="title"?y?I&16&&It(y,1):(y=AS(),y.c(),It(y,1),y.m(a.parentNode,a)):y&&(Fn(),Mt(y,1,1,()=>{y=null}),Bn()),S[3]?w?(w.p(S,I),I&8&&It(w,1)):(w=kS(S),w.c(),It(w,1),w.m(h.parentNode,h)):w&&(Fn(),Mt(w,1,1,()=>{w=null}),Bn())},i(S){u||(It(t.$$.fragment,S),It(y),It(w),u=!0)},o(S){Mt(t.$$.fragment,S),Mt(y),Mt(w),u=!1},d(S){S&&(Bt(n),Bt(r),Bt(i),Bt(a),Bt(h)),me(t,S),e[9](null),y&&y.d(S),w&&w.d(S)}}}function WF(e){let t,n,r,i;function a(u){e[10](u)}let h={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${gC}`,standardControls:!0,hash:!0,$$slots:{default:[jF]},$$scope:{ctx:e}};return e[0]!==void 0&&(h.map=e[0]),n=new cO({props:h}),rr.push(()=>Yo(n,"map",a)),{c(){t=jt("div"),_e(n.$$.fragment),Zt(t,"slot","main"),Ui(t,"position","relative"),Ui(t,"width","100%"),Ui(t,"height","100vh")},m(u,y){Vt(u,t,y),de(n,t,null),i=!0},p(u,y){const w={};y&16445&&(w.$$scope={dirty:y,ctx:u}),!r&&y&1&&(r=!0,w.map=u[0],Xo(()=>r=!1)),n.$set(w)},i(u){i||(It(n.$$.fragment,u),i=!0)},o(u){Mt(n.$$.fragment,u),i=!1},d(u){u&&Bt(t),me(n)}}}function HF(e){let t,n;return t=new vO({props:{$$slots:{main:[WF],left:[NF]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&16447&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){Mt(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function ZF(e,t,n){let r,i,a,h,u;qe(e,iv,X=>n(7,r=X)),qe(e,rv,X=>n(8,i=X)),qe(e,lf,X=>n(3,a=X)),qe(e,Vo,X=>n(4,h=X)),qe(e,Fc,X=>n(5,u=X)),Vu(async()=>{const X=cC(new RF);let et=await new X;Fc.set(et)});let y;async function w(){y&&a&&y.fitBounds(await u.getBounds(),{animate:!1})}async function S(X){X&&(console.log("New map model loaded"),await w(),Jn(Vo,h={kind:"isochrone"},h))}let I,P;function z(X){rr[X?"unshift":"push"](()=>{P=X,n(2,P),n(7,r)})}function R(X){y=X,n(0,y)}function Z(X){rr[X?"unshift":"push"](()=>{I=X,n(1,I),n(8,i)})}return e.$$.update=()=>{e.$$.dirty&1&&y&&ky.set(y),e.$$.dirty&8&&S(a),e.$$.dirty&258&&I&&i&&(n(1,I.innerHTML="",I),I.appendChild(i)),e.$$.dirty&132&&P&&r&&(n(2,P.innerHTML="",P),P.appendChild(r))},[y,I,P,a,h,u,w,r,i,z,R,Z]}class XF extends an{constructor(t){super(),sn(this,t,ZF,HF,He,{})}}new XF({target:document.getElementById("app")}); + OpenStreetMap data.`,h=fe(),u=jt("center"),y=jt("button"),y.textContent="Start!"},m(P,z){Vt(P,t,z),Vt(P,n,z),Vt(P,r,z),Vt(P,i,z),Vt(P,a,z),Vt(P,h,z),Vt(P,u,z),Ot(u,y),w||(S=We(y,"click",I),w=!0)},p(P,z){e=P},d(P){P&&(Bt(t),Bt(n),Bt(r),Bt(i),Bt(a),Bt(h),Bt(u)),w=!1,S()}}}function TF(e){let t;return{c(){t=jt("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){Vt(n,t,r)},i:Se,o:Se,d(n){n&&Bt(t)}}}function LF(e){let t,n;return t=new IF({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function PF(e){let t,n,r,i,a,h,u,y,w,S,I,P,z,R=e[0]&&PS(e);const Y=[LF,TF],Z=[];function et(B,j){return B[1]?0:1}return w=et(e),S=Z[w]=Y[w](e),{c(){t=jt("div"),R&&R.c(),n=fe(),r=jt("h2"),r.textContent="Choose your study area",i=fe(),a=jt("button"),a.textContent="About this tool",h=fe(),u=jt("hr"),y=fe(),S.c(),Zt(t,"slot","sidebar")},m(B,j){Vt(B,t,j),R&&R.m(t,null),Ot(t,n),Ot(t,r),Ot(t,i),Ot(t,a),Ot(t,h),Ot(t,u),Ot(t,y),Z[w].m(t,null),I=!0,P||(z=We(a,"click",e[4]),P=!0)},p(B,j){B[0]?R?(R.p(B,j),j&1&&It(R,1)):(R=PS(B),R.c(),It(R,1),R.m(t,n)):R&&(Fn(),At(R,1,1,()=>{R=null}),Bn());let q=w;w=et(B),w!==q&&(Fn(),At(Z[q],1,1,()=>{Z[q]=null}),Bn(),S=Z[w],S||(S=Z[w]=Y[w](B),S.c()),It(S,1),S.m(t,null))},i(B){I||(It(R),It(S),I=!0)},o(B){At(R),At(S),I=!1},d(B){B&&Bt(t),R&&R.d(),Z[w].d(),P=!1,z()}}}function MF(e){let t,n,r;return n=new pF({}),{c(){t=jt("div"),_e(n.$$.fragment),Zt(t,"slot","map")},m(i,a){Vt(i,t,a),de(n,t,null),r=!0},p:Se,i(i){r||(It(n.$$.fragment,i),r=!0)},o(i){At(n.$$.fragment,i),r=!1},d(i){i&&Bt(t),me(n)}}}function AF(e){let t,n;return t=new Zd({props:{$$slots:{map:[MF],sidebar:[PF]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&259&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function kF(e,t,n){let r,i,a,h;return qe(e,Fc,S=>n(5,r=S)),qe(e,lf,S=>n(6,i=S)),qe(e,m0,S=>n(0,a=S)),qe(e,ky,S=>n(1,h=S)),Vu(async()=>{Jn(lf,i=!1,i),await r.unset()}),[a,h,S=>Hl(S).close(),()=>Jn(m0,a=!1,a),()=>Jn(m0,a=!0,a)]}class DF extends an{constructor(t){super(),sn(this,t,kF,AF,Ze,{})}}function RF(){return new Worker("/15m/assets/worker-65dff4a1.js")}function MS(e){let t,n,r,i,a,h;return{c(){t=jt("hr"),n=fe(),r=jt("div"),i=jt("button"),i.textContent="Zoom to fit"},m(u,y){Vt(u,t,y),Vt(u,n,y),Vt(u,r,y),Ot(r,i),a||(h=We(i,"click",e[6]),a=!0)},p:Se,d(u){u&&(Bt(t),Bt(n),Bt(r)),a=!1,h()}}}function NF(e){let t,n,r,i,a,h=e[4].kind!="title"&&MS(e);return{c(){t=jt("div"),n=jt("h1"),n.textContent="15-minute neighbourhood tool",r=fe(),i=jt("div"),a=fe(),h&&h.c(),Zt(t,"slot","left")},m(u,y){Vt(u,t,y),Ot(t,n),Ot(t,r),Ot(t,i),e[11](i),Ot(t,a),h&&h.m(t,null)},p(u,y){u[4].kind!="title"?h?h.p(u,y):(h=MS(u),h.c(),h.m(t,null)):h&&(h.d(1),h=null)},d(u){u&&Bt(t),e[11](null),h&&h.d()}}}function AS(e){let t,n;return t=new DF({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function kS(e){let t,n,r,i,a,h,u={ctx:e,current:null,token:null,hasCatch:!1,pending:BF,then:zF,catch:OF,value:13,blocks:[,,,]};Hb(t=Hl(e[5]).getInvertedBoundary(),u);const y=[qF,GF,UF,VF],w=[];function S(I,P){return I[4].kind=="debug"?0:I[4].kind=="isochrone"?1:I[4].kind=="route"?2:I[4].kind=="debug-route"?3:-1}return~(r=S(e))&&(i=w[r]=y[r](e)),{c(){u.block.c(),n=fe(),i&&i.c(),a=di()},m(I,P){u.block.m(I,u.anchor=P),u.mount=()=>n.parentNode,u.anchor=n,Vt(I,n,P),~r&&w[r].m(I,P),Vt(I,a,P),h=!0},p(I,P){e=I,u.ctx=e,P&32&&t!==(t=Hl(e[5]).getInvertedBoundary())&&Hb(t,u)||OL(u,e,P);let z=r;r=S(e),r===z?~r&&w[r].p(e,P):(i&&(Fn(),At(w[z],1,1,()=>{w[z]=null}),Bn()),~r?(i=w[r],i?i.p(e,P):(i=w[r]=y[r](e),i.c()),It(i,1),i.m(a.parentNode,a)):i=null)},i(I){h||(It(u.block),It(i),h=!0)},o(I){for(let P=0;P<3;P+=1){const z=u.blocks[P];At(z)}At(i),h=!1},d(I){I&&(Bt(n),Bt(a)),u.block.d(I),u.token=null,u=null,~r&&w[r].d(I)}}}function OF(e){return{c:Se,m:Se,p:Se,i:Se,o:Se,d:Se}}function zF(e){let t,n;return t=new zc({props:{data:e[13],$$slots:{default:[FF]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[13]),i&16384&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function FF(e){let t,n;return t=new rC({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function BF(e){return{c:Se,m:Se,p:Se,i:Se,o:Se,d:Se}}function VF(e){let t,n;return t=new j5({props:{debugGj:e[4].debugGj,start:e[4].start,end:e[4].end,routeGj:e[4].routeGj}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,i){const a={};i&16&&(a.debugGj=r[4].debugGj),i&16&&(a.start=r[4].start),i&16&&(a.end=r[4].end),i&16&&(a.routeGj=r[4].routeGj),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function UF(e){let t,n;return t=new N5({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function GF(e){let t,n;return t=new x5({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function qF(e){let t,n;return t=new h5({}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p:Se,i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function jF(e){let t,n,r,i,a,h,u;t=new JR({props:{map:e[0],apiKey:gC}});let y=e[4].kind=="title"&&AS(),w=e[3]&&kS(e);return{c(){_e(t.$$.fragment),n=fe(),r=jt("div"),i=fe(),y&&y.c(),a=fe(),w&&w.c(),h=di()},m(S,I){de(t,S,I),Vt(S,n,I),Vt(S,r,I),e[9](r),Vt(S,i,I),y&&y.m(S,I),Vt(S,a,I),w&&w.m(S,I),Vt(S,h,I),u=!0},p(S,I){const P={};I&1&&(P.map=S[0]),t.$set(P),S[4].kind=="title"?y?I&16&&It(y,1):(y=AS(),y.c(),It(y,1),y.m(a.parentNode,a)):y&&(Fn(),At(y,1,1,()=>{y=null}),Bn()),S[3]?w?(w.p(S,I),I&8&&It(w,1)):(w=kS(S),w.c(),It(w,1),w.m(h.parentNode,h)):w&&(Fn(),At(w,1,1,()=>{w=null}),Bn())},i(S){u||(It(t.$$.fragment,S),It(y),It(w),u=!0)},o(S){At(t.$$.fragment,S),At(y),At(w),u=!1},d(S){S&&(Bt(n),Bt(r),Bt(i),Bt(a),Bt(h)),me(t,S),e[9](null),y&&y.d(S),w&&w.d(S)}}}function WF(e){let t,n,r,i;function a(u){e[10](u)}let h={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${gC}`,standardControls:!0,hash:!0,$$slots:{default:[jF]},$$scope:{ctx:e}};return e[0]!==void 0&&(h.map=e[0]),n=new cO({props:h}),rr.push(()=>Yo(n,"map",a)),{c(){t=jt("div"),_e(n.$$.fragment),Zt(t,"slot","main"),Ui(t,"position","relative"),Ui(t,"width","100%"),Ui(t,"height","100vh")},m(u,y){Vt(u,t,y),de(n,t,null),i=!0},p(u,y){const w={};y&16445&&(w.$$scope={dirty:y,ctx:u}),!r&&y&1&&(r=!0,w.map=u[0],Xo(()=>r=!1)),n.$set(w)},i(u){i||(It(n.$$.fragment,u),i=!0)},o(u){At(n.$$.fragment,u),i=!1},d(u){u&&Bt(t),me(n)}}}function HF(e){let t,n;return t=new vO({props:{$$slots:{main:[WF],left:[NF]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(r,i){de(t,r,i),n=!0},p(r,[i]){const a={};i&16447&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(It(t.$$.fragment,r),n=!0)},o(r){At(t.$$.fragment,r),n=!1},d(r){me(t,r)}}}function ZF(e,t,n){let r,i,a,h,u;qe(e,iv,Z=>n(7,r=Z)),qe(e,rv,Z=>n(8,i=Z)),qe(e,lf,Z=>n(3,a=Z)),qe(e,Vo,Z=>n(4,h=Z)),qe(e,Fc,Z=>n(5,u=Z)),Vu(async()=>{const Z=cC(new RF);let et=await new Z;Fc.set(et)});let y;async function w(){y&&a&&y.fitBounds(await u.getBounds(),{animate:!1})}async function S(Z){Z&&(console.log("New map model loaded"),await w(),Jn(Vo,h={kind:"isochrone"},h))}let I,P;function z(Z){rr[Z?"unshift":"push"](()=>{P=Z,n(2,P),n(7,r)})}function R(Z){y=Z,n(0,y)}function Y(Z){rr[Z?"unshift":"push"](()=>{I=Z,n(1,I),n(8,i)})}return e.$$.update=()=>{e.$$.dirty&1&&y&&ky.set(y),e.$$.dirty&8&&S(a),e.$$.dirty&258&&I&&i&&(n(1,I.innerHTML="",I),I.appendChild(i)),e.$$.dirty&132&&P&&r&&(n(2,P.innerHTML="",P),P.appendChild(r))},[y,I,P,a,h,u,w,r,i,z,R,Y]}class XF extends an{constructor(t){super(),sn(this,t,ZF,HF,Ze,{})}}new XF({target:document.getElementById("app")}); diff --git a/assets/worker-573e7145.js b/assets/worker-65dff4a1.js similarity index 98% rename from assets/worker-573e7145.js rename to assets/worker-65dff4a1.js index a9e73d2..9927b55 100644 --- a/assets/worker-573e7145.js +++ b/assets/worker-65dff4a1.js @@ -3,4 +3,4 @@ var ke=Object.defineProperty;var Ae=(p,w,E)=>w in p?ke(p,w,{enumerable:!0,config * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */const p=Symbol("Comlink.proxy"),w=Symbol("Comlink.endpoint"),E=Symbol("Comlink.releaseProxy"),z=Symbol("Comlink.finalizer"),j=Symbol("Comlink.thrown"),J=e=>typeof e=="object"&&e!==null||typeof e=="function",te={canHandle:e=>J(e)&&e[p],serialize(e){const{port1:n,port2:t}=new MessageChannel;return D(e,n),[t,[t]]},deserialize(e){return e.start(),se(e)}},re={canHandle:e=>J(e)&&j in e,serialize({value:e}){let n;return e instanceof Error?n={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:n={isError:!1,value:e},[n,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},G=new Map([["proxy",te],["throw",re]]);function oe(e,n){for(const t of e)if(n===t||t==="*"||t instanceof RegExp&&t.test(n))return!0;return!1}function D(e,n=globalThis,t=["*"]){n.addEventListener("message",function r(o){if(!o||!o.data)return;if(!oe(t,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}const{id:f,type:i,path:a}=Object.assign({path:[]},o.data),_=(o.data.argumentList||[]).map(k);let c;try{const d=a.slice(0,-1).reduce((b,F)=>b[F],e),m=a.reduce((b,F)=>b[F],e);switch(i){case"GET":c=m;break;case"SET":d[a.slice(-1)[0]]=k(o.data.value),c=!0;break;case"APPLY":c=m.apply(d,_);break;case"CONSTRUCT":{const b=new m(..._);c=fe(b)}break;case"ENDPOINT":{const{port1:b,port2:F}=new MessageChannel;D(e,F),c=ue(b,[b])}break;case"RELEASE":c=void 0;break;default:return}}catch(d){c={value:d,[j]:0}}Promise.resolve(c).catch(d=>({value:d,[j]:0})).then(d=>{const[m,b]=I(d);n.postMessage(Object.assign(Object.assign({},m),{id:f}),b),i==="RELEASE"&&(n.removeEventListener("message",r),Y(n),z in e&&typeof e[z]=="function"&&e[z]())}).catch(d=>{const[m,b]=I({value:new TypeError("Unserializable return value"),[j]:0});n.postMessage(Object.assign(Object.assign({},m),{id:f}),b)})}),n.start&&n.start()}function ie(e){return e.constructor.name==="MessagePort"}function Y(e){ie(e)&&e.close()}function se(e,n){return U(e,[],n)}function P(e){if(e)throw new Error("Proxy has been released and is not useable")}function X(e){return S(e,{type:"RELEASE"}).then(()=>{Y(e)})}const B=new WeakMap,C="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const n=(B.get(e)||0)-1;B.set(e,n),n===0&&X(e)});function ae(e,n){const t=(B.get(n)||0)+1;B.set(n,t),C&&C.register(e,n,e)}function ce(e){C&&C.unregister(e)}function U(e,n=[],t=function(){}){let r=!1;const o=new Proxy(t,{get(f,i){if(P(r),i===E)return()=>{ce(o),X(e),r=!0};if(i==="then"){if(n.length===0)return{then:()=>o};const a=S(e,{type:"GET",path:n.map(_=>_.toString())}).then(k);return a.then.bind(a)}return U(e,[...n,i])},set(f,i,a){P(r);const[_,c]=I(a);return S(e,{type:"SET",path:[...n,i].map(d=>d.toString()),value:_},c).then(k)},apply(f,i,a){P(r);const _=n[n.length-1];if(_===w)return S(e,{type:"ENDPOINT"}).then(k);if(_==="bind")return U(e,n.slice(0,-1));const[c,d]=K(a);return S(e,{type:"APPLY",path:n.map(m=>m.toString()),argumentList:c},d).then(k)},construct(f,i){P(r);const[a,_]=K(i);return S(e,{type:"CONSTRUCT",path:n.map(c=>c.toString()),argumentList:a},_).then(k)}});return ae(o,e),o}function _e(e){return Array.prototype.concat.apply([],e)}function K(e){const n=e.map(I);return[n.map(t=>t[0]),_e(n.map(t=>t[1]))]}const Q=new WeakMap;function ue(e,n){return Q.set(e,n),e}function fe(e){return Object.assign(e,{[p]:!0})}function I(e){for(const[n,t]of G)if(t.canHandle(e)){const[r,o]=t.serialize(e);return[{type:"HANDLER",name:n,value:r},o]}return[{type:"RAW",value:e},Q.get(e)||[]]}function k(e){switch(e.type){case"HANDLER":return G.get(e.name).deserialize(e.value);case"RAW":return e.value}}function S(e,n,t){return new Promise(r=>{const o=le();e.addEventListener("message",function f(i){!i.data||!i.data.id||i.data.id!==o||(e.removeEventListener("message",f),r(i.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:o},n),t)})}function le(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let s;const y=new Array(128).fill(void 0);y.push(void 0,null,!0,!1);function u(e){return y[e]}let M=y.length;function de(e){e<132||(y[e]=M,M=e)}function x(e){const n=u(e);return de(e),n}const Z=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Z.decode();let O=null;function v(){return(O===null||O.byteLength===0)&&(O=new Uint8Array(s.memory.buffer)),O}function h(e,n){return e=e>>>0,Z.decode(v().subarray(e,e+n))}function g(e){M===y.length&&y.push(y.length+1);const n=M;return M=y[n],y[n]=e,n}let A=0;const N=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},ge=typeof N.encodeInto=="function"?function(e,n){return N.encodeInto(e,n)}:function(e,n){const t=N.encode(e);return n.set(t),{read:e.length,written:t.length}};function H(e,n,t){if(t===void 0){const a=N.encode(e),_=n(a.length,1)>>>0;return v().subarray(_,_+a.length).set(a),A=a.length,_}let r=e.length,o=n(r,1)>>>0;const f=v();let i=0;for(;i127)break;f[o+i]=a}if(i!==r){i!==0&&(e=e.slice(i)),o=t(o,r,r=i+e.length*3,1)>>>0;const a=v().subarray(o+i,o+r),_=ge(e,a);i+=_.written,o=t(o,r,i,1)>>>0}return A=i,o}function W(e){return e==null}let R=null;function l(){return(R===null||R.byteLength===0)&&(R=new Int32Array(s.memory.buffer)),R}let L=null;function q(){return(L===null||L.byteLength===0)&&(L=new Float64Array(s.memory.buffer)),L}function V(e){const n=typeof e;if(n=="number"||n=="boolean"||e==null)return`${e}`;if(n=="string")return`"${e}"`;if(n=="symbol"){const o=e.description;return o==null?"Symbol":`Symbol(${o})`}if(n=="function"){const o=e.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(e)){const o=e.length;let f="[";o>0&&(f+=V(e[0]));for(let i=1;i1)r=t[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} -${e.stack}`:r}function be(e,n){const t=n(e.length*1,1)>>>0;return v().set(e,t/1),A=e.length,t}function we(e,n){return e=e>>>0,q().subarray(e/8,e/8+n)}function T(e,n){try{return e.apply(this,n)}catch(t){s.__wbindgen_exn_store(g(t))}}const ye=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>s.__wbg_mapmodel_free(e>>>0));class ee{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,ye.unregister(this),n}free(){const n=this.__destroy_into_raw();s.__wbg_mapmodel_free(n)}constructor(n,t,r){try{const a=s.__wbindgen_add_to_stack_pointer(-16),_=be(n,s.__wbindgen_malloc),c=A;s.mapmodel_new(a,_,c,t,W(r)?0:g(r));var o=l()[a/4+0],f=l()[a/4+1],i=l()[a/4+2];if(i)throw x(f);return this.__wbg_ptr=o>>>0,this}finally{s.__wbindgen_add_to_stack_pointer(16)}}renderDebug(){let n,t;try{const c=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_renderDebug(c,this.__wbg_ptr);var r=l()[c/4+0],o=l()[c/4+1],f=l()[c/4+2],i=l()[c/4+3],a=r,_=o;if(i)throw a=0,_=0,x(f);return n=a,t=_,h(a,_)}finally{s.__wbindgen_add_to_stack_pointer(16),s.__wbindgen_free(n,t,1)}}getInvertedBoundary(){let n,t;try{const c=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_getInvertedBoundary(c,this.__wbg_ptr);var r=l()[c/4+0],o=l()[c/4+1],f=l()[c/4+2],i=l()[c/4+3],a=r,_=o;if(i)throw a=0,_=0,x(f);return n=a,t=_,h(a,_)}finally{s.__wbindgen_add_to_stack_pointer(16),s.__wbindgen_free(n,t,1)}}getBounds(){try{const o=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_getBounds(o,this.__wbg_ptr);var n=l()[o/4+0],t=l()[o/4+1],r=we(n,t).slice();return s.__wbindgen_free(n,t*8,8),r}finally{s.__wbindgen_add_to_stack_pointer(16)}}isochrone(n){let t,r;try{const d=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_isochrone(d,this.__wbg_ptr,g(n));var o=l()[d/4+0],f=l()[d/4+1],i=l()[d/4+2],a=l()[d/4+3],_=o,c=f;if(a)throw _=0,c=0,x(i);return t=_,r=c,h(_,c)}finally{s.__wbindgen_add_to_stack_pointer(16),s.__wbindgen_free(t,r,1)}}route(n){let t,r;try{const d=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_route(d,this.__wbg_ptr,g(n));var o=l()[d/4+0],f=l()[d/4+1],i=l()[d/4+2],a=l()[d/4+3],_=o,c=f;if(a)throw _=0,c=0,x(i);return t=_,r=c,h(_,c)}finally{s.__wbindgen_add_to_stack_pointer(16),s.__wbindgen_free(t,r,1)}}}async function he(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(r){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{const t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}function me(){const e={};return e.wbg={},e.wbg.__wbindgen_object_drop_ref=function(n){x(n)},e.wbg.__wbindgen_string_new=function(n,t){const r=h(n,t);return g(r)},e.wbg.__wbindgen_boolean_get=function(n){const t=u(n);return typeof t=="boolean"?t?1:0:2},e.wbg.__wbindgen_string_get=function(n,t){const r=u(t),o=typeof r=="string"?r:void 0;var f=W(o)?0:H(o,s.__wbindgen_malloc,s.__wbindgen_realloc),i=A;l()[n/4+1]=i,l()[n/4+0]=f},e.wbg.__wbindgen_error_new=function(n,t){const r=new Error(h(n,t));return g(r)},e.wbg.__wbindgen_is_object=function(n){const t=u(n);return typeof t=="object"&&t!==null},e.wbg.__wbindgen_is_undefined=function(n){return u(n)===void 0},e.wbg.__wbindgen_in=function(n,t){return u(n)in u(t)},e.wbg.__wbindgen_number_get=function(n,t){const r=u(t),o=typeof r=="number"?r:void 0;q()[n/8+1]=W(o)?0:o,l()[n/4+0]=!W(o)},e.wbg.__wbindgen_jsval_loose_eq=function(n,t){return u(n)==u(t)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(n,t){const r=u(n)[u(t)];return g(r)},e.wbg.__wbindgen_object_clone_ref=function(n){const t=u(n);return g(t)},e.wbg.__wbg_debug_34c9290896ec9856=function(n){console.debug(u(n))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(n){console.error(u(n))},e.wbg.__wbg_info_d7d58472d0bab115=function(n){console.info(u(n))},e.wbg.__wbg_log_a4530b4fe289336f=function(n){console.log(u(n))},e.wbg.__wbg_warn_f260f49434e45e62=function(n){console.warn(u(n))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const n=new Error;return g(n)},e.wbg.__wbg_stack_658279fe44541cf6=function(n,t){const r=u(t).stack,o=H(r,s.__wbindgen_malloc,s.__wbindgen_realloc),f=A;l()[n/4+1]=f,l()[n/4+0]=o},e.wbg.__wbg_error_f851667af71bcfc6=function(n,t){let r,o;try{r=n,o=t,console.error(h(n,t))}finally{s.__wbindgen_free(r,o,1)}},e.wbg.__wbg_performance_a1b8bde2ee512264=function(n){const t=u(n).performance;return g(t)},e.wbg.__wbg_now_abd80e969af37148=function(n){return u(n).now()},e.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(n,t){const r=new Function(h(n,t));return g(r)},e.wbg.__wbg_call_27c0f87801dedf93=function(){return T(function(n,t){const r=u(n).call(u(t));return g(r)},arguments)},e.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return T(function(){const n=self.self;return g(n)},arguments)},e.wbg.__wbg_window_c6fb939a7f436783=function(){return T(function(){const n=window.window;return g(n)},arguments)},e.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return T(function(){const n=globalThis.globalThis;return g(n)},arguments)},e.wbg.__wbg_global_207b558942527489=function(){return T(function(){const n=global.global;return g(n)},arguments)},e.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(n){let t;try{t=u(n)instanceof ArrayBuffer}catch{t=!1}return t},e.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return T(function(n,t,r){const o=u(n).call(u(t),u(r));return g(o)},arguments)},e.wbg.__wbg_buffer_12d079cc21e14bdb=function(n){const t=u(n).buffer;return g(t)},e.wbg.__wbg_new_63b92bc8671ed464=function(n){const t=new Uint8Array(u(n));return g(t)},e.wbg.__wbg_set_a47bac70306a19a7=function(n,t,r){u(n).set(u(t),r>>>0)},e.wbg.__wbg_length_c20a40f15020d68a=function(n){return u(n).length},e.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(n){let t;try{t=u(n)instanceof Uint8Array}catch{t=!1}return t},e.wbg.__wbindgen_debug_string=function(n,t){const r=V(u(t)),o=H(r,s.__wbindgen_malloc,s.__wbindgen_realloc),f=A;l()[n/4+1]=f,l()[n/4+0]=o},e.wbg.__wbindgen_throw=function(n,t){throw new Error(h(n,t))},e.wbg.__wbindgen_memory=function(){const n=s.memory;return g(n)},e}function pe(e,n){return s=e.exports,$.__wbindgen_wasm_module=n,L=null,R=null,O=null,s}async function $(e){if(s!==void 0)return s;typeof e>"u"&&(e="/15m/assets/backend_bg.wasm");const n=me();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:t,module:r}=await he(await e,n);return pe(t,r)}class Ee{constructor(){ne(this,"inner");this.inner=null}async loadOsmFile(n,t){await $(),this.inner=new ee(n,!0,t)}async loadGraphFile(n){await $(),this.inner=new ee(n,!1,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}isochrone(n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:n.start.lng,y:n.start.lat,mode:n.mode,contours:n.contours}))}route(n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:n.start.lng,y1:n.start.lat,x2:n.end[0],y2:n.end[1],mode:n.mode,debug_search:n.debugSearch}))}}D(Ee)})(); +${e.stack}`:r}function be(e,n){const t=n(e.length*1,1)>>>0;return v().set(e,t/1),A=e.length,t}function we(e,n){return e=e>>>0,q().subarray(e/8,e/8+n)}function T(e,n){try{return e.apply(this,n)}catch(t){s.__wbindgen_exn_store(g(t))}}const ye=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>s.__wbg_mapmodel_free(e>>>0));class ee{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,ye.unregister(this),n}free(){const n=this.__destroy_into_raw();s.__wbg_mapmodel_free(n)}constructor(n,t,r){try{const a=s.__wbindgen_add_to_stack_pointer(-16),_=be(n,s.__wbindgen_malloc),c=A;s.mapmodel_new(a,_,c,t,W(r)?0:g(r));var o=l()[a/4+0],f=l()[a/4+1],i=l()[a/4+2];if(i)throw x(f);return this.__wbg_ptr=o>>>0,this}finally{s.__wbindgen_add_to_stack_pointer(16)}}renderDebug(){let n,t;try{const c=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_renderDebug(c,this.__wbg_ptr);var r=l()[c/4+0],o=l()[c/4+1],f=l()[c/4+2],i=l()[c/4+3],a=r,_=o;if(i)throw a=0,_=0,x(f);return n=a,t=_,h(a,_)}finally{s.__wbindgen_add_to_stack_pointer(16),s.__wbindgen_free(n,t,1)}}getInvertedBoundary(){let n,t;try{const c=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_getInvertedBoundary(c,this.__wbg_ptr);var r=l()[c/4+0],o=l()[c/4+1],f=l()[c/4+2],i=l()[c/4+3],a=r,_=o;if(i)throw a=0,_=0,x(f);return n=a,t=_,h(a,_)}finally{s.__wbindgen_add_to_stack_pointer(16),s.__wbindgen_free(n,t,1)}}getBounds(){try{const o=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_getBounds(o,this.__wbg_ptr);var n=l()[o/4+0],t=l()[o/4+1],r=we(n,t).slice();return s.__wbindgen_free(n,t*8,8),r}finally{s.__wbindgen_add_to_stack_pointer(16)}}isochrone(n){let t,r;try{const d=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_isochrone(d,this.__wbg_ptr,g(n));var o=l()[d/4+0],f=l()[d/4+1],i=l()[d/4+2],a=l()[d/4+3],_=o,c=f;if(a)throw _=0,c=0,x(i);return t=_,r=c,h(_,c)}finally{s.__wbindgen_add_to_stack_pointer(16),s.__wbindgen_free(t,r,1)}}route(n){let t,r;try{const d=s.__wbindgen_add_to_stack_pointer(-16);s.mapmodel_route(d,this.__wbg_ptr,g(n));var o=l()[d/4+0],f=l()[d/4+1],i=l()[d/4+2],a=l()[d/4+3],_=o,c=f;if(a)throw _=0,c=0,x(i);return t=_,r=c,h(_,c)}finally{s.__wbindgen_add_to_stack_pointer(16),s.__wbindgen_free(t,r,1)}}}async function he(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(r){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{const t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}function me(){const e={};return e.wbg={},e.wbg.__wbindgen_object_drop_ref=function(n){x(n)},e.wbg.__wbindgen_boolean_get=function(n){const t=u(n);return typeof t=="boolean"?t?1:0:2},e.wbg.__wbindgen_string_new=function(n,t){const r=h(n,t);return g(r)},e.wbg.__wbindgen_string_get=function(n,t){const r=u(t),o=typeof r=="string"?r:void 0;var f=W(o)?0:H(o,s.__wbindgen_malloc,s.__wbindgen_realloc),i=A;l()[n/4+1]=i,l()[n/4+0]=f},e.wbg.__wbindgen_error_new=function(n,t){const r=new Error(h(n,t));return g(r)},e.wbg.__wbindgen_is_object=function(n){const t=u(n);return typeof t=="object"&&t!==null},e.wbg.__wbindgen_is_undefined=function(n){return u(n)===void 0},e.wbg.__wbindgen_in=function(n,t){return u(n)in u(t)},e.wbg.__wbindgen_number_get=function(n,t){const r=u(t),o=typeof r=="number"?r:void 0;q()[n/8+1]=W(o)?0:o,l()[n/4+0]=!W(o)},e.wbg.__wbindgen_jsval_loose_eq=function(n,t){return u(n)==u(t)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(n,t){const r=u(n)[u(t)];return g(r)},e.wbg.__wbindgen_object_clone_ref=function(n){const t=u(n);return g(t)},e.wbg.__wbg_debug_34c9290896ec9856=function(n){console.debug(u(n))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(n){console.error(u(n))},e.wbg.__wbg_info_d7d58472d0bab115=function(n){console.info(u(n))},e.wbg.__wbg_log_a4530b4fe289336f=function(n){console.log(u(n))},e.wbg.__wbg_warn_f260f49434e45e62=function(n){console.warn(u(n))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const n=new Error;return g(n)},e.wbg.__wbg_stack_658279fe44541cf6=function(n,t){const r=u(t).stack,o=H(r,s.__wbindgen_malloc,s.__wbindgen_realloc),f=A;l()[n/4+1]=f,l()[n/4+0]=o},e.wbg.__wbg_error_f851667af71bcfc6=function(n,t){let r,o;try{r=n,o=t,console.error(h(n,t))}finally{s.__wbindgen_free(r,o,1)}},e.wbg.__wbg_performance_a1b8bde2ee512264=function(n){const t=u(n).performance;return g(t)},e.wbg.__wbg_now_abd80e969af37148=function(n){return u(n).now()},e.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(n,t){const r=new Function(h(n,t));return g(r)},e.wbg.__wbg_call_27c0f87801dedf93=function(){return T(function(n,t){const r=u(n).call(u(t));return g(r)},arguments)},e.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return T(function(){const n=self.self;return g(n)},arguments)},e.wbg.__wbg_window_c6fb939a7f436783=function(){return T(function(){const n=window.window;return g(n)},arguments)},e.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return T(function(){const n=globalThis.globalThis;return g(n)},arguments)},e.wbg.__wbg_global_207b558942527489=function(){return T(function(){const n=global.global;return g(n)},arguments)},e.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(n){let t;try{t=u(n)instanceof ArrayBuffer}catch{t=!1}return t},e.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return T(function(n,t,r){const o=u(n).call(u(t),u(r));return g(o)},arguments)},e.wbg.__wbg_buffer_12d079cc21e14bdb=function(n){const t=u(n).buffer;return g(t)},e.wbg.__wbg_new_63b92bc8671ed464=function(n){const t=new Uint8Array(u(n));return g(t)},e.wbg.__wbg_set_a47bac70306a19a7=function(n,t,r){u(n).set(u(t),r>>>0)},e.wbg.__wbg_length_c20a40f15020d68a=function(n){return u(n).length},e.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(n){let t;try{t=u(n)instanceof Uint8Array}catch{t=!1}return t},e.wbg.__wbindgen_debug_string=function(n,t){const r=V(u(t)),o=H(r,s.__wbindgen_malloc,s.__wbindgen_realloc),f=A;l()[n/4+1]=f,l()[n/4+0]=o},e.wbg.__wbindgen_throw=function(n,t){throw new Error(h(n,t))},e.wbg.__wbindgen_memory=function(){const n=s.memory;return g(n)},e}function pe(e,n){return s=e.exports,$.__wbindgen_wasm_module=n,L=null,R=null,O=null,s}async function $(e){if(s!==void 0)return s;typeof e>"u"&&(e="/15m/assets/backend_bg.wasm");const n=me();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:t,module:r}=await he(await e,n);return pe(t,r)}class Ee{constructor(){ne(this,"inner");this.inner=null}async loadOsmFile(n,t){await $(),this.inner=new ee(n,!0,t)}async loadGraphFile(n){await $(),this.inner=new ee(n,!1,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}isochrone(n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:n.start.lng,y:n.start.lat,mode:n.mode,contours:n.contours}))}route(n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:n.start.lng,y1:n.start.lat,x2:n.end[0],y2:n.end[1],mode:n.mode,debug_search:n.debugSearch,use_heuristic:n.useHeuristic}))}}D(Ee)})(); diff --git a/index.html b/index.html index 2d0fbc0..4f2c107 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ 15-minute neighborhood tool - +