From c91d24cbf29a2e4e58f39229a4137d243a8a072e Mon Sep 17 00:00:00 2001 From: github-actions-bot Date: Thu, 30 Jan 2025 21:43:43 +0000 Subject: [PATCH] Updates --- assets/{index-JUz72BTa.js => index-C_QEXZ-_.js} | 2 +- assets/{index-Bp-XQTld.css => index-D18MOdYQ.css} | 0 assets/{maplibre-gl-BkmzOCP1.js => maplibre-gl-C6P4tEXy.js} | 2 +- index.html | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) rename assets/{index-JUz72BTa.js => index-C_QEXZ-_.js} (99%) rename assets/{index-Bp-XQTld.css => index-D18MOdYQ.css} (100%) rename assets/{maplibre-gl-BkmzOCP1.js => maplibre-gl-C6P4tEXy.js} (99%) diff --git a/assets/index-JUz72BTa.js b/assets/index-C_QEXZ-_.js similarity index 99% rename from assets/index-JUz72BTa.js rename to assets/index-C_QEXZ-_.js index 1cd9761..c8e3206 100644 --- a/assets/index-JUz72BTa.js +++ b/assets/index-C_QEXZ-_.js @@ -249,7 +249,7 @@ Error generating stack: `+s.message+` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[pS]=this[pS]={accessors:{}}).accessors,o=this.prototype;function s(i){const l=Ac(i);r[l]||(v8(o,i),r[l]=!0)}return Q.isArray(t)?t.forEach(s):s(t),this}}dr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Q.reduceDescriptors(dr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});Q.freezeMethods(dr);function Tg(e,t){const n=this||xd,r=t||n,o=dr.from(r.headers);let s=r.data;return Q.forEach(e,function(l){s=l.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function nR(e){return!!(e&&e.__CANCEL__)}function dc(e,t,n){Xe.call(this,e??"canceled",Xe.ERR_CANCELED,t,n),this.name="CanceledError"}Q.inherits(dc,Xe,{__CANCEL__:!0});function rR(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Xe("Request failed with status code "+n.status,[Xe.ERR_BAD_REQUEST,Xe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function y8(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function b8(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,s=0,i;return t=t!==void 0?t:1e3,function(a){const c=Date.now(),u=r[s];i||(i=c),n[o]=a,r[o]=c;let f=s,h=0;for(;f!==o;)h+=n[f++],f=f%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-i{n=u,o=null,s&&(clearTimeout(s),s=null),e.apply(null,c)};return[(...c)=>{const u=Date.now(),f=u-n;f>=r?i(c,u):(o=c,s||(s=setTimeout(()=>{s=null,i(o)},r-f)))},()=>o&&i(o)]}const Mp=(e,t,n=3)=>{let r=0;const o=b8(50,250);return w8(s=>{const i=s.loaded,l=s.lengthComputable?s.total:void 0,a=i-r,c=o(a),u=i<=l;r=i;const f={loaded:i,total:l,progress:l?i/l:void 0,bytes:a,rate:c||void 0,estimated:c&&l&&u?(l-i)/c:void 0,event:s,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},hS=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},mS=e=>(...t)=>Q.asap(()=>e(...t)),x8=Mo.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(s){let i=s;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(i){const l=Q.isString(i)?o(i):i;return l.protocol===r.protocol&&l.host===r.host}}():function(){return function(){return!0}}(),C8=Mo.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];Q.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),Q.isString(r)&&i.push("path="+r),Q.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function S8(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function k8(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function oR(e,t){return e&&!S8(t)?k8(e,t):t}const gS=e=>e instanceof dr?{...e}:e;function wl(e,t){t=t||{};const n={};function r(c,u,f){return Q.isPlainObject(c)&&Q.isPlainObject(u)?Q.merge.call({caseless:f},c,u):Q.isPlainObject(u)?Q.merge({},u):Q.isArray(u)?u.slice():u}function o(c,u,f){if(Q.isUndefined(u)){if(!Q.isUndefined(c))return r(void 0,c,f)}else return r(c,u,f)}function s(c,u){if(!Q.isUndefined(u))return r(void 0,u)}function i(c,u){if(Q.isUndefined(u)){if(!Q.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function l(c,u,f){if(f in t)return r(c,u);if(f in e)return r(void 0,c)}const a={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(c,u)=>o(gS(c),gS(u),!0)};return Q.forEach(Object.keys(Object.assign({},e,t)),function(u){const f=a[u]||o,h=f(e[u],t[u],u);Q.isUndefined(h)&&f!==l||(n[u]=h)}),n}const sR=e=>{const t=wl({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:l}=t;t.headers=i=dr.from(i),t.url=J2(oR(t.baseURL,t.url),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let a;if(Q.isFormData(n)){if(Mo.hasStandardBrowserEnv||Mo.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((a=i.getContentType())!==!1){const[c,...u]=a?a.split(";").map(f=>f.trim()).filter(Boolean):[];i.setContentType([c||"multipart/form-data",...u].join("; "))}}if(Mo.hasStandardBrowserEnv&&(r&&Q.isFunction(r)&&(r=r(t)),r||r!==!1&&x8(t.url))){const c=o&&s&&C8.read(s);c&&i.set(o,c)}return t},P8=typeof XMLHttpRequest<"u",M8=P8&&function(e){return new Promise(function(n,r){const o=sR(e);let s=o.data;const i=dr.from(o.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:c}=o,u,f,h,p,m;function g(){p&&p(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let x=new XMLHttpRequest;x.open(o.method.toUpperCase(),o.url,!0),x.timeout=o.timeout;function v(){if(!x)return;const C=dr.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),M={data:!l||l==="text"||l==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:C,config:e,request:x};rR(function(P){n(P),g()},function(P){r(P),g()},M),x=null}"onloadend"in x?x.onloadend=v:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(v)},x.onabort=function(){x&&(r(new Xe("Request aborted",Xe.ECONNABORTED,e,x)),x=null)},x.onerror=function(){r(new Xe("Network Error",Xe.ERR_NETWORK,e,x)),x=null},x.ontimeout=function(){let S=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const M=o.transitional||eR;o.timeoutErrorMessage&&(S=o.timeoutErrorMessage),r(new Xe(S,M.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,e,x)),x=null},s===void 0&&i.setContentType(null),"setRequestHeader"in x&&Q.forEach(i.toJSON(),function(S,M){x.setRequestHeader(M,S)}),Q.isUndefined(o.withCredentials)||(x.withCredentials=!!o.withCredentials),l&&l!=="json"&&(x.responseType=o.responseType),c&&([h,m]=Mp(c,!0),x.addEventListener("progress",h)),a&&x.upload&&([f,p]=Mp(a),x.upload.addEventListener("progress",f),x.upload.addEventListener("loadend",p)),(o.cancelToken||o.signal)&&(u=C=>{x&&(r(!C||C.type?new dc(null,e,x):C),x.abort(),x=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const b=y8(o.url);if(b&&Mo.protocols.indexOf(b)===-1){r(new Xe("Unsupported protocol "+b+":",Xe.ERR_BAD_REQUEST,e));return}x.send(s||null)})},I8=(e,t)=>{let n=new AbortController,r;const o=function(a){if(!r){r=!0,i();const c=a instanceof Error?a:this.reason;n.abort(c instanceof Xe?c:new dc(c instanceof Error?c.message:c))}};let s=t&&setTimeout(()=>{o(new Xe(`timeout ${t} of ms exceeded`,Xe.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(a=>{a&&(a.removeEventListener?a.removeEventListener("abort",o):a.unsubscribe(o))}),e=null)};e.forEach(a=>a&&a.addEventListener&&a.addEventListener("abort",o));const{signal:l}=n;return l.unsubscribe=i,[l,()=>{s&&clearTimeout(s),s=null}]},E8=function*(e,t){let n=e.byteLength;if(n{const s=R8(e,t,o);let i=0,l,a=c=>{l||(l=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:f}=await s.next();if(u){a(),c.close();return}let h=f.byteLength;if(n){let p=i+=h;n(p)}c.enqueue(new Uint8Array(f))}catch(u){throw a(u),u}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},um=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",iR=um&&typeof ReadableStream=="function",ay=um&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),lR=(e,...t)=>{try{return!!e(...t)}catch{return!1}},T8=iR&&lR(()=>{let e=!1;const t=new Request(Mo.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),yS=64*1024,cy=iR&&lR(()=>Q.isReadableStream(new Response("").body)),Ip={stream:cy&&(e=>e.body)};um&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ip[t]&&(Ip[t]=Q.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Xe(`Response type '${t}' is not supported`,Xe.ERR_NOT_SUPPORT,r)})})})(new Response);const _8=async e=>{if(e==null)return 0;if(Q.isBlob(e))return e.size;if(Q.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(Q.isArrayBufferView(e)||Q.isArrayBuffer(e))return e.byteLength;if(Q.isURLSearchParams(e)&&(e=e+""),Q.isString(e))return(await ay(e)).byteLength},O8=async(e,t)=>{const n=Q.toFiniteNumber(e.getContentLength());return n??_8(t)},$8=um&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:l,onUploadProgress:a,responseType:c,headers:u,withCredentials:f="same-origin",fetchOptions:h}=sR(e);c=c?(c+"").toLowerCase():"text";let[p,m]=o||s||i?I8([o,s],i):[],g,x;const v=()=>{!g&&setTimeout(()=>{p&&p.unsubscribe()}),g=!0};let b;try{if(a&&T8&&n!=="get"&&n!=="head"&&(b=await O8(u,r))!==0){let k=new Request(t,{method:"POST",body:r,duplex:"half"}),P;if(Q.isFormData(r)&&(P=k.headers.get("content-type"))&&u.setContentType(P),k.body){const[I,N]=hS(b,Mp(mS(a)));r=vS(k.body,yS,I,N,ay)}}Q.isString(f)||(f=f?"include":"omit"),x=new Request(t,{...h,signal:p,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:f});let C=await fetch(x);const S=cy&&(c==="stream"||c==="response");if(cy&&(l||S)){const k={};["status","statusText","headers"].forEach(O=>{k[O]=C[O]});const P=Q.toFiniteNumber(C.headers.get("content-length")),[I,N]=l&&hS(P,Mp(mS(l),!0))||[];C=new Response(vS(C.body,yS,I,()=>{N&&N(),S&&v()},ay),k)}c=c||"text";let M=await Ip[Q.findKey(Ip,c)||"text"](C,e);return!S&&v(),m&&m(),await new Promise((k,P)=>{rR(k,P,{data:M,headers:dr.from(C.headers),status:C.status,statusText:C.statusText,config:e,request:x})})}catch(C){throw v(),C&&C.name==="TypeError"&&/fetch/i.test(C.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,e,x),{cause:C.cause||C}):Xe.from(C,C&&C.code,e,x)}}),uy={http:q9,xhr:M8,fetch:$8};Q.forEach(uy,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const bS=e=>`- ${e}`,F8=e=>Q.isFunction(e)||e===null||e===!1,aR={getAdapter:e=>{e=Q.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s`adapter ${l} `+(a===!1?"is not supported by the environment":"is not available in the build"));let i=t?s.length>1?`since : `+s.map(bS).join(` `):" "+bS(s[0]):"as no adapter specified";throw new Xe("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:uy};function _g(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new dc(null,e)}function wS(e){return _g(e),e.headers=dr.from(e.headers),e.data=Tg.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),aR.getAdapter(e.adapter||xd.adapter)(e).then(function(r){return _g(e),r.data=Tg.call(e,e.transformResponse,r),r.headers=dr.from(r.headers),r},function(r){return nR(r)||(_g(e),r&&r.response&&(r.response.data=Tg.call(e,e.transformResponse,r.response),r.response.headers=dr.from(r.response.headers))),Promise.reject(r)})}const cR="1.7.4",B0={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{B0[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const xS={};B0.transitional=function(t,n,r){function o(s,i){return"[Axios v"+cR+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,l)=>{if(t===!1)throw new Xe(o(i," has been removed"+(n?" in "+n:"")),Xe.ERR_DEPRECATED);return n&&!xS[i]&&(xS[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,i,l):!0}};function D8(e,t,n){if(typeof e!="object")throw new Xe("options must be an object",Xe.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const l=e[s],a=l===void 0||i(l,s,e);if(a!==!0)throw new Xe("option "+s+" must be "+a,Xe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Xe("Unknown option "+s,Xe.ERR_BAD_OPTION)}}const dy={assertOptions:D8,validators:B0},Zs=dy.validators;class ll{constructor(t){this.defaults=t,this.interceptors={request:new fS,response:new fS}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=wl(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&dy.assertOptions(r,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),o!=null&&(Q.isFunction(o)?n.paramsSerializer={serialize:o}:dy.assertOptions(o,{encode:Zs.function,serialize:Zs.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&Q.merge(s.common,s[n.method]);s&&Q.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),n.headers=dr.concat(i,s);const l=[];let a=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(a=a&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,f=0,h;if(!a){const m=[wS.bind(this),void 0];for(m.unshift.apply(m,l),m.push.apply(m,c),h=m.length,u=Promise.resolve(n);f{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(l=>{r.subscribe(l),s=l}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,l){r.reason||(r.reason=new dc(s,i,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new H0(function(o){t=o}),cancel:t}}}function L8(e){return function(n){return e.apply(null,n)}}function N8(e){return Q.isObject(e)&&e.isAxiosError===!0}const fy={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(fy).forEach(([e,t])=>{fy[t]=e});function uR(e){const t=new ll(e),n=B2(ll.prototype.request,t);return Q.extend(n,ll.prototype,t,{allOwnKeys:!0}),Q.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return uR(wl(e,o))},n}const Tt=uR(xd);Tt.Axios=ll;Tt.CanceledError=dc;Tt.CancelToken=H0;Tt.isCancel=nR;Tt.VERSION=cR;Tt.toFormData=cm;Tt.AxiosError=Xe;Tt.Cancel=Tt.CanceledError;Tt.all=function(t){return Promise.all(t)};Tt.spread=L8;Tt.isAxiosError=N8;Tt.mergeConfig=wl;Tt.AxiosHeaders=dr;Tt.formToJSON=e=>tR(Q.isHTMLForm(e)?new FormData(e):e);Tt.getAdapter=aR.getAdapter;Tt.HttpStatusCode=fy;Tt.default=Tt;const A8="https://api.mobilelibraries.org/api",j8="https://api-geography.librarydata.uk/rest/postcodes/",z8="https://tiles.mobilelibraries.org/tiles/{z}/{x}/{y}.mvt",B8="https://api-geography.librarydata.uk/rest/libraryauthorities/{z}/{x}/{y}.mvt",Tr={api:A8,postcodeApi:j8,mobileTiles:z8,libraryAuthorityTiles:B8},H8=(e={})=>new Promise((t,n)=>{navigator.geolocation.getCurrentPosition(t,n,e)}),W8=async()=>{const t=await H8({enableHighAccuracy:!0,timeout:1e4,maximumAge:0});return[t.coords.longitude,t.coords.latitude]},V8=async(e,t)=>{const n=`https://api.postcodes.io/postcodes?lon=${e}&lat=${t}`;try{const r=await Tt.get(n);if(r.status===200){const o=r.data.result;if(o.length>0)return o[0].postcode}}catch{}},G8=async e=>{const t=await Tt.get(Tr.postcodeApi+e);return{location:[t.data.longitude,t.data.latitude],library_service_name:t.data.library_service_name,library_service:t.data.library_service}},U8=e=>/^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$/.test(e.trim()),Y8=e=>{new URLSearchParams(window.location.search).delete("service"),e.push(window.location.pathname)},K8=e=>{const t=d.useRef();return d.useEffect(()=>{t.current=e}),t.current},CS=({children:e})=>w.jsx(To,{position:"relative",display:"inline-flex",sx:{padding:t=>t.spacing(1),textAlign:"center",alignItems:"center",justifyContent:"center",verticalAlign:"middle",boxSizing:"border-box"},children:e}),dR=()=>{const[{searchType:e,searchPostcode:t,searchPosition:n},r]=As(),[{loadingPostcode:o,loadingLocation:s},i]=uo(),[l,a]=d.useState(t||""),c=K8({searchPostcode:t}),u=bE();d.useEffect(()=>{c&&t!==c.searchPostcode&&a(t)},[t,c]);const f=async()=>{if(!s){i({type:"ToggleLoadingLocation"});const g=n.length>0?n:await W8();r({type:"SetLocation",searchPosition:g});const x=await h(g);i({type:"SetLocationLoaded"}),i({type:"ToggleLoadingLocation"}),x&&x!==""&&m(x)}},h=async g=>{if(g.length>0){const x=await V8(...g);return a(x),x}},p=()=>{a(""),r({type:"ClearAll"}),Y8(u)},m=async(g=l)=>{if(!g||g===""){i({type:"ShowNotification",notificationMessage:"Please enter a postcode before searching",notificationSeverity:"warning"});return}if(i({type:"ToggleLoadingPostcode"}),i({type:"LoadingPostcode"}),U8(g)){const x=await G8(g.trim());x&&x.location&&x.location.length>0?(r({type:"SetPostcodeSearch",searchPostcode:g,searchPosition:x.location}),i({type:"FlyTo",mapFlyToPosition:x.location,mapZoom:14})):i({type:"ShowNotification",notificationMessage:"We couldn't find that postcode",notificationSeverity:"error"})}else i({type:"ShowNotification",notificationMessage:"We couldn't find that postcode",notificationSeverity:"error"});i({type:"ToggleLoadingPostcode"})};return w.jsxs(To,{sx:{position:"relative",backgroundColor:g=>Br(g.palette.primary.main,.05),marginLeft:0,paddingLeft:0,whitespace:"nowrap",display:"inline-flex",color:g=>g.palette.primary.main,borderRadius:2,border:g=>`2px solid ${Jr(g.palette.primary.main,.5)}`},children:[w.jsx(Ol,{placeholder:"Postcode",value:l,onChange:g=>a(g.target.value.toUpperCase()),onKeyDown:g=>{g.key==="Enter"&&m()},inputProps:{"aria-label":"search by postcode"},sx:{paddingLeft:g=>g.spacing(2),maxWidth:110,color:g=>g.palette.secondary.main,fontWeight:700}}),!o&&!s?w.jsx(Er,{title:"Search by postcode",children:w.jsx(or,{"aria-label":"Search",color:"inherit",onClick:()=>m(),size:"large",disabled:o||s,children:w.jsx(z2,{})})}):w.jsx(CS,{children:w.jsx(Uu,{color:"inherit",size:22})}),w.jsx(Er,{title:"Use your current location",children:w.jsx(w.Fragment,{children:!s&&!o?w.jsx(or,{"aria-label":"Search by current location",color:"inherit",onClick:()=>f(),size:"large",disabled:o||s,children:w.jsx(j2,{})}):w.jsx(CS,{children:w.jsx(Uu,{color:"inherit",size:22})})})}),e==="postcode"?w.jsx(Er,{title:"Clear search",children:w.jsx(or,{color:"inherit","aria-label":"Clear search",onClick:()=>p(),size:"large",disabled:o||s,children:w.jsx(A2,{})})}):null]})};var W0={},Z8=Zt;Object.defineProperty(W0,"__esModule",{value:!0});var fR=W0.default=void 0,q8=Z8(on()),SS=w;fR=W0.default=(0,q8.default)([(0,SS.jsx)("path",{d:"M12 11h2v2h-2v2h2v2h-2v2h8V9h-8zm4 0h2v2h-2zm0 4h2v2h-2z",opacity:".3"},"0"),(0,SS.jsx)("path",{d:"M16 15h2v2h-2zm0-4h2v2h-2zm6-4H12V3H2v18h20zM6 19H4v-2h2zm0-4H4v-2h2zm0-4H4V9h2zm0-4H4V5h2zm4 12H8v-2h2zm0-4H8v-2h2zm0-4H8V9h2zm0-4H8V5h2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8z"},"1")],"BusinessTwoTone");var V0={},X8=Zt;Object.defineProperty(V0,"__esModule",{value:!0});var pR=V0.default=void 0,Q8=X8(on()),lf=w;pR=V0.default=(0,Q8.default)([(0,lf.jsx)("path",{d:"m17.37 17 .29-.27c.13-.11.34-.36.34-.73v-4H6v4c0 .37.21.62.34.73l.29.27zM8.5 16c-.83 0-1.5-.67-1.5-1.5S7.67 13 8.5 13s1.5.67 1.5 1.5S9.33 16 8.5 16m5.5-1.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5M12 4c-3.69 0-5.11.46-5.66.99h11.31C17.11 4.46 15.69 4 12 4",opacity:".3"},"0"),(0,lf.jsx)("path",{d:"M17 21h1c.55 0 1-.45 1-1v-1.78c.61-.55 1-1.34 1-2.22V6c0-3.5-3.58-4-8-4s-8 .5-8 4v10c0 .88.39 1.67 1 2.22V20c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h8v1c0 .55.45 1 1 1M12 4c3.69 0 5.11.46 5.66.99H6.34C6.89 4.46 8.31 4 12 4M6 6.99h12V10H6zM8 17H6.63l-.29-.27C6.21 16.62 6 16.37 6 16v-4h12v4c0 .37-.21.62-.34.73l-.29.27z"},"1"),(0,lf.jsx)("circle",{cx:"8.5",cy:"14.5",r:"1.5"},"2"),(0,lf.jsx)("circle",{cx:"15.5",cy:"14.5",r:"1.5"},"3")],"DirectionsBusTwoTone");var G0={},J8=Zt;Object.defineProperty(G0,"__esModule",{value:!0});var hR=G0.default=void 0,e7=J8(on()),kS=w;hR=G0.default=(0,e7.default)([(0,kS.jsx)("path",{d:"m3.01 12 9 9L21 12l-9-9zM14 7.5l3.5 3.5-3.5 3.5V12h-4v3H8v-4c0-.55.45-1 1-1h5z",opacity:".3"},"0"),(0,kS.jsx)("path",{d:"M13.42 1.58c-.75-.75-2.07-.76-2.83 0l-9 9c-.78.78-.78 2.04 0 2.82l9 9c.39.39.9.58 1.41.58.51 0 1.02-.19 1.41-.58l8.99-8.99c.78-.76.79-2.03.02-2.82zm-1.41 19.41-9-9 9-9 9 9zM8 11v4h2v-3h4v2.5l3.5-3.5L14 7.5V10H9c-.55 0-1 .45-1 1"},"1")],"DirectionsTwoTone");const t7=()=>{const[{organisations:e,organisationLookup:t,mobiles:n,mobileLookup:r,routeLookup:o,routes:s}]=vd(),[{organisationFilter:i,mobileFilter:l,routeFilter:a},c]=As(),[u,f]=d.useState(null),[h,p]=d.useState(null),[m,g]=d.useState(null),x=R=>f(R),v=()=>f(null),b=R=>{c({type:"FilterByOrganisation",organisationId:R}),v()},C=()=>{c({type:"ClearAll"})},S=R=>p(R),M=()=>p(null),k=(R,E)=>{c({type:"FilterByMobile",organisationId:R,mobileId:E}),M()},P=()=>{c({type:"ClearMobileFilter"})},I=R=>g(R),N=()=>g(null),O=R=>{c({type:"FilterByRoute",routeId:R}),N()},$=()=>{c({type:"ClearRouteFilter"})},F=new Set(e.map(R=>R.country));return w.jsxs(w.Fragment,{children:[i.length===0?w.jsx(Er,{title:"Choose library authority",children:w.jsx(kr,{color:"primary",onClick:R=>x(R.currentTarget),startIcon:w.jsx(fR,{}),children:"Select service"})}):w.jsx(fu,{color:"primary",variant:"outlined",onDelete:C,label:t[i[0]].name,sx:{mr:1}}),i.length>0?l.length===0?w.jsx(Er,{title:"Choose mobile library",children:w.jsxs(kr,{color:"primary",onClick:R=>S(R.currentTarget),children:[w.jsx(pR,{}),"Select mobile"]})}):w.jsx(fu,{color:"primary",variant:"outlined",onDelete:P,label:r[l[0]].name,sx:{mr:1}}):null,l.length>0?a.length===0?w.jsx(Er,{title:"Choose route",children:w.jsxs(kr,{color:"primary",onClick:R=>I(R.currentTarget),children:[w.jsx(hR,{}),"Select route"]})}):w.jsx(fu,{color:"primary",variant:"outlined",onDelete:$,label:o[a[0]].name,sx:{mr:1}}):null,w.jsx(_f,{id:"menu-library-service",anchorEl:u,keepMounted:!0,open:!!u,onClose:()=>v(),children:Array.from(F).sort((R,E)=>R.localeCompare(E)).map((R,E)=>{const _=[w.jsx($i,{disableSticky:!0,children:R},"lst_"+E)],D=e.sort((A,T)=>A.name.localeCompare(T.name)).filter(A=>A.country===R).map(A=>w.jsx(ur,{onClick:()=>b(A.id),children:A.name},"mnu_itm_org_"+A.id));return _.concat(D)})}),w.jsx(_f,{id:"menu-mobile-library",anchorEl:h,keepMounted:!0,open:!!h,onClose:()=>M(),children:n.filter(R=>{let E=!0;return i.length>0&&i.indexOf(R.organisationId)===-1&&(E=!1),E}).sort((R,E)=>R.name.localeCompare(E.name)).map(R=>w.jsx(ur,{onClick:()=>k(R.organisationId,R.id),children:R.name},"mnu_itm_mob_"+R.id))}),w.jsx(_f,{id:"menu-route",anchorEl:m,keepMounted:!0,open:!!m,onClose:()=>N(),children:s.filter(R=>{let E=!0;return l.length>0&&l.indexOf(R.mobileId)===-1&&(E=!1),E}).sort((R,E)=>R.name.localeCompare(E.name)).map(R=>w.jsx(ur,{onClick:()=>O(R.id),children:R.name},"mnu_itm_route_"+R.id))})]})},mR=()=>w.jsxs(To,{sx:{textAlign:"center",marginTop:e=>e.spacing(2),width:"100%"},children:[w.jsx(Lt,{color:"secondary",component:"h2",variant:"h2",children:"Mobile libraries"}),w.jsx(Lt,{component:"p",variant:"h6",color:"secondary",children:"Find your nearest mobile library"}),w.jsx(To,{sx:{margin:e=>e.spacing(2)},children:w.jsx(dR,{settings:!0})}),w.jsx(t7,{})]});var U0={},n7=Zt;Object.defineProperty(U0,"__esModule",{value:!0});var gR=U0.default=void 0,r7=n7(on()),PS=w;gR=U0.default=(0,r7.default)([(0,PS.jsx)("path",{d:"M10 10h4v4h-4zm0 6h4v4h-4zM4 4h4v4H4zm0 6h4v4H4zm0 6h4v4H4zM16 4h4v4h-4zm0 6h4v4h-4zm0 6h4v4h-4zM10 4h4v4h-4z",opacity:".3"},"0"),(0,PS.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M8 20H4v-4h4zm0-6H4v-4h4zm0-6H4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4z"},"1")],"GridOnTwoTone");var Y0={},o7=Zt;Object.defineProperty(Y0,"__esModule",{value:!0});var vR=Y0.default=void 0,s7=o7(on()),i7=w;vR=Y0.default=(0,s7.default)((0,i7.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVertTwoTone");var K0={},l7=Zt;Object.defineProperty(K0,"__esModule",{value:!0});var yR=K0.default=void 0,a7=l7(on()),MS=w;yR=K0.default=(0,a7.default)([(0,MS.jsx)("path",{d:"M4 9h10.5v3.5H4zm0 5.5h10.5V18H4zM16.5 9H20v9h-3.5z",opacity:".3"},"0"),(0,MS.jsx)("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m-5.5 14H4v-3.5h10.5zm0-5.5H4V9h10.5zM20 18h-3.5V9H20z"},"1")],"WebTwoTone");const c7=e=>{const{mobile:t,organisation:n,location:r}=e,[{},o]=As(),[{},s]=uo(),i=(v,b)=>{o({type:"FilterByMobile",organisationId:v,mobileId:b})},l=v=>{o({type:"SetCurrentStop",currentStopId:v}),s({type:"SetStopDialog",stopDialogOpen:!0})},a=v=>{o({type:"SetCurrentMobileLibrary",mobileLibraryId:v}),s({type:"SetMobileLibraryDialog",mobileLibraryDialogOpen:!0})},c=v=>w.jsx(kr,{color:"secondary",onClick:()=>l(v.stopId),children:v.stopName}),u=v=>w.jsx(Lt,{children:v.message}),f=v=>{const b=c(v.args[0]);return w.jsx(w.Fragment,{children:w.jsxs(Lt,{children:[v.message,b,v.args[1]]})})},h=v=>{const b=c(v.args[0]);return w.jsx(w.Fragment,{children:w.jsxs(Lt,{children:[v.message,b," for "+v.args[1]]})})},p=v=>{const b=c(v.args[0]);return w.jsx(w.Fragment,{children:w.jsxs(Lt,{children:[v.message,b,v.args[1]]})})},m=v=>w.jsx(Lt,{children:v.message});let g=null;if(r){const v=r.getStatus();v&&v.type==="offRoad"&&(g=u(v)),v&&v.type==="preRoute"&&(g=f(v)),v&&v.type==="atStop"&&(g=h(v)),v&&v.type==="betweenStops"&&(g=p(v)),v&&v.type==="postRoute"&&(g=m(v))}const x=w.jsx("span",{children:"•"});return w.jsxs(CB,{elevation:0,sx:{border:"1px solid #ccc"},children:[w.jsx(bC,{children:w.jsxs(Lt,{gutterBottom:!0,children:[t.numberRoutes+" route"+(t.numberRoutes>1?"s":""),x,t.numberStops+" stop"+(t.numberStops>1?"s":"")]})}),w.jsxs(bC,{children:[w.jsx(Lt,{variant:"h6",component:"h2",children:(n?n.name+" ":"")+t.name}),g]}),w.jsxs(IB,{children:[w.jsx(Er,{title:"See more mobile details",children:w.jsx(or,{size:"small",onClick:()=>a(t.id),children:w.jsx(vR,{})})}),w.jsx(Sp,{}),w.jsx(Er,{title:"Mobile library stops",children:w.jsxs(kr,{component:rl,to:"/",size:"small",color:"primary",onClick:()=>i(n.id,t.id),children:[w.jsx(gR,{}),"View stops"]})}),t.timetable?w.jsxs(w.Fragment,{children:[w.jsx(Sp,{}),w.jsx(Er,{title:"Website timetable",children:w.jsx(or,{onClick:()=>(void 0).goToWebsite(),size:"large",children:w.jsx(yR,{})})})]}):null]})]})},u7=()=>{const[{organisationLookup:e,mobiles:t,mobileLookup:n,mobileLocationLookup:r,mobilesNearestLookup:o,routeLookup:s},i]=vd(),[{organisationFilter:l,mobileFilter:a,routeFilter:c,searchType:u,searchDistance:f,searchPostcode:h},p]=As(),[{loadingMobileLocations:m},g]=uo(),[x,v]=d.useState(0),b=$=>{v($)},C=t.filter($=>{let F=!0;return(u==="gps"||u==="postcode")&&(F=o[$.id]),l.length>0&&l.indexOf($.organisationId)===-1&&(F=!1),a.length>0&&a.indexOf($.id)===-1&&(F=!1),F}),S=C.filter($=>{if(r[$.id]){const F=r[$.id].getStatus();return F&&F.type!=="offRoad"&&F.type!=="postRoute"}return null}),M=l.length>0?e[l[0]].name:"",k=a.length>0?n[a[0]].name:"",P=c.length>0?s[c[0]].name:"";let I="Mobile libraries";M!==""&&(I="Mobile libraries serving "+M),k!==""&&(I=M+" "+k),P!==""&&(I=M+" "+P),h!==""&&(I="Mobile libraries with stops within "+Math.round(f/1609)+" mile(s) of "+h),u==="gps"&&(I="Mobile libraries with stops within "+Math.round(f/1609)+" mile(s) of your location");const O=(x===0?S:C).filter($=>{let F=!0;return l.length>0&&l.indexOf($.organisationId)===-1&&(F=!1),a.length>0&&a.indexOf($.id)===-1&&(F=!1),F}).filter($=>u==="gps"||u==="postcode"?o[$.id]:!0);return w.jsxs(w.Fragment,{children:[w.jsx(mR,{}),w.jsx($i,{component:"span",disableSticky:!0,children:I}),w.jsxs(EE,{variant:"standard",scrollButtons:!1,value:x,indicatorColor:"secondary",onChange:($,F)=>b(F),centered:!0,sx:{marginBottom:$=>$.spacing()},children:[w.jsx(au,{label:w.jsx(Cp,{color:"secondary",badgeContent:S.length,children:w.jsx(To,{sx:{minWidth:"50px"},children:"On the road"})})}),w.jsx(au,{label:w.jsx(Cp,{showZero:!0,color:"secondary",badgeContent:C.length,children:w.jsx(To,{sx:{minWidth:"50px"},children:"All"})})})]}),O.length>0?w.jsx(ha,{container:!0,spacing:3,children:O.map(($,F)=>w.jsx(ha,{item:!0,xs:12,sm:6,md:4,lg:3,xl:3,children:w.jsx(c7,{mobile:$,location:r[$.id],organisation:e[$.organisationId]})},"grd_"+$.name.replace(" ","")+"_"+F))}):m?null:w.jsx(Lt,{component:"p",variant:"body1",children:"No mobile libraries currently on the road."})]})};var Z0={},d7=Zt;Object.defineProperty(Z0,"__esModule",{value:!0});var bR=Z0.default=void 0,f7=d7(on()),IS=w;bR=Z0.default=(0,f7.default)([(0,IS.jsx)("path",{d:"M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8m5 11.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12z",opacity:".3"},"0"),(0,IS.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"},"1")],"CancelTwoTone");const p7=()=>{const[{mobileLookup:e}]=vd(),[{currentMobileLibraryId:t}]=As(),[{mobileLibraryDialogOpen:n},r]=uo(),[o,s]=d.useState({});d.useEffect(()=>{t!=null&&e&&s(e[t])},[t,e]);const i=()=>{r({type:"SetMobileLibraryDialog",mobileLibraryDialogOpen:!1})},l=On(),a=Wa(l.breakpoints.down("md"));return w.jsxs(em,{fullScreen:a,open:n,onClose:i,"aria-labelledby":"dlg-title",BackdropProps:{invisible:!0},PaperProps:{elevation:0},children:[o?w.jsxs(w.Fragment,{children:[w.jsx(rm,{id:"dlg-title",children:o.name}),w.jsxs(nm,{children:[w.jsx($i,{disableSticky:!0,children:"Actions"}),w.jsx("div",{})]})]}):w.jsx(Uu,{color:"primary",size:30}),w.jsx(tm,{children:w.jsx(kr,{onClick:()=>i(),color:"secondary",endIcon:w.jsx(bR,{}),children:"Close"})})]})},h7="modulepreload",m7=function(e){return"/"+e},ES={},g7=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=Promise.allSettled(n.map(a=>{if(a=m7(a),a in ES)return;ES[a]=!0;const c=a.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":h7,c||(f.as="script"),f.crossOrigin="",f.href=a,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${a}`)))})}))}function s(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return o.then(i=>{for(const l of i||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},v7=d.createContext(null);function y7(e,t){const n=Array.isArray(e)?e[0]:e?e.x:0,r=Array.isArray(e)?e[1]:e?e.y:0,o=Array.isArray(t)?t[0]:t?t.x:0,s=Array.isArray(t)?t[1]:t?t.y:0;return n===o&&r===s}function xr(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n{let o=null;"interactive"in r&&(o=Object.assign({},r),delete o.interactive);const s=t[r.ref];if(s){o=o||Object.assign({},r),delete o.ref;for(const i of w7)i in s&&(o[i]=s[i])}return o||r});return{...e,layers:n}}var $S={};const FS={version:8,sources:{},layers:[]},DS={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Og={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},LS={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},x7=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],C7=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Za{constructor(t,n,r){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=o=>{const s=this.props[LS[o.type]];s?s(o):o.type==="error"&&console.error(o.error)},this._onPointerEvent=o=>{(o.type==="mousemove"||o.type==="mouseout")&&this._updateHover(o);const s=this.props[DS[o.type]];s&&(this.props.interactiveLayerIds&&o.type!=="mouseover"&&o.type!=="mouseout"&&(o.features=this._hoveredFeatures||this._queryRenderedFeatures(o.point)),s(o),delete o.features)},this._onCameraEvent=o=>{if(!this._internalUpdate){const s=this.props[Og[o.type]];s&&s(o)}o.type in this._deferredEvents&&(this._deferredEvents[o.type]=!1)},this._MapClass=t,this.props=n,this._initialize(r)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){const n=this.props;this.props=t;const r=this._updateSettings(t,n);r&&this._createShadowTransform(this._map);const o=this._updateSize(t),s=this._updateViewState(t,!0);this._updateStyle(t,n),this._updateStyleComponents(t,n),this._updateHandlers(t,n),(r||o||s&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){const r=Za.savedMaps.pop();if(!r)return null;const o=r.map,s=o.getContainer();for(n.className=s.className;s.childNodes.length>0;)n.appendChild(s.childNodes[0]);o._container=n;const i=o._resizeObserver;i&&(i.disconnect(),i.observe(n)),r.setProps({...t,styleDiffing:!1}),o.resize();const{initialViewState:l}=t;return l&&(l.bounds?o.fitBounds(l.bounds,{...l.fitBoundsOptions,duration:0}):r._updateViewState(l,!1)),o.isStyleLoaded()?o.fire("load"):o.once("styledata",()=>o.fire("load")),o._update(),r}_initialize(t){const{props:n}=this,{mapStyle:r=FS}=n,o={...n,...n.initialViewState,accessToken:n.mapboxAccessToken||S7()||null,container:t,style:OS(r)},s=o.initialViewState||o.viewState||o;if(Object.assign(o,{center:[s.longitude||0,s.latitude||0],zoom:s.zoom||0,pitch:s.pitch||0,bearing:s.bearing||0}),n.gl){const u=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=u,n.gl)}const i=new this._MapClass(o);s.padding&&i.setPadding(s.padding),n.cursor&&(i.getCanvas().style.cursor=n.cursor),this._createShadowTransform(i);const l=i._render;i._render=u=>{this._inRender=!0,l.call(i,u),this._inRender=!1};const a=i._renderTaskQueue.run;i._renderTaskQueue.run=u=>{a.call(i._renderTaskQueue,u),this._onBeforeRepaint()},i.on("render",()=>this._onAfterRepaint());const c=i.fire;i.fire=this._fireEvent.bind(this,c),i.on("resize",()=>{this._renderTransform.resize(i.transform.width,i.transform.height)}),i.on("styledata",()=>{this._updateStyleComponents(this.props,{}),RS(i.transform,this._renderTransform)}),i.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const u in DS)i.on(u,this._onPointerEvent);for(const u in Og)i.on(u,this._onCameraEvent);for(const u in LS)i.on(u,this._onEvent);this._map=i}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n==null||n.remove(),Za.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){const n=b7(t.transform);t.painter.transform=n,this._renderTransform=n}_updateSize(t){const{viewState:n}=t;if(n){const r=this._map;if(n.width!==r.transform.width||n.height!==r.transform.height)return r.resize(),!0}return!1}_updateViewState(t,n){if(this._internalUpdate)return!1;const r=this._map,o=this._renderTransform,{zoom:s,pitch:i,bearing:l}=o,a=r.isMoving();a&&(o.cameraElevationReference="sea");const c=_S(o,{...TS(r.transform),...t});if(a&&(o.cameraElevationReference="ground"),c&&n){const u=this._deferredEvents;u.move=!0,u.zoom||(u.zoom=s!==o.zoom),u.rotate||(u.rotate=l!==o.bearing),u.pitch||(u.pitch=i!==o.pitch)}return a||_S(r.transform,t),c}_updateSettings(t,n){const r=this._map;let o=!1;for(const s of x7)if(s in t&&!xr(t[s],n[s])){o=!0;const i=r[`set${s[0].toUpperCase()}${s.slice(1)}`];i==null||i.call(r,t[s])}return o}_updateStyle(t,n){if(t.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==n.mapStyle){const{mapStyle:r=FS,styleDiffing:o=!0}=t,s={diff:o};return"localIdeographFontFamily"in t&&(s.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(OS(r),s),!0}return!1}_updateStyleComponents(t,n){const r=this._map;let o=!1;return r.isStyleLoaded()&&("light"in t&&r.setLight&&!xr(t.light,n.light)&&(o=!0,r.setLight(t.light)),"fog"in t&&r.setFog&&!xr(t.fog,n.fog)&&(o=!0,r.setFog(t.fog)),"terrain"in t&&r.setTerrain&&!xr(t.terrain,n.terrain)&&(!t.terrain||r.getSource(t.terrain.source))&&(o=!0,r.setTerrain(t.terrain))),o}_updateHandlers(t,n){var r,o;const s=this._map;let i=!1;for(const l of C7){const a=(r=t[l])!==null&&r!==void 0?r:!0,c=(o=n[l])!==null&&o!==void 0?o:!0;xr(a,c)||(i=!0,a?s[l].enable(a):s[l].disable())}return i}_queryRenderedFeatures(t){const n=this._map,r=n.transform,{interactiveLayerIds:o=[]}=this.props;try{return n.transform=this._renderTransform,n.queryRenderedFeatures(t,{layers:o.filter(n.getLayer.bind(n))})}catch{return[]}finally{n.transform=r}}_updateHover(t){var n;const{props:r}=this;if(r.interactiveLayerIds&&(r.onMouseMove||r.onMouseEnter||r.onMouseLeave)){const s=t.type,i=((n=this._hoveredFeatures)===null||n===void 0?void 0:n.length)>0,l=this._queryRenderedFeatures(t.point),a=l.length>0;!a&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=l,a&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=s}else this._hoveredFeatures=null}_fireEvent(t,n,r){const o=this._map,s=o.transform,i=typeof n=="string"?n:n.type;return i==="move"&&this._updateViewState(this.props,!1),i in Og&&(typeof n=="object"&&(n.viewState=TS(s)),this._map.isMoving())?(o.transform=this._renderTransform,t.call(o,n,r),o.transform=s,o):(t.call(o,n,r),o)}_onBeforeRepaint(){const t=this._map;this._internalUpdate=!0;for(const r in this._deferredEvents)this._deferredEvents[r]&&t.fire(r);this._internalUpdate=!1;const n=this._map.transform;t.transform=this._renderTransform,this._onAfterRepaint=()=>{RS(this._renderTransform,n),t.transform=n}}}Za.savedMaps=[];function S7(){let e=null;if(typeof location<"u"){const t=/access_token=([^&\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||$S.MapboxAccessToken}catch{}try{e=e||$S.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}const k7=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function P7(e){if(!e)return null;const t=e.map,n={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:r=>{const o=t.transform;t.transform=e.transform;const s=t.project(r);return t.transform=o,s},unproject:r=>{const o=t.transform;t.transform=e.transform;const s=t.unproject(r);return t.transform=o,s},queryTerrainElevation:(r,o)=>{const s=t.transform;t.transform=e.transform;const i=t.queryTerrainElevation(r,o);return t.transform=s,i},queryRenderedFeatures:(r,o)=>{const s=t.transform;t.transform=e.transform;const i=t.queryRenderedFeatures(r,o);return t.transform=s,i}};for(const r of M7(t))!(r in n)&&!k7.includes(r)&&(n[r]=t[r].bind(t));return n}function M7(e){const t=new Set;let n=e;for(;n;){for(const r of Object.getOwnPropertyNames(n))r[0]!=="_"&&typeof e[r]=="function"&&r!=="fire"&&r!=="setEventedParent"&&t.add(r);n=Object.getPrototypeOf(n)}return Array.from(t)}const I7=typeof document<"u"?d.useLayoutEffect:d.useEffect,E7=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function R7(e,t){for(const r of E7)r in t&&(e[r]=t[r]);const{RTLTextPlugin:n="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=t;n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"&&e.setRTLTextPlugin(n,r=>{r&&console.error(r)},!0)}const fc=d.createContext(null);function T7(e,t,n){const r=d.useContext(v7),[o,s]=d.useState(null),i=d.useRef(),{current:l}=d.useRef({mapLib:null,map:null});d.useEffect(()=>{const u=e.mapLib;let f=!0,h;return Promise.resolve(u||n).then(p=>{if(!f)return;if(!p)throw new Error("Invalid mapLib");const m="Map"in p?p:p.default;if(!m.Map)throw new Error("Invalid mapLib");if(R7(m,e),!m.supported||m.supported(e))e.reuseMaps&&(h=Za.reuse(e,i.current)),h||(h=new Za(m.Map,e,i.current)),l.map=P7(h),l.mapLib=m,s(h),r==null||r.onMapMount(l.map,e.id);else throw new Error("Map is not supported by this browser")}).catch(p=>{const{onError:m}=e;m?m({type:"error",target:null,originalEvent:null,error:p}):console.error(p)}),()=>{f=!1,h&&(r==null||r.onMapUnmount(e.id),e.reuseMaps?h.recycle():h.destroy())}},[]),I7(()=>{o&&o.setProps(e)}),d.useImperativeHandle(t,()=>l.map,[o]);const a=d.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),c={height:"100%"};return d.createElement("div",{id:e.id,ref:i,style:a},o&&d.createElement(fc.Provider,{value:l},d.createElement("div",{"mapboxgl-children":"",style:c},e.children)))}const _7=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function $l(e,t){if(!e||!t)return;const n=e.style;for(const r in t){const o=t[r];Number.isFinite(o)&&!_7.test(r)?n[r]=`${o}px`:n[r]=o}}function O7(e,t){const{map:n,mapLib:r}=d.useContext(fc),o=d.useRef({props:e});o.current.props=e;const s=d.useMemo(()=>{let g=!1;d.Children.forEach(e.children,b=>{b&&(g=!0)});const x={...e,element:g?document.createElement("div"):null},v=new r.Marker(x);return v.setLngLat([e.longitude,e.latitude]),v.getElement().addEventListener("click",b=>{var C,S;(S=(C=o.current.props).onClick)===null||S===void 0||S.call(C,{type:"click",target:v,originalEvent:b})}),v.on("dragstart",b=>{var C,S;const M=b;M.lngLat=s.getLngLat(),(S=(C=o.current.props).onDragStart)===null||S===void 0||S.call(C,M)}),v.on("drag",b=>{var C,S;const M=b;M.lngLat=s.getLngLat(),(S=(C=o.current.props).onDrag)===null||S===void 0||S.call(C,M)}),v.on("dragend",b=>{var C,S;const M=b;M.lngLat=s.getLngLat(),(S=(C=o.current.props).onDragEnd)===null||S===void 0||S.call(C,M)}),v},[]);d.useEffect(()=>(s.addTo(n.getMap()),()=>{s.remove()}),[]);const{longitude:i,latitude:l,offset:a,style:c,draggable:u=!1,popup:f=null,rotation:h=0,rotationAlignment:p="auto",pitchAlignment:m="auto"}=e;return d.useEffect(()=>{$l(s.getElement(),c)},[c]),d.useImperativeHandle(t,()=>s,[]),(s.getLngLat().lng!==i||s.getLngLat().lat!==l)&&s.setLngLat([i,l]),a&&!y7(s.getOffset(),a)&&s.setOffset(a),s.isDraggable()!==u&&s.setDraggable(u),s.getRotation()!==h&&s.setRotation(h),s.getRotationAlignment()!==p&&s.setRotationAlignment(p),s.getPitchAlignment()!==m&&s.setPitchAlignment(m),s.getPopup()!==f&&s.setPopup(f),Ml.createPortal(e.children,s.getElement())}const $7=d.memo(d.forwardRef(O7));function NS(e){return new Set(e?e.trim().split(/\s+/):[])}function F7(e,t){const{map:n,mapLib:r}=d.useContext(fc),o=d.useMemo(()=>document.createElement("div"),[]),s=d.useRef({props:e});s.current.props=e;const i=d.useMemo(()=>{const l={...e},a=new r.Popup(l);return a.setLngLat([e.longitude,e.latitude]),a.once("open",c=>{var u,f;(f=(u=s.current.props).onOpen)===null||f===void 0||f.call(u,c)}),a},[]);if(d.useEffect(()=>{const l=a=>{var c,u;(u=(c=s.current.props).onClose)===null||u===void 0||u.call(c,a)};return i.on("close",l),i.setDOMContent(o).addTo(n.getMap()),()=>{i.off("close",l),i.isOpen()&&i.remove()}},[]),d.useEffect(()=>{$l(i.getElement(),e.style)},[e.style]),d.useImperativeHandle(t,()=>i,[]),i.isOpen()&&((i.getLngLat().lng!==e.longitude||i.getLngLat().lat!==e.latitude)&&i.setLngLat([e.longitude,e.latitude]),e.offset&&!xr(i.options.offset,e.offset)&&i.setOffset(e.offset),(i.options.anchor!==e.anchor||i.options.maxWidth!==e.maxWidth)&&(i.options.anchor=e.anchor,i.setMaxWidth(e.maxWidth)),i.options.className!==e.className)){const l=NS(i.options.className),a=NS(e.className);for(const c of l)a.has(c)||i.removeClassName(c);for(const c of a)l.has(c)||i.addClassName(c);i.options.className=e.className}return Ml.createPortal(e.children,o)}d.memo(d.forwardRef(F7));function Cd(e,t,n,r){const o=d.useContext(fc),s=d.useMemo(()=>e(o),[]);return d.useEffect(()=>{const i=t,l=typeof t=="function"&&typeof n=="function"?t:null,a=typeof t=="function"?t:null,{map:c}=o;return c.hasControl(s)||(c.addControl(s,i==null?void 0:i.position),l&&l(o)),()=>{a&&a(o),c.hasControl(s)&&c.removeControl(s)}},[]),s}function D7(e){const t=Cd(({mapLib:n})=>new n.AttributionControl(e),{position:e.position});return d.useEffect(()=>{$l(t._container,e.style)},[e.style]),null}d.memo(D7);function L7(e){const t=Cd(({mapLib:n})=>new n.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return d.useEffect(()=>{$l(t._controlContainer,e.style)},[e.style]),null}d.memo(L7);function N7(e,t){const n=d.useRef({props:e}),r=Cd(({mapLib:o})=>{const s=new o.GeolocateControl(e),i=s._setupUI;return s._setupUI=l=>{s._container.hasChildNodes()||i(l)},s.on("geolocate",l=>{var a,c;(c=(a=n.current.props).onGeolocate)===null||c===void 0||c.call(a,l)}),s.on("error",l=>{var a,c;(c=(a=n.current.props).onError)===null||c===void 0||c.call(a,l)}),s.on("outofmaxbounds",l=>{var a,c;(c=(a=n.current.props).onOutOfMaxBounds)===null||c===void 0||c.call(a,l)}),s.on("trackuserlocationstart",l=>{var a,c;(c=(a=n.current.props).onTrackUserLocationStart)===null||c===void 0||c.call(a,l)}),s.on("trackuserlocationend",l=>{var a,c;(c=(a=n.current.props).onTrackUserLocationEnd)===null||c===void 0||c.call(a,l)}),s},{position:e.position});return n.current.props=e,d.useImperativeHandle(t,()=>r,[]),d.useEffect(()=>{$l(r._container,e.style)},[e.style]),null}d.memo(d.forwardRef(N7));function A7(e){const t=Cd(({mapLib:n})=>new n.NavigationControl(e),{position:e.position});return d.useEffect(()=>{$l(t._container,e.style)},[e.style]),null}const j7=d.memo(A7);function z7(e){const t=Cd(({mapLib:s})=>new s.ScaleControl(e),{position:e.position}),n=d.useRef(e),r=n.current;n.current=e;const{style:o}=e;return e.maxWidth!==void 0&&e.maxWidth!==r.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==r.unit&&t.setUnit(e.unit),d.useEffect(()=>{$l(t._container,o)},[o]),null}d.memo(z7);function Ep(e,t){if(!e)throw new Error(t)}function B7(e,t,n,r){if(Ep(n.id===r.id,"layer id changed"),Ep(n.type===r.type,"layer type changed"),n.type==="custom"||r.type==="custom")return;const{layout:o={},paint:s={},filter:i,minzoom:l,maxzoom:a,beforeId:c}=n;if(c!==r.beforeId&&e.moveLayer(t,c),o!==r.layout){const u=r.layout||{};for(const f in o)xr(o[f],u[f])||e.setLayoutProperty(t,f,o[f]);for(const f in u)o.hasOwnProperty(f)||e.setLayoutProperty(t,f,void 0)}if(s!==r.paint){const u=r.paint||{};for(const f in s)xr(s[f],u[f])||e.setPaintProperty(t,f,s[f]);for(const f in u)s.hasOwnProperty(f)||e.setPaintProperty(t,f,void 0)}xr(i,r.filter)||e.setFilter(t,i),(l!==r.minzoom||a!==r.maxzoom)&&e.setLayerZoomRange(t,l,a)}function H7(e,t,n){if(e.style&&e.style._loaded&&(!("source"in n)||e.getSource(n.source))){const r={...n,id:t};delete r.beforeId,e.addLayer(r,n.beforeId)}}let W7=0;function V7(e){const t=d.useContext(fc).map.getMap(),n=d.useRef(e),[,r]=d.useState(0),o=d.useMemo(()=>e.id||`jsx-layer-${W7++}`,[]);if(d.useEffect(()=>{if(t){const i=()=>r(l=>l+1);return t.on("styledata",i),i(),()=>{t.off("styledata",i),t.style&&t.style._loaded&&t.getLayer(o)&&t.removeLayer(o)}}},[t]),t&&t.style&&t.getLayer(o))try{B7(t,o,e,n.current)}catch(i){console.warn(i)}else H7(t,o,e);return n.current=e,null}let G7=0;function U7(e,t,n){if(e.style&&e.style._loaded){const r={...n};return delete r.id,delete r.children,e.addSource(t,r),e.getSource(t)}return null}function Y7(e,t,n){Ep(t.id===n.id,"source id changed"),Ep(t.type===n.type,"source type changed");let r="",o=0;for(const i in t)i!=="children"&&i!=="id"&&!xr(n[i],t[i])&&(r=i,o++);if(!o)return;const s=t.type;if(s==="geojson")e.setData(t.data);else if(s==="image")e.updateImage({url:t.url,coordinates:t.coordinates});else if("setCoordinates"in e&&o===1&&r==="coordinates")e.setCoordinates(t.coordinates);else if("setUrl"in e)switch(r){case"url":e.setUrl(t.url);break;case"tiles":e.setTiles(t.tiles);break}else console.warn(`Unable to update prop: ${r}`)}function K7(e){const t=d.useContext(fc).map.getMap(),n=d.useRef(e),[,r]=d.useState(0),o=d.useMemo(()=>e.id||`jsx-source-${G7++}`,[]);d.useEffect(()=>{if(t){const i=()=>setTimeout(()=>r(l=>l+1),0);return t.on("styledata",i),i(),()=>{var l;if(t.off("styledata",i),t.style&&t.style._loaded&&t.getSource(o)){const a=(l=t.getStyle())===null||l===void 0?void 0:l.layers;if(a)for(const c of a)c.source===o&&t.removeLayer(c.id);t.removeSource(o)}}}},[t]);let s=t&&t.style&&t.getSource(o);return s?Y7(s,e,n.current):s=U7(t,o,e),n.current=e,s&&d.Children.map(e.children,i=>i&&d.cloneElement(i,{source:o}))||null}const Z7=g7(()=>import("./maplibre-gl-BkmzOCP1.js").then(e=>e.m),[]),q7=d.forwardRef(function(t,n){return T7(t,n,Z7)}),AS=$7,X7=j7,Ai=V7,$g=K7;var q0={},Q7=Zt;Object.defineProperty(q0,"__esModule",{value:!0});var wR=q0.default=void 0,J7=Q7(on()),eY=w;wR=q0.default=(0,J7.default)((0,eY.jsx)("path",{d:"M12.6 18.06c-.36.28-.87.28-1.23 0l-6.15-4.78a.991.991 0 0 0-1.22 0c-.51.4-.51 1.17 0 1.57l6.76 5.26c.72.56 1.73.56 2.46 0l6.76-5.26c.51-.4.51-1.17 0-1.57l-.01-.01a.991.991 0 0 0-1.22 0zm.63-3.02 6.76-5.26c.51-.4.51-1.18 0-1.58l-6.76-5.26c-.72-.56-1.73-.56-2.46 0L4.01 8.21c-.51.4-.51 1.18 0 1.58l6.76 5.26c.72.56 1.74.56 2.46-.01"}),"LayersRounded");var X0={},tY=Zt;Object.defineProperty(X0,"__esModule",{value:!0});var xR=X0.default=void 0,nY=tY(on()),rY=w;xR=X0.default=(0,nY.default)((0,rY.jsx)("path",{d:"M10.25 13c0 .69-.56 1.25-1.25 1.25S7.75 13.69 7.75 13s.56-1.25 1.25-1.25 1.25.56 1.25 1.25M15 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25m7 .25c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10m-2 0c0-.78-.12-1.53-.33-2.24-.7.15-1.42.24-2.17.24-3.13 0-5.92-1.44-7.76-3.69C8.69 8.87 6.6 10.88 4 11.86c.01.04 0 .09 0 .14 0 4.41 3.59 8 8 8s8-3.59 8-8"}),"FaceRounded");const oY=()=>w.jsx(Er,{title:"Me",children:w.jsx(X3,{color:"primary",children:w.jsx(xR,{})})});var Q0={},sY=Zt;Object.defineProperty(Q0,"__esModule",{value:!0});var CR=Q0.default=void 0,iY=sY(on()),lY=w;CR=Q0.default=(0,iY.default)((0,lY.jsx)("path",{d:"M4 16c0 .88.39 1.67 1 2.22v1.28c0 .83.67 1.5 1.5 1.5S8 20.33 8 19.5V19h8v.5c0 .82.67 1.5 1.5 1.5.82 0 1.5-.67 1.5-1.5v-1.28c.61-.55 1-1.34 1-2.22V6c0-3.5-3.58-4-8-4s-8 .5-8 4zm3.5 1c-.83 0-1.5-.67-1.5-1.5S6.67 14 7.5 14s1.5.67 1.5 1.5S8.33 17 7.5 17m9 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m1.5-6H6V6h12z"}),"DirectionsBusRounded");function aY(e,t){let n;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(e))return n=e.substring(1).split(""),n.length===3&&(n=[n[0],n[0],n[1],n[1],n[2],n[2]]),n="0x"+n.join(""),"rgba("+[n>>16&255,n>>8&255,n&255].join(",")+", "+t+")";throw new Error("Bad Hex")}const cY=e=>{const[{mapZoom:t}]=uo(),{location:n,organisation:r}=e,o=n.getStatus(),s=t[0]<8?"small":t[0]<12?"medium":"large",i=t[0]<8?2:t[0]<12?3:4;return w.jsx(Er,{title:o?o.textFormat:"",children:w.jsx(t2,{size:s,color:"primary",style:{backgroundColor:aY(r.colour,.8),color:"white",border:i+"px solid #FFFFFF"},children:w.jsx(CR,{})})})};var J0={},uY=Zt;Object.defineProperty(J0,"__esModule",{value:!0});var dm=J0.default=void 0,dY=uY(on()),fY=w;dm=J0.default=(0,dY.default)((0,fY.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0a.9959.9959 0 0 1 0-1.41L10.59 12 7.7 9.11a.9959.9959 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41"}),"CancelRounded");function pY(){const[{mapSettings:e,mapSettingsDialogOpen:t},n]=uo(),r=()=>{n({type:"SetMapSettingsDialog",mapSettingsDialogOpen:!1})},o=()=>{n({type:"ToggleMapSetting",mapSetting:"authorityBoundary"})},s=On(),i=Wa(s.breakpoints.down("md"));return w.jsxs(em,{fullScreen:i,open:t,onClose:r,slotProps:{backdrop:{invisible:!0}},PaperProps:{elevation:0},children:[w.jsx(rm,{children:"Map settings"}),w.jsx(nm,{children:w.jsx(r2,{control:w.jsx(d2,{checked:e.authorityBoundary,onChange:o,name:"sw_authority_boundary",color:"primary"}),label:"Library authority boundaries"})}),w.jsx(tm,{children:w.jsx(kr,{onClick:r,color:"secondary",endIcon:w.jsx(dm,{}),children:"Close"})})]})}const hY=Tr.libraryAuthorityTiles,mY=Tr.mobileTiles,gY=()=>{const[{mobileLocations:e,mobileLookup:t,organisationLookup:n}]=vd(),[{searchType:r,searchPosition:o,currentService:s},i]=As(),[{mapZoom:l,mapPosition:a,mapSettings:c,mapSettingsDialogOpen:u,mapFlyToPosition:f,mapBounds:h,loadingLibraryOrMobileLibrary:p},m]=uo(),[g,x]=d.useState(null);d.useEffect(()=>{h&&g&&g.fitBounds(h,{padding:50})},[h,g]),d.useEffect(()=>{f&&g&&g.flyTo({center:f,zoom:15})},[f,g]);const v=M=>{m({type:"SetMapPosition",mapZoom:M.zoom,mapPosition:[M.longitude,M.latitude]})},b=async M=>{const k=M.properties.id;i({type:"SetCurrentStop",currentStopId:k}),m({type:"SetStopDialog",stopDialogOpen:!0})},C=M=>{const k=M.properties.id;i({type:"SetCurrentTrip",currentTripId:k}),m({type:"SetTripDialog",tripDialogOpen:!0})},S=async M=>{if(p)return;m({type:"ToggleLoadingLibraryOrMobileLibrary"});const k=g.queryRenderedFeatures(M.point);if(k&&k.length>0)for(const P of k){if(P.sourceLayer==="stops"){await b(P);break}if(P.sourceLayer==="trips"){C(P);break}}m({type:"ToggleLoadingLibraryOrMobileLibrary"})};return w.jsxs(w.Fragment,{children:[w.jsx(To,{sx:{position:"absolute",marginTop:M=>M.spacing(2)},children:w.jsx(dR,{})}),w.jsxs(q7,{ref:x,style:{width:"100vw",height:"100vh",position:"absolute",top:0,left:0},mapStyle:"https://api.maptiler.com/maps/dataviz/style.json?key=1OK05AJqNta7xYzrG2kA",longitude:a[0],latitude:a[1],zoom:l,maxZoom:18,onMove:M=>v(M.viewState),onClick:S,children:[e&&e.length>0?e.map(M=>{if(!M.geoX||!M.geoY)return null;let k=[M.geoX,M.geoY];if(M.routeSection&&M.routeSection.coordinates&&M.updated){const N=moment(Date.now()).diff(M.updated),O=Math.round(N/500),$=M.routeSection.coordinates;$.length>O&&O>0&&(k=$[O]),$.length<=O&&O>0&&(k=$[$.length-1])}const P=t[M.mobileId],I=P?n[P.organisationId]:null;return w.jsx(AS,{coordinates:k,anchor:"bottom",children:w.jsx(cY,{organisation:I,location:M,zoom:g?g.getZoom():0})},"mkr_"+M.id)}):null,s&&s.geojson&&w.jsx($g,{type:"geojson",data:JSON.parse(s.geojson),children:w.jsx(Ai,{type:"line",paint:{"line-opacity":.4,"line-width":2,"line-color":"#455a64"}})}),w.jsxs($g,{type:"vector",tiles:[hY],children:[c.authorityBoundary?w.jsx(Ai,{type:"line","source-layer":"library_authority_boundaries",minzoom:6,layout:{"line-join":"round","line-cap":"square"},paint:{"line-color":"#a7a39b","line-opacity":1,"line-width":["interpolate",["linear"],["zoom"],6,1,18,4]}}):null,c.authorityBoundary?w.jsx(Ai,{type:"fill","source-layer":"library_authority_boundaries",minzoom:6,paint:{"fill-color":"#ccc","fill-opacity":.1}}):null]}),w.jsxs($g,{type:"vector",tiles:[mY],maxzoom:14,children:[w.jsx(Ai,{type:"line","source-layer":"trips",minzoom:14,layout:{"line-join":"round","line-cap":"square"},paint:{"line-color":"#a7a39b","line-offset":["interpolate",["linear"],["zoom"],14,1,18,4],"line-opacity":1,"line-width":["interpolate",["linear"],["zoom"],14,1,18,4],"line-dasharray":[2,.5]}}),w.jsx(Ai,{type:"circle","source-layer":"stops",minzoom:5,layout:{},paint:{"circle-radius":["interpolate",["linear"],["zoom"],5,2,18,8],"circle-color":"#455a64","circle-stroke-width":["interpolate",["linear"],["zoom"],5,1,18,3],"circle-stroke-color":"#ffffff","circle-opacity":.5}}),w.jsx(Ai,{type:"symbol","source-layer":"stops",minzoom:13,layout:{"text-ignore-placement":!1,"text-field":["get","name"],"text-font":["Source Sans Pro Bold"],"text-line-height":1,"text-size":["interpolate",["linear"],["zoom"],13,12,18,18],"text-offset":["interpolate",["linear"],["zoom"],13,["literal",[0,1.5]],18,["literal",[0,2]]]},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"text-halo-blur":1,"text-color":"#6a6f73"}}),w.jsx(Ai,{type:"symbol","source-layer":"stops",minzoom:14,layout:{"text-ignore-placement":!1,"text-field":["to-string",["get","next_visiting"]],"text-font":["Source Sans Pro Bold"],"text-line-height":1,"text-size":["interpolate",["linear"],["zoom"],14,10,18,16],"text-offset":["interpolate",["linear"],["zoom"],13,["literal",[0,-1.5]],18,["literal",[0,-2]]]},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"text-halo-blur":1,"text-color":"#6a6f73"}})]}),o&&o.length>1?w.jsx(AS,{longitude:o[0],latitude:o[1],children:w.jsx(oY,{searchType:r})}):null,w.jsx(X7,{position:"bottom-left"})]}),w.jsx(Er,{title:"Map settings",children:w.jsx(t2,{color:"primary",sx:{position:"absolute",bottom:28,right:16,zIndex:1,color:"white"},onClick:()=>m({type:"SetMapSettingsDialog",mapSettingsDialogOpen:!0}),children:w.jsx(wR,{})})}),w.jsx(pY,{mapSettings:c,mapSettingsDialogOpen:u})]})};var e1={},vY=Zt;Object.defineProperty(e1,"__esModule",{value:!0});var SR=e1.default=void 0,yY=vY(on()),bY=w;SR=e1.default=(0,yY.default)((0,bY.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"CloseTwoTone");const wY=()=>{const[{notificationOpen:e,notificationMessage:t},n]=uo(),r=()=>{n({type:"SetNotification",notificationOpen:!1})};return w.jsx(bG,{anchorOrigin:{vertical:"bottom",horizontal:"left"},open:e,autoHideDuration:3e3,onClose:r,ContentProps:{"aria-describedby":"message-id"},message:w.jsx("span",{id:"message-id",children:t}),action:[w.jsx(or,{"aria-label":"close",onClick:r,color:"secondary",size:"large",children:w.jsx(SR,{})},"close")]})};var t1={},xY=Zt;Object.defineProperty(t1,"__esModule",{value:!0});var kR=t1.default=void 0,CY=xY(on()),SY=w;kR=t1.default=(0,CY.default)((0,SY.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined");const PR=d.createContext(void 0);function ot(){const e=d.useContext(PR);if(e===void 0)throw new Error(["MUI: Could not find the data grid context.","It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.","This can also happen if you are bundling multiple versions of the data grid."].join(` +`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=wl(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&dy.assertOptions(r,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),o!=null&&(Q.isFunction(o)?n.paramsSerializer={serialize:o}:dy.assertOptions(o,{encode:Zs.function,serialize:Zs.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&Q.merge(s.common,s[n.method]);s&&Q.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),n.headers=dr.concat(i,s);const l=[];let a=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(a=a&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,f=0,h;if(!a){const m=[wS.bind(this),void 0];for(m.unshift.apply(m,l),m.push.apply(m,c),h=m.length,u=Promise.resolve(n);f{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(l=>{r.subscribe(l),s=l}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,l){r.reason||(r.reason=new dc(s,i,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new H0(function(o){t=o}),cancel:t}}}function L8(e){return function(n){return e.apply(null,n)}}function N8(e){return Q.isObject(e)&&e.isAxiosError===!0}const fy={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(fy).forEach(([e,t])=>{fy[t]=e});function uR(e){const t=new ll(e),n=B2(ll.prototype.request,t);return Q.extend(n,ll.prototype,t,{allOwnKeys:!0}),Q.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return uR(wl(e,o))},n}const Tt=uR(xd);Tt.Axios=ll;Tt.CanceledError=dc;Tt.CancelToken=H0;Tt.isCancel=nR;Tt.VERSION=cR;Tt.toFormData=cm;Tt.AxiosError=Xe;Tt.Cancel=Tt.CanceledError;Tt.all=function(t){return Promise.all(t)};Tt.spread=L8;Tt.isAxiosError=N8;Tt.mergeConfig=wl;Tt.AxiosHeaders=dr;Tt.formToJSON=e=>tR(Q.isHTMLForm(e)?new FormData(e):e);Tt.getAdapter=aR.getAdapter;Tt.HttpStatusCode=fy;Tt.default=Tt;const A8="https://api.mobilelibraries.org/api",j8="https://api-geography.librarydata.uk/rest/postcodes/",z8="https://tiles.mobilelibraries.org/tiles/{z}/{x}/{y}.mvt",B8="https://api-geography.librarydata.uk/rest/libraryauthorities/{z}/{x}/{y}.mvt",Tr={api:A8,postcodeApi:j8,mobileTiles:z8,libraryAuthorityTiles:B8},H8=(e={})=>new Promise((t,n)=>{navigator.geolocation.getCurrentPosition(t,n,e)}),W8=async()=>{const t=await H8({enableHighAccuracy:!0,timeout:1e4,maximumAge:0});return[t.coords.longitude,t.coords.latitude]},V8=async(e,t)=>{const n=`https://api.postcodes.io/postcodes?lon=${e}&lat=${t}`;try{const r=await Tt.get(n);if(r.status===200){const o=r.data.result;if(o.length>0)return o[0].postcode}}catch{}},G8=async e=>{const t=await Tt.get(Tr.postcodeApi+e);return{location:[t.data.longitude,t.data.latitude],library_service_name:t.data.library_service_name,library_service:t.data.library_service}},U8=e=>/^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$/.test(e.trim()),Y8=e=>{new URLSearchParams(window.location.search).delete("service"),e.push(window.location.pathname)},K8=e=>{const t=d.useRef();return d.useEffect(()=>{t.current=e}),t.current},CS=({children:e})=>w.jsx(To,{position:"relative",display:"inline-flex",sx:{padding:t=>t.spacing(1),textAlign:"center",alignItems:"center",justifyContent:"center",verticalAlign:"middle",boxSizing:"border-box"},children:e}),dR=()=>{const[{searchType:e,searchPostcode:t,searchPosition:n},r]=As(),[{loadingPostcode:o,loadingLocation:s},i]=uo(),[l,a]=d.useState(t||""),c=K8({searchPostcode:t}),u=bE();d.useEffect(()=>{c&&t!==c.searchPostcode&&a(t)},[t,c]);const f=async()=>{if(!s){i({type:"ToggleLoadingLocation"});const g=n.length>0?n:await W8();r({type:"SetLocation",searchPosition:g});const x=await h(g);i({type:"SetLocationLoaded"}),i({type:"ToggleLoadingLocation"}),x&&x!==""&&m(x)}},h=async g=>{if(g.length>0){const x=await V8(...g);return a(x),x}},p=()=>{a(""),r({type:"ClearAll"}),Y8(u)},m=async(g=l)=>{if(!g||g===""){i({type:"ShowNotification",notificationMessage:"Please enter a postcode before searching",notificationSeverity:"warning"});return}if(i({type:"ToggleLoadingPostcode"}),i({type:"LoadingPostcode"}),U8(g)){const x=await G8(g.trim());x&&x.location&&x.location.length>0?(r({type:"SetPostcodeSearch",searchPostcode:g,searchPosition:x.location}),i({type:"FlyTo",mapFlyToPosition:x.location,mapZoom:14})):i({type:"ShowNotification",notificationMessage:"We couldn't find that postcode",notificationSeverity:"error"})}else i({type:"ShowNotification",notificationMessage:"We couldn't find that postcode",notificationSeverity:"error"});i({type:"ToggleLoadingPostcode"})};return w.jsxs(To,{sx:{position:"relative",backgroundColor:g=>Br(g.palette.primary.main,.05),marginLeft:0,paddingLeft:0,whitespace:"nowrap",display:"inline-flex",color:g=>g.palette.primary.main,borderRadius:2,border:g=>`2px solid ${Jr(g.palette.primary.main,.5)}`},children:[w.jsx(Ol,{placeholder:"Postcode",value:l,onChange:g=>a(g.target.value.toUpperCase()),onKeyDown:g=>{g.key==="Enter"&&m()},inputProps:{"aria-label":"search by postcode"},sx:{paddingLeft:g=>g.spacing(2),maxWidth:110,color:g=>g.palette.secondary.main,fontWeight:700}}),!o&&!s?w.jsx(Er,{title:"Search by postcode",children:w.jsx(or,{"aria-label":"Search",color:"inherit",onClick:()=>m(),size:"large",disabled:o||s,children:w.jsx(z2,{})})}):w.jsx(CS,{children:w.jsx(Uu,{color:"inherit",size:22})}),w.jsx(Er,{title:"Use your current location",children:w.jsx(w.Fragment,{children:!s&&!o?w.jsx(or,{"aria-label":"Search by current location",color:"inherit",onClick:()=>f(),size:"large",disabled:o||s,children:w.jsx(j2,{})}):w.jsx(CS,{children:w.jsx(Uu,{color:"inherit",size:22})})})}),e==="postcode"?w.jsx(Er,{title:"Clear search",children:w.jsx(or,{color:"inherit","aria-label":"Clear search",onClick:()=>p(),size:"large",disabled:o||s,children:w.jsx(A2,{})})}):null]})};var W0={},Z8=Zt;Object.defineProperty(W0,"__esModule",{value:!0});var fR=W0.default=void 0,q8=Z8(on()),SS=w;fR=W0.default=(0,q8.default)([(0,SS.jsx)("path",{d:"M12 11h2v2h-2v2h2v2h-2v2h8V9h-8zm4 0h2v2h-2zm0 4h2v2h-2z",opacity:".3"},"0"),(0,SS.jsx)("path",{d:"M16 15h2v2h-2zm0-4h2v2h-2zm6-4H12V3H2v18h20zM6 19H4v-2h2zm0-4H4v-2h2zm0-4H4V9h2zm0-4H4V5h2zm4 12H8v-2h2zm0-4H8v-2h2zm0-4H8V9h2zm0-4H8V5h2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8z"},"1")],"BusinessTwoTone");var V0={},X8=Zt;Object.defineProperty(V0,"__esModule",{value:!0});var pR=V0.default=void 0,Q8=X8(on()),lf=w;pR=V0.default=(0,Q8.default)([(0,lf.jsx)("path",{d:"m17.37 17 .29-.27c.13-.11.34-.36.34-.73v-4H6v4c0 .37.21.62.34.73l.29.27zM8.5 16c-.83 0-1.5-.67-1.5-1.5S7.67 13 8.5 13s1.5.67 1.5 1.5S9.33 16 8.5 16m5.5-1.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5M12 4c-3.69 0-5.11.46-5.66.99h11.31C17.11 4.46 15.69 4 12 4",opacity:".3"},"0"),(0,lf.jsx)("path",{d:"M17 21h1c.55 0 1-.45 1-1v-1.78c.61-.55 1-1.34 1-2.22V6c0-3.5-3.58-4-8-4s-8 .5-8 4v10c0 .88.39 1.67 1 2.22V20c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h8v1c0 .55.45 1 1 1M12 4c3.69 0 5.11.46 5.66.99H6.34C6.89 4.46 8.31 4 12 4M6 6.99h12V10H6zM8 17H6.63l-.29-.27C6.21 16.62 6 16.37 6 16v-4h12v4c0 .37-.21.62-.34.73l-.29.27z"},"1"),(0,lf.jsx)("circle",{cx:"8.5",cy:"14.5",r:"1.5"},"2"),(0,lf.jsx)("circle",{cx:"15.5",cy:"14.5",r:"1.5"},"3")],"DirectionsBusTwoTone");var G0={},J8=Zt;Object.defineProperty(G0,"__esModule",{value:!0});var hR=G0.default=void 0,e7=J8(on()),kS=w;hR=G0.default=(0,e7.default)([(0,kS.jsx)("path",{d:"m3.01 12 9 9L21 12l-9-9zM14 7.5l3.5 3.5-3.5 3.5V12h-4v3H8v-4c0-.55.45-1 1-1h5z",opacity:".3"},"0"),(0,kS.jsx)("path",{d:"M13.42 1.58c-.75-.75-2.07-.76-2.83 0l-9 9c-.78.78-.78 2.04 0 2.82l9 9c.39.39.9.58 1.41.58.51 0 1.02-.19 1.41-.58l8.99-8.99c.78-.76.79-2.03.02-2.82zm-1.41 19.41-9-9 9-9 9 9zM8 11v4h2v-3h4v2.5l3.5-3.5L14 7.5V10H9c-.55 0-1 .45-1 1"},"1")],"DirectionsTwoTone");const t7=()=>{const[{organisations:e,organisationLookup:t,mobiles:n,mobileLookup:r,routeLookup:o,routes:s}]=vd(),[{organisationFilter:i,mobileFilter:l,routeFilter:a},c]=As(),[u,f]=d.useState(null),[h,p]=d.useState(null),[m,g]=d.useState(null),x=R=>f(R),v=()=>f(null),b=R=>{c({type:"FilterByOrganisation",organisationId:R}),v()},C=()=>{c({type:"ClearAll"})},S=R=>p(R),M=()=>p(null),k=(R,E)=>{c({type:"FilterByMobile",organisationId:R,mobileId:E}),M()},P=()=>{c({type:"ClearMobileFilter"})},I=R=>g(R),N=()=>g(null),O=R=>{c({type:"FilterByRoute",routeId:R}),N()},$=()=>{c({type:"ClearRouteFilter"})},F=new Set(e.map(R=>R.country));return w.jsxs(w.Fragment,{children:[i.length===0?w.jsx(Er,{title:"Choose library authority",children:w.jsx(kr,{color:"primary",onClick:R=>x(R.currentTarget),startIcon:w.jsx(fR,{}),children:"Select service"})}):w.jsx(fu,{color:"primary",variant:"outlined",onDelete:C,label:t[i[0]].name,sx:{mr:1}}),i.length>0?l.length===0?w.jsx(Er,{title:"Choose mobile library",children:w.jsxs(kr,{color:"primary",onClick:R=>S(R.currentTarget),children:[w.jsx(pR,{}),"Select mobile"]})}):w.jsx(fu,{color:"primary",variant:"outlined",onDelete:P,label:r[l[0]].name,sx:{mr:1}}):null,l.length>0?a.length===0?w.jsx(Er,{title:"Choose route",children:w.jsxs(kr,{color:"primary",onClick:R=>I(R.currentTarget),children:[w.jsx(hR,{}),"Select route"]})}):w.jsx(fu,{color:"primary",variant:"outlined",onDelete:$,label:o[a[0]].name,sx:{mr:1}}):null,w.jsx(_f,{id:"menu-library-service",anchorEl:u,keepMounted:!0,open:!!u,onClose:()=>v(),children:Array.from(F).sort((R,E)=>R.localeCompare(E)).map((R,E)=>{const _=[w.jsx($i,{disableSticky:!0,children:R},"lst_"+E)],D=e.sort((A,T)=>A.name.localeCompare(T.name)).filter(A=>A.country===R).map(A=>w.jsx(ur,{onClick:()=>b(A.id),children:A.name},"mnu_itm_org_"+A.id));return _.concat(D)})}),w.jsx(_f,{id:"menu-mobile-library",anchorEl:h,keepMounted:!0,open:!!h,onClose:()=>M(),children:n.filter(R=>{let E=!0;return i.length>0&&i.indexOf(R.organisationId)===-1&&(E=!1),E}).sort((R,E)=>R.name.localeCompare(E.name)).map(R=>w.jsx(ur,{onClick:()=>k(R.organisationId,R.id),children:R.name},"mnu_itm_mob_"+R.id))}),w.jsx(_f,{id:"menu-route",anchorEl:m,keepMounted:!0,open:!!m,onClose:()=>N(),children:s.filter(R=>{let E=!0;return l.length>0&&l.indexOf(R.mobileId)===-1&&(E=!1),E}).sort((R,E)=>R.name.localeCompare(E.name)).map(R=>w.jsx(ur,{onClick:()=>O(R.id),children:R.name},"mnu_itm_route_"+R.id))})]})},mR=()=>w.jsxs(To,{sx:{textAlign:"center",marginTop:e=>e.spacing(2),width:"100%"},children:[w.jsx(Lt,{color:"secondary",component:"h2",variant:"h2",children:"Mobile libraries"}),w.jsx(Lt,{component:"p",variant:"h6",color:"secondary",children:"Find your nearest mobile library"}),w.jsx(To,{sx:{margin:e=>e.spacing(2)},children:w.jsx(dR,{settings:!0})}),w.jsx(t7,{})]});var U0={},n7=Zt;Object.defineProperty(U0,"__esModule",{value:!0});var gR=U0.default=void 0,r7=n7(on()),PS=w;gR=U0.default=(0,r7.default)([(0,PS.jsx)("path",{d:"M10 10h4v4h-4zm0 6h4v4h-4zM4 4h4v4H4zm0 6h4v4H4zm0 6h4v4H4zM16 4h4v4h-4zm0 6h4v4h-4zm0 6h4v4h-4zM10 4h4v4h-4z",opacity:".3"},"0"),(0,PS.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M8 20H4v-4h4zm0-6H4v-4h4zm0-6H4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4z"},"1")],"GridOnTwoTone");var Y0={},o7=Zt;Object.defineProperty(Y0,"__esModule",{value:!0});var vR=Y0.default=void 0,s7=o7(on()),i7=w;vR=Y0.default=(0,s7.default)((0,i7.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVertTwoTone");var K0={},l7=Zt;Object.defineProperty(K0,"__esModule",{value:!0});var yR=K0.default=void 0,a7=l7(on()),MS=w;yR=K0.default=(0,a7.default)([(0,MS.jsx)("path",{d:"M4 9h10.5v3.5H4zm0 5.5h10.5V18H4zM16.5 9H20v9h-3.5z",opacity:".3"},"0"),(0,MS.jsx)("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m-5.5 14H4v-3.5h10.5zm0-5.5H4V9h10.5zM20 18h-3.5V9H20z"},"1")],"WebTwoTone");const c7=e=>{const{mobile:t,organisation:n,location:r}=e,[{},o]=As(),[{},s]=uo(),i=(v,b)=>{o({type:"FilterByMobile",organisationId:v,mobileId:b})},l=v=>{o({type:"SetCurrentStop",currentStopId:v}),s({type:"SetStopDialog",stopDialogOpen:!0})},a=v=>{o({type:"SetCurrentMobileLibrary",mobileLibraryId:v}),s({type:"SetMobileLibraryDialog",mobileLibraryDialogOpen:!0})},c=v=>w.jsx(kr,{color:"secondary",onClick:()=>l(v.stopId),children:v.stopName}),u=v=>w.jsx(Lt,{children:v.message}),f=v=>{const b=c(v.args[0]);return w.jsx(w.Fragment,{children:w.jsxs(Lt,{children:[v.message,b,v.args[1]]})})},h=v=>{const b=c(v.args[0]);return w.jsx(w.Fragment,{children:w.jsxs(Lt,{children:[v.message,b," for "+v.args[1]]})})},p=v=>{const b=c(v.args[0]);return w.jsx(w.Fragment,{children:w.jsxs(Lt,{children:[v.message,b,v.args[1]]})})},m=v=>w.jsx(Lt,{children:v.message});let g=null;if(r){const v=r.getStatus();v&&v.type==="offRoad"&&(g=u(v)),v&&v.type==="preRoute"&&(g=f(v)),v&&v.type==="atStop"&&(g=h(v)),v&&v.type==="betweenStops"&&(g=p(v)),v&&v.type==="postRoute"&&(g=m(v))}const x=w.jsx("span",{children:"•"});return w.jsxs(CB,{elevation:0,sx:{border:"1px solid #ccc"},children:[w.jsx(bC,{children:w.jsxs(Lt,{gutterBottom:!0,children:[t.numberRoutes+" route"+(t.numberRoutes>1?"s":""),x,t.numberStops+" stop"+(t.numberStops>1?"s":"")]})}),w.jsxs(bC,{children:[w.jsx(Lt,{variant:"h6",component:"h2",children:(n?n.name+" ":"")+t.name}),g]}),w.jsxs(IB,{children:[w.jsx(Er,{title:"See more mobile details",children:w.jsx(or,{size:"small",onClick:()=>a(t.id),children:w.jsx(vR,{})})}),w.jsx(Sp,{}),w.jsx(Er,{title:"Mobile library stops",children:w.jsxs(kr,{component:rl,to:"/",size:"small",color:"primary",onClick:()=>i(n.id,t.id),children:[w.jsx(gR,{}),"View stops"]})}),t.timetable?w.jsxs(w.Fragment,{children:[w.jsx(Sp,{}),w.jsx(Er,{title:"Website timetable",children:w.jsx(or,{onClick:()=>(void 0).goToWebsite(),size:"large",children:w.jsx(yR,{})})})]}):null]})]})},u7=()=>{const[{organisationLookup:e,mobiles:t,mobileLookup:n,mobileLocationLookup:r,mobilesNearestLookup:o,routeLookup:s},i]=vd(),[{organisationFilter:l,mobileFilter:a,routeFilter:c,searchType:u,searchDistance:f,searchPostcode:h},p]=As(),[{loadingMobileLocations:m},g]=uo(),[x,v]=d.useState(0),b=$=>{v($)},C=t.filter($=>{let F=!0;return(u==="gps"||u==="postcode")&&(F=o[$.id]),l.length>0&&l.indexOf($.organisationId)===-1&&(F=!1),a.length>0&&a.indexOf($.id)===-1&&(F=!1),F}),S=C.filter($=>{if(r[$.id]){const F=r[$.id].getStatus();return F&&F.type!=="offRoad"&&F.type!=="postRoute"}return null}),M=l.length>0?e[l[0]].name:"",k=a.length>0?n[a[0]].name:"",P=c.length>0?s[c[0]].name:"";let I="Mobile libraries";M!==""&&(I="Mobile libraries serving "+M),k!==""&&(I=M+" "+k),P!==""&&(I=M+" "+P),h!==""&&(I="Mobile libraries with stops within "+Math.round(f/1609)+" mile(s) of "+h),u==="gps"&&(I="Mobile libraries with stops within "+Math.round(f/1609)+" mile(s) of your location");const O=(x===0?S:C).filter($=>{let F=!0;return l.length>0&&l.indexOf($.organisationId)===-1&&(F=!1),a.length>0&&a.indexOf($.id)===-1&&(F=!1),F}).filter($=>u==="gps"||u==="postcode"?o[$.id]:!0);return w.jsxs(w.Fragment,{children:[w.jsx(mR,{}),w.jsx($i,{component:"span",disableSticky:!0,children:I}),w.jsxs(EE,{variant:"standard",scrollButtons:!1,value:x,indicatorColor:"secondary",onChange:($,F)=>b(F),centered:!0,sx:{marginBottom:$=>$.spacing()},children:[w.jsx(au,{label:w.jsx(Cp,{color:"secondary",badgeContent:S.length,children:w.jsx(To,{sx:{minWidth:"50px"},children:"On the road"})})}),w.jsx(au,{label:w.jsx(Cp,{showZero:!0,color:"secondary",badgeContent:C.length,children:w.jsx(To,{sx:{minWidth:"50px"},children:"All"})})})]}),O.length>0?w.jsx(ha,{container:!0,spacing:3,children:O.map(($,F)=>w.jsx(ha,{item:!0,xs:12,sm:6,md:4,lg:3,xl:3,children:w.jsx(c7,{mobile:$,location:r[$.id],organisation:e[$.organisationId]})},"grd_"+$.name.replace(" ","")+"_"+F))}):m?null:w.jsx(Lt,{component:"p",variant:"body1",children:"No mobile libraries currently on the road."})]})};var Z0={},d7=Zt;Object.defineProperty(Z0,"__esModule",{value:!0});var bR=Z0.default=void 0,f7=d7(on()),IS=w;bR=Z0.default=(0,f7.default)([(0,IS.jsx)("path",{d:"M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8m5 11.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12z",opacity:".3"},"0"),(0,IS.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"},"1")],"CancelTwoTone");const p7=()=>{const[{mobileLookup:e}]=vd(),[{currentMobileLibraryId:t}]=As(),[{mobileLibraryDialogOpen:n},r]=uo(),[o,s]=d.useState({});d.useEffect(()=>{t!=null&&e&&s(e[t])},[t,e]);const i=()=>{r({type:"SetMobileLibraryDialog",mobileLibraryDialogOpen:!1})},l=On(),a=Wa(l.breakpoints.down("md"));return w.jsxs(em,{fullScreen:a,open:n,onClose:i,"aria-labelledby":"dlg-title",BackdropProps:{invisible:!0},PaperProps:{elevation:0},children:[o?w.jsxs(w.Fragment,{children:[w.jsx(rm,{id:"dlg-title",children:o.name}),w.jsxs(nm,{children:[w.jsx($i,{disableSticky:!0,children:"Actions"}),w.jsx("div",{})]})]}):w.jsx(Uu,{color:"primary",size:30}),w.jsx(tm,{children:w.jsx(kr,{onClick:()=>i(),color:"secondary",endIcon:w.jsx(bR,{}),children:"Close"})})]})},h7="modulepreload",m7=function(e){return"/"+e},ES={},g7=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=Promise.allSettled(n.map(a=>{if(a=m7(a),a in ES)return;ES[a]=!0;const c=a.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":h7,c||(f.as="script"),f.crossOrigin="",f.href=a,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${a}`)))})}))}function s(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return o.then(i=>{for(const l of i||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},v7=d.createContext(null);function y7(e,t){const n=Array.isArray(e)?e[0]:e?e.x:0,r=Array.isArray(e)?e[1]:e?e.y:0,o=Array.isArray(t)?t[0]:t?t.x:0,s=Array.isArray(t)?t[1]:t?t.y:0;return n===o&&r===s}function xr(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n{let o=null;"interactive"in r&&(o=Object.assign({},r),delete o.interactive);const s=t[r.ref];if(s){o=o||Object.assign({},r),delete o.ref;for(const i of w7)i in s&&(o[i]=s[i])}return o||r});return{...e,layers:n}}var $S={};const FS={version:8,sources:{},layers:[]},DS={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Og={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},LS={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},x7=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],C7=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Za{constructor(t,n,r){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=o=>{const s=this.props[LS[o.type]];s?s(o):o.type==="error"&&console.error(o.error)},this._onPointerEvent=o=>{(o.type==="mousemove"||o.type==="mouseout")&&this._updateHover(o);const s=this.props[DS[o.type]];s&&(this.props.interactiveLayerIds&&o.type!=="mouseover"&&o.type!=="mouseout"&&(o.features=this._hoveredFeatures||this._queryRenderedFeatures(o.point)),s(o),delete o.features)},this._onCameraEvent=o=>{if(!this._internalUpdate){const s=this.props[Og[o.type]];s&&s(o)}o.type in this._deferredEvents&&(this._deferredEvents[o.type]=!1)},this._MapClass=t,this.props=n,this._initialize(r)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){const n=this.props;this.props=t;const r=this._updateSettings(t,n);r&&this._createShadowTransform(this._map);const o=this._updateSize(t),s=this._updateViewState(t,!0);this._updateStyle(t,n),this._updateStyleComponents(t,n),this._updateHandlers(t,n),(r||o||s&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){const r=Za.savedMaps.pop();if(!r)return null;const o=r.map,s=o.getContainer();for(n.className=s.className;s.childNodes.length>0;)n.appendChild(s.childNodes[0]);o._container=n;const i=o._resizeObserver;i&&(i.disconnect(),i.observe(n)),r.setProps({...t,styleDiffing:!1}),o.resize();const{initialViewState:l}=t;return l&&(l.bounds?o.fitBounds(l.bounds,{...l.fitBoundsOptions,duration:0}):r._updateViewState(l,!1)),o.isStyleLoaded()?o.fire("load"):o.once("styledata",()=>o.fire("load")),o._update(),r}_initialize(t){const{props:n}=this,{mapStyle:r=FS}=n,o={...n,...n.initialViewState,accessToken:n.mapboxAccessToken||S7()||null,container:t,style:OS(r)},s=o.initialViewState||o.viewState||o;if(Object.assign(o,{center:[s.longitude||0,s.latitude||0],zoom:s.zoom||0,pitch:s.pitch||0,bearing:s.bearing||0}),n.gl){const u=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=u,n.gl)}const i=new this._MapClass(o);s.padding&&i.setPadding(s.padding),n.cursor&&(i.getCanvas().style.cursor=n.cursor),this._createShadowTransform(i);const l=i._render;i._render=u=>{this._inRender=!0,l.call(i,u),this._inRender=!1};const a=i._renderTaskQueue.run;i._renderTaskQueue.run=u=>{a.call(i._renderTaskQueue,u),this._onBeforeRepaint()},i.on("render",()=>this._onAfterRepaint());const c=i.fire;i.fire=this._fireEvent.bind(this,c),i.on("resize",()=>{this._renderTransform.resize(i.transform.width,i.transform.height)}),i.on("styledata",()=>{this._updateStyleComponents(this.props,{}),RS(i.transform,this._renderTransform)}),i.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const u in DS)i.on(u,this._onPointerEvent);for(const u in Og)i.on(u,this._onCameraEvent);for(const u in LS)i.on(u,this._onEvent);this._map=i}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n==null||n.remove(),Za.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){const n=b7(t.transform);t.painter.transform=n,this._renderTransform=n}_updateSize(t){const{viewState:n}=t;if(n){const r=this._map;if(n.width!==r.transform.width||n.height!==r.transform.height)return r.resize(),!0}return!1}_updateViewState(t,n){if(this._internalUpdate)return!1;const r=this._map,o=this._renderTransform,{zoom:s,pitch:i,bearing:l}=o,a=r.isMoving();a&&(o.cameraElevationReference="sea");const c=_S(o,{...TS(r.transform),...t});if(a&&(o.cameraElevationReference="ground"),c&&n){const u=this._deferredEvents;u.move=!0,u.zoom||(u.zoom=s!==o.zoom),u.rotate||(u.rotate=l!==o.bearing),u.pitch||(u.pitch=i!==o.pitch)}return a||_S(r.transform,t),c}_updateSettings(t,n){const r=this._map;let o=!1;for(const s of x7)if(s in t&&!xr(t[s],n[s])){o=!0;const i=r[`set${s[0].toUpperCase()}${s.slice(1)}`];i==null||i.call(r,t[s])}return o}_updateStyle(t,n){if(t.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==n.mapStyle){const{mapStyle:r=FS,styleDiffing:o=!0}=t,s={diff:o};return"localIdeographFontFamily"in t&&(s.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(OS(r),s),!0}return!1}_updateStyleComponents(t,n){const r=this._map;let o=!1;return r.isStyleLoaded()&&("light"in t&&r.setLight&&!xr(t.light,n.light)&&(o=!0,r.setLight(t.light)),"fog"in t&&r.setFog&&!xr(t.fog,n.fog)&&(o=!0,r.setFog(t.fog)),"terrain"in t&&r.setTerrain&&!xr(t.terrain,n.terrain)&&(!t.terrain||r.getSource(t.terrain.source))&&(o=!0,r.setTerrain(t.terrain))),o}_updateHandlers(t,n){var r,o;const s=this._map;let i=!1;for(const l of C7){const a=(r=t[l])!==null&&r!==void 0?r:!0,c=(o=n[l])!==null&&o!==void 0?o:!0;xr(a,c)||(i=!0,a?s[l].enable(a):s[l].disable())}return i}_queryRenderedFeatures(t){const n=this._map,r=n.transform,{interactiveLayerIds:o=[]}=this.props;try{return n.transform=this._renderTransform,n.queryRenderedFeatures(t,{layers:o.filter(n.getLayer.bind(n))})}catch{return[]}finally{n.transform=r}}_updateHover(t){var n;const{props:r}=this;if(r.interactiveLayerIds&&(r.onMouseMove||r.onMouseEnter||r.onMouseLeave)){const s=t.type,i=((n=this._hoveredFeatures)===null||n===void 0?void 0:n.length)>0,l=this._queryRenderedFeatures(t.point),a=l.length>0;!a&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=l,a&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=s}else this._hoveredFeatures=null}_fireEvent(t,n,r){const o=this._map,s=o.transform,i=typeof n=="string"?n:n.type;return i==="move"&&this._updateViewState(this.props,!1),i in Og&&(typeof n=="object"&&(n.viewState=TS(s)),this._map.isMoving())?(o.transform=this._renderTransform,t.call(o,n,r),o.transform=s,o):(t.call(o,n,r),o)}_onBeforeRepaint(){const t=this._map;this._internalUpdate=!0;for(const r in this._deferredEvents)this._deferredEvents[r]&&t.fire(r);this._internalUpdate=!1;const n=this._map.transform;t.transform=this._renderTransform,this._onAfterRepaint=()=>{RS(this._renderTransform,n),t.transform=n}}}Za.savedMaps=[];function S7(){let e=null;if(typeof location<"u"){const t=/access_token=([^&\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||$S.MapboxAccessToken}catch{}try{e=e||$S.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}const k7=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function P7(e){if(!e)return null;const t=e.map,n={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:r=>{const o=t.transform;t.transform=e.transform;const s=t.project(r);return t.transform=o,s},unproject:r=>{const o=t.transform;t.transform=e.transform;const s=t.unproject(r);return t.transform=o,s},queryTerrainElevation:(r,o)=>{const s=t.transform;t.transform=e.transform;const i=t.queryTerrainElevation(r,o);return t.transform=s,i},queryRenderedFeatures:(r,o)=>{const s=t.transform;t.transform=e.transform;const i=t.queryRenderedFeatures(r,o);return t.transform=s,i}};for(const r of M7(t))!(r in n)&&!k7.includes(r)&&(n[r]=t[r].bind(t));return n}function M7(e){const t=new Set;let n=e;for(;n;){for(const r of Object.getOwnPropertyNames(n))r[0]!=="_"&&typeof e[r]=="function"&&r!=="fire"&&r!=="setEventedParent"&&t.add(r);n=Object.getPrototypeOf(n)}return Array.from(t)}const I7=typeof document<"u"?d.useLayoutEffect:d.useEffect,E7=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function R7(e,t){for(const r of E7)r in t&&(e[r]=t[r]);const{RTLTextPlugin:n="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=t;n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"&&e.setRTLTextPlugin(n,r=>{r&&console.error(r)},!0)}const fc=d.createContext(null);function T7(e,t,n){const r=d.useContext(v7),[o,s]=d.useState(null),i=d.useRef(),{current:l}=d.useRef({mapLib:null,map:null});d.useEffect(()=>{const u=e.mapLib;let f=!0,h;return Promise.resolve(u||n).then(p=>{if(!f)return;if(!p)throw new Error("Invalid mapLib");const m="Map"in p?p:p.default;if(!m.Map)throw new Error("Invalid mapLib");if(R7(m,e),!m.supported||m.supported(e))e.reuseMaps&&(h=Za.reuse(e,i.current)),h||(h=new Za(m.Map,e,i.current)),l.map=P7(h),l.mapLib=m,s(h),r==null||r.onMapMount(l.map,e.id);else throw new Error("Map is not supported by this browser")}).catch(p=>{const{onError:m}=e;m?m({type:"error",target:null,originalEvent:null,error:p}):console.error(p)}),()=>{f=!1,h&&(r==null||r.onMapUnmount(e.id),e.reuseMaps?h.recycle():h.destroy())}},[]),I7(()=>{o&&o.setProps(e)}),d.useImperativeHandle(t,()=>l.map,[o]);const a=d.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),c={height:"100%"};return d.createElement("div",{id:e.id,ref:i,style:a},o&&d.createElement(fc.Provider,{value:l},d.createElement("div",{"mapboxgl-children":"",style:c},e.children)))}const _7=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function $l(e,t){if(!e||!t)return;const n=e.style;for(const r in t){const o=t[r];Number.isFinite(o)&&!_7.test(r)?n[r]=`${o}px`:n[r]=o}}function O7(e,t){const{map:n,mapLib:r}=d.useContext(fc),o=d.useRef({props:e});o.current.props=e;const s=d.useMemo(()=>{let g=!1;d.Children.forEach(e.children,b=>{b&&(g=!0)});const x={...e,element:g?document.createElement("div"):null},v=new r.Marker(x);return v.setLngLat([e.longitude,e.latitude]),v.getElement().addEventListener("click",b=>{var C,S;(S=(C=o.current.props).onClick)===null||S===void 0||S.call(C,{type:"click",target:v,originalEvent:b})}),v.on("dragstart",b=>{var C,S;const M=b;M.lngLat=s.getLngLat(),(S=(C=o.current.props).onDragStart)===null||S===void 0||S.call(C,M)}),v.on("drag",b=>{var C,S;const M=b;M.lngLat=s.getLngLat(),(S=(C=o.current.props).onDrag)===null||S===void 0||S.call(C,M)}),v.on("dragend",b=>{var C,S;const M=b;M.lngLat=s.getLngLat(),(S=(C=o.current.props).onDragEnd)===null||S===void 0||S.call(C,M)}),v},[]);d.useEffect(()=>(s.addTo(n.getMap()),()=>{s.remove()}),[]);const{longitude:i,latitude:l,offset:a,style:c,draggable:u=!1,popup:f=null,rotation:h=0,rotationAlignment:p="auto",pitchAlignment:m="auto"}=e;return d.useEffect(()=>{$l(s.getElement(),c)},[c]),d.useImperativeHandle(t,()=>s,[]),(s.getLngLat().lng!==i||s.getLngLat().lat!==l)&&s.setLngLat([i,l]),a&&!y7(s.getOffset(),a)&&s.setOffset(a),s.isDraggable()!==u&&s.setDraggable(u),s.getRotation()!==h&&s.setRotation(h),s.getRotationAlignment()!==p&&s.setRotationAlignment(p),s.getPitchAlignment()!==m&&s.setPitchAlignment(m),s.getPopup()!==f&&s.setPopup(f),Ml.createPortal(e.children,s.getElement())}const $7=d.memo(d.forwardRef(O7));function NS(e){return new Set(e?e.trim().split(/\s+/):[])}function F7(e,t){const{map:n,mapLib:r}=d.useContext(fc),o=d.useMemo(()=>document.createElement("div"),[]),s=d.useRef({props:e});s.current.props=e;const i=d.useMemo(()=>{const l={...e},a=new r.Popup(l);return a.setLngLat([e.longitude,e.latitude]),a.once("open",c=>{var u,f;(f=(u=s.current.props).onOpen)===null||f===void 0||f.call(u,c)}),a},[]);if(d.useEffect(()=>{const l=a=>{var c,u;(u=(c=s.current.props).onClose)===null||u===void 0||u.call(c,a)};return i.on("close",l),i.setDOMContent(o).addTo(n.getMap()),()=>{i.off("close",l),i.isOpen()&&i.remove()}},[]),d.useEffect(()=>{$l(i.getElement(),e.style)},[e.style]),d.useImperativeHandle(t,()=>i,[]),i.isOpen()&&((i.getLngLat().lng!==e.longitude||i.getLngLat().lat!==e.latitude)&&i.setLngLat([e.longitude,e.latitude]),e.offset&&!xr(i.options.offset,e.offset)&&i.setOffset(e.offset),(i.options.anchor!==e.anchor||i.options.maxWidth!==e.maxWidth)&&(i.options.anchor=e.anchor,i.setMaxWidth(e.maxWidth)),i.options.className!==e.className)){const l=NS(i.options.className),a=NS(e.className);for(const c of l)a.has(c)||i.removeClassName(c);for(const c of a)l.has(c)||i.addClassName(c);i.options.className=e.className}return Ml.createPortal(e.children,o)}d.memo(d.forwardRef(F7));function Cd(e,t,n,r){const o=d.useContext(fc),s=d.useMemo(()=>e(o),[]);return d.useEffect(()=>{const i=t,l=typeof t=="function"&&typeof n=="function"?t:null,a=typeof t=="function"?t:null,{map:c}=o;return c.hasControl(s)||(c.addControl(s,i==null?void 0:i.position),l&&l(o)),()=>{a&&a(o),c.hasControl(s)&&c.removeControl(s)}},[]),s}function D7(e){const t=Cd(({mapLib:n})=>new n.AttributionControl(e),{position:e.position});return d.useEffect(()=>{$l(t._container,e.style)},[e.style]),null}d.memo(D7);function L7(e){const t=Cd(({mapLib:n})=>new n.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return d.useEffect(()=>{$l(t._controlContainer,e.style)},[e.style]),null}d.memo(L7);function N7(e,t){const n=d.useRef({props:e}),r=Cd(({mapLib:o})=>{const s=new o.GeolocateControl(e),i=s._setupUI;return s._setupUI=l=>{s._container.hasChildNodes()||i(l)},s.on("geolocate",l=>{var a,c;(c=(a=n.current.props).onGeolocate)===null||c===void 0||c.call(a,l)}),s.on("error",l=>{var a,c;(c=(a=n.current.props).onError)===null||c===void 0||c.call(a,l)}),s.on("outofmaxbounds",l=>{var a,c;(c=(a=n.current.props).onOutOfMaxBounds)===null||c===void 0||c.call(a,l)}),s.on("trackuserlocationstart",l=>{var a,c;(c=(a=n.current.props).onTrackUserLocationStart)===null||c===void 0||c.call(a,l)}),s.on("trackuserlocationend",l=>{var a,c;(c=(a=n.current.props).onTrackUserLocationEnd)===null||c===void 0||c.call(a,l)}),s},{position:e.position});return n.current.props=e,d.useImperativeHandle(t,()=>r,[]),d.useEffect(()=>{$l(r._container,e.style)},[e.style]),null}d.memo(d.forwardRef(N7));function A7(e){const t=Cd(({mapLib:n})=>new n.NavigationControl(e),{position:e.position});return d.useEffect(()=>{$l(t._container,e.style)},[e.style]),null}const j7=d.memo(A7);function z7(e){const t=Cd(({mapLib:s})=>new s.ScaleControl(e),{position:e.position}),n=d.useRef(e),r=n.current;n.current=e;const{style:o}=e;return e.maxWidth!==void 0&&e.maxWidth!==r.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==r.unit&&t.setUnit(e.unit),d.useEffect(()=>{$l(t._container,o)},[o]),null}d.memo(z7);function Ep(e,t){if(!e)throw new Error(t)}function B7(e,t,n,r){if(Ep(n.id===r.id,"layer id changed"),Ep(n.type===r.type,"layer type changed"),n.type==="custom"||r.type==="custom")return;const{layout:o={},paint:s={},filter:i,minzoom:l,maxzoom:a,beforeId:c}=n;if(c!==r.beforeId&&e.moveLayer(t,c),o!==r.layout){const u=r.layout||{};for(const f in o)xr(o[f],u[f])||e.setLayoutProperty(t,f,o[f]);for(const f in u)o.hasOwnProperty(f)||e.setLayoutProperty(t,f,void 0)}if(s!==r.paint){const u=r.paint||{};for(const f in s)xr(s[f],u[f])||e.setPaintProperty(t,f,s[f]);for(const f in u)s.hasOwnProperty(f)||e.setPaintProperty(t,f,void 0)}xr(i,r.filter)||e.setFilter(t,i),(l!==r.minzoom||a!==r.maxzoom)&&e.setLayerZoomRange(t,l,a)}function H7(e,t,n){if(e.style&&e.style._loaded&&(!("source"in n)||e.getSource(n.source))){const r={...n,id:t};delete r.beforeId,e.addLayer(r,n.beforeId)}}let W7=0;function V7(e){const t=d.useContext(fc).map.getMap(),n=d.useRef(e),[,r]=d.useState(0),o=d.useMemo(()=>e.id||`jsx-layer-${W7++}`,[]);if(d.useEffect(()=>{if(t){const i=()=>r(l=>l+1);return t.on("styledata",i),i(),()=>{t.off("styledata",i),t.style&&t.style._loaded&&t.getLayer(o)&&t.removeLayer(o)}}},[t]),t&&t.style&&t.getLayer(o))try{B7(t,o,e,n.current)}catch(i){console.warn(i)}else H7(t,o,e);return n.current=e,null}let G7=0;function U7(e,t,n){if(e.style&&e.style._loaded){const r={...n};return delete r.id,delete r.children,e.addSource(t,r),e.getSource(t)}return null}function Y7(e,t,n){Ep(t.id===n.id,"source id changed"),Ep(t.type===n.type,"source type changed");let r="",o=0;for(const i in t)i!=="children"&&i!=="id"&&!xr(n[i],t[i])&&(r=i,o++);if(!o)return;const s=t.type;if(s==="geojson")e.setData(t.data);else if(s==="image")e.updateImage({url:t.url,coordinates:t.coordinates});else if("setCoordinates"in e&&o===1&&r==="coordinates")e.setCoordinates(t.coordinates);else if("setUrl"in e)switch(r){case"url":e.setUrl(t.url);break;case"tiles":e.setTiles(t.tiles);break}else console.warn(`Unable to update prop: ${r}`)}function K7(e){const t=d.useContext(fc).map.getMap(),n=d.useRef(e),[,r]=d.useState(0),o=d.useMemo(()=>e.id||`jsx-source-${G7++}`,[]);d.useEffect(()=>{if(t){const i=()=>setTimeout(()=>r(l=>l+1),0);return t.on("styledata",i),i(),()=>{var l;if(t.off("styledata",i),t.style&&t.style._loaded&&t.getSource(o)){const a=(l=t.getStyle())===null||l===void 0?void 0:l.layers;if(a)for(const c of a)c.source===o&&t.removeLayer(c.id);t.removeSource(o)}}}},[t]);let s=t&&t.style&&t.getSource(o);return s?Y7(s,e,n.current):s=U7(t,o,e),n.current=e,s&&d.Children.map(e.children,i=>i&&d.cloneElement(i,{source:o}))||null}const Z7=g7(()=>import("./maplibre-gl-C6P4tEXy.js").then(e=>e.m),[]),q7=d.forwardRef(function(t,n){return T7(t,n,Z7)}),AS=$7,X7=j7,Ai=V7,$g=K7;var q0={},Q7=Zt;Object.defineProperty(q0,"__esModule",{value:!0});var wR=q0.default=void 0,J7=Q7(on()),eY=w;wR=q0.default=(0,J7.default)((0,eY.jsx)("path",{d:"M12.6 18.06c-.36.28-.87.28-1.23 0l-6.15-4.78a.991.991 0 0 0-1.22 0c-.51.4-.51 1.17 0 1.57l6.76 5.26c.72.56 1.73.56 2.46 0l6.76-5.26c.51-.4.51-1.17 0-1.57l-.01-.01a.991.991 0 0 0-1.22 0zm.63-3.02 6.76-5.26c.51-.4.51-1.18 0-1.58l-6.76-5.26c-.72-.56-1.73-.56-2.46 0L4.01 8.21c-.51.4-.51 1.18 0 1.58l6.76 5.26c.72.56 1.74.56 2.46-.01"}),"LayersRounded");var X0={},tY=Zt;Object.defineProperty(X0,"__esModule",{value:!0});var xR=X0.default=void 0,nY=tY(on()),rY=w;xR=X0.default=(0,nY.default)((0,rY.jsx)("path",{d:"M10.25 13c0 .69-.56 1.25-1.25 1.25S7.75 13.69 7.75 13s.56-1.25 1.25-1.25 1.25.56 1.25 1.25M15 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25m7 .25c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10m-2 0c0-.78-.12-1.53-.33-2.24-.7.15-1.42.24-2.17.24-3.13 0-5.92-1.44-7.76-3.69C8.69 8.87 6.6 10.88 4 11.86c.01.04 0 .09 0 .14 0 4.41 3.59 8 8 8s8-3.59 8-8"}),"FaceRounded");const oY=()=>w.jsx(Er,{title:"Me",children:w.jsx(X3,{color:"primary",children:w.jsx(xR,{})})});var Q0={},sY=Zt;Object.defineProperty(Q0,"__esModule",{value:!0});var CR=Q0.default=void 0,iY=sY(on()),lY=w;CR=Q0.default=(0,iY.default)((0,lY.jsx)("path",{d:"M4 16c0 .88.39 1.67 1 2.22v1.28c0 .83.67 1.5 1.5 1.5S8 20.33 8 19.5V19h8v.5c0 .82.67 1.5 1.5 1.5.82 0 1.5-.67 1.5-1.5v-1.28c.61-.55 1-1.34 1-2.22V6c0-3.5-3.58-4-8-4s-8 .5-8 4zm3.5 1c-.83 0-1.5-.67-1.5-1.5S6.67 14 7.5 14s1.5.67 1.5 1.5S8.33 17 7.5 17m9 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m1.5-6H6V6h12z"}),"DirectionsBusRounded");function aY(e,t){let n;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(e))return n=e.substring(1).split(""),n.length===3&&(n=[n[0],n[0],n[1],n[1],n[2],n[2]]),n="0x"+n.join(""),"rgba("+[n>>16&255,n>>8&255,n&255].join(",")+", "+t+")";throw new Error("Bad Hex")}const cY=e=>{const[{mapZoom:t}]=uo(),{location:n,organisation:r}=e,o=n.getStatus(),s=t[0]<8?"small":t[0]<12?"medium":"large",i=t[0]<8?2:t[0]<12?3:4;return w.jsx(Er,{title:o?o.textFormat:"",children:w.jsx(t2,{size:s,color:"primary",style:{backgroundColor:aY(r.colour,.8),color:"white",border:i+"px solid #FFFFFF"},children:w.jsx(CR,{})})})};var J0={},uY=Zt;Object.defineProperty(J0,"__esModule",{value:!0});var dm=J0.default=void 0,dY=uY(on()),fY=w;dm=J0.default=(0,dY.default)((0,fY.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0a.9959.9959 0 0 1 0-1.41L10.59 12 7.7 9.11a.9959.9959 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41"}),"CancelRounded");function pY(){const[{mapSettings:e,mapSettingsDialogOpen:t},n]=uo(),r=()=>{n({type:"SetMapSettingsDialog",mapSettingsDialogOpen:!1})},o=()=>{n({type:"ToggleMapSetting",mapSetting:"authorityBoundary"})},s=On(),i=Wa(s.breakpoints.down("md"));return w.jsxs(em,{fullScreen:i,open:t,onClose:r,slotProps:{backdrop:{invisible:!0}},PaperProps:{elevation:0},children:[w.jsx(rm,{children:"Map settings"}),w.jsx(nm,{children:w.jsx(r2,{control:w.jsx(d2,{checked:e.authorityBoundary,onChange:o,name:"sw_authority_boundary",color:"primary"}),label:"Library authority boundaries"})}),w.jsx(tm,{children:w.jsx(kr,{onClick:r,color:"secondary",endIcon:w.jsx(dm,{}),children:"Close"})})]})}const hY=Tr.libraryAuthorityTiles,mY=Tr.mobileTiles,gY=()=>{const[{mobileLocations:e,mobileLookup:t,organisationLookup:n}]=vd(),[{searchType:r,searchPosition:o,currentService:s},i]=As(),[{mapZoom:l,mapPosition:a,mapSettings:c,mapSettingsDialogOpen:u,mapFlyToPosition:f,mapBounds:h,loadingLibraryOrMobileLibrary:p},m]=uo(),[g,x]=d.useState(null);d.useEffect(()=>{h&&g&&g.fitBounds(h,{padding:50})},[h,g]),d.useEffect(()=>{f&&g&&g.flyTo({center:f,zoom:15})},[f,g]);const v=M=>{m({type:"SetMapPosition",mapZoom:M.zoom,mapPosition:[M.longitude,M.latitude]})},b=async M=>{const k=M.properties.id;i({type:"SetCurrentStop",currentStopId:k}),m({type:"SetStopDialog",stopDialogOpen:!0})},C=M=>{const k=M.properties.id;i({type:"SetCurrentTrip",currentTripId:k}),m({type:"SetTripDialog",tripDialogOpen:!0})},S=async M=>{if(p)return;m({type:"ToggleLoadingLibraryOrMobileLibrary"});const k=g.queryRenderedFeatures(M.point);if(k&&k.length>0)for(const P of k){if(P.sourceLayer==="stops"){await b(P);break}if(P.sourceLayer==="trips"){C(P);break}}m({type:"ToggleLoadingLibraryOrMobileLibrary"})};return w.jsxs(w.Fragment,{children:[w.jsx(To,{sx:{position:"absolute",marginTop:M=>M.spacing(2)},children:w.jsx(dR,{})}),w.jsxs(q7,{ref:x,style:{width:"100vw",height:"100vh",position:"absolute",top:0,left:0},mapStyle:"https://api.maptiler.com/maps/dataviz/style.json?key=1OK05AJqNta7xYzrG2kA",longitude:a[0],latitude:a[1],zoom:l,maxZoom:18,onMove:M=>v(M.viewState),onClick:S,children:[e&&e.length>0?e.map(M=>{if(!M.geoX||!M.geoY)return null;let k=[M.geoX,M.geoY];if(M.routeSection&&M.routeSection.coordinates&&M.updated){const N=moment(Date.now()).diff(M.updated),O=Math.round(N/500),$=M.routeSection.coordinates;$.length>O&&O>0&&(k=$[O]),$.length<=O&&O>0&&(k=$[$.length-1])}const P=t[M.mobileId],I=P?n[P.organisationId]:null;return w.jsx(AS,{coordinates:k,anchor:"bottom",children:w.jsx(cY,{organisation:I,location:M,zoom:g?g.getZoom():0})},"mkr_"+M.id)}):null,s&&s.geojson&&w.jsx($g,{type:"geojson",data:JSON.parse(s.geojson),children:w.jsx(Ai,{type:"line",paint:{"line-opacity":.4,"line-width":2,"line-color":"#455a64"}})}),w.jsxs($g,{type:"vector",tiles:[hY],children:[c.authorityBoundary?w.jsx(Ai,{type:"line","source-layer":"library_authority_boundaries",minzoom:6,layout:{"line-join":"round","line-cap":"square"},paint:{"line-color":"#a7a39b","line-opacity":1,"line-width":["interpolate",["linear"],["zoom"],6,1,18,4]}}):null,c.authorityBoundary?w.jsx(Ai,{type:"fill","source-layer":"library_authority_boundaries",minzoom:6,paint:{"fill-color":"#ccc","fill-opacity":.1}}):null]}),w.jsxs($g,{type:"vector",tiles:[mY],maxzoom:14,children:[w.jsx(Ai,{type:"line","source-layer":"trips",minzoom:14,layout:{"line-join":"round","line-cap":"square"},paint:{"line-color":"#a7a39b","line-offset":["interpolate",["linear"],["zoom"],14,1,18,4],"line-opacity":1,"line-width":["interpolate",["linear"],["zoom"],14,1,18,4],"line-dasharray":[2,.5]}}),w.jsx(Ai,{type:"circle","source-layer":"stops",minzoom:5,layout:{},paint:{"circle-radius":["interpolate",["linear"],["zoom"],5,2,18,8],"circle-color":"#455a64","circle-stroke-width":["interpolate",["linear"],["zoom"],5,1,18,3],"circle-stroke-color":"#ffffff","circle-opacity":.5}}),w.jsx(Ai,{type:"symbol","source-layer":"stops",minzoom:13,layout:{"text-ignore-placement":!1,"text-field":["get","name"],"text-font":["Source Sans Pro Bold"],"text-line-height":1,"text-size":["interpolate",["linear"],["zoom"],13,12,18,18],"text-offset":["interpolate",["linear"],["zoom"],13,["literal",[0,1.5]],18,["literal",[0,2]]]},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"text-halo-blur":1,"text-color":"#6a6f73"}}),w.jsx(Ai,{type:"symbol","source-layer":"stops",minzoom:14,layout:{"text-ignore-placement":!1,"text-field":["to-string",["get","next_visiting"]],"text-font":["Source Sans Pro Bold"],"text-line-height":1,"text-size":["interpolate",["linear"],["zoom"],14,10,18,16],"text-offset":["interpolate",["linear"],["zoom"],13,["literal",[0,-1.5]],18,["literal",[0,-2]]]},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"text-halo-blur":1,"text-color":"#6a6f73"}})]}),o&&o.length>1?w.jsx(AS,{longitude:o[0],latitude:o[1],children:w.jsx(oY,{searchType:r})}):null,w.jsx(X7,{position:"bottom-left"})]}),w.jsx(Er,{title:"Map settings",children:w.jsx(t2,{color:"primary",sx:{position:"absolute",bottom:28,right:16,zIndex:1,color:"white"},onClick:()=>m({type:"SetMapSettingsDialog",mapSettingsDialogOpen:!0}),children:w.jsx(wR,{})})}),w.jsx(pY,{mapSettings:c,mapSettingsDialogOpen:u})]})};var e1={},vY=Zt;Object.defineProperty(e1,"__esModule",{value:!0});var SR=e1.default=void 0,yY=vY(on()),bY=w;SR=e1.default=(0,yY.default)((0,bY.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"CloseTwoTone");const wY=()=>{const[{notificationOpen:e,notificationMessage:t},n]=uo(),r=()=>{n({type:"SetNotification",notificationOpen:!1})};return w.jsx(bG,{anchorOrigin:{vertical:"bottom",horizontal:"left"},open:e,autoHideDuration:3e3,onClose:r,ContentProps:{"aria-describedby":"message-id"},message:w.jsx("span",{id:"message-id",children:t}),action:[w.jsx(or,{"aria-label":"close",onClick:r,color:"secondary",size:"large",children:w.jsx(SR,{})},"close")]})};var t1={},xY=Zt;Object.defineProperty(t1,"__esModule",{value:!0});var kR=t1.default=void 0,CY=xY(on()),SY=w;kR=t1.default=(0,CY.default)((0,SY.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined");const PR=d.createContext(void 0);function ot(){const e=d.useContext(PR);if(e===void 0)throw new Error(["MUI: Could not find the data grid context.","It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.","This can also happen if you are bundling multiple versions of the data grid."].join(` `));return e}const MR=d.createContext(void 0),Le=()=>{const e=d.useContext(MR);if(!e)throw new Error("MUI: useGridRootProps should only be used inside the DataGrid, DataGridPro or DataGridPremium component.");return e},IR=d.createContext(void 0);function Fi(){const e=d.useContext(IR);if(e===void 0)throw new Error(["MUI: Could not find the data grid private context.","It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.","This can also happen if you are bundling multiple versions of the data grid."].join(` `));return e}const jS={};function n1(e,t){const n=d.useRef(jS);return n.current===jS&&(n.current=e(t)),n}const kY=[];function ER(e){d.useEffect(e,kY)}const os=(e,t="warning")=>{let n=!1;const r=Array.isArray(e)?e.join(` `):e;return()=>{n||(n=!0,t==="error"?console.error(r):console.warn(r))}},PY=Object.is;function RR(e,t){if(e===t)return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=0,r=0;for(const o in e)if(n+=1,!PY(e[o],t[o])||!(o in t))return!1;for(const o in t)r+=1;return n===r}os(["MUI: `useGridSelector` has been called before the initialization of the state.","This hook can only be used inside the context of the grid."]);function MY(e){return e.acceptsApiRef}function zS(e,t){return MY(t)?t(e):t(e.current.state)}const IY=Object.is,r1=RR,EY=()=>({state:null,equals:null,selector:null}),Ee=(e,t,n=IY)=>{const r=n1(EY),o=r.current.selector!==null,[s,i]=d.useState(o?null:zS(e,t));return r.current.state=s,r.current.equals=n,r.current.selector=t,ER(()=>e.current.store.subscribe(()=>{const l=zS(e,r.current.selector);r.current.equals(r.current.state,l)||(r.current.state=l,i(l))})),s};function st(e){return Fe("MuiDataGrid",e)}const z=De("MuiDataGrid",["actionsCell","aggregationColumnHeader","aggregationColumnHeader--alignLeft","aggregationColumnHeader--alignCenter","aggregationColumnHeader--alignRight","aggregationColumnHeaderLabel","autoHeight","autosizing","booleanCell","cell--editable","cell--editing","cell--textCenter","cell--textLeft","cell--textRight","cell--withRenderer","cell--rangeTop","cell--rangeBottom","cell--rangeLeft","cell--rangeRight","cell--selectionMode","cell","cellContent","cellCheckbox","cellSkeleton","checkboxInput","columnHeader--alignCenter","columnHeader--alignLeft","columnHeader--alignRight","columnHeader--dragging","columnHeader--moving","columnHeader--numeric","columnHeader--sortable","columnHeader--sorted","columnHeader--filtered","columnHeader","columnHeaderCheckbox","columnHeaderDraggableContainer","columnHeaderDropZone","columnHeaderTitle","columnHeaderTitleContainer","columnHeaderTitleContainerContent","columnGroupHeader","columnHeader--filledGroup","columnHeader--emptyGroup","columnHeader--showColumnBorder","columnHeaders","columnHeadersInner","columnHeadersInner--scrollable","columnSeparator--resizable","columnSeparator--resizing","columnSeparator--sideLeft","columnSeparator--sideRight","columnSeparator","columnsPanel","columnsPanelRow","detailPanel","detailPanels","detailPanelToggleCell","detailPanelToggleCell--expanded","footerCell","panel","panelHeader","panelWrapper","panelContent","panelFooter","paper","editBooleanCell","editInputCell","filterForm","filterFormDeleteIcon","filterFormLogicOperatorInput","filterFormColumnInput","filterFormOperatorInput","filterFormValueInput","filterIcon","footerContainer","headerFilterRow","iconButtonContainer","iconSeparator","main","menu","menuIcon","menuIconButton","menuOpen","menuList","overlay","overlayWrapper","overlayWrapperInner","root","root--densityStandard","root--densityComfortable","root--densityCompact","root--disableUserSelection","row","row--editable","row--editing","row--lastVisible","row--dragging","row--dynamicHeight","row--detailPanelExpanded","rowReorderCellPlaceholder","rowCount","rowReorderCellContainer","rowReorderCell","rowReorderCell--draggable","scrollArea--left","scrollArea--right","scrollArea","selectedRowCount","sortIcon","toolbarContainer","toolbarFilterList","virtualScroller","virtualScrollerContent","virtualScrollerContent--overflowed","virtualScrollerRenderZone","pinnedColumns","pinnedColumns--left","pinnedColumns--right","pinnedColumnHeaders","pinnedColumnHeaders--left","pinnedColumnHeaders--right","withBorderColor","cell--withRightBorder","columnHeader--withRightBorder","treeDataGroupingCell","treeDataGroupingCellToggle","groupingCriteriaCell","groupingCriteriaCellToggle","pinnedRows","pinnedRows--top","pinnedRows--bottom","pinnedRowsRenderZone"]);var Rp="NOT_FOUND";function RY(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:Rp},put:function(r,o){t={key:r,value:o}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function TY(e,t){var n=[];function r(l){var a=n.findIndex(function(u){return t(l,u.key)});if(a>-1){var c=n[a];return a>0&&(n.splice(a,1),n.unshift(c)),c.value}return Rp}function o(l,a){r(l)===Rp&&(n.unshift({key:l,value:a}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var _Y=function(t,n){return t===n};function OY(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var o=n.length,s=0;s1?t-1:0),r=1;r{if(i.length>0)throw new Error("Unsupported number of selectors");let l;if(e&&t&&n&&r&&o&&s)l=(a,c)=>{const u=Xl(a),f=c??(u?a.current.instanceId:Ql),h=u?a.current.state:a,p=e(h,f),m=t(h,f),g=n(h,f),x=r(h,f),v=o(h,f);return s(p,m,g,x,v)};else if(e&&t&&n&&r&&o)l=(a,c)=>{const u=Xl(a),f=c??(u?a.current.instanceId:Ql),h=u?a.current.state:a,p=e(h,f),m=t(h,f),g=n(h,f),x=r(h,f);return o(p,m,g,x)};else if(e&&t&&n&&r)l=(a,c)=>{const u=Xl(a),f=c??(u?a.current.instanceId:Ql),h=u?a.current.state:a,p=e(h,f),m=t(h,f),g=n(h,f);return r(p,m,g)};else if(e&&t&&n)l=(a,c)=>{const u=Xl(a),f=c??(u?a.current.instanceId:Ql),h=u?a.current.state:a,p=e(h,f),m=t(h,f);return n(p,m)};else if(e&&t)l=(a,c)=>{const u=Xl(a),f=c??(u?a.current.instanceId:Ql),h=u?a.current.state:a,p=e(h,f);return t(p)};else throw new Error("Missing arguments");return l.acceptsApiRef=!0,l},Ht=(...e)=>{const t=(...n)=>{var r,o;const[s,i]=n,l=Xl(s),a=l?s.current.instanceId:i??Ql,c=l?s.current.state:s,{cache:u}=LY;if(u.get(a)&&(r=u.get(a))!=null&&r.get(e)){var f;return(f=u.get(a))==null?void 0:f.get(e)(c,a)}const h=DY(...e);return u.get(a)||u.set(a,new Map),(o=u.get(a))==null||o.set(e,h),h(c,a)};return t.acceptsApiRef=!0,t},al=e=>e.columns,Ps=Ze(al,e=>e.orderedFields),pc=Ze(al,e=>e.lookup),Qo=Ht(Ps,pc,(e,t)=>e.map(n=>t[n])),Co=Ze(al,e=>e.columnVisibilityModel),Rn=Ht(Qo,Co,(e,t)=>e.filter(n=>t[n.field]!==!1)),pm=Ht(Rn,e=>e.map(t=>t.field)),qa=Ht(Rn,e=>{const t=[];let n=0;for(let r=0;r{const n=e.length;return n===0?0:t[n-1]+e[n-1].computedWidth}),TR=Ht(Qo,e=>e.filter(t=>t.filterable)),NY=Ht(Qo,e=>e.reduce((t,n)=>(n.filterable&&(t[n.field]=n),t),{})),hm=e=>e.columnGrouping,AY=Ht(hm,e=>{var t;return(t=e==null?void 0:e.unwrappedGroupingModel)!=null?t:{}}),_R=Ht(hm,e=>{var t;return(t=e==null?void 0:e.lookup)!=null?t:{}}),jY=Ht(hm,e=>{var t;return(t=e==null?void 0:e.headerStructure)!=null?t:[]}),Sd=Ze(hm,e=>{var t;return(t=e==null?void 0:e.maxDepth)!=null?t:0}),Fo=e=>e.rows,mm=Ze(Fo,e=>e.totalRowCount),zY=Ze(Fo,e=>e.loading),BY=Ze(Fo,e=>e.totalTopLevelRowCount),xs=Ze(Fo,e=>e.dataRowIdToModelLookup),Tp=Ze(Fo,e=>e.dataRowIdToIdLookup),xo=Ze(Fo,e=>e.tree),HY=Ze(Fo,e=>e.groupingName),BS=Ze(Fo,e=>e.treeDepths),gm=Ht(Fo,e=>{const t=Object.entries(e.treeDepths);return t.length===0?1:t.filter(([,n])=>n>0).map(([n])=>Number(n)).sort((n,r)=>r-n)[0]+1}),Zc=Ze(Fo,e=>e.dataRowIds),WY=Ze(Fo,e=>e==null?void 0:e.additionalRowGroups),hc=Ht(WY,e=>{var t,n;const r=e==null?void 0:e.pinnedRows;return{bottom:r==null||(t=r.bottom)==null?void 0:t.map(o=>{var s;return{id:o.id,model:(s=o.model)!=null?s:{}}}),top:r==null||(n=r.top)==null?void 0:n.map(o=>{var s;return{id:o.id,model:(s=o.model)!=null?s:{}}})}}),VY=Ze(hc,e=>{var t,n;return((e==null||(t=e.top)==null?void 0:t.length)||0)+((e==null||(n=e.bottom)==null?void 0:n.length)||0)}),OR=()=>{var e;const t=Fi(),n=Le(),r=Ee(t,Rn),o=Ee(t,mm),s=Ee(t,Sd),i=Ee(t,VY);let l="grid";return(e=n.experimentalFeatures)!=null&&e.ariaV7&&n.treeData&&(l="treegrid"),{role:l,"aria-colcount":r.length,"aria-rowcount":s+1+i+o,"aria-multiselectable":!n.disableMultipleRowSelection}},GY=e=>{const{classes:t}=e;return le({root:["main"]},st,t)},UY=bn("div",{name:"MuiDataGrid",slot:"Main",overridesResolver:(e,t)=>t.main})(()=>({position:"relative",flexGrow:1,display:"flex",flexDirection:"column",overflow:"hidden"})),YY=d.forwardRef((e,t)=>{var n;const r=Le(),o=GY(r),s=(n=r.experimentalFeatures)!=null&&n.ariaV7?OR:null,i=typeof s=="function"?s():null;return w.jsx(UY,y({ref:t,className:o.root,ownerState:r},i,{children:e.children}))}),$R=e=>e.sorting,s1=Ze($R,e=>e.sortedRows),i1=Ht(s1,xs,(e,t)=>e.map(n=>{var r;return{id:n,model:(r=t[n])!=null?r:{}}})),Wr=Ze($R,e=>e.sortModel),KY=Ht(Wr,e=>e.reduce((n,r,o)=>(n[r.field]={sortDirection:r.sort,sortIndex:e.length>1?o+1:void 0},n),{})),l1=e=>e.filter,In=Ze(l1,e=>e.filterModel);Ze(In,e=>e.quickFilterValues);const ZY=e=>e.visibleRowsLookup,FR=Ze(l1,e=>e.filteredRowsLookup);Ze(l1,e=>e.filteredDescendantCountLookup);const Di=Ht(ZY,i1,(e,t)=>t.filter(n=>e[n.id]!==!1)),hu=Ht(Di,e=>e.map(t=>t.id)),qY=Ht(FR,i1,(e,t)=>t.filter(n=>e[n.id]!==!1)),XY=Ht(qY,e=>e.map(t=>t.id)),DR=Ht(Di,xo,gm,(e,t,n)=>n<2?e:e.filter(r=>{var o;return((o=t[r.id])==null?void 0:o.depth)===0})),LR=Ze(Di,e=>e.length),vm=Ze(DR,e=>e.length),QY=Ht(In,pc,(e,t)=>{var n;return(n=e.items)==null?void 0:n.filter(r=>{var o,s;if(!r.field)return!1;const i=t[r.field];if(!(i!=null&&i.filterOperators)||(i==null||(o=i.filterOperators)==null?void 0:o.length)===0)return!1;const l=i.filterOperators.find(a=>a.value===r.operator);return l?!l.InputComponent||r.value!=null&&((s=r.value)==null?void 0:s.toString())!=="":!1})}),JY=Ht(QY,e=>e.reduce((n,r)=>(n[r.field]?n[r.field].push(r):n[r.field]=[r],n),{})),ym=e=>e.focus,vr=Ze(ym,e=>e.cell),eK=Ze(ym,e=>e.columnHeader);Ze(ym,e=>e.columnHeaderFilter);const _p=Ze(ym,e=>e.columnGroupHeader),bm=e=>e.tabIndex,Op=Ze(bm,e=>e.cell),NR=Ze(bm,e=>e.columnHeader);Ze(bm,e=>e.columnHeaderFilter);const tK=Ze(bm,e=>e.columnGroupHeader),a1=e=>e.density,nK=Ze(a1,e=>e.value),mc=Ze(a1,e=>e.factor),py=e=>e.columnMenu;function rK(e){const{VirtualScrollerComponent:t,ColumnHeadersProps:n,children:r}=e,o=Fi(),s=Le(),i=d.useRef(null),l=Ee(o,Rn),a=Ee(o,JY),c=Ee(o,KY),u=Ee(o,qa),f=Ee(o,NR),h=Ee(o,Op),p=Ee(o,tK),m=Ee(o,eK),g=Ee(o,_p),x=Ee(o,mc),v=Ee(o,Sd),b=Ee(o,py),C=Ee(o,Co),S=Ee(o,jY),M=!(p===null&&f===null&&h===null);xt(()=>{o.current.computeSizeAndPublishResizeEvent();const O=i.current;if(typeof ResizeObserver>"u")return()=>{};let $;const F=new ResizeObserver(()=>{$=requestAnimationFrame(()=>{o.current.computeSizeAndPublishResizeEvent()})});return O&&F.observe(O),()=>{$&&window.cancelAnimationFrame($),O&&F.unobserve(O)}},[o]);const k=d.useRef(null),P=d.useRef(null),I=d.useRef(null);o.current.register("private",{columnHeadersContainerElementRef:P,columnHeadersElementRef:k,virtualScrollerRef:I,mainElementRef:i});const N=!!o.current.getRootDimensions();return w.jsxs(YY,{ref:i,children:[w.jsx(s.slots.columnHeaders,y({ref:P,innerRef:k,visibleColumns:l,filterColumnLookup:a,sortColumnLookup:c,columnPositions:u,columnHeaderTabIndexState:f,columnGroupHeaderTabIndexState:p,columnHeaderFocus:m,columnGroupHeaderFocus:g,densityFactor:x,headerGroupingMaxDepth:v,columnMenuState:b,columnVisibility:C,columnGroupsHeaderStructure:S,hasOtherElementInTabSequence:M},n)),N&&w.jsx(t,{ref:I}),r]})}function oK(){var e;const t=Le();return t.hideFooter?null:w.jsx(t.slots.footer,y({},(e=t.slotProps)==null?void 0:e.footer))}const Yn="auto-generated-group-node-root",Ea=Symbol("mui.id_autogenerated"),sK=()=>({type:"group",id:Yn,depth:-1,groupingField:null,groupingKey:null,isAutoGenerated:!0,children:[],childrenFromPath:{},childrenExpanded:!0,parent:null});function iK(e,t,n="A row was provided without id in the rows prop:"){if(e==null)throw new Error(["MUI: The data grid component requires all rows to have a unique `id` property.","Alternatively, you can use the `getRowId` prop to specify a custom id for each row.",n,JSON.stringify(t)].join(` diff --git a/assets/index-Bp-XQTld.css b/assets/index-D18MOdYQ.css similarity index 100% rename from assets/index-Bp-XQTld.css rename to assets/index-D18MOdYQ.css diff --git a/assets/maplibre-gl-BkmzOCP1.js b/assets/maplibre-gl-C6P4tEXy.js similarity index 99% rename from assets/maplibre-gl-BkmzOCP1.js rename to assets/maplibre-gl-C6P4tEXy.js index c398954..83dfaa1 100644 --- a/assets/maplibre-gl-BkmzOCP1.js +++ b/assets/maplibre-gl-C6P4tEXy.js @@ -1,4 +1,4 @@ -import{g as pp,c as dp}from"./index-JUz72BTa.js";function mp(qs,Xo){for(var Tr=0;TrXi[Er]})}}}return Object.freeze(Object.defineProperty(qs,Symbol.toStringTag,{value:"Module"}))}var vh={exports:{}};(function(qs,Xo){(function(Tr,Xi){qs.exports=Xi()})(dp,function(){var Tr,Xi,Er;function _n(h,bi){if(!Tr)Tr=bi;else if(!Xi)Xi=bi;else{var lr="var sharedChunk = {}; ("+Tr+")(sharedChunk); ("+Xi+")(sharedChunk);",Wi={};Tr(Wi),Er=bi(Wi),typeof window<"u"&&(Er.workerUrl=window.URL.createObjectURL(new Blob([lr],{type:"text/javascript"})))}}_n(["exports"],function(h){var bi=lr;function lr(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}function Wi(i,e,r,s){const l=new bi(i,e,r,s);return function(u){return l.solve(u)}}lr.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const tt=Wi(.25,.1,.25,1);function ae(i,e,r){return Math.min(r,Math.max(e,i))}function Gr(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function wi(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let vt=1;function is(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function yn(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function Hi(i,e,r){const s={};for(const l in i)e.call(r||this,i[l],l,i)&&(s[l]=i[l]);return s}function si(i){return Array.isArray(i)?i.map(si):typeof i=="object"&&i?yn(i,si):i}const xn={};function Pt(i){xn[i]||(typeof console<"u"&&console.warn(i),xn[i]=!0)}function Fi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function cr(i){let e=0;for(let r,s,l=0,u=i.length,d=u-1;l@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,u)=>{const d=l||u;return e[s]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let Ki,Ir,Ji=null;function qr(i){if(Ji==null){const e=i.navigator?i.navigator.userAgent:null;Ji=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Ji}function hr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const ur={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),s=r.getContext("2d");if(!s)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,s.drawImage(i,0,0,i.width,i.height),s.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(Ki||(Ki=document.createElement("a")),Ki.href=i,Ki.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Ir==null&&(Ir=matchMedia("(prefers-reduced-motion: reduce)")),Ir.matches)}};var Re=Yi;function Yi(i,e){this.x=i,this.y=e}Yi.prototype={clone:function(){return new Yi(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Yi.convert=function(i){return i instanceof Yi?i:Array.isArray(i)?new Yi(i[0],i[1]):i};const Qi={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Ti="mapbox-tiles";let pr,vn=500,Zr=50;function bn(){typeof caches>"u"||pr||(pr=caches.open(Ti))}let jr=1/0;const Oi={supported:!1,testSupport:function(i){!wn&&er&&(ai?Xr(i):Ui=i)}};let Ui,er,wn=!1,ai=!1;function Xr(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,er),i.isContextLost())return;Oi.supported=!0}catch{}i.deleteTexture(e),wn=!0}typeof document<"u"&&(er=document.createElement("img"),er.onload=function(){Ui&&Xr(Ui),Ui=null,ai=!0},er.onerror=function(){wn=!0,Ui=null},er.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Tn={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Tn);class Ei extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const _i=gi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function rs(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:_i(),signal:r.signal});let l=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),((d,f,g)=>{u||fetch(s).then(x=>x.ok?((w,E,A)=>{(i.type==="arrayBuffer"?w.arrayBuffer():i.type==="json"?w.json():w.text()).then(z=>{u||(l=!0,e(null,z,w.headers.get("Cache-Control"),w.headers.get("Expires")))}).catch(z=>{u||e(new Error(z.message))})})(x):x.blob().then(w=>e(new Ei(x.status,x.statusText,i.url,w)))).catch(x=>{x.code!==20&&e(new Error(x.message))})})(),{cancel:()=>{u=!0,l||r.abort()}}}const tr=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(gi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!gi()){const s=i.url.substring(0,i.url.indexOf("://"));return(Qi.REGISTERED_PROTOCOLS[s]||rs)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(_i())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return rs(i,e);if(gi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,l){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const d in s.headers)u.setRequestHeader(d,s.headers[d]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{l(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(s.type==="json")try{d=JSON.parse(u.response)}catch(f){return l(f)}l(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});l(new Ei(u.status,u.statusText,s.url,d))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},Wr=function(i,e){return tr(wi(i,{type:"arrayBuffer"}),e)};function ns(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let He,Ii;He=[],Ii=0;const En=function(i,e){if(Oi.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Ii>=Qi.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return He.push(u),u}Ii++;let r=!1;const s=()=>{if(!r)for(r=!0,Ii--;He.length&&Ii{s(),u?e(u):d&&function(x,w){typeof createImageBitmap=="function"?function(E,A){const z=new Blob([new Uint8Array(E)],{type:"image/png"});createImageBitmap(z).then(k=>{A(null,k)}).catch(k=>{A(new Error(`Could not load image because of ${k.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,w):function(E,A){const z=new Image;z.onload=()=>{A(null,z),URL.revokeObjectURL(z.src),z.onload=null,window.requestAnimationFrame(()=>{z.src=Hr})},z.onerror=()=>A(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 k=new Blob([new Uint8Array(E)],{type:"image/png"});z.src=E.byteLength?URL.createObjectURL(k):Hr}(x,w)}(d,(x,w)=>{x!=null?e(x):w!=null&&e(null,w,{cacheControl:f,expires:g})})});return{cancel:()=>{l.cancel(),s()}}};function dr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Kr(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class Vi{constructor(e,r={}){wi(this,r),this.type=e}}class mr extends Vi{constructor(e,r={}){super("error",wi({error:e},r))}}class Jr{on(e,r){return this._listeners=this._listeners||{},dr(e,r,this._listeners),this}off(e,r){return Kr(e,r,this._listeners),Kr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},dr(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new Vi(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)Kr(s,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(wi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof mr&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var ne={$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"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{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-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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},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"}}};class de{constructor(e,r,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function Sr(i){const e=i.value;return e?[new de(i.key,e,"constants have been deprecated as of v8")]:[]}function Si(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}function ct(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function bt(i){if(Array.isArray(i))return i.map(bt);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=bt(i[r]);return e}return ct(i)}class Xt extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Yr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new Yr(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Wt={kind:"null"},ge={kind:"number"},Ge={kind:"string"},Oe={kind:"boolean"},Ht={kind:"color"},oi={kind:"object"},Ve={kind:"value"},Ai={kind:"collator"},Ni={kind:"formatted"},Nt={kind:"padding"},fr={kind:"resolvedImage"};function ot(i,e){return{kind:"array",itemType:i,N:e}}function lt(i){if(i.kind==="array"){const e=lt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Ar=[Wt,ge,Ge,Oe,Ht,Ni,oi,ot(Ve),Nt,fr];function $i(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!$i(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of Ar)if(!$i(r,e))return null}}return`Expected ${lt(i)} but found ${lt(e)} instead.`}function gr(i,e){return e.some(r=>r.kind===i.kind)}function ir(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var In,Sn={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function rr(i){return(i=Math.round(i))<0?0:i>255?255:i}function P(i){return rr(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function b(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function I(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{In={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in Sn)return Sn[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var s=r.indexOf("("),l=r.indexOf(")");if(s!==-1&&l+1===r.length){var u=r.substr(0,s),d=r.substr(s+1,l-(s+1)).split(","),f=1;switch(u){case"rgba":if(d.length!==4)return null;f=b(d.pop());case"rgb":return d.length!==3?null:[P(d[0]),P(d[1]),P(d[2]),f];case"hsla":if(d.length!==4)return null;f=b(d.pop());case"hsl":if(d.length!==3)return null;var g=(parseFloat(d[0])%360+360)%360/360,x=b(d[1]),w=b(d[2]),E=w<=.5?w*(x+1):w+x-w*x,A=2*w-E;return[rr(255*I(A,E,g+1/3)),rr(255*I(A,E,g)),rr(255*I(A,E,g-1/3)),f];default:return null}}return null}}catch{}class M{constructor(e,r,s,l=1){this.r=e,this.g=r,this.b=s,this.a=l}static parse(e){if(!e)return;if(e instanceof M)return e;if(typeof e!="string")return;const r=In(e);return r?new M(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,s,l]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(s)},${l})`}toArray(){const{r:e,g:r,b:s,a:l}=this;return l===0?[0,0,0,0]:[255*e/l,255*r/l,255*s/l,l]}}M.black=new M(0,0,0,1),M.white=new M(1,1,1,1),M.transparent=new M(0,0,0,0),M.red=new M(1,0,0,1);class D{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class V{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class G{constructor(e){this.sections=e}static fromString(e){return new G([new V(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof G?e:G.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ${constructor(e){this.values=e.slice()}static parse(e){if(e instanceof $)return e;if(typeof e=="number")return new $([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new $(e)}}toString(){return JSON.stringify(this.values)}}class N{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new N({name:e,available:!1}):null}}function j(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ee(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof M||i instanceof D||i instanceof G||i instanceof $||i instanceof N)return!0;if(Array.isArray(i)){for(const e of i)if(!ee(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ee(i[e]))return!1;return!0}return!1}function oe(i){if(i===null)return Wt;if(typeof i=="string")return Ge;if(typeof i=="boolean")return Oe;if(typeof i=="number")return ge;if(i instanceof M)return Ht;if(i instanceof D)return Ai;if(i instanceof G)return Ni;if(i instanceof $)return Nt;if(i instanceof N)return fr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=oe(s);if(r){if(r===l)continue;r=Ve;break}r=l}return ot(r||Ve,e)}return oi}function se(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof M||i instanceof G||i instanceof $||i instanceof N?i.toString():JSON.stringify(i)}class Ie{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ee(e[1]))return r.error("invalid value");const s=e[1];let l=oe(s);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Ie(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class be{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ze={string:Ge,number:ge,boolean:Oe,object:oi};class Pe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,l=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in ze)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=ze[x],l++}else f=Ve;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],l++}s=ot(f,g)}else{if(!ze[u])throw new Error(`Types doesn't contain name = ${u}`);s=ze[u]}const d=[];for(;le.outputDefined())}}const Ne={"to-boolean":Oe,"to-color":Ht,"to-number":ge,"to-string":Ge};class Xe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!Ne[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=Ne[s],u=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:j(r[0],r[1],r[2],r[3]),!s))return new M(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new be(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const s of this.args){r=s.evaluate(e);const l=$.parse(r);if(l)return l}throw new be(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new be(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?G.fromString(se(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?N.fromString(se(this.args[0].evaluate(e))):se(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const qe=["Unknown","Point","LineString","Polygon"];class $e{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"?qe[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=M.parse(e)),r}}class Ue{constructor(e,r,s,l){this.name=e,this.type=r,this._evaluate=s,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const s=e[0],l=Ue.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,w]of f){g=new ls(r.registry,r.path,null,r.scope);const E=[];let A=!1;for(let z=1;z{return A=E,Array.isArray(A)?`(${A.map(lt).join(", ")})`:`(${lt(A.type)}...)`;var A}).join(" | "),w=[];for(let E=1;E=e[2]||i[1]<=e[1]||i[3]>=e[3])}function js(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*wt),Math.round(s*l*wt)]}function An(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return s*d-u*l==0&&s*u<=0&&l*d<=0}function rt(i,e){let r=!1;for(let d=0,f=e.length;d(s=i)[1]!=(u=g[x+1])[1]>s[1]&&s[0]<(u[0]-l[0])*(s[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var s,l,u;return r}function Wo(i,e){for(let r=0;r0&&f<0||d<0&&f>0}function Ho(i,e,r){for(const x of r)for(let w=0;wr[2]){const l=.5*s;let u=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;u===0&&(u=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=u}At(e,i)}function ja(i,e,r,s){const l=Math.pow(2,s.z)*wt,u=[s.x*wt,s.y*wt],d=[];for(const f of i)for(const g of f){const x=[g.x+u[0],g.y+u[1]];Ks(x,e,r,l),d.push(x)}return d}function Xa(i,e,r,s){const l=Math.pow(2,s.z)*wt,u=[s.x*wt,s.y*wt],d=[];for(const g of i){const x=[];for(const w of g){const E=[w.x+u[0],w.y+u[1]];At(e,E),x.push(E)}d.push(x)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of d)for(const x of g)Ks(x,e,r,l)}var f;return d}class Cr{constructor(e,r){this.type=Oe,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ee(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l{e&&!as(r)&&(e=!1)}),e}function Qr(i){if(i instanceof Ue&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Qr(r)&&(e=!1)}),e}function Cn(i,e){if(i instanceof Ue&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!Cn(s,e)&&(r=!1)}),r}class os{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const s=e[1];return r.scope.has(s)?new os(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class ls{constructor(e,r=[],s,l=new Yr,u=[]){this.registry=e,this.path=r,this.key=r.map(d=>`[${d}]`).join(""),this.scope=l,this.errors=u,this.expectedType=s}parse(e,r,s,l,u={}){return r?this.concat(r,s,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(l,u,d){return d==="assert"?new Pe(u,[l]):d==="coerce"?new Xe(u,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[l];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,g=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Ie)&&d.type.kind!=="resolvedImage"&&zn(d)){const f=new $e;try{d=new Ie(d.type,d.evaluate(f))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const l=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new ls(this.registry,l,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Xt(s,e))}checkSubtype(e,r){const s=$i(e,r);return s&&this.error(s),s}}function zn(i){if(i instanceof os)return zn(i.boundExpression);if(i instanceof Ue&&i.name==="error"||i instanceof It||i instanceof Cr)return!1;const e=i instanceof Xe||i instanceof Pe;let r=!0;return i.eachChild(s=>{r=e?r&&zn(s):r&&s instanceof Ie}),!!r&&as(i)&&Cn(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function cs(i,e){const r=i.length-1;let s,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),s=i[f],l=i[f+1],s<=e){if(f===r||ee))throw new be("Input is not a number.");d=f-1}return 0}class Mn{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,ge);if(!s)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const E=r.parse(g,w,u);if(!E)return null;u=u||E.type,l.push([f,E])}return new Mn(u,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;return l>=r[u-1]?s[u-1].evaluate(e):s[cs(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function _t(i,e,r){return i*(1-r)+e*r}var kn=Object.freeze({__proto__:null,number:_t,color:function(i,e,r){return new M(_t(i.r,e.r,r),_t(i.g,e.g,r),_t(i.b,e.b,r),_t(i.a,e.a,r))},array:function(i,e,r){return i.map((s,l)=>_t(s,e[l],r))},padding:function(i,e,r){const s=i.values,l=e.values;return new $([_t(s[0],l[0],r),_t(s[1],l[1],r),_t(s[2],l[2],r),_t(s[3],l[3],r)])}});const Js=.95047,Wa=1.08883,Ha=4/29,hs=6/29,Ys=3*hs*hs,Ko=Math.PI/180,Jo=180/Math.PI;function Qs(i){return i>.008856451679035631?Math.pow(i,1/3):i/Ys+Ha}function ea(i){return i>hs?i*i*i:Ys*(i-Ha)}function ta(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function ia(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ka(i){const e=ia(i.r),r=ia(i.g),s=ia(i.b),l=Qs((.4124564*e+.3575761*r+.1804375*s)/Js),u=Qs((.2126729*e+.7151522*r+.072175*s)/1);return{l:116*u-16,a:500*(l-u),b:200*(u-Qs((.0193339*e+.119192*r+.9503041*s)/Wa)),alpha:i.a}}function it(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,s=isNaN(i.b)?e:e-i.b/200;return e=1*ea(e),r=Js*ea(r),s=Wa*ea(s),new M(ta(3.2404542*r-1.5371385*e-.4985314*s),ta(-.969266*r+1.8760108*e+.041556*s),ta(.0556434*r-.2040259*e+1.0572252*s),i.alpha)}function Yo(i,e,r){const s=e-i;return i+r*(s>180||s<-180?s-360*Math.round(s/360):s)}const Pn={forward:Ka,reverse:it,interpolate:function(i,e,r){return{l:_t(i.l,e.l,r),a:_t(i.a,e.a,r),b:_t(i.b,e.b,r),alpha:_t(i.alpha,e.alpha,r)}}},Dn={forward:function(i){const{l:e,a:r,b:s}=Ka(i),l=Math.atan2(s,r)*Jo;return{h:l<0?l+360:l,c:Math.sqrt(r*r+s*s),l:e,alpha:i.a}},reverse:function(i){const e=i.h*Ko,r=i.c;return it({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:Yo(i.h,e.h,r),c:_t(i.c,e.c,r),l:_t(i.l,e.l,r),alpha:_t(i.alpha,e.alpha,r)}}};var Ja=Object.freeze({__proto__:null,lab:Pn,hcl:Dn});class li{constructor(e,r,s,l,u){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let u=0;if(e.name==="exponential")u=ra(r,e.base,s,l);else if(e.name==="linear")u=ra(r,1,s,l);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new bi(d[0],d[1],d[2],d[3]).solve(ra(r,1,s,l))}return u}static parse(e,r){let[s,l,u,...d]=e;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,ge),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Ht:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const k=r.parse(E,z,g);if(!k)return null;g=g||k.type,f.push([w,k])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new li(g,s,l,u,f):r.error(`Type ${lt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;if(l>=r[u-1])return s[u-1].evaluate(e);const d=cs(r,l),f=li.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=s[d].evaluate(e),x=s[d+1].evaluate(e);return this.operator==="interpolate"?kn[this.type.kind.toLowerCase()](g,x,f):this.operator==="interpolate-hcl"?Dn.reverse(Dn.interpolate(Dn.forward(g),Dn.forward(x),f)):Pn.reverse(Pn.interpolate(Pn.forward(g),Pn.forward(x),f))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ra(i,e,r,s){const l=s-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class us{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const u=[];for(const f of e.slice(1)){const g=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}if(!s)throw new Error("No output type");const d=l&&u.some(f=>$i(l,f.type));return new us(d?Ve:s,u)}evaluate(e){let r,s=null,l=0;for(const u of this.args)if(l++,s=u.evaluate(e),s&&s instanceof N&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class ps{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u=s.length)throw new be(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new be(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class sa{constructor(e,r){this.type=Oe,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ve),l=r.parse(e[2],2,Ve);return s&&l?gr(s.type,[Oe,Ge,ge,Wt,Ve])?new sa(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${lt(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!ir(r,["boolean","string","number","null"]))throw new be(`Expected first argument to be of type boolean, string, number or null, but found ${lt(oe(r))} instead.`);if(!ir(s,["string","array"]))throw new be(`Expected second argument to be of type array or string, but found ${lt(oe(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ds{constructor(e,r,s){this.type=ge,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ve),l=r.parse(e[2],2,Ve);if(!s||!l)return null;if(!gr(s.type,[Oe,Ge,ge,Wt,Ve]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${lt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ge);return u?new ds(s,l,u):null}return new ds(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!ir(r,["boolean","string","number","null"]))throw new be(`Expected first argument to be of type boolean, string, number or null, but found ${lt(oe(r))} instead.`);if(!ir(s,["string","array"]))throw new be(`Expected second argument to be of type array or string, but found ${lt(oe(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class aa{constructor(e,r,s,l,u,d){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let x=2;xNumber.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof k=="number"&&Math.floor(k)!==k)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,oe(k)))return null}else s=oe(k);if(u[String(k)]!==void 0)return A.error("Branch labels must be unique.");u[String(k)]=d.length}const z=r.parse(E,x,l);if(!z)return null;l=l||z.type,d.push(z)}const f=r.parse(e[1],1,Ve);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new aa(s,l,f,u,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(oe(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class oa{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class ms{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ve),l=r.parse(e[2],2,ge);if(!s||!l)return null;if(!gr(s.type,[ot(Ve),Ge,Ve]))return r.error(`Expected first argument to be of type array or string, but found ${lt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ge);return u?new ms(s.type,s,l,u):null}return new ms(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!ir(r,["string","array"]))throw new be(`Expected first argument to be of type array or string, but found ${lt(oe(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ya(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Qa(i,e,r,s){return s.compare(e,r)===0}function en(i,e,r){const s=i!=="=="&&i!=="!=";return class bh{constructor(u,d,f){this.type=Oe,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let g=d.parse(u[1],1,Ve);if(!g)return null;if(!Ya(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${lt(g.type)}'.`);let x=d.parse(u[2],2,Ve);if(!x)return null;if(!Ya(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${lt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${lt(g.type)}' and '${lt(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Pe(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Pe(g.type,[x])));let w=null;if(u.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(w=d.parse(u[3],3,Ai),!w)return null}return new bh(g,x,w)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=oe(d),x=oe(f);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new be(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=oe(d),x=oe(f);if(g.kind!=="string"||x.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Qo=en("==",function(i,e,r){return e===r},Qa),el=en("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!Qa(0,e,r,s)}),tl=en("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),rl=en("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),nl=en(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class la{constructor(e,r,s,l,u){this.type=Ge,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,ge);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,Ge),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,Ge),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,ge),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,ge),!g)?null:new la(s,u,d,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class fs{constructor(e){this.type=Ni,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,ge),!g))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,ot(Ge)),!x))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,Ht),!w))return null;const E=l[l.length-1];E.scale=g,E.font=x,E.textColor=w}else{const g=r.parse(e[d],1,Ve);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new fs(l)}evaluate(e){return new G(this.sections.map(r=>{const s=r.content.evaluate(e);return oe(s)===fr?new V("",s,null,null,null):new V(se(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class ca{constructor(e){this.type=fr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ge);return s?new ca(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=N.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class ha{constructor(e){this.type=ge,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${lt(s.type)} instead.`):new ha(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new be(`Expected value to be of type string or array, but found ${lt(oe(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const tn={"==":Qo,"!=":el,">":il,"<":tl,">=":nl,"<=":rl,array:Pe,at:na,boolean:Pe,case:oa,coalesce:us,collator:It,format:fs,image:ca,in:sa,"index-of":ds,interpolate:li,"interpolate-hcl":li,"interpolate-lab":li,length:ha,let:ps,literal:Ie,match:aa,number:Pe,"number-format":la,object:Pe,slice:ms,step:Mn,string:Pe,"to-boolean":Xe,"to-color":Xe,"to-number":Xe,"to-string":Xe,var:os,within:Cr};function eo(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=l?l.evaluate(i):1,d=j(e,r,s,u);if(d)throw new be(d);return new M(e/255*u,r/255*u,s/255*u,u)}function to(i,e){return i in e}function ua(i,e){const r=e[i];return r===void 0?null:r}function _r(i){return{type:i}}function io(i){return{result:"success",value:i}}function rn(i){return{result:"error",value:i}}function nn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Tt(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function pa(i){return!!i.expression&&i.expression.interpolated}function Ae(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function sn(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function yt(i){return i}function ht(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(pa(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?M.parse:$.parse;(i=Si({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],x(w[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!Ja[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let d,f,g;if(u==="exponential")d=no;else if(u==="interval")d=sl;else if(u==="categorical"){d=ro,f=Object.create(null);for(const x of i.stops)f[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);d=al}if(s){const x={},w=[];for(let z=0;zz[0]),evaluate:({zoom:z},k)=>no({stops:E,base:i.base},e,z).evaluate(z,k)}}if(l){const x=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:li.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>d(i,e,w,f,g)}}return{kind:"source",evaluate(x,w){const E=w&&w.properties?w.properties[i.property]:void 0;return E===void 0?yr(i.default,e.default):d(i,e,E,f,g)}}}function yr(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function ro(i,e,r,s,l){return yr(typeof r===l?s[r]:void 0,i.default,e.default)}function sl(i,e,r){if(Ae(r)!=="number")return yr(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=cs(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function no(i,e,r){const s=i.base!==void 0?i.base:1;if(Ae(r)!=="number")return yr(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const u=cs(i.stops.map(w=>w[0]),r),d=function(w,E,A,z){const k=z-A,U=w-A;return k===0?0:E===1?U/k:(Math.pow(E,U)-1)/(Math.pow(E,k)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],g=i.stops[u+1][1];let x=kn[e.type]||yt;if(i.colorSpace&&i.colorSpace!=="rgb"){const w=Ja[i.colorSpace];x=(E,A)=>w.reverse(w.interpolate(w.forward(E),w.forward(A),d))}return typeof f.evaluate=="function"?{evaluate(...w){const E=f.evaluate.apply(void 0,w),A=g.evaluate.apply(void 0,w);if(E!==void 0&&A!==void 0)return x(E,A,d)}}:x(f,g,d)}function al(i,e,r){switch(e.type){case"color":r=M.parse(r);break;case"formatted":r=G.fromString(r.toString());break;case"resolvedImage":r=N.fromString(r.toString());break;case"padding":r=$.parse(r);break;default:Ae(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return yr(r,i.default,e.default)}Ue.register(tn,{error:[{kind:"error"},[Ge],(i,[e])=>{throw new be(e.evaluate(i))}],typeof:[Ge,[Ve],(i,[e])=>lt(oe(e.evaluate(i)))],"to-rgba":[ot(ge,4),[Ht],(i,[e])=>e.evaluate(i).toArray()],rgb:[Ht,[ge,ge,ge],eo],rgba:[Ht,[ge,ge,ge,ge],eo],has:{type:Oe,overloads:[[[Ge],(i,[e])=>to(e.evaluate(i),i.properties())],[[Ge,oi],(i,[e,r])=>to(e.evaluate(i),r.evaluate(i))]]},get:{type:Ve,overloads:[[[Ge],(i,[e])=>ua(e.evaluate(i),i.properties())],[[Ge,oi],(i,[e,r])=>ua(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Ve,[Ge],(i,[e])=>ua(e.evaluate(i),i.featureState||{})],properties:[oi,[],i=>i.properties()],"geometry-type":[Ge,[],i=>i.geometryType()],id:[Ve,[],i=>i.id()],zoom:[ge,[],i=>i.globals.zoom],"heatmap-density":[ge,[],i=>i.globals.heatmapDensity||0],"line-progress":[ge,[],i=>i.globals.lineProgress||0],accumulated:[Ve,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ge,_r(ge),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[ge,_r(ge),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:ge,overloads:[[[ge,ge],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[ge],(i,[e])=>-e.evaluate(i)]]},"/":[ge,[ge,ge],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[ge,[ge,ge],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[ge,[],()=>Math.LN2],pi:[ge,[],()=>Math.PI],e:[ge,[],()=>Math.E],"^":[ge,[ge,ge],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[ge,[ge],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))],log2:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ge,[ge],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ge,[ge],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ge,[ge],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ge,[ge],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ge,[ge],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ge,[ge],(i,[e])=>Math.atan(e.evaluate(i))],min:[ge,_r(ge),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[ge,_r(ge),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[ge,[ge],(i,[e])=>Math.abs(e.evaluate(i))],round:[ge,[ge],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[ge,[ge],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ge,[ge],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Oe,[Ge,Ve],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Oe,[Ve],(i,[e])=>i.id()===e.value],"filter-type-==":[Oe,[Ge],(i,[e])=>i.geometryType()===e.value],"filter-<":[Oe,[Ge,Ve],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s{const r=i.id(),s=e.value;return typeof r==typeof s&&r":[Oe,[Ge,Ve],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Oe,[Ve],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Oe,[Ge,Ve],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Oe,[Ve],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Oe,[Ge,Ve],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Oe,[Ve],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Oe,[Ve],(i,[e])=>e.value in i.properties()],"filter-has-id":[Oe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Oe,[ot(Ge)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Oe,[ot(Ve)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Oe,[Ge,ot(Ve)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Oe,[Ge,ot(Ve)],(i,[e,r])=>function(s,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===s)return!0;l[f]>s?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Oe,overloads:[[[Oe,Oe],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[_r(Oe),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Oe,overloads:[[[Oe,Oe],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[_r(Oe),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Oe,[Oe],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Oe,[Ge],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Ge,[Ge],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Ge,[Ge],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Ge,_r(Ve),(i,e)=>e.map(r=>se(r.evaluate(i))).join("")],"resolved-locale":[Ge,[Ai],(i,[e])=>e.evaluate(i).resolvedLocale()]});class da{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new $e,this._defaultValue=r?function(s){return s.type==="color"&&sn(s.default)?new M(0,0,0,0):s.type==="color"?M.parse(s.default)||null:s.type==="padding"?$.parse(s.default)||null:s.default===void 0?null:s.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new be(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Ln(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in tn}function Bn(i,e){const r=new ls(tn,[],e?function(l){const u={color:Ht,string:Ge,number:ge,enum:Ge,boolean:Oe,formatted:Ni,padding:Nt,resolvedImage:fr};return l.type==="array"?ot(u[l.value]||Ve,l.length):u[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?io(new da(s,e)):rn(r.errors)}class gs{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Qr(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}}class Rn{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Qr(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}interpolationFactor(e,r,s){return this.interpolationType?li.interpolationFactor(this.interpolationType,e,r,s):0}}function so(i,e){const r=Bn(i,e);if(r.result==="error")return r;const s=r.value.expression,l=as(s);if(!l&&!nn(e))return rn([new Xt("","data expressions not supported")]);const u=Cn(s,["zoom"]);if(!u&&!Tt(e))return rn([new Xt("","zoom expressions not supported")]);const d=ys(s);return d||u?d instanceof Xt?rn([d]):d instanceof li&&!pa(e)?rn([new Xt("",'"interpolate" expressions cannot be used with this property')]):io(d?new Rn(l?"camera":"composite",r.value,d.labels,d instanceof li?d.interpolation:void 0):new gs(l?"constant":"source",r.value)):rn([new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class _s{constructor(e,r){this._parameters=e,this._specification=r,Si(this,ht(this._parameters,this._specification))}static deserialize(e){return new _s(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ys(i){let e=null;if(i instanceof ps)e=ys(i.result);else if(i instanceof us){for(const r of i.args)if(e=ys(r),e)break}else(i instanceof Mn||i instanceof li)&&i.input instanceof Ue&&i.input.name==="zoom"&&(e=i);return e instanceof Xt||i.eachChild(r=>{const s=ys(r);s instanceof Xt?e=s:!e&&s?e=new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Xt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Ci(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},u=i.style,d=i.styleSpec;let f=[];const g=Ae(r);if(g!=="object")return[new de(e,r,`object expected, ${g} found`)];for(const x in r){const w=x.split(".")[0],E=s[w]||s["*"];let A;if(l[w])A=l[w];else if(s[w])A=$t;else if(l["*"])A=l["*"];else{if(!s["*"]){f.push(new de(e,r[x],`unknown property "${x}"`));continue}A=$t}f=f.concat(A({key:(e&&`${e}.`)+x,value:r[x],valueSpec:E,style:u,styleSpec:d,object:r,objectKey:x},r))}for(const x in s)l[x]||s[x].required&&s[x].default===void 0&&r[x]===void 0&&f.push(new de(e,r,`missing required property "${x}"`));return f}function ao(i){const e=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,u=i.key,d=i.arrayElementValidator||$t;if(Ae(e)!=="array")return[new de(u,e,`array expected, ${Ae(e)} found`)];if(r.length&&e.length!==r.length)return[new de(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.lengths.maximum?[new de(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function oo(i){const e=i.valueSpec,r=ct(i.value.type);let s,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,x=Ae(i.value.stops)==="array"&&Ae(i.value.stops[0])==="array"&&Ae(i.value.stops[0][0])==="object",w=Ci({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(z){if(r==="identity")return[new de(z.key,z.value,'identity function may not have a "stops" property')];let k=[];const U=z.value;return k=k.concat(ao({key:z.key,value:U,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:E})),Ae(U)==="array"&&U.length===0&&k.push(new de(z.key,U,"array must have at least one stop")),k},default:function(z){return $t({key:z.key,value:z.value,valueSpec:e,style:z.style,styleSpec:z.styleSpec})}}});return r==="identity"&&f&&w.push(new de(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new de(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!pa(i.valueSpec)&&w.push(new de(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!nn(i.valueSpec)?w.push(new de(i.key,i.value,"property functions not supported")):f&&!Tt(i.valueSpec)&&w.push(new de(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new de(i.key,i.value,'"property" property is required')),w;function E(z){let k=[];const U=z.value,O=z.key;if(Ae(U)!=="array")return[new de(O,U,`array expected, ${Ae(U)} found`)];if(U.length!==2)return[new de(O,U,`array length 2 expected, length ${U.length} found`)];if(x){if(Ae(U[0])!=="object")return[new de(O,U,`object expected, ${Ae(U[0])} found`)];if(U[0].zoom===void 0)return[new de(O,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new de(O,U,"object stop key must have value")];if(u&&u>ct(U[0].zoom))return[new de(O,U[0].zoom,"stop zoom values must appear in ascending order")];ct(U[0].zoom)!==u&&(u=ct(U[0].zoom),l=void 0,d={}),k=k.concat(Ci({key:`${O}[0]`,value:U[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:ma,value:A}}))}else k=k.concat(A({key:`${O}[0]`,value:U[0],valueSpec:{},style:z.style,styleSpec:z.styleSpec},U));return Ln(bt(U[1]))?k.concat([new de(`${O}[1]`,U[1],"expressions are not allowed in function stops.")]):k.concat($t({key:`${O}[1]`,value:U[1],valueSpec:e,style:z.style,styleSpec:z.styleSpec}))}function A(z,k){const U=Ae(z.value),O=ct(z.value),W=z.value!==null?z.value:k;if(s){if(U!==s)return[new de(z.key,W,`${U} stop domain type must match previous stop domain type ${s}`)]}else s=U;if(U!=="number"&&U!=="string"&&U!=="boolean")return[new de(z.key,W,"stop domain value must be a number, string, or boolean")];if(U!=="number"&&r!=="categorical"){let Q=`number expected, ${U} found`;return nn(e)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new de(z.key,W,Q)]}return r!=="categorical"||U!=="number"||isFinite(O)&&Math.floor(O)===O?r!=="categorical"&&U==="number"&&l!==void 0&&Onew de(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new de(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Qr(r))return[new de(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Qr(r))return[new de(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Cn(r,["zoom","feature-state"]))return[new de(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!as(r))return[new de(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Fn(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(ct(r))===-1&&l.push(new de(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(ct(r))===-1&&l.push(new de(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function xs(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!xs(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const vs={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function fa(i){if(i==null)return{filter:()=>!0,needGeometry:!1};xs(i)||(i=bs(i));const e=Bn(i,vs);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:ga(i)}}function lo(i,e){return ie?1:0}function ga(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?ws(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(bs))):e==="all"?["all"].concat(i.slice(1).map(bs)):e==="none"?["all"].concat(i.slice(1).map(bs).map(zr)):e==="in"?co(i[1],i.slice(2)):e==="!in"?zr(co(i[1],i.slice(2))):e==="has"?Ts(i[1]):e==="!has"?zr(Ts(i[1])):e!=="within"||i;var r}function ws(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function co(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(lo)]]:["filter-in-small",i,["literal",e]]}}function Ts(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function zr(i){return["!",i]}function On(i){return xs(bt(i.value))?an(Si({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Es(i)}function Es(i){const e=i.value,r=i.key;if(Ae(e)!=="array")return[new de(r,e,`array expected, ${Ae(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new de(r,e,"filter array must have at least 1 element")];switch(u=u.concat(Fn({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),ct(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ct(e[1])==="$type"&&u.push(new de(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new de(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=Ae(e[1]),l!=="string"&&u.push(new de(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;dXi[Er]})}}}return Object.freeze(Object.defineProperty(qs,Symbol.toStringTag,{value:"Module"}))}var vh={exports:{}};(function(qs,Xo){(function(Tr,Xi){qs.exports=Xi()})(dp,function(){var Tr,Xi,Er;function _n(h,bi){if(!Tr)Tr=bi;else if(!Xi)Xi=bi;else{var lr="var sharedChunk = {}; ("+Tr+")(sharedChunk); ("+Xi+")(sharedChunk);",Wi={};Tr(Wi),Er=bi(Wi),typeof window<"u"&&(Er.workerUrl=window.URL.createObjectURL(new Blob([lr],{type:"text/javascript"})))}}_n(["exports"],function(h){var bi=lr;function lr(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}function Wi(i,e,r,s){const l=new bi(i,e,r,s);return function(u){return l.solve(u)}}lr.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const tt=Wi(.25,.1,.25,1);function ae(i,e,r){return Math.min(r,Math.max(e,i))}function Gr(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function wi(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let vt=1;function is(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function yn(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function Hi(i,e,r){const s={};for(const l in i)e.call(r||this,i[l],l,i)&&(s[l]=i[l]);return s}function si(i){return Array.isArray(i)?i.map(si):typeof i=="object"&&i?yn(i,si):i}const xn={};function Pt(i){xn[i]||(typeof console<"u"&&console.warn(i),xn[i]=!0)}function Fi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function cr(i){let e=0;for(let r,s,l=0,u=i.length,d=u-1;l@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,u)=>{const d=l||u;return e[s]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let Ki,Ir,Ji=null;function qr(i){if(Ji==null){const e=i.navigator?i.navigator.userAgent:null;Ji=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Ji}function hr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const ur={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),s=r.getContext("2d");if(!s)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,s.drawImage(i,0,0,i.width,i.height),s.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(Ki||(Ki=document.createElement("a")),Ki.href=i,Ki.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Ir==null&&(Ir=matchMedia("(prefers-reduced-motion: reduce)")),Ir.matches)}};var Re=Yi;function Yi(i,e){this.x=i,this.y=e}Yi.prototype={clone:function(){return new Yi(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Yi.convert=function(i){return i instanceof Yi?i:Array.isArray(i)?new Yi(i[0],i[1]):i};const Qi={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Ti="mapbox-tiles";let pr,vn=500,Zr=50;function bn(){typeof caches>"u"||pr||(pr=caches.open(Ti))}let jr=1/0;const Oi={supported:!1,testSupport:function(i){!wn&&er&&(ai?Xr(i):Ui=i)}};let Ui,er,wn=!1,ai=!1;function Xr(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,er),i.isContextLost())return;Oi.supported=!0}catch{}i.deleteTexture(e),wn=!0}typeof document<"u"&&(er=document.createElement("img"),er.onload=function(){Ui&&Xr(Ui),Ui=null,ai=!0},er.onerror=function(){wn=!0,Ui=null},er.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Tn={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Tn);class Ei extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const _i=gi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function rs(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:_i(),signal:r.signal});let l=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),((d,f,g)=>{u||fetch(s).then(x=>x.ok?((w,E,A)=>{(i.type==="arrayBuffer"?w.arrayBuffer():i.type==="json"?w.json():w.text()).then(z=>{u||(l=!0,e(null,z,w.headers.get("Cache-Control"),w.headers.get("Expires")))}).catch(z=>{u||e(new Error(z.message))})})(x):x.blob().then(w=>e(new Ei(x.status,x.statusText,i.url,w)))).catch(x=>{x.code!==20&&e(new Error(x.message))})})(),{cancel:()=>{u=!0,l||r.abort()}}}const tr=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(gi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!gi()){const s=i.url.substring(0,i.url.indexOf("://"));return(Qi.REGISTERED_PROTOCOLS[s]||rs)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(_i())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return rs(i,e);if(gi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,l){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const d in s.headers)u.setRequestHeader(d,s.headers[d]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{l(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(s.type==="json")try{d=JSON.parse(u.response)}catch(f){return l(f)}l(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});l(new Ei(u.status,u.statusText,s.url,d))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},Wr=function(i,e){return tr(wi(i,{type:"arrayBuffer"}),e)};function ns(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let He,Ii;He=[],Ii=0;const En=function(i,e){if(Oi.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Ii>=Qi.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return He.push(u),u}Ii++;let r=!1;const s=()=>{if(!r)for(r=!0,Ii--;He.length&&Ii{s(),u?e(u):d&&function(x,w){typeof createImageBitmap=="function"?function(E,A){const z=new Blob([new Uint8Array(E)],{type:"image/png"});createImageBitmap(z).then(k=>{A(null,k)}).catch(k=>{A(new Error(`Could not load image because of ${k.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,w):function(E,A){const z=new Image;z.onload=()=>{A(null,z),URL.revokeObjectURL(z.src),z.onload=null,window.requestAnimationFrame(()=>{z.src=Hr})},z.onerror=()=>A(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 k=new Blob([new Uint8Array(E)],{type:"image/png"});z.src=E.byteLength?URL.createObjectURL(k):Hr}(x,w)}(d,(x,w)=>{x!=null?e(x):w!=null&&e(null,w,{cacheControl:f,expires:g})})});return{cancel:()=>{l.cancel(),s()}}};function dr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Kr(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class Vi{constructor(e,r={}){wi(this,r),this.type=e}}class mr extends Vi{constructor(e,r={}){super("error",wi({error:e},r))}}class Jr{on(e,r){return this._listeners=this._listeners||{},dr(e,r,this._listeners),this}off(e,r){return Kr(e,r,this._listeners),Kr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},dr(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new Vi(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)Kr(s,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(wi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof mr&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var ne={$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"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{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-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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},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"}}};class de{constructor(e,r,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function Sr(i){const e=i.value;return e?[new de(i.key,e,"constants have been deprecated as of v8")]:[]}function Si(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}function ct(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function bt(i){if(Array.isArray(i))return i.map(bt);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=bt(i[r]);return e}return ct(i)}class Xt extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Yr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new Yr(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Wt={kind:"null"},ge={kind:"number"},Ge={kind:"string"},Oe={kind:"boolean"},Ht={kind:"color"},oi={kind:"object"},Ve={kind:"value"},Ai={kind:"collator"},Ni={kind:"formatted"},Nt={kind:"padding"},fr={kind:"resolvedImage"};function ot(i,e){return{kind:"array",itemType:i,N:e}}function lt(i){if(i.kind==="array"){const e=lt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Ar=[Wt,ge,Ge,Oe,Ht,Ni,oi,ot(Ve),Nt,fr];function $i(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!$i(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of Ar)if(!$i(r,e))return null}}return`Expected ${lt(i)} but found ${lt(e)} instead.`}function gr(i,e){return e.some(r=>r.kind===i.kind)}function ir(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var In,Sn={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function rr(i){return(i=Math.round(i))<0?0:i>255?255:i}function P(i){return rr(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function b(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function I(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{In={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in Sn)return Sn[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var s=r.indexOf("("),l=r.indexOf(")");if(s!==-1&&l+1===r.length){var u=r.substr(0,s),d=r.substr(s+1,l-(s+1)).split(","),f=1;switch(u){case"rgba":if(d.length!==4)return null;f=b(d.pop());case"rgb":return d.length!==3?null:[P(d[0]),P(d[1]),P(d[2]),f];case"hsla":if(d.length!==4)return null;f=b(d.pop());case"hsl":if(d.length!==3)return null;var g=(parseFloat(d[0])%360+360)%360/360,x=b(d[1]),w=b(d[2]),E=w<=.5?w*(x+1):w+x-w*x,A=2*w-E;return[rr(255*I(A,E,g+1/3)),rr(255*I(A,E,g)),rr(255*I(A,E,g-1/3)),f];default:return null}}return null}}catch{}class M{constructor(e,r,s,l=1){this.r=e,this.g=r,this.b=s,this.a=l}static parse(e){if(!e)return;if(e instanceof M)return e;if(typeof e!="string")return;const r=In(e);return r?new M(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,s,l]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(s)},${l})`}toArray(){const{r:e,g:r,b:s,a:l}=this;return l===0?[0,0,0,0]:[255*e/l,255*r/l,255*s/l,l]}}M.black=new M(0,0,0,1),M.white=new M(1,1,1,1),M.transparent=new M(0,0,0,0),M.red=new M(1,0,0,1);class D{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class V{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class G{constructor(e){this.sections=e}static fromString(e){return new G([new V(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof G?e:G.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ${constructor(e){this.values=e.slice()}static parse(e){if(e instanceof $)return e;if(typeof e=="number")return new $([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new $(e)}}toString(){return JSON.stringify(this.values)}}class N{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new N({name:e,available:!1}):null}}function j(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ee(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof M||i instanceof D||i instanceof G||i instanceof $||i instanceof N)return!0;if(Array.isArray(i)){for(const e of i)if(!ee(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ee(i[e]))return!1;return!0}return!1}function oe(i){if(i===null)return Wt;if(typeof i=="string")return Ge;if(typeof i=="boolean")return Oe;if(typeof i=="number")return ge;if(i instanceof M)return Ht;if(i instanceof D)return Ai;if(i instanceof G)return Ni;if(i instanceof $)return Nt;if(i instanceof N)return fr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=oe(s);if(r){if(r===l)continue;r=Ve;break}r=l}return ot(r||Ve,e)}return oi}function se(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof M||i instanceof G||i instanceof $||i instanceof N?i.toString():JSON.stringify(i)}class Ie{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ee(e[1]))return r.error("invalid value");const s=e[1];let l=oe(s);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Ie(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class be{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ze={string:Ge,number:ge,boolean:Oe,object:oi};class Pe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,l=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in ze)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=ze[x],l++}else f=Ve;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],l++}s=ot(f,g)}else{if(!ze[u])throw new Error(`Types doesn't contain name = ${u}`);s=ze[u]}const d=[];for(;le.outputDefined())}}const Ne={"to-boolean":Oe,"to-color":Ht,"to-number":ge,"to-string":Ge};class Xe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!Ne[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=Ne[s],u=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:j(r[0],r[1],r[2],r[3]),!s))return new M(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new be(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const s of this.args){r=s.evaluate(e);const l=$.parse(r);if(l)return l}throw new be(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new be(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?G.fromString(se(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?N.fromString(se(this.args[0].evaluate(e))):se(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const qe=["Unknown","Point","LineString","Polygon"];class $e{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"?qe[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=M.parse(e)),r}}class Ue{constructor(e,r,s,l){this.name=e,this.type=r,this._evaluate=s,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const s=e[0],l=Ue.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,w]of f){g=new ls(r.registry,r.path,null,r.scope);const E=[];let A=!1;for(let z=1;z{return A=E,Array.isArray(A)?`(${A.map(lt).join(", ")})`:`(${lt(A.type)}...)`;var A}).join(" | "),w=[];for(let E=1;E=e[2]||i[1]<=e[1]||i[3]>=e[3])}function js(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*wt),Math.round(s*l*wt)]}function An(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return s*d-u*l==0&&s*u<=0&&l*d<=0}function rt(i,e){let r=!1;for(let d=0,f=e.length;d(s=i)[1]!=(u=g[x+1])[1]>s[1]&&s[0]<(u[0]-l[0])*(s[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var s,l,u;return r}function Wo(i,e){for(let r=0;r0&&f<0||d<0&&f>0}function Ho(i,e,r){for(const x of r)for(let w=0;wr[2]){const l=.5*s;let u=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;u===0&&(u=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=u}At(e,i)}function ja(i,e,r,s){const l=Math.pow(2,s.z)*wt,u=[s.x*wt,s.y*wt],d=[];for(const f of i)for(const g of f){const x=[g.x+u[0],g.y+u[1]];Ks(x,e,r,l),d.push(x)}return d}function Xa(i,e,r,s){const l=Math.pow(2,s.z)*wt,u=[s.x*wt,s.y*wt],d=[];for(const g of i){const x=[];for(const w of g){const E=[w.x+u[0],w.y+u[1]];At(e,E),x.push(E)}d.push(x)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of d)for(const x of g)Ks(x,e,r,l)}var f;return d}class Cr{constructor(e,r){this.type=Oe,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ee(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l{e&&!as(r)&&(e=!1)}),e}function Qr(i){if(i instanceof Ue&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Qr(r)&&(e=!1)}),e}function Cn(i,e){if(i instanceof Ue&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!Cn(s,e)&&(r=!1)}),r}class os{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const s=e[1];return r.scope.has(s)?new os(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class ls{constructor(e,r=[],s,l=new Yr,u=[]){this.registry=e,this.path=r,this.key=r.map(d=>`[${d}]`).join(""),this.scope=l,this.errors=u,this.expectedType=s}parse(e,r,s,l,u={}){return r?this.concat(r,s,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(l,u,d){return d==="assert"?new Pe(u,[l]):d==="coerce"?new Xe(u,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[l];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,g=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Ie)&&d.type.kind!=="resolvedImage"&&zn(d)){const f=new $e;try{d=new Ie(d.type,d.evaluate(f))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const l=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new ls(this.registry,l,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Xt(s,e))}checkSubtype(e,r){const s=$i(e,r);return s&&this.error(s),s}}function zn(i){if(i instanceof os)return zn(i.boundExpression);if(i instanceof Ue&&i.name==="error"||i instanceof It||i instanceof Cr)return!1;const e=i instanceof Xe||i instanceof Pe;let r=!0;return i.eachChild(s=>{r=e?r&&zn(s):r&&s instanceof Ie}),!!r&&as(i)&&Cn(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function cs(i,e){const r=i.length-1;let s,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),s=i[f],l=i[f+1],s<=e){if(f===r||ee))throw new be("Input is not a number.");d=f-1}return 0}class Mn{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,ge);if(!s)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const E=r.parse(g,w,u);if(!E)return null;u=u||E.type,l.push([f,E])}return new Mn(u,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;return l>=r[u-1]?s[u-1].evaluate(e):s[cs(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function _t(i,e,r){return i*(1-r)+e*r}var kn=Object.freeze({__proto__:null,number:_t,color:function(i,e,r){return new M(_t(i.r,e.r,r),_t(i.g,e.g,r),_t(i.b,e.b,r),_t(i.a,e.a,r))},array:function(i,e,r){return i.map((s,l)=>_t(s,e[l],r))},padding:function(i,e,r){const s=i.values,l=e.values;return new $([_t(s[0],l[0],r),_t(s[1],l[1],r),_t(s[2],l[2],r),_t(s[3],l[3],r)])}});const Js=.95047,Wa=1.08883,Ha=4/29,hs=6/29,Ys=3*hs*hs,Ko=Math.PI/180,Jo=180/Math.PI;function Qs(i){return i>.008856451679035631?Math.pow(i,1/3):i/Ys+Ha}function ea(i){return i>hs?i*i*i:Ys*(i-Ha)}function ta(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function ia(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ka(i){const e=ia(i.r),r=ia(i.g),s=ia(i.b),l=Qs((.4124564*e+.3575761*r+.1804375*s)/Js),u=Qs((.2126729*e+.7151522*r+.072175*s)/1);return{l:116*u-16,a:500*(l-u),b:200*(u-Qs((.0193339*e+.119192*r+.9503041*s)/Wa)),alpha:i.a}}function it(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,s=isNaN(i.b)?e:e-i.b/200;return e=1*ea(e),r=Js*ea(r),s=Wa*ea(s),new M(ta(3.2404542*r-1.5371385*e-.4985314*s),ta(-.969266*r+1.8760108*e+.041556*s),ta(.0556434*r-.2040259*e+1.0572252*s),i.alpha)}function Yo(i,e,r){const s=e-i;return i+r*(s>180||s<-180?s-360*Math.round(s/360):s)}const Pn={forward:Ka,reverse:it,interpolate:function(i,e,r){return{l:_t(i.l,e.l,r),a:_t(i.a,e.a,r),b:_t(i.b,e.b,r),alpha:_t(i.alpha,e.alpha,r)}}},Dn={forward:function(i){const{l:e,a:r,b:s}=Ka(i),l=Math.atan2(s,r)*Jo;return{h:l<0?l+360:l,c:Math.sqrt(r*r+s*s),l:e,alpha:i.a}},reverse:function(i){const e=i.h*Ko,r=i.c;return it({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:Yo(i.h,e.h,r),c:_t(i.c,e.c,r),l:_t(i.l,e.l,r),alpha:_t(i.alpha,e.alpha,r)}}};var Ja=Object.freeze({__proto__:null,lab:Pn,hcl:Dn});class li{constructor(e,r,s,l,u){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let u=0;if(e.name==="exponential")u=ra(r,e.base,s,l);else if(e.name==="linear")u=ra(r,1,s,l);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new bi(d[0],d[1],d[2],d[3]).solve(ra(r,1,s,l))}return u}static parse(e,r){let[s,l,u,...d]=e;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,ge),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Ht:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const k=r.parse(E,z,g);if(!k)return null;g=g||k.type,f.push([w,k])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new li(g,s,l,u,f):r.error(`Type ${lt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;if(l>=r[u-1])return s[u-1].evaluate(e);const d=cs(r,l),f=li.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=s[d].evaluate(e),x=s[d+1].evaluate(e);return this.operator==="interpolate"?kn[this.type.kind.toLowerCase()](g,x,f):this.operator==="interpolate-hcl"?Dn.reverse(Dn.interpolate(Dn.forward(g),Dn.forward(x),f)):Pn.reverse(Pn.interpolate(Pn.forward(g),Pn.forward(x),f))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ra(i,e,r,s){const l=s-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class us{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const u=[];for(const f of e.slice(1)){const g=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}if(!s)throw new Error("No output type");const d=l&&u.some(f=>$i(l,f.type));return new us(d?Ve:s,u)}evaluate(e){let r,s=null,l=0;for(const u of this.args)if(l++,s=u.evaluate(e),s&&s instanceof N&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class ps{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u=s.length)throw new be(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new be(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class sa{constructor(e,r){this.type=Oe,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ve),l=r.parse(e[2],2,Ve);return s&&l?gr(s.type,[Oe,Ge,ge,Wt,Ve])?new sa(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${lt(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!ir(r,["boolean","string","number","null"]))throw new be(`Expected first argument to be of type boolean, string, number or null, but found ${lt(oe(r))} instead.`);if(!ir(s,["string","array"]))throw new be(`Expected second argument to be of type array or string, but found ${lt(oe(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ds{constructor(e,r,s){this.type=ge,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ve),l=r.parse(e[2],2,Ve);if(!s||!l)return null;if(!gr(s.type,[Oe,Ge,ge,Wt,Ve]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${lt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ge);return u?new ds(s,l,u):null}return new ds(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!ir(r,["boolean","string","number","null"]))throw new be(`Expected first argument to be of type boolean, string, number or null, but found ${lt(oe(r))} instead.`);if(!ir(s,["string","array"]))throw new be(`Expected second argument to be of type array or string, but found ${lt(oe(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class aa{constructor(e,r,s,l,u,d){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let x=2;xNumber.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof k=="number"&&Math.floor(k)!==k)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,oe(k)))return null}else s=oe(k);if(u[String(k)]!==void 0)return A.error("Branch labels must be unique.");u[String(k)]=d.length}const z=r.parse(E,x,l);if(!z)return null;l=l||z.type,d.push(z)}const f=r.parse(e[1],1,Ve);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new aa(s,l,f,u,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(oe(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class oa{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class ms{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ve),l=r.parse(e[2],2,ge);if(!s||!l)return null;if(!gr(s.type,[ot(Ve),Ge,Ve]))return r.error(`Expected first argument to be of type array or string, but found ${lt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ge);return u?new ms(s.type,s,l,u):null}return new ms(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!ir(r,["string","array"]))throw new be(`Expected first argument to be of type array or string, but found ${lt(oe(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ya(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Qa(i,e,r,s){return s.compare(e,r)===0}function en(i,e,r){const s=i!=="=="&&i!=="!=";return class bh{constructor(u,d,f){this.type=Oe,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let g=d.parse(u[1],1,Ve);if(!g)return null;if(!Ya(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${lt(g.type)}'.`);let x=d.parse(u[2],2,Ve);if(!x)return null;if(!Ya(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${lt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${lt(g.type)}' and '${lt(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Pe(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Pe(g.type,[x])));let w=null;if(u.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(w=d.parse(u[3],3,Ai),!w)return null}return new bh(g,x,w)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=oe(d),x=oe(f);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new be(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=oe(d),x=oe(f);if(g.kind!=="string"||x.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Qo=en("==",function(i,e,r){return e===r},Qa),el=en("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!Qa(0,e,r,s)}),tl=en("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),rl=en("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),nl=en(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class la{constructor(e,r,s,l,u){this.type=Ge,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,ge);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,Ge),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,Ge),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,ge),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,ge),!g)?null:new la(s,u,d,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class fs{constructor(e){this.type=Ni,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,ge),!g))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,ot(Ge)),!x))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,Ht),!w))return null;const E=l[l.length-1];E.scale=g,E.font=x,E.textColor=w}else{const g=r.parse(e[d],1,Ve);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new fs(l)}evaluate(e){return new G(this.sections.map(r=>{const s=r.content.evaluate(e);return oe(s)===fr?new V("",s,null,null,null):new V(se(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class ca{constructor(e){this.type=fr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ge);return s?new ca(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=N.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class ha{constructor(e){this.type=ge,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${lt(s.type)} instead.`):new ha(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new be(`Expected value to be of type string or array, but found ${lt(oe(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const tn={"==":Qo,"!=":el,">":il,"<":tl,">=":nl,"<=":rl,array:Pe,at:na,boolean:Pe,case:oa,coalesce:us,collator:It,format:fs,image:ca,in:sa,"index-of":ds,interpolate:li,"interpolate-hcl":li,"interpolate-lab":li,length:ha,let:ps,literal:Ie,match:aa,number:Pe,"number-format":la,object:Pe,slice:ms,step:Mn,string:Pe,"to-boolean":Xe,"to-color":Xe,"to-number":Xe,"to-string":Xe,var:os,within:Cr};function eo(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=l?l.evaluate(i):1,d=j(e,r,s,u);if(d)throw new be(d);return new M(e/255*u,r/255*u,s/255*u,u)}function to(i,e){return i in e}function ua(i,e){const r=e[i];return r===void 0?null:r}function _r(i){return{type:i}}function io(i){return{result:"success",value:i}}function rn(i){return{result:"error",value:i}}function nn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Tt(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function pa(i){return!!i.expression&&i.expression.interpolated}function Ae(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function sn(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function yt(i){return i}function ht(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(pa(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?M.parse:$.parse;(i=Si({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],x(w[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!Ja[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let d,f,g;if(u==="exponential")d=no;else if(u==="interval")d=sl;else if(u==="categorical"){d=ro,f=Object.create(null);for(const x of i.stops)f[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);d=al}if(s){const x={},w=[];for(let z=0;zz[0]),evaluate:({zoom:z},k)=>no({stops:E,base:i.base},e,z).evaluate(z,k)}}if(l){const x=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:li.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>d(i,e,w,f,g)}}return{kind:"source",evaluate(x,w){const E=w&&w.properties?w.properties[i.property]:void 0;return E===void 0?yr(i.default,e.default):d(i,e,E,f,g)}}}function yr(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function ro(i,e,r,s,l){return yr(typeof r===l?s[r]:void 0,i.default,e.default)}function sl(i,e,r){if(Ae(r)!=="number")return yr(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=cs(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function no(i,e,r){const s=i.base!==void 0?i.base:1;if(Ae(r)!=="number")return yr(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const u=cs(i.stops.map(w=>w[0]),r),d=function(w,E,A,z){const k=z-A,U=w-A;return k===0?0:E===1?U/k:(Math.pow(E,U)-1)/(Math.pow(E,k)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],g=i.stops[u+1][1];let x=kn[e.type]||yt;if(i.colorSpace&&i.colorSpace!=="rgb"){const w=Ja[i.colorSpace];x=(E,A)=>w.reverse(w.interpolate(w.forward(E),w.forward(A),d))}return typeof f.evaluate=="function"?{evaluate(...w){const E=f.evaluate.apply(void 0,w),A=g.evaluate.apply(void 0,w);if(E!==void 0&&A!==void 0)return x(E,A,d)}}:x(f,g,d)}function al(i,e,r){switch(e.type){case"color":r=M.parse(r);break;case"formatted":r=G.fromString(r.toString());break;case"resolvedImage":r=N.fromString(r.toString());break;case"padding":r=$.parse(r);break;default:Ae(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return yr(r,i.default,e.default)}Ue.register(tn,{error:[{kind:"error"},[Ge],(i,[e])=>{throw new be(e.evaluate(i))}],typeof:[Ge,[Ve],(i,[e])=>lt(oe(e.evaluate(i)))],"to-rgba":[ot(ge,4),[Ht],(i,[e])=>e.evaluate(i).toArray()],rgb:[Ht,[ge,ge,ge],eo],rgba:[Ht,[ge,ge,ge,ge],eo],has:{type:Oe,overloads:[[[Ge],(i,[e])=>to(e.evaluate(i),i.properties())],[[Ge,oi],(i,[e,r])=>to(e.evaluate(i),r.evaluate(i))]]},get:{type:Ve,overloads:[[[Ge],(i,[e])=>ua(e.evaluate(i),i.properties())],[[Ge,oi],(i,[e,r])=>ua(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Ve,[Ge],(i,[e])=>ua(e.evaluate(i),i.featureState||{})],properties:[oi,[],i=>i.properties()],"geometry-type":[Ge,[],i=>i.geometryType()],id:[Ve,[],i=>i.id()],zoom:[ge,[],i=>i.globals.zoom],"heatmap-density":[ge,[],i=>i.globals.heatmapDensity||0],"line-progress":[ge,[],i=>i.globals.lineProgress||0],accumulated:[Ve,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ge,_r(ge),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[ge,_r(ge),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:ge,overloads:[[[ge,ge],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[ge],(i,[e])=>-e.evaluate(i)]]},"/":[ge,[ge,ge],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[ge,[ge,ge],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[ge,[],()=>Math.LN2],pi:[ge,[],()=>Math.PI],e:[ge,[],()=>Math.E],"^":[ge,[ge,ge],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[ge,[ge],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))],log2:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ge,[ge],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ge,[ge],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ge,[ge],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ge,[ge],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ge,[ge],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ge,[ge],(i,[e])=>Math.atan(e.evaluate(i))],min:[ge,_r(ge),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[ge,_r(ge),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[ge,[ge],(i,[e])=>Math.abs(e.evaluate(i))],round:[ge,[ge],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[ge,[ge],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ge,[ge],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Oe,[Ge,Ve],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Oe,[Ve],(i,[e])=>i.id()===e.value],"filter-type-==":[Oe,[Ge],(i,[e])=>i.geometryType()===e.value],"filter-<":[Oe,[Ge,Ve],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s{const r=i.id(),s=e.value;return typeof r==typeof s&&r":[Oe,[Ge,Ve],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Oe,[Ve],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Oe,[Ge,Ve],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Oe,[Ve],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Oe,[Ge,Ve],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Oe,[Ve],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Oe,[Ve],(i,[e])=>e.value in i.properties()],"filter-has-id":[Oe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Oe,[ot(Ge)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Oe,[ot(Ve)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Oe,[Ge,ot(Ve)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Oe,[Ge,ot(Ve)],(i,[e,r])=>function(s,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===s)return!0;l[f]>s?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Oe,overloads:[[[Oe,Oe],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[_r(Oe),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Oe,overloads:[[[Oe,Oe],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[_r(Oe),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Oe,[Oe],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Oe,[Ge],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Ge,[Ge],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Ge,[Ge],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Ge,_r(Ve),(i,e)=>e.map(r=>se(r.evaluate(i))).join("")],"resolved-locale":[Ge,[Ai],(i,[e])=>e.evaluate(i).resolvedLocale()]});class da{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new $e,this._defaultValue=r?function(s){return s.type==="color"&&sn(s.default)?new M(0,0,0,0):s.type==="color"?M.parse(s.default)||null:s.type==="padding"?$.parse(s.default)||null:s.default===void 0?null:s.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new be(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Ln(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in tn}function Bn(i,e){const r=new ls(tn,[],e?function(l){const u={color:Ht,string:Ge,number:ge,enum:Ge,boolean:Oe,formatted:Ni,padding:Nt,resolvedImage:fr};return l.type==="array"?ot(u[l.value]||Ve,l.length):u[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?io(new da(s,e)):rn(r.errors)}class gs{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Qr(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}}class Rn{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Qr(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}interpolationFactor(e,r,s){return this.interpolationType?li.interpolationFactor(this.interpolationType,e,r,s):0}}function so(i,e){const r=Bn(i,e);if(r.result==="error")return r;const s=r.value.expression,l=as(s);if(!l&&!nn(e))return rn([new Xt("","data expressions not supported")]);const u=Cn(s,["zoom"]);if(!u&&!Tt(e))return rn([new Xt("","zoom expressions not supported")]);const d=ys(s);return d||u?d instanceof Xt?rn([d]):d instanceof li&&!pa(e)?rn([new Xt("",'"interpolate" expressions cannot be used with this property')]):io(d?new Rn(l?"camera":"composite",r.value,d.labels,d instanceof li?d.interpolation:void 0):new gs(l?"constant":"source",r.value)):rn([new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class _s{constructor(e,r){this._parameters=e,this._specification=r,Si(this,ht(this._parameters,this._specification))}static deserialize(e){return new _s(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ys(i){let e=null;if(i instanceof ps)e=ys(i.result);else if(i instanceof us){for(const r of i.args)if(e=ys(r),e)break}else(i instanceof Mn||i instanceof li)&&i.input instanceof Ue&&i.input.name==="zoom"&&(e=i);return e instanceof Xt||i.eachChild(r=>{const s=ys(r);s instanceof Xt?e=s:!e&&s?e=new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Xt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Ci(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},u=i.style,d=i.styleSpec;let f=[];const g=Ae(r);if(g!=="object")return[new de(e,r,`object expected, ${g} found`)];for(const x in r){const w=x.split(".")[0],E=s[w]||s["*"];let A;if(l[w])A=l[w];else if(s[w])A=$t;else if(l["*"])A=l["*"];else{if(!s["*"]){f.push(new de(e,r[x],`unknown property "${x}"`));continue}A=$t}f=f.concat(A({key:(e&&`${e}.`)+x,value:r[x],valueSpec:E,style:u,styleSpec:d,object:r,objectKey:x},r))}for(const x in s)l[x]||s[x].required&&s[x].default===void 0&&r[x]===void 0&&f.push(new de(e,r,`missing required property "${x}"`));return f}function ao(i){const e=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,u=i.key,d=i.arrayElementValidator||$t;if(Ae(e)!=="array")return[new de(u,e,`array expected, ${Ae(e)} found`)];if(r.length&&e.length!==r.length)return[new de(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.lengths.maximum?[new de(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function oo(i){const e=i.valueSpec,r=ct(i.value.type);let s,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,x=Ae(i.value.stops)==="array"&&Ae(i.value.stops[0])==="array"&&Ae(i.value.stops[0][0])==="object",w=Ci({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(z){if(r==="identity")return[new de(z.key,z.value,'identity function may not have a "stops" property')];let k=[];const U=z.value;return k=k.concat(ao({key:z.key,value:U,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:E})),Ae(U)==="array"&&U.length===0&&k.push(new de(z.key,U,"array must have at least one stop")),k},default:function(z){return $t({key:z.key,value:z.value,valueSpec:e,style:z.style,styleSpec:z.styleSpec})}}});return r==="identity"&&f&&w.push(new de(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new de(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!pa(i.valueSpec)&&w.push(new de(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!nn(i.valueSpec)?w.push(new de(i.key,i.value,"property functions not supported")):f&&!Tt(i.valueSpec)&&w.push(new de(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new de(i.key,i.value,'"property" property is required')),w;function E(z){let k=[];const U=z.value,O=z.key;if(Ae(U)!=="array")return[new de(O,U,`array expected, ${Ae(U)} found`)];if(U.length!==2)return[new de(O,U,`array length 2 expected, length ${U.length} found`)];if(x){if(Ae(U[0])!=="object")return[new de(O,U,`object expected, ${Ae(U[0])} found`)];if(U[0].zoom===void 0)return[new de(O,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new de(O,U,"object stop key must have value")];if(u&&u>ct(U[0].zoom))return[new de(O,U[0].zoom,"stop zoom values must appear in ascending order")];ct(U[0].zoom)!==u&&(u=ct(U[0].zoom),l=void 0,d={}),k=k.concat(Ci({key:`${O}[0]`,value:U[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:ma,value:A}}))}else k=k.concat(A({key:`${O}[0]`,value:U[0],valueSpec:{},style:z.style,styleSpec:z.styleSpec},U));return Ln(bt(U[1]))?k.concat([new de(`${O}[1]`,U[1],"expressions are not allowed in function stops.")]):k.concat($t({key:`${O}[1]`,value:U[1],valueSpec:e,style:z.style,styleSpec:z.styleSpec}))}function A(z,k){const U=Ae(z.value),O=ct(z.value),W=z.value!==null?z.value:k;if(s){if(U!==s)return[new de(z.key,W,`${U} stop domain type must match previous stop domain type ${s}`)]}else s=U;if(U!=="number"&&U!=="string"&&U!=="boolean")return[new de(z.key,W,"stop domain value must be a number, string, or boolean")];if(U!=="number"&&r!=="categorical"){let Q=`number expected, ${U} found`;return nn(e)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new de(z.key,W,Q)]}return r!=="categorical"||U!=="number"||isFinite(O)&&Math.floor(O)===O?r!=="categorical"&&U==="number"&&l!==void 0&&Onew de(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new de(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Qr(r))return[new de(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Qr(r))return[new de(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Cn(r,["zoom","feature-state"]))return[new de(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!as(r))return[new de(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Fn(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(ct(r))===-1&&l.push(new de(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(ct(r))===-1&&l.push(new de(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function xs(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!xs(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const vs={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function fa(i){if(i==null)return{filter:()=>!0,needGeometry:!1};xs(i)||(i=bs(i));const e=Bn(i,vs);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:ga(i)}}function lo(i,e){return ie?1:0}function ga(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?ws(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(bs))):e==="all"?["all"].concat(i.slice(1).map(bs)):e==="none"?["all"].concat(i.slice(1).map(bs).map(zr)):e==="in"?co(i[1],i.slice(2)):e==="!in"?zr(co(i[1],i.slice(2))):e==="has"?Ts(i[1]):e==="!has"?zr(Ts(i[1])):e!=="within"||i;var r}function ws(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function co(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(lo)]]:["filter-in-small",i,["literal",e]]}}function Ts(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function zr(i){return["!",i]}function On(i){return xs(bt(i.value))?an(Si({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Es(i)}function Es(i){const e=i.value,r=i.key;if(Ae(e)!=="array")return[new de(r,e,`array expected, ${Ae(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new de(r,e,"filter array must have at least 1 element")];switch(u=u.concat(Fn({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),ct(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ct(e[1])==="$type"&&u.push(new de(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new de(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=Ae(e[1]),l!=="string"&&u.push(new de(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d{x in r&&e.push(new de(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{ct(x.id)===f&&(g=x)}),g?g.ref?e.push(new de(s,r.ref,"ref cannot reference another ref layer")):d=ct(g.type):e.push(new de(s,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const g=l.sources&&l.sources[r.source],x=g&&ct(g.type);g?x==="vector"&&d==="raster"?e.push(new de(s,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&d!=="raster"?e.push(new de(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new de(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new de(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new de(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new de(s,r.source,`source "${r.source}" not found`))}else e.push(new de(s,r,'missing required property "source"'));return e=e.concat(Ci({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>$t({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:On,layout:g=>Ci({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>uo(Si({layerType:d},x))}}),paint:g=>Ci({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Un(Si({layerType:d},x))}})}})),e}function on(i){const e=i.value,r=i.key,s=Ae(e);return s!=="string"?[new de(r,e,`string expected, ${s} found`)]:[]}const mo={promoteId:function({key:i,value:e}){if(Ae(e)==="string")return on({key:i,value:e});{const r=[];for(const s in e)r.push(...on({key:`${i}.${s}`,value:e[s]}));return r}}};function fo(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style;if(!e.type)return[new de(r,e,'"type" is required')];const u=ct(e.type);let d;switch(u){case"vector":case"raster":case"raster-dem":return d=Ci({key:r,value:e,valueSpec:s[`source_${u.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:mo}),d;case"geojson":if(d=Ci({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,objectElementValidators:mo}),e.cluster)for(const f in e.clusterProperties){const[g,x]=e.clusterProperties[f],w=typeof g=="string"?[g,["accumulated"],["get",f]]:g;d.push(...an({key:`${r}.${f}.map`,value:x,expressionContext:"cluster-map"})),d.push(...an({key:`${r}.${f}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return d;case"video":return Ci({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return Ci({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});case"canvas":return[new de(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Fn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,styleSpec:s})}}function Vn(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let u=[];const d=Ae(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new de("light",e,`object expected, ${d} found`)]),u;for(const f in e){const g=f.match(/^(.*)-transition$/);u=u.concat(g&&s[g[1]]&&s[g[1]].transition?$t({key:f,value:e[f],valueSpec:r.transition,style:l,styleSpec:r}):s[f]?$t({key:f,value:e[f],valueSpec:s[f],style:l,styleSpec:r}):[new de(f,e[f],`unknown property "${f}"`)])}return u}function Nn(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let u=[];const d=Ae(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new de("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(s[f]?$t({key:f,value:e[f],valueSpec:s[f],style:l,styleSpec:r}):[new de(f,e[f],`unknown property "${f}"`)]);return u}const ci={"*":()=>[],array:ao,boolean:function(i){const e=i.value,r=i.key,s=Ae(e);return s!=="boolean"?[new de(r,e,`boolean expected, ${s} found`)]:[]},number:ma,color:function(i){const e=i.key,r=i.value,s=Ae(r);return s!=="string"?[new de(e,r,`color expected, ${s} found`)]:In(r)===null?[new de(e,r,`color expected, "${r}" found`)]:[]},constants:Sr,enum:Fn,filter:On,function:oo,layer:po,object:Ci,source:fo,light:Vn,terrain:Nn,string:on,formatted:function(i){return on(i).length===0?[]:an(i)},resolvedImage:function(i){return on(i).length===0?[]:an(i)},padding:function(i){const e=i.key,r=i.value;if(Ae(r)==="array"){if(r.length<1||r.length>4)return[new de(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let u=0;u[]}})),i.constants&&(r=r.concat(Sr({key:"constants",value:i.constants,style:i,styleSpec:e}))),go(r)}function go(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Mr(i){return function(...e){return go(i.apply(this,e))}}xr.source=Mr(fo),xr.light=Mr(Vn),xr.terrain=Mr(Nn),xr.layer=Mr(po),xr.filter=Mr(On),xr.paintProperty=Mr(Un),xr.layoutProperty=Mr(uo);const kr=xr,ll=kr.light,_a=kr.paintProperty,cl=kr.layoutProperty;function _o(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new mr(new Error(s.message))),r=!0;return r}class Pr{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(s=d[2]);for(let g=0;g=E[k+0]&&l>=E[k+1])?(f[z]=!0,d.push(w[z])):f[z]=!1}}}}_forEachCell(e,r,s,l,u,d,f,g){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),E=this._convertToCellCoord(s),A=this._convertToCellCoord(l);for(let z=x;z<=E;z++)for(let k=w;k<=A;k++){const U=this.d*k+z;if((!g||g(this._convertFromCellCoord(z),this._convertFromCellCoord(k),this._convertFromCellCoord(z+1),this._convertFromCellCoord(k+1)))&&u.call(this,e,r,s,l,U,d,f,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let d=0;d=0)continue;const d=i[u];l[u]=vr[s].shallow.indexOf(u)>=0?d:$n(d,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof i)}function Dr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||ya(i)||hr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Dr);if(typeof i=="object"){const e=i.$name||"Object";if(!vr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=vr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];s[l]=vr[e].shallow.indexOf(l)>=0?u:Dr(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Gn{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function xa(i){for(const e of i)if(qn(e.charCodeAt(0)))return!0;return!1}function yo(i){for(const e of i)if(!hl(e.charCodeAt(0)))return!1;return!0}function hl(i){return!(ye.Arabic(i)||ye["Arabic Supplement"](i)||ye["Arabic Extended-A"](i)||ye["Arabic Presentation Forms-A"](i)||ye["Arabic Presentation Forms-B"](i))}function qn(i){return!(i!==746&&i!==747&&(i<4352||!(ye["Bopomofo Extended"](i)||ye.Bopomofo(i)||ye["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ye["CJK Compatibility Ideographs"](i)||ye["CJK Compatibility"](i)||ye["CJK Radicals Supplement"](i)||ye["CJK Strokes"](i)||!(!ye["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ye["CJK Unified Ideographs Extension A"](i)||ye["CJK Unified Ideographs"](i)||ye["Enclosed CJK Letters and Months"](i)||ye["Hangul Compatibility Jamo"](i)||ye["Hangul Jamo Extended-A"](i)||ye["Hangul Jamo Extended-B"](i)||ye["Hangul Jamo"](i)||ye["Hangul Syllables"](i)||ye.Hiragana(i)||ye["Ideographic Description Characters"](i)||ye.Kanbun(i)||ye["Kangxi Radicals"](i)||ye["Katakana Phonetic Extensions"](i)||ye.Katakana(i)&&i!==12540||!(!ye["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!ye["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ye["Unified Canadian Aboriginal Syllabics"](i)||ye["Unified Canadian Aboriginal Syllabics Extended"](i)||ye["Vertical Forms"](i)||ye["Yijing Hexagram Symbols"](i)||ye["Yi Syllables"](i)||ye["Yi Radicals"](i))))}function xo(i){return!(qn(i)||function(e){return!!(ye["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ye["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||ye["Letterlike Symbols"](e)||ye["Number Forms"](e)||ye["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||ye["Control Pictures"](e)&&e!==9251||ye["Optical Character Recognition"](e)||ye["Enclosed Alphanumerics"](e)||ye["Geometric Shapes"](e)||ye["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ye["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ye["CJK Symbols and Punctuation"](e)||ye.Katakana(e)||ye["Private Use Area"](e)||ye["CJK Compatibility Forms"](e)||ye["Small Form Variants"](e)||ye["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function vo(i){return i>=1424&&i<=2303||ye["Arabic Presentation Forms-A"](i)||ye["Arabic Presentation Forms-B"](i)}function ul(i,e){return!(!e&&vo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ye.Khmer(i))}function pl(i){for(const e of i)if(vo(e.charCodeAt(0)))return!0;return!1}const Is="deferred",va="loading",ba="loaded";let wa=null,Qt="unavailable",br=null;const bo=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Qt="error"),wa&&wa(i)};function Ta(){ln.fire(new Vi("pluginStateChange",{pluginStatus:Qt,pluginURL:br}))}const ln=new Jr,Ea=function(){return Qt},Ss=function(){if(Qt!==Is||!br)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Qt=va,Ta(),br&&Wr({url:br},i=>{i?bo(i):(Qt=ba,Ta())})},yi={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Qt===ba||yi.applyArabicShaping!=null,isLoading:()=>Qt===va,setState(i){if(!gi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Qt=i.pluginStatus,br=i.pluginURL},isParsed(){if(!gi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return yi.applyArabicShaping!=null&&yi.processBidirectionalText!=null&&yi.processStyledBidirectionalText!=null},getPluginURL(){if(!gi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return br}};class mt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gn,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!ul(l.charCodeAt(0),s))return!1;return!0}(e,yi.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class As{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(sn(s))return new _s(s,l);if(Ln(s)){const u=so(s,l);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=s;return l.type==="color"&&typeof s=="string"?u=M.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)||(u=$.parse(s)),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class Cs{constructor(e){this.property=e,this.value=new As(e,void 0)}transitioned(e,r){return new wo(this.property,this.value,r,wi({},e.transition,this.transition),e.now)}untransitioned(){return new wo(this.property,this.value,null,{},0)}}class Ia{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return si(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Cs(this._values[e].property)),this._values[e].value=new As(this._values[e].property,r===null?void 0:si(r))}getTransition(e){return si(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Cs(this._values[e].property)),this._values[e].transition=si(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new To(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new To(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class wo{constructor(e,r,s,l,u){this.property=e,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,u=this.value.possiblyEvaluate(e,r,s),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l=1)return 1;const x=g*g,w=x*g;return 4*(g<.5?w:3*(g-x)+w-.75)}(f))}}return u}}class To{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new zs(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class dl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return si(this._values[e].value)}setValue(e,r){this._values[e]=new As(this._values[e].property,r===null?void 0:si(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new zs(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}}class Gi{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class zs{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Me{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const l=kn[this.specification.type];return l?l(e,r,s):e}}class Be{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new Gi(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Gi(this,{kind:"constant",value:void 0},e.parameters);const l=kn[this.specification.type];return l?new Gi(this,{kind:"constant",value:l(e.value.value,r.value.value,s)},e.parameters):e}evaluate(e,r,s,l,u,d){return e.kind==="constant"?e.value:e.evaluate(r,s,l,u,d)}}class Zn extends Be{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new Gi(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new Gi(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Gi(this,{kind:"constant",value:u},r)}return new Gi(this,e.expression,r)}evaluate(e,r,s,l,u,d){if(e.kind==="source"){const f=e.evaluate(r,s,l,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class jn{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new mt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new mt(Math.floor(r.zoom),r)),e.expression.evaluate(new mt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Sa{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class Dt{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new As(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new Cs(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ee("DataDrivenProperty",Be),Ee("DataConstantProperty",Me),Ee("CrossFadedDataDrivenProperty",Zn),Ee("CrossFadedProperty",jn),Ee("ColorRampProperty",Sa);const Lr="-transition";class ei extends Jr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new dl(r.layout)),r.paint)){this._transitionablePaint=new Ia(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new zs(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(cl,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Lr)?this._transitionablePaint.getTransition(e.slice(0,-Lr.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(_a,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(Lr))return this._transitionablePaint.setTransition(e.slice(0,-Lr.length),r||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Hi(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,u={}){return(!u||u.validate!==!1)&&_o(this,e.call(kr,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:ne,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Gi&&nn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const ml={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Xn{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ut{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ct(i,e=1){let r=0,s=0;return{members:i.map(l=>{const u=ml[l.type].BYTES_PER_ELEMENT,d=r=Eo(r,Math.max(e,u)),f=l.components||1;return s=Math.max(s,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}}),size:Eo(r,Math.max(s,e)),alignment:e}}function Eo(i,e){return Math.ceil(i/e)*e}class cn extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}cn.prototype.bytesPerElement=4,Ee("StructArrayLayout2i4",cn);class Wn extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,this.int16[d+3]=u,e}}Wn.prototype.bytesPerElement=8,Ee("StructArrayLayout4i8",Wn);class o extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}o.prototype.bytesPerElement=12,Ee("StructArrayLayout2i4i12",o);class t extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=u,this.uint8[x+6]=d,this.uint8[x+7]=f,e}}t.prototype.bytesPerElement=8,Ee("StructArrayLayout2i4ub8",t);class n extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}n.prototype.bytesPerElement=8,Ee("StructArrayLayout2f8",n);class a extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,x,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,s,l,u,d,f,g,x,w)}emplace(e,r,s,l,u,d,f,g,x,w,E){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=s,this.uint16[A+2]=l,this.uint16[A+3]=u,this.uint16[A+4]=d,this.uint16[A+5]=f,this.uint16[A+6]=g,this.uint16[A+7]=x,this.uint16[A+8]=w,this.uint16[A+9]=E,e}}a.prototype.bytesPerElement=20,Ee("StructArrayLayout10ui20",a);class c extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,x,w,E,A){const z=this.length;return this.resize(z+1),this.emplace(z,e,r,s,l,u,d,f,g,x,w,E,A)}emplace(e,r,s,l,u,d,f,g,x,w,E,A,z){const k=12*e;return this.int16[k+0]=r,this.int16[k+1]=s,this.int16[k+2]=l,this.int16[k+3]=u,this.uint16[k+4]=d,this.uint16[k+5]=f,this.uint16[k+6]=g,this.uint16[k+7]=x,this.int16[k+8]=w,this.int16[k+9]=E,this.int16[k+10]=A,this.int16[k+11]=z,e}}c.prototype.bytesPerElement=24,Ee("StructArrayLayout4i4ui4i24",c);class p extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,e}}p.prototype.bytesPerElement=12,Ee("StructArrayLayout3f12",p);class m extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}m.prototype.bytesPerElement=4,Ee("StructArrayLayout1ul4",m);class _ extends ut{_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(e,r,s,l,u,d,f,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,s,l,u,d,f,g,x)}emplace(e,r,s,l,u,d,f,g,x,w){const E=10*e,A=5*e;return this.int16[E+0]=r,this.int16[E+1]=s,this.int16[E+2]=l,this.int16[E+3]=u,this.int16[E+4]=d,this.int16[E+5]=f,this.uint32[A+3]=g,this.uint16[E+8]=x,this.uint16[E+9]=w,e}}_.prototype.bytesPerElement=20,Ee("StructArrayLayout6i1ul2ui20",_);class y extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}y.prototype.bytesPerElement=12,Ee("StructArrayLayout2i2i2i12",y);class v extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l,u)}emplace(e,r,s,l,u,d){const f=4*e,g=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=u,this.int16[g+7]=d,e}}v.prototype.bytesPerElement=16,Ee("StructArrayLayout2f1f2i16",v);class T extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=s,this.float32[f+1]=l,this.float32[f+2]=u,e}}T.prototype.bytesPerElement=12,Ee("StructArrayLayout2ub2f12",T);class S extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=l,e}}S.prototype.bytesPerElement=6,Ee("StructArrayLayout3ui6",S);class C extends ut{_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(e,r,s,l,u,d,f,g,x,w,E,A,z,k,U,O,W){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,r,s,l,u,d,f,g,x,w,E,A,z,k,U,O,W)}emplace(e,r,s,l,u,d,f,g,x,w,E,A,z,k,U,O,W,Q){const X=24*e,Y=12*e,ce=48*e;return this.int16[X+0]=r,this.int16[X+1]=s,this.uint16[X+2]=l,this.uint16[X+3]=u,this.uint32[Y+2]=d,this.uint32[Y+3]=f,this.uint32[Y+4]=g,this.uint16[X+10]=x,this.uint16[X+11]=w,this.uint16[X+12]=E,this.float32[Y+7]=A,this.float32[Y+8]=z,this.uint8[ce+36]=k,this.uint8[ce+37]=U,this.uint8[ce+38]=O,this.uint32[Y+10]=W,this.int16[X+22]=Q,e}}C.prototype.bytesPerElement=48,Ee("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",C);class R extends ut{_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(e,r,s,l,u,d,f,g,x,w,E,A,z,k,U,O,W,Q,X,Y,ce,le,Se,Ce,xe,fe,pe,ve){const _e=this.length;return this.resize(_e+1),this.emplace(_e,e,r,s,l,u,d,f,g,x,w,E,A,z,k,U,O,W,Q,X,Y,ce,le,Se,Ce,xe,fe,pe,ve)}emplace(e,r,s,l,u,d,f,g,x,w,E,A,z,k,U,O,W,Q,X,Y,ce,le,Se,Ce,xe,fe,pe,ve,_e){const ue=34*e,De=17*e;return this.int16[ue+0]=r,this.int16[ue+1]=s,this.int16[ue+2]=l,this.int16[ue+3]=u,this.int16[ue+4]=d,this.int16[ue+5]=f,this.int16[ue+6]=g,this.int16[ue+7]=x,this.uint16[ue+8]=w,this.uint16[ue+9]=E,this.uint16[ue+10]=A,this.uint16[ue+11]=z,this.uint16[ue+12]=k,this.uint16[ue+13]=U,this.uint16[ue+14]=O,this.uint16[ue+15]=W,this.uint16[ue+16]=Q,this.uint16[ue+17]=X,this.uint16[ue+18]=Y,this.uint16[ue+19]=ce,this.uint16[ue+20]=le,this.uint16[ue+21]=Se,this.uint16[ue+22]=Ce,this.uint32[De+12]=xe,this.float32[De+13]=fe,this.float32[De+14]=pe,this.float32[De+15]=ve,this.float32[De+16]=_e,e}}R.prototype.bytesPerElement=68,Ee("StructArrayLayout8i15ui1ul4f68",R);class L extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}L.prototype.bytesPerElement=4,Ee("StructArrayLayout1f4",L);class B extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=l,e}}B.prototype.bytesPerElement=6,Ee("StructArrayLayout3i6",B);class q extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=l,e}}q.prototype.bytesPerElement=8,Ee("StructArrayLayout1ul2ui8",q);class Z extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}Z.prototype.bytesPerElement=4,Ee("StructArrayLayout2ui4",Z);class H extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}H.prototype.bytesPerElement=2,Ee("StructArrayLayout1ui2",H);class F extends ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,this.float32[d+3]=u,e}}F.prototype.bytesPerElement=16,Ee("StructArrayLayout4f16",F);class J extends Xn{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 Re(this.anchorPointX,this.anchorPointY)}}J.prototype.size=20;class K extends _{get(e){return new J(this,e)}}Ee("CollisionBoxArray",K);class ie extends Xn{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}ie.prototype.size=48;class re extends C{get(e){return new ie(this,e)}}Ee("PlacedSymbolArray",re);class he extends Xn{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(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}he.prototype.size=68;class te extends R{get(e){return new he(this,e)}}Ee("SymbolInstanceArray",te);class we extends L{getoffsetX(e){return this.float32[1*e+0]}}Ee("GlyphOffsetArray",we);class me extends B{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Ee("SymbolLineVertexArray",me);class Te extends Xn{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]}}Te.prototype.size=8;class Fe extends q{get(e){return new Te(this,e)}}Ee("FeatureIndexArray",Fe);class Ze extends cn{}class Le extends cn{}class nt extends cn{}class st extends o{}class Ke extends t{}class Je extends n{}class Ye extends a{}class hi extends c{}class qi extends p{}class zi extends m{}class Mi extends y{}class Br extends T{}class Ut extends S{}class ki extends Z{}const Rr=Ct([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ms}=Rr;class Qe{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let u=this.segments[this.segments.length-1];return e>Qe.MAX_VERTEX_ARRAY_LENGTH&&Pt(`Max vertices per segment is ${Qe.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Qe.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,l){return new Qe([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function pt(i,e){return 256*(i=ae(Math.floor(i),0,255))+ae(Math.floor(e),0,255)}Qe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ee("SegmentVector",Qe);const et=Ct([{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 zt={exports:{}},ti={exports:{}};ti.exports=function(i,e){var r,s,l,u,d,f,g,x;for(s=i.length-(r=3&i.length),l=e,d=3432918353,f=461845907,x=0;x>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var ft={exports:{}};ft.exports=function(i,e){for(var r,s=i.length,l=e^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++u;switch(s){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var xi=ti.exports,hn=ft.exports;zt.exports=xi,zt.exports.murmur3=xi,zt.exports.murmur2=hn;class un{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(ks(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=ks(e);let s=0,l=this.ids.length-1;for(;s>1;this.ids[d]>=r?l=d:s=d+1}const u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return Aa(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new un;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function ks(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:zt.exports(String(i))}function Aa(i,e,r,s){for(;r>1];let u=r-1,d=s+1;for(;;){do u++;while(i[u]l);if(u>=d)break;Ps(i,u,d),Ps(e,3*u,3*d),Ps(e,3*u+1,3*d+1),Ps(e,3*u+2,3*d+2)}d-r`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new Ls(e,r):new Ds(e,r)}}class Bs{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,l){const u=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new Hn(e,r):new Ds(e,r)}}class Fr{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new mt(0),r,{},l,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,u)}_setPaintValue(e,r,s){if(this.type==="color"){const l=fl(s);for(let u=e;u`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,s,l,u){const d=this.expression.evaluate(new mt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new mt(this.zoom+1),r,{},l,[],u),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:this.zoom},s,l),d=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,s,l){if(this.type==="color"){const u=fl(s),d=fl(l);for(let f=e;f`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Fr||s instanceof nr)for(let l=0;l!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Ql(l,r,s);this.needsUpload=!1,this._featureMap=new un,this._bufferOffset=0}populatePaintArrays(e,r,s,l,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Ih(i,e){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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function ec(i,e,r){const s={color:{source:n,composite:F},number:{source:L,composite:n}},l=function(u){return{"line-pattern":{source:Ye,composite:Ye},"fill-pattern":{source:Ye,composite:Ye},"fill-extrusion-pattern":{source:Ye,composite:Ye}}[u]}(i);return l&&l[r]||s[e][r]}Ee("ConstantBinder",Ca),Ee("CrossFadedConstantBinder",Bs),Ee("SourceExpressionBinder",Fr),Ee("CrossFadedCompositeBinder",pn),Ee("CompositeExpressionBinder",nr),Ee("ProgramConfiguration",Ql,{omit:["_buffers"]}),Ee("ProgramConfigurationSet",Kn);var Lt=8192;const gl=Math.pow(2,14)-1,tc=-gl-1;function Jn(i){const e=Lt/i.extent,r=i.loadGeometry();for(let s=0;sd.x+1||gd.y+1)&&Pt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Yn(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Jn(i):[]}}function Io(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class _l{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Le,this.indexArray=new Ut,this.segments=new Qe,this.programConfigurations=new Kn(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],u=[];let d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:g,id:x,index:w,sourceLayerIndex:E}of e){const A=this.layers[0]._featureFilter.needGeometry,z=Yn(g,A);if(!this.layers[0]._featureFilter.filter(new mt(this.zoom),z,s))continue;const k=f?d.evaluate(z,{},s):void 0,U={id:x,properties:g.properties,type:g.type,sourceLayerIndex:E,index:w,geometry:A?z.geometry:Jn(g),patterns:{},sortKey:k};u.push(U)}f&&u.sort((g,x)=>g.sortKey-x.sortKey);for(const g of u){const{geometry:x,index:w,sourceLayerIndex:E}=g,A=e[w].feature;this.addFeature(g,x,w,s),r.featureIndex.insert(A,x,w,E,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ms),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,l){for(const u of r)for(const d of u){const f=d.x,g=d.y;if(f<0||f>=Lt||g<0||g>=Lt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;Io(this.layoutVertexArray,f,g,-1,-1),Io(this.layoutVertexArray,f,g,1,-1),Io(this.layoutVertexArray,f,g,1,1),Io(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function ic(i,e){for(let r=0;r1){if(yl(i,e))return!0;for(let s=0;s1?r:r.sub(e)._mult(l)._add(e))}function sc(i,e){let r,s,l,u=!1;for(let d=0;de.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(u=!u)}return u}function Rs(i,e){let r=!1;for(let s=0,l=i.length-1;se.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function zh(i,e,r){const s=r[0],l=r[2];if(i.xl.x&&e.x>l.x||i.yl.y&&e.y>l.y)return!1;const u=Fi(i,e,r[0]);return u!==Fi(i,e,r[1])||u!==Fi(i,e,r[2])||u!==Fi(i,e,r[3])}function za(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function So(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Ao(i,e,r,s,l){if(!e[0]&&!e[1])return i;const u=Re.convert(e)._mult(l);r==="viewport"&&u._rotate(-s);const d=[];for(let f=0;fi.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);l.data[d+f+0]=Math.floor(255*x.r/x.a),l.data[d+f+1]=Math.floor(255*x.g/x.a),l.data[d+f+2]=Math.floor(255*x.b/x.a),l.data[d+f+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,f=0;d80*r){s=u=i[0],l=d=i[1];for(var k=r;ku&&(u=f),g>d&&(d=g);x=(x=Math.max(u-s,d-l))!==0?32767/x:0}return Pa(A,z,r,s,l,x,0),z}function fc(i,e,r,s,l){var u,d;if(l===Il(i,e,r,s)>0)for(u=e;u=e;u-=s)d=yc(u,i[u],i[u+1],d);return d&&ko(d,d.next)&&(La(d),d=d.next),d}function Qn(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!ko(s,s.next)&&St(s.prev,s,s.next)!==0)s=s.next;else{if(La(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function Pa(i,e,r,s,l,u,d){if(i){!d&&u&&function(w,E,A,z){var k=w;do k.z===0&&(k.z=Tl(k.x,k.y,E,A,z)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==w);k.prevZ.nextZ=null,k.prevZ=null,function(U){var O,W,Q,X,Y,ce,le,Se,Ce=1;do{for(W=U,U=null,Y=null,ce=0;W;){for(ce++,Q=W,le=0,O=0;O0||Se>0&&Q;)le!==0&&(Se===0||!Q||W.z<=Q.z)?(X=W,W=W.nextZ,le--):(X=Q,Q=Q.nextZ,Se--),Y?Y.nextZ=X:U=X,X.prevZ=Y,Y=X;W=Q}Y.nextZ=null,Ce*=2}while(ce>1)}(k)}(i,s,l,u);for(var f,g,x=i;i.prev!==i.next;)if(f=i.prev,g=i.next,u?Oh(i,s,l,u):Fh(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),La(i),i=g.next,x=g.next;else if((i=g)===x){d?d===1?Pa(i=Uh(Qn(i),e,r),e,r,s,l,u,2):d===2&&Vh(i,e,r,s,l,u):Pa(Qn(i),e,r,s,l,u,1);break}}}function Fh(i){var e=i.prev,r=i,s=i.next;if(St(e,r,s)>=0)return!1;for(var l=e.x,u=r.x,d=s.x,f=e.y,g=r.y,x=s.y,w=lu?l>d?l:d:u>d?u:d,z=f>g?f>x?f:x:g>x?g:x,k=s.next;k!==e;){if(k.x>=w&&k.x<=A&&k.y>=E&&k.y<=z&&Fs(l,f,u,g,d,x,k.x,k.y)&&St(k.prev,k,k.next)>=0)return!1;k=k.next}return!0}function Oh(i,e,r,s){var l=i.prev,u=i,d=i.next;if(St(l,u,d)>=0)return!1;for(var f=l.x,g=u.x,x=d.x,w=l.y,E=u.y,A=d.y,z=fg?f>x?f:x:g>x?g:x,O=w>E?w>A?w:A:E>A?E:A,W=Tl(z,k,e,r,s),Q=Tl(U,O,e,r,s),X=i.prevZ,Y=i.nextZ;X&&X.z>=W&&Y&&Y.z<=Q;){if(X.x>=z&&X.x<=U&&X.y>=k&&X.y<=O&&X!==l&&X!==d&&Fs(f,w,g,E,x,A,X.x,X.y)&&St(X.prev,X,X.next)>=0||(X=X.prevZ,Y.x>=z&&Y.x<=U&&Y.y>=k&&Y.y<=O&&Y!==l&&Y!==d&&Fs(f,w,g,E,x,A,Y.x,Y.y)&&St(Y.prev,Y,Y.next)>=0))return!1;Y=Y.nextZ}for(;X&&X.z>=W;){if(X.x>=z&&X.x<=U&&X.y>=k&&X.y<=O&&X!==l&&X!==d&&Fs(f,w,g,E,x,A,X.x,X.y)&&St(X.prev,X,X.next)>=0)return!1;X=X.prevZ}for(;Y&&Y.z<=Q;){if(Y.x>=z&&Y.x<=U&&Y.y>=k&&Y.y<=O&&Y!==l&&Y!==d&&Fs(f,w,g,E,x,A,Y.x,Y.y)&&St(Y.prev,Y,Y.next)>=0)return!1;Y=Y.nextZ}return!0}function Uh(i,e,r){var s=i;do{var l=s.prev,u=s.next.next;!ko(l,u)&&gc(l,s,s.next,u)&&Da(l,u)&&Da(u,l)&&(e.push(l.i/r|0),e.push(s.i/r|0),e.push(u.i/r|0),La(s),La(s.next),s=i=u),s=s.next}while(s!==i);return Qn(s)}function Vh(i,e,r,s,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Zh(d,f)){var g=_c(d,f);return d=Qn(d,d.next),g=Qn(g,g.next),Pa(d,e,r,s,l,u,0),void Pa(g,e,r,s,l,u,0)}f=f.next}d=d.next}while(d!==i)}function Nh(i,e){return i.x-e.x}function $h(i,e){var r=function(l,u){var d,f=u,g=l.x,x=l.y,w=-1/0;do{if(x<=f.y&&x>=f.next.y&&f.next.y!==f.y){var E=f.x+(x-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(E<=g&&E>w&&(w=E,d=f.x=f.x&&f.x>=k&&g!==f.x&&Fs(xd.x||f.x===d.x&&Gh(d,f)))&&(d=f,O=A)),f=f.next;while(f!==z);return d}(i,e);if(!r)return e;var s=_c(r,i);return Qn(s,s.next),Qn(r,r.next)}function Gh(i,e){return St(i.prev,i,e.prev)<0&&St(e.next,i,i.next)<0}function Tl(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qh(i){var e=i,r=i;do(e.x=(i-d)*(u-f)&&(i-d)*(s-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(l-d)*(s-f)}function Zh(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&gc(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(Da(i,e)&&Da(e,i)&&function(r,s){var l=r,u=!1,d=(r.x+s.x)/2,f=(r.y+s.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(u=!u),l=l.next;while(l!==r);return u}(i,e)&&(St(i.prev,i,e.prev)||St(i,e.prev,e))||ko(i,e)&&St(i.prev,i,i.next)>0&&St(e.prev,e,e.next)>0)}function St(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function ko(i,e){return i.x===e.x&&i.y===e.y}function gc(i,e,r,s){var l=Do(St(i,e,r)),u=Do(St(i,e,s)),d=Do(St(r,s,i)),f=Do(St(r,s,e));return l!==u&&d!==f||!(l!==0||!Po(i,r,e))||!(u!==0||!Po(i,s,e))||!(d!==0||!Po(r,i,s))||!(f!==0||!Po(r,e,s))}function Po(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function Do(i){return i>0?1:i<0?-1:0}function Da(i,e){return St(i.prev,i,i.next)<0?St(i,e,i.next)>=0&&St(i,i.prev,e)>=0:St(i,e,i.prev)<0||St(i,i.next,e)<0}function _c(i,e){var r=new El(i.i,i.x,i.y),s=new El(e.i,e.x,e.y),l=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function yc(i,e,r,s){var l=new El(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function La(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function El(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Il(i,e,r,s){for(var l=0,u=e,d=r-s;ur;){if(s-r>600){var u=s-r+1,d=e-r+1,f=Math.log(u),g=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*g*(u-g)/u)*(d-u/2<0?-1:1);xc(i,e,Math.max(r,Math.floor(e-d*g/u+x)),Math.min(s,Math.floor(e+(u-d)*g/u+x)),l)}var w=i[e],E=r,A=s;for(Ba(i,r,e),l(i[s],w)>0&&Ba(i,r,s);E0;)A--}l(i[r],w)===0?Ba(i,r,A):Ba(i,++A,s),A<=e&&(r=A+1),e<=A&&(s=A-1)}}function Ba(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function Xh(i,e){return ie?1:0}function Sl(i,e){const r=i.length;if(r<=1)return[i];const s=[];let l,u;for(let d=0;d1)for(let d=0;d0&&r.holes.push(s+=i[l-1].length)}return r};class zl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new nt,this.indexArray=new Ut,this.indexArray2=new ki,this.programConfigurations=new Kn(e.layers,e.zoom),this.segments=new Qe,this.segments2=new Qe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Al("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=Yn(f,E);if(!this.layers[0]._featureFilter.filter(new mt(this.zoom),A,s))continue;const z=u?l.evaluate(A,{},s,r.availableImages):void 0,k={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:E?A.geometry:Jn(f),patterns:{},sortKey:z};d.push(k)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const E=Cl("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Rh),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,r,s,l,u){for(const d of Sl(r,500)){let f=0;for(const z of d)f+=z.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=g.vertexLength,w=[],E=[];for(const z of d){if(z.length===0)continue;z!==d[0]&&E.push(w.length/2);const k=this.segments2.prepareSegment(z.length,this.layoutVertexArray,this.indexArray2),U=k.vertexLength;this.layoutVertexArray.emplaceBack(z[0].x,z[0].y),this.indexArray2.emplaceBack(U+z.length-1,U),w.push(z[0].x),w.push(z[0].y);for(let O=1;O>3}if(l--,s===1||s===2)u+=i.readSVarint(),d+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new eu(u,d));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Os.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,u=0,d=1/0,f=-1/0,g=1/0,x=-1/0;i.pos>3}if(s--,r===1||r===2)(l+=i.readSVarint())f&&(f=l),(u+=i.readSVarint())x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,x]},Os.prototype.toGeoJSON=function(i,e,r){var s,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,g=this.loadGeometry(),x=Os.types[this.type];function w(z){for(var k=0;k>3;l=d===1?s.readString():d===2?s.readFloat():d===3?s.readDouble():d===4?s.readVarint64():d===5?s.readVarint():d===6?s.readSVarint():d===7?s.readBoolean():null}return l}(r))}wc.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new ru(this._pbf,e,this.extent,this._keys,this._values)};var su=bc;function au(i,e,r){if(i===3){var s=new su(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}dn.VectorTile=function(i,e){this.layers=i.readFields(au,{},e)},dn.VectorTileFeature=vc,dn.VectorTileLayer=bc;const ou=dn.VectorTileFeature.types,Ml=Math.pow(2,13);function Ra(i,e,r,s,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(s*Ml)+d,l*Ml*2,u*Ml*2,Math.round(f))}class kl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new st,this.centroidVertexArray=new Ze,this.indexArray=new Ut,this.programConfigurations=new Kn(e.layers,e.zoom),this.segments=new Qe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=Al("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,x=Yn(l,g);if(!this.layers[0]._featureFilter.filter(new mt(this.zoom),x,s))continue;const w={id:u,sourceLayerIndex:f,index:d,geometry:g?x.geometry:Jn(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Cl("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,d,s,{}),r.featureIndex.insert(l,w.geometry,d,f,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Qh),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Yh.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,l,u){const d={x:0,y:0,vertexCount:0};for(const f of Sl(r,500)){let g=0;for(const k of f)g+=k.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const k of f){if(k.length===0||cu(k))continue;let U=0;for(let O=0;O=1){const Q=k[O-1];if(!lu(W,Q)){x.vertexLength+4>Qe.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const X=W.sub(Q)._perp()._unit(),Y=Q.dist(W);U+Y>32768&&(U=0),Ra(this.layoutVertexArray,W.x,W.y,X.x,X.y,0,0,U),Ra(this.layoutVertexArray,W.x,W.y,X.x,X.y,0,1,U),d.x+=2*W.x,d.y+=2*W.y,d.vertexCount+=2,U+=Y,Ra(this.layoutVertexArray,Q.x,Q.y,X.x,X.y,0,0,U),Ra(this.layoutVertexArray,Q.x,Q.y,X.x,X.y,0,1,U),d.x+=2*Q.x,d.y+=2*Q.y,d.vertexCount+=2;const ce=x.vertexLength;this.indexArray.emplaceBack(ce,ce+2,ce+1),this.indexArray.emplaceBack(ce+1,ce+2,ce+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>Qe.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),ou[e.type]!=="Polygon")continue;const w=[],E=[],A=x.vertexLength;for(const k of f)if(k.length!==0){k!==f[0]&&E.push(w.length/2);for(let U=0;ULt)||i.y===e.y&&(i.y<0||i.y>Lt)}function cu(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Lt)||i.every(e=>e.y<0)||i.every(e=>e.y>Lt)}Ee("FillExtrusionBucket",kl,{omit:["layers","features"]});var hu={paint:new Dt({"fill-extrusion-opacity":new Me(ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Be(ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Me(ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Me(ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Zn(ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Be(ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Be(ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Me(ne["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Fa(i,e){return i.x*e.x+i.y*e.y}function Tc(i,e){if(i.length===1){let r=0;const s=e[r++];let l;for(;!l||s.equals(l);)if(l=e[r++],!l)return 1/0;for(;rr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Ke,this.layoutVertexArray2=new Je,this.indexArray=new Ut,this.programConfigurations=new Kn(e.layers,e.zoom),this.segments=new Qe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Al("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=Yn(f,E);if(!this.layers[0]._featureFilter.filter(new mt(this.zoom),A,s))continue;const z=u?l.evaluate(A,{},s):void 0,k={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:E?A.geometry:Jn(f),patterns:{},sortKey:z};d.push(k)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const E=Cl("line",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,mu)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,pu),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,l,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),x=d.get("line-miter-limit"),w=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,f,g,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}addLine(e,r,s,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let W=0;W=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x0;if(Se&&W>x){const pe=A.dist(z);if(pe>2*w){const ve=A.sub(A.sub(z)._mult(w/pe)._round());this.updateDistance(z,ve),this.addCurrentVertex(ve,U,0,0,E),z=ve}}const xe=z&&k;let fe=xe?s:f?"butt":l;if(xe&&fe==="round"&&(ceu&&(fe="bevel"),fe==="bevel"&&(ce>2&&(fe="flipbevel"),ce100)Q=O.mult(-1);else{const pe=ce*U.add(O).mag()/U.sub(O).mag();Q._perp()._mult(pe*(Ce?-1:1))}this.addCurrentVertex(A,Q,0,0,E),this.addCurrentVertex(A,Q.mult(-1),0,0,E)}else if(fe==="bevel"||fe==="fakeround"){const pe=-Math.sqrt(ce*ce-1),ve=Ce?pe:0,_e=Ce?0:pe;if(z&&this.addCurrentVertex(A,U,ve,_e,E),fe==="fakeround"){const ue=Math.round(180*le/Math.PI/20);for(let De=1;De2*w){const ve=A.add(k.sub(A)._mult(w/pe)._round());this.updateDistance(A,ve),this.addCurrentVertex(ve,O,0,0,E),A=ve}}}}addCurrentVertex(e,r,s,l,u,d=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,d,!1,s,u),this.addHalfVertex(e,f,g,d,!0,-l,u),this.distance>Ec/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,s,l,u,d))}addHalfVertex({x:e,y:r},s,l,u,d,f,g){const x=.5*(this.lineClips?this.scaledDistance*(Ec-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),d?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}Ee("LineBucket",Pl,{omit:["layers","patternFeatures"]});const _u=new Dt({"line-cap":new Me(ne.layout_line["line-cap"]),"line-join":new Be(ne.layout_line["line-join"]),"line-miter-limit":new Me(ne.layout_line["line-miter-limit"]),"line-round-limit":new Me(ne.layout_line["line-round-limit"]),"line-sort-key":new Be(ne.layout_line["line-sort-key"])});var Ic={paint:new Dt({"line-opacity":new Be(ne.paint_line["line-opacity"]),"line-color":new Be(ne.paint_line["line-color"]),"line-translate":new Me(ne.paint_line["line-translate"]),"line-translate-anchor":new Me(ne.paint_line["line-translate-anchor"]),"line-width":new Be(ne.paint_line["line-width"]),"line-gap-width":new Be(ne.paint_line["line-gap-width"]),"line-offset":new Be(ne.paint_line["line-offset"]),"line-blur":new Be(ne.paint_line["line-blur"]),"line-dasharray":new jn(ne.paint_line["line-dasharray"]),"line-pattern":new Zn(ne.paint_line["line-pattern"]),"line-gradient":new Sa(ne.paint_line["line-gradient"])}),layout:_u};const Sc=new class extends Be{possiblyEvaluate(i,e){return e=new mt(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,s){return e=wi({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,s)}}(Ic.paint.properties["line-width"].specification);function Ac(i,e){return e>0?e+2*i:i}Sc.useIntegerZoom=!0;const yu=Ct([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),xu=Ct([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ct([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const vu=Ct([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Ct([{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 Cc=Ct([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bu=Ct([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function wu(i,e,r){return i.sections.forEach(s=>{s.text=function(l,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),yi.applyArabicShaping&&(l=yi.applyArabicShaping(l)),l}(s.text,e,r)}),i}Ct([{name:"triangle",components:3,type:"Uint16"}]),Ct([{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"}]),Ct([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ct([{type:"Float32",name:"offsetX"}]),Ct([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Oa={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Vt=24,Dl=at,zc=function(i,e,r,s,l){var u,d,f=8*l-s-1,g=(1<>1,w=-7,E=l-1,A=-1,z=i[e+E];for(E+=A,u=z&(1<<-w)-1,z>>=-w,w+=f;w>0;u=256*u+i[e+E],E+=A,w-=8);for(d=u&(1<<-w)-1,u>>=-w,w+=s;w>0;d=256*d+i[e+E],E+=A,w-=8);if(u===0)u=1-x;else{if(u===g)return d?NaN:1/0*(z?-1:1);d+=Math.pow(2,s),u-=x}return(z?-1:1)*d*Math.pow(2,u-s)},Mc=function(i,e,r,s,l,u){var d,f,g,x=8*u-l-1,w=(1<>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=0,k=1,U=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=w):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+E>=1?A/g:A*Math.pow(2,1-E))*g>=2&&(d++,g/=2),d+E>=w?(f=0,d=w):d+E>=1?(f=(e*g-1)*Math.pow(2,l),d+=E):(f=e*Math.pow(2,E-1)*Math.pow(2,l),d=0));l>=8;i[r+z]=255&f,z+=k,f/=256,l-=8);for(d=d<0;i[r+z]=255&d,z+=k,d/=256,x-=8);i[r+z-k]|=128*U};function at(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}at.Varint=0,at.Fixed64=1,at.Bytes=2,at.Fixed32=5;var mn,Ll=4294967296,kc=1/Ll,Pc=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Or(i){return i.type===at.Bytes?i.readVarint()+i.pos:i.pos+1}function Us(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Dc(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function Tu(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Lc(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Pu(i,e,r){i===1&&r.readMessage(Du,e)}function Du(i,e,r){if(i===3){const{id:s,bitmap:l,width:u,height:d,left:f,top:g,advance:x}=r.readMessage(Lu,{});e.push({id:s,bitmap:new ka({width:u+6,height:d+6},l),metrics:{width:u,height:d,left:f,top:g,advance:x}})}}function Lu(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function Bc(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,u=0;for(const d of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){const x=s.pop();f>3,u=this.pos;this.type=7&s,i(l,e,this),this.pos===u&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Lo(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Lc(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Lo(this.buf,this.pos)+Lo(this.buf,this.pos+4)*Ll;return this.pos+=8,i},readSFixed64:function(){var i=Lo(this.buf,this.pos)+Lc(this.buf,this.pos+4)*Ll;return this.pos+=8,i},readFloat:function(){var i=zc(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=zc(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,u,d){var f,g,x=d.buf;if(f=(112&(g=x[d.pos++]))>>4,g<128||(f|=(127&(g=x[d.pos++]))<<3,g<128)||(f|=(127&(g=x[d.pos++]))<<10,g<128)||(f|=(127&(g=x[d.pos++]))<<17,g<128)||(f|=(127&(g=x[d.pos++]))<<24,g<128)||(f|=(1&(g=x[d.pos++]))<<31,g<128))return Us(l,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Pc?function(r,s,l){return Pc.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var u="",d=s;d239?4:w>223?3:w>191?2:1;if(d+A>l)break;A===1?w<128&&(E=w):A===2?(192&(f=r[d+1]))==128&&(E=(31&w)<<6|63&f)<=127&&(E=null):A===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((E=(15&w)<<12|(63&f)<<6|63&g)<=2047||E>=55296&&E<=57343)&&(E=null)):A===4&&(g=r[d+2],x=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((E=(15&w)<<18|(63&f)<<12|(63&g)<<6|63&x)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,A=1):E>65535&&(E-=65536,u+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),u+=String.fromCharCode(E),d+=A}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==at.Bytes)return i.push(this.readVarint(e));var r=Or(this);for(i=i||[];this.pos127;);else if(e===at.Bytes)this.pos=this.readVarint()+this.pos;else if(e===at.Fixed32)this.pos+=4;else{if(e!==at.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(s,l,u){for(var d,f,g=0;g55295&&d<57344){if(!f){d>56319||g+1===l.length?(s[u++]=239,s[u++]=191,s[u++]=189):f=d;continue}if(d<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);d<128?s[u++]=d:(d<2048?s[u++]=d>>6|192:(d<65536?s[u++]=d>>12|224:(s[u++]=d>>18|240,s[u++]=d>>12&63|128),s[u++]=d>>6&63|128),s[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Dc(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Mc(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Mc(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Dc(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,at.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Tu,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Eu,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Au,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Iu,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Su,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Cu,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,zu,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Mu,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,ku,e)},writeBytesField:function(i,e){this.writeTag(i,at.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,at.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,at.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,at.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,at.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,at.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,at.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,at.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,at.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,at.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};class Bl{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:u,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=u,this.content=d,this.version=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Rc{constructor(e,r){const s={},l={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,s,u),this.addImages(r,l,u);const{w:d,h:f}=Bc(u),g=new Di({width:d||1,height:f||1});for(const x in e){const w=e[x],E=s[x].paddedRect;Di.copy(w.data,g,{x:0,y:0},{x:E.x+1,y:E.y+1},w.data)}for(const x in r){const w=r[x],E=l[x].paddedRect,A=E.x+1,z=E.y+1,k=w.data.width,U=w.data.height;Di.copy(w.data,g,{x:0,y:0},{x:A,y:z},w.data),Di.copy(w.data,g,{x:0,y:U-1},{x:A,y:z-1},{width:k,height:1}),Di.copy(w.data,g,{x:0,y:0},{x:A,y:z+U},{width:k,height:1}),Di.copy(w.data,g,{x:k-1,y:0},{x:A-1,y:z},{width:1,height:U}),Di.copy(w.data,g,{x:0,y:0},{x:A+k,y:z},{width:1,height:U})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(e,r,s){for(const l in e){const u=e[l],d={x:0,y:0,w:u.data.width+2,h:u.data.height+2};s.push(d),r[l]=new Bl(d,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),r)}patchUpdatedImage(e,r,s){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,u]=e.tl;s.update(r.data,void 0,{x:l,y:u})}}Ee("ImagePosition",Bl),Ee("ImageAtlas",Rc),h.WritingMode=void 0,(mn=h.WritingMode||(h.WritingMode={}))[mn.none=0]="none",mn[mn.horizontal=1]="horizontal",mn[mn.vertical=2]="vertical",mn[mn.horizontalOnly=3]="horizontalOnly";const Bo=-17;class Ua{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new Ua;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new Ua;return r.imageName=e,r}}class Ns{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new Ns;for(let l=0;l=0&&s>=e&&Fo[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new Ns;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(Ua.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ro(i,e,r,s,l,u,d,f,g,x,w,E,A,z,k,U){const O=Ns.fromFeature(i,l);let W;E===h.WritingMode.vertical&&O.verticalizePunctuation();const{processBidirectionalText:Q,processStyledBidirectionalText:X}=yi;if(Q&&O.sections.length===1){W=[];const le=Q(O.toString(),Rl(O,x,u,e,s,z,k));for(const Se of le){const Ce=new Ns;Ce.text=Se,Ce.sections=O.sections;for(let xe=0;xe0&&Nr>di&&(di=Nr)}else{const Ri=Ce[We.fontStack],mi=Ri&&Ri[jt];if(mi&&mi.rect)sr=mi.rect,Zi=mi.metrics;else{const Nr=Se[We.fontStack],$a=Nr&&Nr[jt];if(!$a)continue;Zi=$a.metrics}Yt=(Zt-We.scale)*Vt}ji?(le.verticalizable=!0,pi.push({glyph:jt,imageName:ar,x:dt,y:gt+Yt,vertical:ji,scale:We.scale,fontStack:We.fontStack,sectionIndex:vi,metrics:Zi,rect:sr}),dt+=Vr*We.scale+De):(pi.push({glyph:jt,imageName:ar,x:dt,y:gt+Yt,vertical:ji,scale:We.scale,fontStack:We.fontStack,sectionIndex:vi,metrics:Zi,rect:sr}),dt+=Zi.advance*We.scale+De)}pi.length!==0&&(Bt=Math.max(dt-De,Bt),Fu(pi,0,pi.length-1,Gt,di)),dt=0;const xt=pe*Zt+di;ni.lineOffset=Math.max(di,Jt),gt+=xt,Bi=Math.max(xt,Bi),++Mt}var Rt;const qt=gt-Bo,{horizontalAlign:Kt,verticalAlign:ui}=Fl(ve);(function(kt,Zt,Jt,ni,pi,di,xt,Ft,We){const vi=(Zt-Jt)*pi;let jt=0;jt=di!==xt?-Ft*ni-Bo:(-ni*We+.5)*xt;for(const Yt of kt)for(const Zi of Yt.positionedGlyphs)Zi.x+=vi,Zi.y+=jt})(le.positionedLines,Gt,Kt,ui,Bt,Bi,pe,qt,fe.length),le.top+=-ui*qt,le.bottom=le.top+qt,le.left+=-Kt*Bt,le.right=le.left+Bt}(ce,e,r,s,W,d,f,g,E,x,A,U),!function(le){for(const Se of le)if(Se.positionedGlyphs.length!==0)return!1;return!0}(Y)&&ce}const Fo={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Bu={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 Fc(i,e,r,s,l,u){if(e.imageName){const d=s[e.imageName];return d?d.displaySize[0]*e.scale*Vt/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function Oc(i,e,r,s){const l=Math.pow(i-e,2);return s?i=0;let w=0;for(let A=0;A-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const g=[];let x=0;for(;fs;)x-=g.shift().angleDelta;if(x>l)return!1;d++,f+=w.dist(E)}return!0}function qc(i){let e=0;for(let r=0;rx){const k=(x-g)/z,U=_t(E.x,A.x,k),O=_t(E.y,A.y,k),W=new fn(U,O,A.angleTo(E),w);return W._round(),!d||Gc(i,W,f,d,e)?W:void 0}g+=z}}function Vu(i,e,r,s,l,u,d,f,g){const x=Zc(s,u,d),w=jc(s,l),E=w*d,A=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E=0&&Y=0&&ce=0&&A+x<=w){const le=new fn(Y,ce,Q,k);le._round(),s&&!Gc(i,le,u,s,l)||z.push(le)}}E+=W}return f||z.length||d||(z=Xc(i,E/2,r,s,l,u,d,!0,g)),z}function Wc(i,e,r,s,l){const u=[];for(let d=0;d=s&&E.x>=s||(w.x>=s?w=new Re(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x>=s&&(E=new Re(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y>=l&&E.y>=l||(w.y>=l?w=new Re(w.x+(l-w.y)/(E.y-w.y)*(E.x-w.x),l)._round():E.y>=l&&(E=new Re(w.x+(l-w.y)/(E.y-w.y)*(E.x-w.x),l)._round()),g&&w.equals(g[g.length-1])||(g=[w],u.push(g)),g.push(E)))))}}return u}function Hc(i,e,r,s){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2,g=u.paddedRect.h-2,x=i.right-i.left,w=i.bottom-i.top,E=u.stretchX||[[0,f]],A=u.stretchY||[[0,g]],z=(pe,ve)=>pe+ve[1]-ve[0],k=E.reduce(z,0),U=A.reduce(z,0),O=f-k,W=g-U;let Q=0,X=k,Y=0,ce=U,le=0,Se=O,Ce=0,xe=W;if(u.content&&s){const pe=u.content;Q=Oo(E,0,pe[0]),Y=Oo(A,0,pe[1]),X=Oo(E,pe[0],pe[2]),ce=Oo(A,pe[1],pe[3]),le=pe[0]-Q,Ce=pe[1]-Y,Se=pe[2]-pe[0]-X,xe=pe[3]-pe[1]-ce}const fe=(pe,ve,_e,ue)=>{const De=Uo(pe.stretch-Q,X,x,i.left),ke=Vo(pe.fixed-le,Se,pe.stretch,k),je=Uo(ve.stretch-Y,ce,w,i.top),dt=Vo(ve.fixed-Ce,xe,ve.stretch,U),gt=Uo(_e.stretch-Q,X,x,i.left),Bt=Vo(_e.fixed-le,Se,_e.stretch,k),Bi=Uo(ue.stretch-Y,ce,w,i.top),Gt=Vo(ue.fixed-Ce,xe,ue.stretch,U),Mt=new Re(De,je),Rt=new Re(gt,je),qt=new Re(gt,Bi),Kt=new Re(De,Bi),ui=new Re(ke/d,dt/d),kt=new Re(Bt/d,Gt/d),Zt=e*Math.PI/180;if(Zt){const pi=Math.sin(Zt),di=Math.cos(Zt),xt=[di,-pi,pi,di];Mt._matMult(xt),Rt._matMult(xt),Kt._matMult(xt),qt._matMult(xt)}const Jt=pe.stretch+pe.fixed,ni=ve.stretch+ve.fixed;return{tl:Mt,tr:Rt,bl:Kt,br:qt,tex:{x:u.paddedRect.x+1+Jt,y:u.paddedRect.y+1+ni,w:_e.stretch+_e.fixed-Jt,h:ue.stretch+ue.fixed-ni},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ui,pixelOffsetBR:kt,minFontScaleX:Se/d/x,minFontScaleY:xe/d/w,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const pe=Kc(E,O,k),ve=Kc(A,W,U);for(let _e=0;_e0&&(k=Math.max(10,k),this.circleDiameter=k)}else{let E=d.top*f-g[0],A=d.bottom*f+g[2],z=d.left*f-g[3],k=d.right*f+g[1];const U=d.collisionPadding;if(U&&(z-=U[0]*f,E-=U[1]*f,k+=U[2]*f,A+=U[3]*f),w){const O=new Re(z,E),W=new Re(k,E),Q=new Re(z,A),X=new Re(k,A),Y=w*Math.PI/180;O._rotate(Y),W._rotate(Y),Q._rotate(Y),X._rotate(Y),z=Math.min(O.x,W.x,Q.x,X.x),k=Math.max(O.x,W.x,Q.x,X.x),E=Math.min(O.y,W.y,Q.y,X.y),A=Math.max(O.y,W.y,Q.y,X.y)}e.emplaceBack(r.x,r.y,z,E,k,A,s,l,u)}this.boxEndIndex=e.length}}class Nu{constructor(e=[],r=$u){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(s(l,d)>=0)break;r[e]=d,e=u}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,u=r[e];for(;e=0)break;r[e]=f,e=d}r[e]=u}}function $u(i,e){return ie?1:0}function Gu(i,e=1,r=!1){let s=1/0,l=1/0,u=-1/0,d=-1/0;const f=i[0];for(let z=0;zu)&&(u=k.x),(!z||k.y>d)&&(d=k.y)}const g=Math.min(u-s,d-l);let x=g/2;const w=new Nu([],qu);if(g===0)return new Re(s,l);for(let z=s;zE.d||!E.d)&&(E=z,r&&console.log("found best %d after %d probes",Math.round(1e4*z.d)/1e4,A)),z.max-E.d<=e||(x=z.h/2,w.push(new $s(z.p.x-x,z.p.y-x,x,i)),w.push(new $s(z.p.x+x,z.p.y-x,x,i)),w.push(new $s(z.p.x-x,z.p.y+x,x,i)),w.push(new $s(z.p.x+x,z.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${E.d}`)),E.p}function qu(i,e){return e.max-i.max}function $s(i,e,r,s){this.p=new Re(i,e),this.h=r,this.d=function(l,u){let d=!1,f=1/0;for(let g=0;gl.y!=k.y>l.y&&l.x<(k.x-z.x)*(l.y-z.y)/(k.y-z.y)+z.x&&(d=!d),f=Math.min(f,nc(l,z,k))}}return(d?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Ol=Number.POSITIVE_INFINITY;function Jc(i,e){return e[1]!==Ol?function(r,s,l){let u=0,d=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-l}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,d]}(i,e[0],e[1]):function(r,s){let l=0,u=0;s<0&&(s=0);const d=s/Math.sqrt(2);switch(r){case"top-right":case"top-left":u=d-7;break;case"bottom-right":case"bottom-left":u=7-d;break;case"bottom":u=7-s;break;case"top":u=s-7}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=s;break;case"right":l=-s}return[l,u]}(i,e[0])}function Ul(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Zu(i,e,r,s,l,u,d,f,g,x,w){let E=u.textMaxSize.evaluate(e,{});E===void 0&&(E=d);const A=i.layers[0].layout,z=A.get("icon-offset").evaluate(e,{},w),k=Qc(r.horizontal),U=d/24,O=i.tilePixelRatio*U,W=i.tilePixelRatio*E/24,Q=i.tilePixelRatio*f,X=i.tilePixelRatio*A.get("symbol-spacing"),Y=A.get("text-padding")*i.tilePixelRatio,ce=function(ue,De,ke,je=1){const dt=ue.get("icon-padding").evaluate(De,{},ke),gt=dt&&dt.values;return[gt[0]*je,gt[1]*je,gt[2]*je,gt[3]*je]}(A,e,w,i.tilePixelRatio),le=A.get("text-max-angle")/180*Math.PI,Se=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Ce=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",xe=A.get("symbol-placement"),fe=X/2,pe=A.get("icon-text-fit");let ve;s&&pe!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(ve=Nc(s,r.vertical,pe,A.get("icon-text-fit-padding"),z,U)),k&&(s=Nc(s,k,pe,A.get("icon-text-fit-padding"),z,U)));const _e=(ue,De)=>{De.x<0||De.x>=Lt||De.y<0||De.y>=Lt||function(ke,je,dt,gt,Bt,Bi,Gt,Mt,Rt,qt,Kt,ui,kt,Zt,Jt,ni,pi,di,xt,Ft,We,vi,jt,Yt,Zi){const sr=ke.addToLineVertexArray(je,dt);let ar,Vr,ji,Ri,mi=0,Nr=0,$a=0,fh=0,Hl=-1,Kl=-1;const $r={};let gh=zt.exports(""),Jl=0,Yl=0;if(Mt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Jl,Yl]=Mt.layout.get("text-offset").evaluate(We,{},Yt).map(fi=>fi*Vt):(Jl=Mt.layout.get("text-radial-offset").evaluate(We,{},Yt)*Vt,Yl=Ol),ke.allowVerticalPlacement&>.vertical){const fi=Mt.layout.get("text-rotate").evaluate(We,{},Yt)+90;ji=new No(Rt,je,qt,Kt,ui,gt.vertical,kt,Zt,Jt,fi),Gt&&(Ri=new No(Rt,je,qt,Kt,ui,Gt,pi,di,Jt,fi))}if(Bt){const fi=Mt.layout.get("icon-rotate").evaluate(We,{}),wr=Mt.layout.get("icon-text-fit")!=="none",Ga=Hc(Bt,fi,jt,wr),qa=Gt?Hc(Gt,fi,jt,wr):void 0;Vr=new No(Rt,je,qt,Kt,ui,Bt,pi,di,!1,fi),mi=4*Ga.length;const xh=ke.iconSizeData;let ts=null;xh.kind==="source"?(ts=[Ur*Mt.layout.get("icon-size").evaluate(We,{})],ts[0]>gn&&Pt(`${ke.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):xh.kind==="composite"&&(ts=[Ur*vi.compositeIconSizes[0].evaluate(We,{},Yt),Ur*vi.compositeIconSizes[1].evaluate(We,{},Yt)],(ts[0]>gn||ts[1]>gn)&&Pt(`${ke.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),ke.addSymbols(ke.icon,Ga,ts,Ft,xt,We,h.WritingMode.none,je,sr.lineStartIndex,sr.lineLength,-1,Yt),Hl=ke.icon.placedSymbolArray.length-1,qa&&(Nr=4*qa.length,ke.addSymbols(ke.icon,qa,ts,Ft,xt,We,h.WritingMode.vertical,je,sr.lineStartIndex,sr.lineLength,-1,Yt),Kl=ke.icon.placedSymbolArray.length-1)}const _h=Object.keys(gt.horizontal);for(const fi of _h){const wr=gt.horizontal[fi];if(!ar){gh=zt.exports(wr.text);const qa=Mt.layout.get("text-rotate").evaluate(We,{},Yt);ar=new No(Rt,je,qt,Kt,ui,wr,kt,Zt,Jt,qa)}const Ga=wr.positionedLines.length===1;if($a+=Yc(ke,je,wr,Bi,Mt,Jt,We,ni,sr,gt.vertical?h.WritingMode.horizontal:h.WritingMode.horizontalOnly,Ga?_h:[fi],$r,Hl,vi,Yt),Ga)break}gt.vertical&&(fh+=Yc(ke,je,gt.vertical,Bi,Mt,Jt,We,ni,sr,h.WritingMode.vertical,["vertical"],$r,Kl,vi,Yt));const np=ar?ar.boxStartIndex:ke.collisionBoxArray.length,sp=ar?ar.boxEndIndex:ke.collisionBoxArray.length,ap=ji?ji.boxStartIndex:ke.collisionBoxArray.length,op=ji?ji.boxEndIndex:ke.collisionBoxArray.length,lp=Vr?Vr.boxStartIndex:ke.collisionBoxArray.length,cp=Vr?Vr.boxEndIndex:ke.collisionBoxArray.length,hp=Ri?Ri.boxStartIndex:ke.collisionBoxArray.length,up=Ri?Ri.boxEndIndex:ke.collisionBoxArray.length;let or=-1;const jo=(fi,wr)=>fi&&fi.circleDiameter?Math.max(fi.circleDiameter,wr):wr;or=jo(ar,or),or=jo(ji,or),or=jo(Vr,or),or=jo(Ri,or);const yh=or>-1?1:0;yh&&(or*=Zi/Vt),ke.glyphOffsetArray.length>=Gs.MAX_GLYPHS&&Pt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),We.sortKey!==void 0&&ke.addToSortKeyRanges(ke.symbolInstances.length,We.sortKey),ke.symbolInstances.emplaceBack(je.x,je.y,$r.right>=0?$r.right:-1,$r.center>=0?$r.center:-1,$r.left>=0?$r.left:-1,$r.vertical||-1,Hl,Kl,gh,np,sp,ap,op,lp,cp,hp,up,qt,$a,fh,mi,Nr,yh,0,kt,Jl,Yl,or)}(i,De,ue,r,s,l,ve,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,O,[Y,Y,Y,Y],Se,g,Q,ce,Ce,z,e,u,x,w,d)};if(xe==="line")for(const ue of Wc(e.geometry,0,0,Lt,Lt)){const De=Vu(ue,X,le,r.vertical||k,s,24,W,i.overscaling,Lt);for(const ke of De){const je=k;je&&ju(i,je.text,fe,ke)||_e(ue,ke)}}else if(xe==="line-center"){for(const ue of e.geometry)if(ue.length>1){const De=Uu(ue,le,r.vertical||k,s,24,W);De&&_e(ue,De)}}else if(e.type==="Polygon")for(const ue of Sl(e.geometry,0)){const De=Gu(ue,16);_e(ue[0],new fn(De.x,De.y,0))}else if(e.type==="LineString")for(const ue of e.geometry)_e(ue,new fn(ue[0].x,ue[0].y,0));else if(e.type==="Point")for(const ue of e.geometry)for(const De of ue)_e([De],new fn(De.x,De.y,0))}const gn=32640;function Yc(i,e,r,s,l,u,d,f,g,x,w,E,A,z,k){const U=function(Q,X,Y,ce,le,Se,Ce,xe){const fe=ce.layout.get("text-rotate").evaluate(Se,{})*Math.PI/180,pe=[];for(const ve of X.positionedLines)for(const _e of ve.positionedGlyphs){if(!_e.rect)continue;const ue=_e.rect||{};let De=4,ke=!0,je=1,dt=0;const gt=(le||xe)&&_e.vertical,Bt=_e.metrics.advance*_e.scale/2;if(xe&&X.verticalizable){const xt=(_e.scale-1)*Vt,Ft=(Vt-_e.metrics.width*_e.scale)/2;dt=ve.lineOffset/2-(_e.imageName?-Ft:xt)}if(_e.imageName){const xt=Ce[_e.imageName];ke=xt.sdf,je=xt.pixelRatio,De=1/je}const Bi=le?[_e.x+Bt,_e.y]:[0,0];let Gt=le?[0,0]:[_e.x+Bt+Y[0],_e.y+Y[1]-dt],Mt=[0,0];gt&&(Mt=Gt,Gt=[0,0]);const Rt=(_e.metrics.left-De)*_e.scale-Bt+Gt[0],qt=(-_e.metrics.top-De)*_e.scale+Gt[1],Kt=Rt+ue.w*_e.scale/je,ui=qt+ue.h*_e.scale/je,kt=new Re(Rt,qt),Zt=new Re(Kt,qt),Jt=new Re(Rt,ui),ni=new Re(Kt,ui);if(gt){const xt=new Re(-Bt,Bt-Bo),Ft=-Math.PI/2,We=12-Bt,vi=new Re(22-We,-(_e.imageName?We:0)),jt=new Re(...Mt);kt._rotateAround(Ft,xt)._add(vi)._add(jt),Zt._rotateAround(Ft,xt)._add(vi)._add(jt),Jt._rotateAround(Ft,xt)._add(vi)._add(jt),ni._rotateAround(Ft,xt)._add(vi)._add(jt)}if(fe){const xt=Math.sin(fe),Ft=Math.cos(fe),We=[Ft,-xt,xt,Ft];kt._matMult(We),Zt._matMult(We),Jt._matMult(We),ni._matMult(We)}const pi=new Re(0,0),di=new Re(0,0);pe.push({tl:kt,tr:Zt,bl:Jt,br:ni,tex:ue,writingMode:X.writingMode,glyphOffset:Bi,sectionIndex:_e.sectionIndex,isSDF:ke,pixelOffsetTL:pi,pixelOffsetBR:di,minFontScaleX:0,minFontScaleY:0})}return pe}(0,r,f,l,u,d,s,i.allowVerticalPlacement),O=i.textSizeData;let W=null;O.kind==="source"?(W=[Ur*l.layout.get("text-size").evaluate(d,{})],W[0]>gn&&Pt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):O.kind==="composite"&&(W=[Ur*z.compositeTextSizes[0].evaluate(d,{},k),Ur*z.compositeTextSizes[1].evaluate(d,{},k)],(W[0]>gn||W[1]>gn)&&Pt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,U,W,f,u,d,x,e,g.lineStartIndex,g.lineLength,A,k);for(const Q of w)E[Q]=i.text.placedSymbolArray.length-1;return 4*U.length}function Qc(i){for(const e in i)return i[e];return null}function ju(i,e,r,s){const l=i.compareText;if(e in l){const u=l[e];for(let d=u.length-1;d>=0;d--)if(s.dist(u[d])d.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=vl([]),this.placementViewportMatrix=vl([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=$c(this.zoom,r["text-size"]),this.iconSizeData=$c(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=ql(s,"text-overlap","text-allow-overlap")!=="never"||ql(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(d=>h.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new Nl(new Kn(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Nl(new Kn(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new we,this.lineVertexArray=new me,this.symbolInstances=new te}calculateGlyphDependencies(e,r,s,l,u){for(let d=0;d0)&&(d.value.kind!=="constant"||d.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,E=u.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const A=r.iconDependencies,z=r.glyphDependencies,k=r.availableImages,U=new mt(this.zoom);for(const{feature:O,id:W,index:Q,sourceLayerIndex:X}of e){const Y=l._featureFilter.needGeometry,ce=Yn(O,Y);if(!l._featureFilter.filter(U,ce,s))continue;let le,Se;if(Y||(ce.geometry=Jn(O)),x){const xe=l.getValueAndResolveTokens("text-field",ce,s,k),fe=G.factory(xe);Hu(fe)&&(this.hasRTLText=!0),(!this.hasRTLText||Ea()==="unavailable"||this.hasRTLText&&yi.isParsed())&&(le=wu(fe,l,ce))}if(w){const xe=l.getValueAndResolveTokens("icon-image",ce,s,k);Se=xe instanceof N?xe:N.fromString(xe)}if(!le&&!Se)continue;const Ce=this.sortFeaturesByKey?E.evaluate(ce,{},s):void 0;if(this.features.push({id:W,text:le,icon:Se,index:Q,sourceLayerIndex:X,geometry:ce.geometry,properties:O.properties,type:Xu[O.type],sortKey:Ce}),Se&&(A[Se.name]=!0),le){const xe=d.evaluate(ce,{},s).join(","),fe=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.WritingMode.vertical)>=0;for(const pe of le.sections)if(pe.image)A[pe.image.name]=!0;else{const ve=xa(le.toString()),_e=pe.fontStack||xe,ue=z[_e]=z[_e]||{};this.calculateGlyphDependencies(pe.text,ue,fe,this.allowVerticalPlacement,ve)}}}u.get("symbol-placement")==="line"&&(this.features=function(O){const W={},Q={},X=[];let Y=0;function ce(xe){X.push(O[xe]),Y++}function le(xe,fe,pe){const ve=Q[xe];return delete Q[xe],Q[fe]=ve,X[ve].geometry[0].pop(),X[ve].geometry[0]=X[ve].geometry[0].concat(pe[0]),ve}function Se(xe,fe,pe){const ve=W[fe];return delete W[fe],W[xe]=ve,X[ve].geometry[0].shift(),X[ve].geometry[0]=pe[0].concat(X[ve].geometry[0]),ve}function Ce(xe,fe,pe){const ve=pe?fe[0][fe[0].length-1]:fe[0][0];return`${xe}:${ve.x}:${ve.y}`}for(let xe=0;xexe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((O,W)=>O.sortKey-W.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.segment+1;f=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f0}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(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;ul[f]-l[g]||u[g]-u[f]),d}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Ee("SymbolBucket",Gs,{omit:["layers","collisionBoxArray","features","compareText"]}),Gs.MAX_GLYPHS=65535,Gs.addDynamicAttributes=Vl;const Ku=new Dt({"symbol-placement":new Me(ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Me(ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Me(ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Be(ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Me(ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Me(ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Me(ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Me(ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Me(ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Me(ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new Be(ne.layout_symbol["icon-size"]),"icon-text-fit":new Me(ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Me(ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new Be(ne.layout_symbol["icon-image"]),"icon-rotate":new Be(ne.layout_symbol["icon-rotate"]),"icon-padding":new Be(ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Me(ne.layout_symbol["icon-keep-upright"]),"icon-offset":new Be(ne.layout_symbol["icon-offset"]),"icon-anchor":new Be(ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Me(ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Me(ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Me(ne.layout_symbol["text-rotation-alignment"]),"text-field":new Be(ne.layout_symbol["text-field"]),"text-font":new Be(ne.layout_symbol["text-font"]),"text-size":new Be(ne.layout_symbol["text-size"]),"text-max-width":new Be(ne.layout_symbol["text-max-width"]),"text-line-height":new Me(ne.layout_symbol["text-line-height"]),"text-letter-spacing":new Be(ne.layout_symbol["text-letter-spacing"]),"text-justify":new Be(ne.layout_symbol["text-justify"]),"text-radial-offset":new Be(ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Me(ne.layout_symbol["text-variable-anchor"]),"text-anchor":new Be(ne.layout_symbol["text-anchor"]),"text-max-angle":new Me(ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Me(ne.layout_symbol["text-writing-mode"]),"text-rotate":new Be(ne.layout_symbol["text-rotate"]),"text-padding":new Me(ne.layout_symbol["text-padding"]),"text-keep-upright":new Me(ne.layout_symbol["text-keep-upright"]),"text-transform":new Be(ne.layout_symbol["text-transform"]),"text-offset":new Be(ne.layout_symbol["text-offset"]),"text-allow-overlap":new Me(ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Me(ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Me(ne.layout_symbol["text-ignore-placement"]),"text-optional":new Me(ne.layout_symbol["text-optional"])});var Gl={paint:new Dt({"icon-opacity":new Be(ne.paint_symbol["icon-opacity"]),"icon-color":new Be(ne.paint_symbol["icon-color"]),"icon-halo-color":new Be(ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new Be(ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Be(ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Me(ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Me(ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new Be(ne.paint_symbol["text-opacity"]),"text-color":new Be(ne.paint_symbol["text-color"],{runtimeType:Ht,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Be(ne.paint_symbol["text-halo-color"]),"text-halo-width":new Be(ne.paint_symbol["text-halo-width"]),"text-halo-blur":new Be(ne.paint_symbol["text-halo-blur"]),"text-translate":new Me(ne.paint_symbol["text-translate"]),"text-translate-anchor":new Me(ne.paint_symbol["text-translate-anchor"])}),layout:Ku};class eh{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Wt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ee("FormatSectionOverride",eh,{omit:["defaultValue"]});class Go extends ei{constructor(e){super(e,Gl)}recalculate(e,r){if(super.recalculate(e,r),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 s=this.layout.get("text-writing-mode");if(s){const l=[];for(const u of s)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const u=this.layout.get(e).evaluate(r,{},s,l),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||Ln(d.value)||!u?u:function(f,g){return g.replace(/{([^{}]+)}/g,(x,w)=>w in f?String(f[w]):"")}(r.properties,u)}createBucket(e){return new Gs(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Gl.paint.overridableProperties){if(!Go.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new eh(r),l=new da(s,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new gs("source",l):new Rn("composite",l,r.value.zoomStops),this.paint._values[e]=new Gi(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Go.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=Gl.paint.properties[r];let u=!1;const d=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof G)d(s.value.value.sections);else if(s.value.kind==="source"){const f=x=>{u||(x instanceof Ie&&oe(x.value)===Ni?d(x.value.sections):x instanceof fs?d(x.sections):x.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}function ql(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}var Ju={paint:new Dt({"background-color":new Me(ne.paint_background["background-color"]),"background-pattern":new jn(ne.paint_background["background-pattern"]),"background-opacity":new Me(ne.paint_background["background-opacity"])})},Yu={paint:new Dt({"raster-opacity":new Me(ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Me(ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Me(ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Me(ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Me(ne.paint_raster["raster-saturation"]),"raster-contrast":new Me(ne.paint_raster["raster-contrast"]),"raster-resampling":new Me(ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Me(ne.paint_raster["raster-fade-duration"])})};class Qu extends ei{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}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")}}const ep={circle:class extends ei{constructor(i){super(i,kh)}createBucket(i){return new _l(i)}queryRadius(i){const e=i;return za("circle-radius",this,e)+za("circle-stroke-width",this,e)+So(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=Ao(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,d),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),w=this.paint.get("circle-pitch-alignment")==="map",E=w?g:function(z,k){return z.map(U=>uc(U,k))}(g,f),A=w?x*d:x;for(const z of s)for(const k of z){const U=w?k:uc(k,f);let O=A;const W=Co([],[k.x,k.y,0,1],f);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?O*=W[3]/u.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(O*=u.cameraToCenterDistance/W[3]),Sh(E,U,O))return!0}return!1}},heatmap:class extends ei{constructor(i){super(i,Dh),this._updateColorRamp()}createBucket(i){return new pc(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=mc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends ei{constructor(i){super(i,Lh)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends ei{constructor(i){super(i,Kh)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new zl(i)}queryRadius(){return So(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){return rc(Ao(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,d),s)}isTileClipped(){return!0}},"fill-extrusion":class extends ei{constructor(i){super(i,hu)}createBucket(i){return new kl(i)}queryRadius(){return So(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=Ao(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,d),x=this.paint.get("fill-extrusion-height").evaluate(e,r),w=this.paint.get("fill-extrusion-base").evaluate(e,r),E=function(z,k,U,O){const W=[];for(const Q of z){const X=[Q.x,Q.y,0,1];Co(X,X,k),W.push(new Re(X[0]/X[3],X[1]/X[3]))}return W}(g,f),A=function(z,k,U,O){const W=[],Q=[],X=O[8]*k,Y=O[9]*k,ce=O[10]*k,le=O[11]*k,Se=O[8]*U,Ce=O[9]*U,xe=O[10]*U,fe=O[11]*U;for(const pe of z){const ve=[],_e=[];for(const ue of pe){const De=ue.x,ke=ue.y,je=O[0]*De+O[4]*ke+O[12],dt=O[1]*De+O[5]*ke+O[13],gt=O[2]*De+O[6]*ke+O[14],Bt=O[3]*De+O[7]*ke+O[15],Bi=gt+ce,Gt=Bt+le,Mt=je+Se,Rt=dt+Ce,qt=gt+xe,Kt=Bt+fe,ui=new Re((je+X)/Gt,(dt+Y)/Gt);ui.z=Bi/Gt,ve.push(ui);const kt=new Re(Mt/Kt,Rt/Kt);kt.z=qt/Kt,_e.push(kt)}W.push(ve),Q.push(_e)}return[W,Q]}(s,w,x,f);return function(z,k,U){let O=1/0;rc(U,k)&&(O=Tc(U,k[0]));for(let W=0;W=3){for(let U=0;U{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const th=63710088e-1;class Et{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Et(Gr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,l=e.lat*r,u=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return th*Math.acos(Math.min(u,1))}toBounds(e=0){const r=360*e/40075017,s=r/Math.cos(Math.PI/180*this.lat);return new es(new Et(this.lng-s,this.lat-r),new Et(this.lng+s,this.lat+r))}static convert(e){if(e instanceof Et)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Et(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Et(Number("lng"in e?e.lng:e.lon),Number(e.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 [, ]")}}class es{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Et?new Et(e.lng,e.lat):Et.convert(e),this}setSouthWest(e){return this._sw=e instanceof Et?new Et(e.lng,e.lat):Et.convert(e),this}extend(e){const r=this._sw,s=this._ne;let l,u;if(e instanceof Et)l=e,u=e;else{if(!(e instanceof es))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(es.convert(e)):this.extend(Et.convert(e)):this;if(l=e._sw,u=e._ne,!l||!u)return this}return r||s?(r.lng=Math.min(l.lng,r.lng),r.lat=Math.min(l.lat,r.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new Et(l.lng,l.lat),this._ne=new Et(u.lng,u.lat)),this}getCenter(){return new Et((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 Et(this.getWest(),this.getNorth())}getSouthEast(){return new Et(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(e){const{lng:r,lat:s}=Et.convert(e);let l=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){return e instanceof es?e:e&&new es(e)}}const ih=2*Math.PI*th;function rh(i){return ih*Math.cos(i*Math.PI/180)}function nh(i){return(180+i)/360}function sh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function ah(i,e){return i/rh(e)}function Zl(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class qo{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Et.convert(e);return new qo(nh(s.lng),sh(s.lat),ah(r,s.lat))}toLngLat(){return new Et(360*this.x-180,Zl(this.y))}toAltitude(){return this.z*rh(Zl(this.y))}meterInMercatorCoordinateUnits(){return 1/ih*(e=Zl(this.y),1/Math.cos(e*Math.PI/180));var e}}function oh(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class jl{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=Va(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=(d=this.y,f=this.z,g=oh(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),x=oh(256*(u+1),256*(d+1),f),g[0]+","+g[1]+","+x[0]+","+x[1]);var u,d,f,g,x;const w=function(E,A,z){let k,U="";for(let O=E;O>0;O--)k=1<1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new Re((e.x*r-this.x)*Lt,(e.y*r-this.y)*Lt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Va(e,r.z,r.z,r.x,r.y)}}class Li{constructor(e,r,s,l,u){if(e= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new jl(s,+l,+u),this.key=Va(r,e,s,l,u)}clone(){return new Li(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Li(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Li(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?Va(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Va(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Li(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new Li(r,this.wrap,r,s,l),new Li(r,this.wrap,r,s+1,l),new Li(r,this.wrap,r,s,l+1),new Li(r,this.wrap,r,s+1,l+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=f),f=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new Di({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(s){case-1:d=f-1;break;case 1:f=d+1}const g=-r*this.dim,x=-s*this.dim;for(let w=d;w=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class uh{constructor(e,r,s,l,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=u}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class ph{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Pr(Lt,16,0),this.grid3D=new Pr(Lt,16,0),this.featureIndexArray=new Fe,this.promoteId=r}insert(e,r,s,l,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,u);const g=d?this.grid3D:this.grid;for(let x=0;x=0&&E[3]>=0&&g.insert(f,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new dn.VectorTile(new Dl(this.rawTileData)).layers,this.sourceLayerCoder=new hh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const u=e.params||{},d=Lt/e.tileSize/e.scale,f=fa(u.filter),g=e.queryGeometry,x=e.queryPadding*d,w=mh(g),E=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),A=mh(e.cameraQueryGeometry),z=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(O,W,Q,X)=>function(Y,ce,le,Se,Ce){for(const fe of Y)if(ce<=fe.x&&le<=fe.y&&Se>=fe.x&&Ce>=fe.y)return!0;const xe=[new Re(ce,le),new Re(ce,Ce),new Re(Se,Ce),new Re(Se,le)];if(Y.length>2){for(const fe of xe)if(Rs(Y,fe))return!0}for(let fe=0;fe(X||(X=Jn(Y)),ce.queryIntersectsFeature(g,Y,le,X,this.z,e.transform,d,e.pixelPosMatrix)))}return k}loadMatchingFeature(e,r,s,l,u,d,f,g,x,w,E){const A=this.bucketLayerIDs[r];if(d&&!function(O,W){for(let Q=0;Q=0)return!0;return!1}(d,A))return;const z=this.sourceLayerCoder.decode(s),k=this.vtLayers[z].feature(l);if(u.needGeometry){const O=Yn(k,!0);if(!u.filter(new mt(this.tileID.overscaledZ),O,this.tileID.canonical))return}else if(!u.filter(new mt(this.tileID.overscaledZ),k))return;const U=this.getId(k,z);for(let O=0;O{const f=e instanceof zs?e.get(d):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function mh(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return{minX:e,minY:r,maxX:s,maxY:l}}function ip(i,e){return e-i}var Xl;Ee("FeatureIndex",ph,{omit:["rawTileData","sourceLayerCoder"]}),h.PerformanceMarkers=void 0,(Xl=h.PerformanceMarkers||(h.PerformanceMarkers={})).create="create",Xl.load="load",Xl.fullLoad="fullLoad";let Zo=null,Na=[];const Wl=1e3/30,rp={mark(i){performance.mark(i)},frame(i){const e=i;Zo!=null&&Na.push(e-Zo),Zo=e},clearMetrics(){Zo=null,Na=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in h.PerformanceMarkers)performance.clearMarks(h.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",h.PerformanceMarkers.create,h.PerformanceMarkers.load),performance.measure("fullLoadTime",h.PerformanceMarkers.create,h.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=Na.length,s=1/(Na.reduce((u,d)=>u+d,0)/r/1e3),l=Na.filter(u=>u>Wl).reduce((u,d)=>u+(d-Wl)/Wl,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100}}};h.AJAXError=Ei,h.ARRAY_TYPE=ri,h.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},is(["receive","process"],this),this.invoker=new tp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=gi()?i:window}send(i,e,r,s,l=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const d=qr(this.globalScope)?void 0:[];return this.target.postMessage({id:u,type:i,hasCallback:!!r,targetMapId:s,mustQueue:l,sourceMapId:this.mapId,data:$n(e,d)},d),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"",targetMapId:s,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type===""){delete this.tasks[r];const s=this.cancelCallbacks[r];delete this.cancelCallbacks[r],s&&s()}else gi()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type===""){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Dr(e.error)):r(null,Dr(e.data)))}else{let r=!1;const s=qr(this.globalScope)?void 0:[],l=e.hasCallback?(f,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:f?$n(f):null,data:$n(g,s)},s)}:f=>{r=!0};let u=null;const d=Dr(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,d,l);else if(this.parent.getWorkerSource){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],d.source)[f[1]](d,l)}else l(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},h.AlphaImage=ka,h.CanonicalTileID=jl,h.CollisionBoxArray=K,h.CollisionCircleLayoutArray=class extends v{},h.Color=M,h.DEMData=ch,h.DataConstantProperty=Me,h.DictionaryCoder=hh,h.EXTENT=Lt,h.ErrorEvent=mr,h.EvaluationParameters=mt,h.Event=Vi,h.Evented=Jr,h.FeatureIndex=ph,h.FillBucket=zl,h.FillExtrusionBucket=kl,h.GeoJSONFeature=uh,h.ImageAtlas=Rc,h.ImagePosition=Bl,h.LineBucket=Pl,h.LineStripIndexArray=class extends H{},h.LngLat=Et,h.LngLatBounds=es,h.MercatorCoordinate=qo,h.ONE_EM=Vt,h.OverscaledTileID=Li,h.PerformanceUtils=rp,h.PosArray=Ze,h.Properties=Dt,h.QuadTriangleArray=class extends S{},h.RGBAImage=Di,h.RasterBoundsArray=class extends Wn{},h.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},h.ResourceType=Tn,h.SegmentVector=Qe,h.SymbolBucket=Gs,h.Transitionable=Ia,h.TriangleIndexArray=Ut,h.Uniform1f=Ds,h.Uniform1i=class extends Pi{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},h.Uniform2f=class extends Pi{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},h.Uniform3f=class extends Pi{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},h.Uniform4f=Hn,h.UniformColor=Ls,h.UniformMatrix4f=class extends Pi{constructor(i,e){super(i,e),this.current=Eh}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},h.UnwrappedTileID=lh,h.ValidationError=de,h.ZoomHistory=Gn,h.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},h.addDynamicAttributes=Vl,h.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const l=new Array(i.length);let u=null;i.forEach((d,f)=>{e(d,(g,x)=>{g&&(u=g),l[f]=x,--s==0&&r(u,l)})})},h.bezier=Wi,h.bindAll=is,h.cacheEntryPossiblyAdded=function(i){jr++,jr>Zr&&(i.getActor().send("enforceCacheSizeLimit",vn),jr=0)},h.clamp=ae,h.clearTileCache=function(i){const e=caches.delete(Ti);i&&e.catch(i).then(()=>i())},h.clipLine=Wc,h.clone=function(i){var e=new ri(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},h.clone$1=si,h.clone$2=function(i){var e=new ri(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},h.collisionCircleLayout=bu,h.config=Qi,h.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},h.create=function(){var i=new ri(16);return ri!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},h.create$1=ac,h.createExpression=Bn,h.createFilter=fa,h.createLayout=Ct,h.createStyleLayer=function(i){return i.type==="custom"?new Qu(i):new ep[i.type](i)},h.cross=function(i,e,r){var s=e[0],l=e[1],u=e[2],d=r[0],f=r[1],g=r[2];return i[0]=l*g-u*f,i[1]=u*d-s*g,i[2]=s*f-l*d,i},h.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},h.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},h.ease=tt,h.emitValidationErrors=_o,h.enforceCacheSizeLimit=function(i){bn(),pr&&pr.then(e=>{e.keys().then(r=>{for(let s=0;s{}}},h.identity=vl,h.invert=function(i,e){var r=e[0],s=e[1],l=e[2],u=e[3],d=e[4],f=e[5],g=e[6],x=e[7],w=e[8],E=e[9],A=e[10],z=e[11],k=e[12],U=e[13],O=e[14],W=e[15],Q=r*f-s*d,X=r*g-l*d,Y=r*x-u*d,ce=s*g-l*f,le=s*x-u*f,Se=l*x-u*g,Ce=w*U-E*k,xe=w*O-A*k,fe=w*W-z*k,pe=E*O-A*U,ve=E*W-z*U,_e=A*W-z*O,ue=Q*_e-X*ve+Y*pe+ce*fe-le*xe+Se*Ce;return ue?(i[0]=(f*_e-g*ve+x*pe)*(ue=1/ue),i[1]=(l*ve-s*_e-u*pe)*ue,i[2]=(U*Se-O*le+W*ce)*ue,i[3]=(A*le-E*Se-z*ce)*ue,i[4]=(g*fe-d*_e-x*xe)*ue,i[5]=(r*_e-l*fe+u*xe)*ue,i[6]=(O*Y-k*Se-W*X)*ue,i[7]=(w*Se-A*Y+z*X)*ue,i[8]=(d*ve-f*fe+x*Ce)*ue,i[9]=(s*fe-r*ve-u*Ce)*ue,i[10]=(k*le-U*Y+W*Q)*ue,i[11]=(E*Y-w*le-z*Q)*ue,i[12]=(f*xe-d*pe-g*Ce)*ue,i[13]=(r*pe-s*xe+l*Ce)*ue,i[14]=(U*X-k*ce-O*Q)*ue,i[15]=(w*ce-E*X+A*Q)*ue,i):null},h.isImageBitmap=hr,h.isSafari=qr,h.isWorker=gi,h.keysDifference=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},h.lazyLoadRTLTextPlugin=function(){yi.isLoading()||yi.isLoaded()||Ea()!=="deferred"||Ss()},h.makeRequest=tr,h.mapObject=yn,h.mercatorXfromLng=nh,h.mercatorYfromLat=sh,h.mercatorZfromAltitude=ah,h.mul=Ph,h.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},h.multiply=oc,h.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},h.normalize=function(i,e){var r=e[0],s=e[1],l=e[2],u=r*r+s*s+l*l;return u>0&&(u=1/Math.sqrt(u)),i[0]=e[0]*u,i[1]=e[1]*u,i[2]=e[2]*u,i},h.number=_t,h.ortho=function(i,e,r,s,l,u,d){var f=1/(e-r),g=1/(s-l),x=1/(u-d);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*f,i[13]=(l+s)*g,i[14]=(d+u)*x,i[15]=1,i},h.parseCacheControl=Zs,h.parseGlyphPbf=function(i){return new Dl(i).readFields(Pu,[])},h.pbf=Dl,h.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Lt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,s={layoutIconSize:r["icon-size"].possiblyEvaluate(new mt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new mt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new mt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;s.compositeTextSizes=[r["text-size"].possiblyEvaluate(new mt(g),i.canonical),r["text-size"].possiblyEvaluate(new mt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;s.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new mt(g),i.canonical),r["icon-size"].possiblyEvaluate(new mt(x),i.canonical)]}const l=e.get("text-line-height")*Vt,u=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),f=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),w=f.evaluate(g,{},i.canonical),E=s.layoutTextSize.evaluate(g,{},i.canonical),A=s.layoutIconSize.evaluate(g,{},i.canonical),z={horizontal:{},vertical:void 0},k=g.text;let U,O=[0,0];if(k){const X=k.toString(),Y=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*Vt,ce=yo(X)?Y:0,le=e.get("text-anchor").evaluate(g,{},i.canonical),Se=e.get("text-variable-anchor");if(!Se){const ve=e.get("text-radial-offset").evaluate(g,{},i.canonical);O=ve?Jc(le,[ve*Vt,Ol]):e.get("text-offset").evaluate(g,{},i.canonical).map(_e=>_e*Vt)}let Ce=u?"center":e.get("text-justify").evaluate(g,{},i.canonical);const xe=e.get("symbol-placement"),fe=xe==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*Vt:0,pe=()=>{i.bucket.allowVerticalPlacement&&xa(X)&&(z.vertical=Ro(k,i.glyphMap,i.glyphPositions,i.imagePositions,x,fe,l,le,"left",ce,O,h.WritingMode.vertical,!0,xe,E,w))};if(!u&&Se){const ve=Ce==="auto"?Se.map(ue=>Ul(ue)):[Ce];let _e=!1;for(let ue=0;uethis._layers[oe.id]),G=V[0];if(G.visibility==="none")continue;const $=G.source||"";let N=this.familiesBySource[$];N||(N=this.familiesBySource[$]={});const j=G.sourceLayer||"_geojsonTileLayer";let ee=N[j];ee||(ee=N[j]=[]),ee.push(V)}}}class tt{constructor(b){const I={},M=[];for(const $ in b){const N=b[$],j=I[$]={};for(const ee in N){const oe=N[+ee];if(!oe||oe.bitmap.width===0||oe.bitmap.height===0)continue;const se={x:0,y:0,w:oe.bitmap.width+2,h:oe.bitmap.height+2};M.push(se),j[ee]={rect:se,metrics:oe.metrics}}}const{w:D,h:V}=h.potpack(M),G=new h.AlphaImage({width:D||1,height:V||1});for(const $ in b){const N=b[$];for(const j in N){const ee=N[+j];if(!ee||ee.bitmap.width===0||ee.bitmap.height===0)continue;const oe=I[$][j].rect;h.AlphaImage.copy(ee.bitmap,G,{x:0,y:0},{x:oe.x+1,y:oe.y+1},ee.bitmap)}}this.image=G,this.positions=I}}h.register("GlyphAtlas",tt);class ae{constructor(b){this.tileID=new h.OverscaledTileID(b.tileID.overscaledZ,b.tileID.wrap,b.tileID.canonical.z,b.tileID.canonical.x,b.tileID.canonical.y),this.uid=b.uid,this.zoom=b.zoom,this.pixelRatio=b.pixelRatio,this.tileSize=b.tileSize,this.source=b.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=b.showCollisionBoxes,this.collectResourceTiming=!!b.collectResourceTiming,this.returnDependencies=!!b.returnDependencies,this.promoteId=b.promoteId}parse(b,I,M,D,V){this.status="parsing",this.data=b,this.collisionBoxArray=new h.CollisionBoxArray;const G=new h.DictionaryCoder(Object.keys(b.layers).sort()),$=new h.FeatureIndex(this.tileID,this.promoteId);$.bucketLayerIDs=[];const N={},j={featureIndex:$,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:M},ee=I.familiesBySource[this.source];for(const qe in ee){const $e=b.layers[qe];if(!$e)continue;$e.version===1&&h.warnOnce(`Vector tile source "${this.source}" layer "${qe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ue=G.encode(qe),It=[];for(let wt=0;wt<$e.length;wt++){const At=$e.feature(wt),Ot=$.getId(At,qe);It.push({feature:At,id:Ot,index:wt,sourceLayerIndex:Ue})}for(const wt of ee[qe]){const At=wt[0];At.source!==this.source&&h.warnOnce(`layer.source = ${At.source} does not equal this.source = ${this.source}`),At.minzoom&&this.zoom=At.maxzoom||At.visibility!=="none"&&(Gr(wt,this.zoom,M),(N[At.id]=At.createBucket({index:$.bucketLayerIDs.length,layers:wt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ue,sourceID:this.source})).populate(It,j,this.tileID.canonical),$.bucketLayerIDs.push(wt.map(Ot=>Ot.id)))}}let oe,se,Ie,be;const ze=h.mapObject(j.glyphDependencies,qe=>Object.keys(qe).map(Number));Object.keys(ze).length?D.send("getGlyphs",{uid:this.uid,stacks:ze},(qe,$e)=>{oe||(oe=qe,se=$e,Xe.call(this))}):se={};const Pe=Object.keys(j.iconDependencies);Pe.length?D.send("getImages",{icons:Pe,source:this.source,tileID:this.tileID,type:"icons"},(qe,$e)=>{oe||(oe=qe,Ie=$e,Xe.call(this))}):Ie={};const Ne=Object.keys(j.patternDependencies);function Xe(){if(oe)return V(oe);if(se&&Ie&&be){const qe=new tt(se),$e=new h.ImageAtlas(Ie,be);for(const Ue in N){const It=N[Ue];It instanceof h.SymbolBucket?(Gr(It.layers,this.zoom,M),h.performSymbolLayout({bucket:It,glyphMap:se,glyphPositions:qe.positions,imageMap:Ie,imagePositions:$e.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):It.hasPattern&&(It instanceof h.LineBucket||It instanceof h.FillBucket||It instanceof h.FillExtrusionBucket)&&(Gr(It.layers,this.zoom,M),It.addFeatures(j,this.tileID.canonical,$e.patternPositions))}this.status="done",V(null,{buckets:Object.values(N).filter(Ue=>!Ue.isEmpty()),featureIndex:$,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:qe.image,imageAtlas:$e,glyphMap:this.returnDependencies?se:null,iconMap:this.returnDependencies?Ie:null,glyphPositions:this.returnDependencies?qe.positions:null})}}Ne.length?D.send("getImages",{icons:Ne,source:this.source,tileID:this.tileID,type:"patterns"},(qe,$e)=>{oe||(oe=qe,be=$e,Xe.call(this))}):be={},Xe.call(this)}}function Gr(P,b,I){const M=new h.EvaluationParameters(b);for(const D of P)D.recalculate(M,I)}function wi(P,b){const I=h.getArrayBuffer(P.request,(M,D,V,G)=>{M?b(M):D&&b(null,{vectorTile:new h.vectorTile.VectorTile(new h.pbf(D)),rawData:D,cacheControl:V,expires:G})});return()=>{I.cancel(),b()}}class vt{constructor(b,I,M,D){this.actor=b,this.layerIndex=I,this.availableImages=M,this.loadVectorData=D||wi,this.loading={},this.loaded={}}loadTile(b,I){const M=b.uid;this.loading||(this.loading={});const D=!!(b&&b.request&&b.request.collectResourceTiming)&&new h.RequestPerformance(b.request),V=this.loading[M]=new ae(b);V.abort=this.loadVectorData(b,(G,$)=>{if(delete this.loading[M],G||!$)return V.status="done",this.loaded[M]=V,I(G);const N=$.rawData,j={};$.expires&&(j.expires=$.expires),$.cacheControl&&(j.cacheControl=$.cacheControl);const ee={};if(D){const oe=D.finish();oe&&(ee.resourceTiming=JSON.parse(JSON.stringify(oe)))}V.vectorTile=$.vectorTile,V.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor,(oe,se)=>{if(oe||!se)return I(oe);I(null,h.extend({rawTileData:N.slice(0)},se,j,ee))}),this.loaded=this.loaded||{},this.loaded[M]=V})}reloadTile(b,I){const M=this.loaded,D=b.uid,V=this;if(M&&M[D]){const G=M[D];G.showCollisionBoxes=b.showCollisionBoxes;const $=(N,j)=>{const ee=G.reloadCallback;ee&&(delete G.reloadCallback,G.parse(G.vectorTile,V.layerIndex,this.availableImages,V.actor,ee)),I(N,j)};G.status==="parsing"?G.reloadCallback=$:G.status==="done"&&(G.vectorTile?G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,$):$())}}abortTile(b,I){const M=this.loading,D=b.uid;M&&M[D]&&M[D].abort&&(M[D].abort(),delete M[D]),I()}removeTile(b,I){const M=this.loaded,D=b.uid;M&&M[D]&&delete M[D],I()}}class is{constructor(){this.loaded={}}loadTile(b,I){const{uid:M,encoding:D,rawImageData:V}=b,G=h.isImageBitmap(V)?this.getImageData(V):V,$=new h.DEMData(M,G,D);this.loaded=this.loaded||{},this.loaded[M]=$,I(null,$)}getImageData(b){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(b.width,b.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=b.width,this.offscreenCanvas.height=b.height,this.offscreenCanvasContext.drawImage(b,0,0,b.width,b.height);const I=this.offscreenCanvasContext.getImageData(-1,-1,b.width+2,b.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new h.RGBAImage({width:I.width,height:I.height},I.data)}removeTile(b){const I=this.loaded,M=b.uid;I&&I[M]&&delete I[M]}}var yn=function P(b,I){var M,D=b&&b.type;if(D==="FeatureCollection")for(M=0;M=Math.abs($)?I-N+$:$-N+I,I=N}I+M>=0!=!!b&&P.reverse()}const xn=h.vectorTile.VectorTileFeature.prototype.toGeoJSON;class Pt{constructor(b){this._feature=b,this.extent=h.EXTENT,this.type=b.type,this.properties=b.tags,"id"in b&&!isNaN(b.id)&&(this.id=parseInt(b.id,10))}loadGeometry(){if(this._feature.type===1){const b=[];for(const I of this._feature.geometry)b.push([new h.pointGeometry(I[0],I[1])]);return b}{const b=[];for(const I of this._feature.geometry){const M=[];for(const D of I)M.push(new h.pointGeometry(D[0],D[1]));b.push(M)}return b}}toGeoJSON(b,I,M){return xn.call(this,b,I,M)}}class Fi{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=h.EXTENT,this.length=b.length,this._features=b}feature(b){return new Pt(this._features[b])}}var cr={exports:{}},gi=h.pointGeometry,Zs=h.vectorTile.VectorTileFeature,Ki=Ir;function Ir(P,b){this.options=b||{},this.features=P,this.length=P.length}function Ji(P,b){this.id=typeof P.id=="number"?P.id:void 0,this.type=P.type,this.rawGeometry=P.type===1?[P.geometry]:P.geometry,this.properties=P.tags,this.extent=b||4096}Ir.prototype.feature=function(P){return new Ji(this.features[P],this.options.extent)},Ji.prototype.loadGeometry=function(){var P=this.rawGeometry;this.geometry=[];for(var b=0;b>31}function vn(P,b){for(var I=P.loadGeometry(),M=P.type,D=0,V=0,G=I.length,$=0;$>1;jr(P,b,G,M,D,V%2),bn(P,b,I,M,G-1,V+1),bn(P,b,I,G+1,D,V+1)}function jr(P,b,I,M,D,V){for(;D>M;){if(D-M>600){const j=D-M+1,ee=I-M+1,oe=Math.log(j),se=.5*Math.exp(2*oe/3),Ie=.5*Math.sqrt(oe*se*(j-se)/j)*(ee-j/2<0?-1:1);jr(P,b,I,Math.max(M,Math.floor(I-ee*se/j+Ie)),Math.min(D,Math.floor(I+(j-ee)*se/j+Ie)),V)}const G=b[2*I+V];let $=M,N=D;for(Oi(P,b,M,I),b[2*D+V]>G&&Oi(P,b,M,D);$G;)N--}b[2*M+V]===G?Oi(P,b,M,N):(N++,Oi(P,b,N,D)),N<=I&&(M=N+1),I<=N&&(D=N-1)}}function Oi(P,b,I,M){Ui(P,I,M),Ui(b,2*I,2*M),Ui(b,2*I+1,2*M+1)}function Ui(P,b,I){const M=P[b];P[b]=P[I],P[I]=M}function er(P,b,I,M){const D=P-I,V=b-M;return D*D+V*V}cr.exports=ur,cr.exports.fromVectorTileJs=ur,cr.exports.fromGeojsonVt=function(P,b){b=b||{};var I={};for(var M in P)I[M]=new hr(P[M].features,b),I[M].name=M,I[M].version=b.version,I[M].extent=b.extent;return ur({layers:I})},cr.exports.GeoJSONWrapper=hr;const wn=P=>P[0],ai=P=>P[1];class Xr{constructor(b,I=wn,M=ai,D=64,V=Float64Array){this.nodeSize=D,this.points=b;const G=b.length<65536?Uint16Array:Uint32Array,$=this.ids=new G(b.length),N=this.coords=new V(2*b.length);for(let j=0;j=$&&be<=j&&ze>=N&&ze<=ee&&Ie.push(V[Ue]);continue}const qe=Math.floor((Xe+Ne)/2);be=G[2*qe],ze=G[2*qe+1],be>=$&&be<=j&&ze>=N&&ze<=ee&&Ie.push(V[qe]);const $e=(Pe+1)%2;(Pe===0?$<=be:N<=ze)&&(se.push(Xe),se.push(qe-1),se.push($e)),(Pe===0?j>=be:ee>=ze)&&(se.push(qe+1),se.push(Ne),se.push($e))}return Ie}(this.ids,this.coords,b,I,M,D,this.nodeSize)}within(b,I,M){return function(D,V,G,$,N,j){const ee=[0,D.length-1,0],oe=[],se=N*N;for(;ee.length;){const Ie=ee.pop(),be=ee.pop(),ze=ee.pop();if(be-ze<=j){for(let $e=ze;$e<=be;$e++)er(V[2*$e],V[2*$e+1],G,$)<=se&&oe.push(D[$e]);continue}const Pe=Math.floor((ze+be)/2),Ne=V[2*Pe],Xe=V[2*Pe+1];er(Ne,Xe,G,$)<=se&&oe.push(D[Pe]);const qe=(Ie+1)%2;(Ie===0?G-N<=Ne:$-N<=Xe)&&(ee.push(ze),ee.push(Pe-1),ee.push(qe)),(Ie===0?G+N>=Ne:$+N>=Xe)&&(ee.push(Pe+1),ee.push(be),ee.push(qe))}return oe}(this.ids,this.coords,b,I,M,this.nodeSize)}}const Tn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:P=>P},Ei=Math.fround||(_i=new Float32Array(1),P=>(_i[0]=+P,_i[0]));var _i;class rs{constructor(b){this.options=dr(Object.create(Tn),b),this.trees=new Array(this.options.maxZoom+1)}load(b){const{log:I,minZoom:M,maxZoom:D,nodeSize:V}=this.options;I&&console.time("total time");const G=`prepare ${b.length} points`;I&&console.time(G),this.points=b;let $=[];for(let N=0;N=M;N--){const j=+Date.now();$=this._cluster($,N),this.trees[N]=new Xr($,Kr,Vi,V,Float32Array),I&&console.log("z%d: %d clusters in %dms",N,$.length,+Date.now()-j)}return I&&console.timeEnd("total time"),this}getClusters(b,I){let M=((b[0]+180)%360+360)%360-180;const D=Math.max(-90,Math.min(90,b[1]));let V=b[2]===180?180:((b[2]+180)%360+360)%360-180;const G=Math.max(-90,Math.min(90,b[3]));if(b[2]-b[0]>=360)M=-180,V=180;else if(M>V){const ee=this.getClusters([M,D,180,G],I),oe=this.getClusters([-180,D,V,G],I);return ee.concat(oe)}const $=this.trees[this._limitZoom(I)],N=$.range(He(M),Ii(G),He(V),Ii(D)),j=[];for(const ee of N){const oe=$.points[ee];j.push(oe.numPoints?ns(oe):this.points[oe.index])}return j}getChildren(b){const I=this._getOriginId(b),M=this._getOriginZoom(b),D="No cluster with the specified id.",V=this.trees[M];if(!V)throw new Error(D);const G=V.points[I];if(!G)throw new Error(D);const $=this.options.radius/(this.options.extent*Math.pow(2,M-1)),N=V.within(G.x,G.y,$),j=[];for(const ee of N){const oe=V.points[ee];oe.parentId===b&&j.push(oe.numPoints?ns(oe):this.points[oe.index])}if(j.length===0)throw new Error(D);return j}getLeaves(b,I,M){const D=[];return this._appendLeaves(D,b,I=I||10,M=M||0,0),D}getTile(b,I,M){const D=this.trees[this._limitZoom(b)],V=Math.pow(2,b),{extent:G,radius:$}=this.options,N=$/G,j=(M-N)/V,ee=(M+1+N)/V,oe={features:[]};return this._addTileFeatures(D.range((I-N)/V,j,(I+1+N)/V,ee),D.points,I,M,V,oe),I===0&&this._addTileFeatures(D.range(1-N/V,j,1,ee),D.points,V,M,V,oe),I===V-1&&this._addTileFeatures(D.range(0,j,N/V,ee),D.points,-1,M,V,oe),oe.features.length?oe:null}getClusterExpansionZoom(b){let I=this._getOriginZoom(b)-1;for(;I<=this.options.maxZoom;){const M=this.getChildren(b);if(I++,M.length!==1)break;b=M[0].properties.cluster_id}return I}_appendLeaves(b,I,M,D,V){const G=this.getChildren(I);for(const $ of G){const N=$.properties;if(N&&N.cluster?V+N.point_count<=D?V+=N.point_count:V=this._appendLeaves(b,N.cluster_id,M,D,V):VI&&(be+=Pe.numPoints||1)}if(be>Ie&&be>=$){let ze=ee.x*Ie,Pe=ee.y*Ie,Ne=G&&Ie>1?this._map(ee,!0):null;const Xe=(j<<5)+(I+1)+this.points.length;for(const qe of se){const $e=oe.points[qe];if($e.zoom<=I)continue;$e.zoom=I;const Ue=$e.numPoints||1;ze+=$e.x*Ue,Pe+=$e.y*Ue,$e.parentId=Xe,G&&(Ne||(Ne=this._map(ee,!0)),G(Ne,this._map($e)))}ee.parentId=Xe,M.push(tr(ze/be,Pe/be,Xe,be,Ne))}else if(M.push(ee),be>1)for(const ze of se){const Pe=oe.points[ze];Pe.zoom<=I||(Pe.zoom=I,M.push(Pe))}}return M}_getOriginId(b){return b-this.points.length>>5}_getOriginZoom(b){return(b-this.points.length)%32}_map(b,I){if(b.numPoints)return I?dr({},b.properties):b.properties;const M=this.points[b.index].properties,D=this.options.map(M);return I&&D===M?dr({},D):D}}function tr(P,b,I,M,D){return{x:Ei(P),y:Ei(b),zoom:1/0,id:I,parentId:-1,numPoints:M,properties:D}}function Wr(P,b){const[I,M]=P.geometry.coordinates;return{x:Ei(He(I)),y:Ei(Ii(M)),zoom:1/0,index:b,parentId:-1}}function ns(P){return{type:"Feature",id:P.id,properties:Hr(P),geometry:{type:"Point",coordinates:[(b=P.x,360*(b-.5)),En(P.y)]}};var b}function Hr(P){const b=P.numPoints,I=b>=1e4?`${Math.round(b/1e3)}k`:b>=1e3?Math.round(b/100)/10+"k":b;return dr(dr({},P.properties),{cluster:!0,cluster_id:P.id,point_count:b,point_count_abbreviated:I})}function He(P){return P/360+.5}function Ii(P){const b=Math.sin(P*Math.PI/180),I=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return I<0?0:I>1?1:I}function En(P){const b=(180-360*P)*Math.PI/180;return 360*Math.atan(Math.exp(b))/Math.PI-90}function dr(P,b){for(const I in b)P[I]=b[I];return P}function Kr(P){return P.x}function Vi(P){return P.y}function mr(P,b,I,M){for(var D,V=M,G=I-b>>1,$=I-b,N=P[b],j=P[b+1],ee=P[I],oe=P[I+1],se=b+3;seV)D=se,V=Ie;else if(Ie===V){var be=Math.abs(se-G);be<$&&(D=se,$=be)}}V>M&&(D-b>3&&mr(P,b,D,M),P[D+2]=V,I-D>3&&mr(P,D,I,M))}function Jr(P,b,I,M,D,V){var G=D-I,$=V-M;if(G!==0||$!==0){var N=((P-I)*G+(b-M)*$)/(G*G+$*$);N>1?(I=D,M=V):N>0&&(I+=G*N,M+=$*N)}return(G=P-I)*G+($=b-M)*$}function ne(P,b,I,M){var D={id:P===void 0?null:P,type:b,geometry:I,tags:M,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(V){var G=V.geometry,$=V.type;if($==="Point"||$==="MultiPoint"||$==="LineString")de(V,G);else if($==="Polygon"||$==="MultiLineString")for(var N=0;N0&&(G+=M?(D*j-N*V)/2:Math.sqrt(Math.pow(N-D,2)+Math.pow(j-V,2))),D=N,V=j}var ee=b.length-3;b[2]=1,mr(b,0,ee,I),b[ee+2]=1,b.size=Math.abs(G),b.start=0,b.end=b.size}function bt(P,b,I,M){for(var D=0;D1?1:I}function Wt(P,b,I,M,D,V,G,$){if(M/=b,V>=(I/=b)&&G=M)return null;for(var N=[],j=0;j=I&&be=M)){var ze=[];if(se==="Point"||se==="MultiPoint")ge(oe,ze,I,M,D);else if(se==="LineString")Ge(oe,ze,I,M,D,!1,$.lineMetrics);else if(se==="MultiLineString")Ht(oe,ze,I,M,D,!1);else if(se==="Polygon")Ht(oe,ze,I,M,D,!0);else if(se==="MultiPolygon")for(var Pe=0;Pe=I&&G<=M&&(b.push(P[V]),b.push(P[V+1]),b.push(P[V+2]))}}function Ge(P,b,I,M,D,V,G){for(var $,N,j=Oe(P),ee=D===0?Ve:Ai,oe=P.start,se=0;seI&&(N=ee(j,Ie,be,Pe,Ne,I),G&&(j.start=oe+$*N)):Xe>M?qe=I&&(N=ee(j,Ie,be,Pe,Ne,I),$e=!0),qe>M&&Xe<=M&&(N=ee(j,Ie,be,Pe,Ne,M),$e=!0),!V&&$e&&(G&&(j.end=oe+$*N),b.push(j),j=Oe(P)),G&&(oe+=$)}var Ue=P.length-3;Ie=P[Ue],be=P[Ue+1],ze=P[Ue+2],(Xe=D===0?Ie:be)>=I&&Xe<=M&&oi(j,Ie,be,ze),Ue=j.length-3,V&&Ue>=3&&(j[Ue]!==j[0]||j[Ue+1]!==j[1])&&oi(j,j[0],j[1],j[2]),j.length&&b.push(j)}function Oe(P){var b=[];return b.size=P.size,b.start=P.start,b.end=P.end,b}function Ht(P,b,I,M,D,V){for(var G=0;GG.maxX&&(G.maxX=ee),oe>G.maxY&&(G.maxY=oe)}return G}function Ar(P,b,I,M){var D=b.geometry,V=b.type,G=[];if(V==="Point"||V==="MultiPoint")for(var $=0;$0&&b.size<(D?G:M))I.numPoints+=b.length/3;else{for(var $=[],N=0;NG)&&(I.numSimplified++,$.push(b[N]),$.push(b[N+1])),I.numPoints++;D&&function(j,ee){for(var oe=0,se=0,Ie=j.length,be=Ie-2;se0===ee)for(se=0,Ie=j.length;se24)throw new Error("maxZoom should be in the 0-24 range");if(b.promoteId&&b.generateId)throw new Error("promoteId and generateId cannot be used together.");var M=function(D,V){var G=[];if(D.type==="FeatureCollection")for(var $=0;$1&&console.time("creation"),se=this.tiles[oe]=lt(P,b,I,M,N),this.tileCoords.push({z:b,x:I,y:M}),j)){j>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",b,I,M,se.numFeatures,se.numPoints,se.numSimplified),console.timeEnd("creation"));var Ie="z"+b;this.stats[Ie]=(this.stats[Ie]||0)+1,this.total++}if(se.source=P,D){if(b===N.maxZoom||b===D)continue;var be=1<1&&console.time("clipping");var ze,Pe,Ne,Xe,qe,$e,Ue=.5*N.buffer/N.extent,It=.5-Ue,wt=.5+Ue,At=1+Ue;ze=Pe=Ne=Xe=null,qe=Wt(P,ee,I-Ue,I+wt,0,se.minX,se.maxX,N),$e=Wt(P,ee,I+It,I+At,0,se.minX,se.maxX,N),P=null,qe&&(ze=Wt(qe,ee,M-Ue,M+wt,1,se.minY,se.maxY,N),Pe=Wt(qe,ee,M+It,M+At,1,se.minY,se.maxY,N),qe=null),$e&&(Ne=Wt($e,ee,M-Ue,M+wt,1,se.minY,se.maxY,N),Xe=Wt($e,ee,M+It,M+At,1,se.minY,se.maxY,N),$e=null),j>1&&console.timeEnd("clipping"),$.push(ze||[],b+1,2*I,2*M),$.push(Pe||[],b+1,2*I,2*M+1),$.push(Ne||[],b+1,2*I+1,2*M),$.push(Xe||[],b+1,2*I+1,2*M+1)}}},gr.prototype.getTile=function(P,b,I){var M=this.options,D=M.extent,V=M.debug;if(P<0||P>24)return null;var G=1<1&&console.log("drilling down to z%d-%d-%d",P,b,I);for(var N,j=P,ee=b,oe=I;!N&&j>0;)j--,ee=Math.floor(ee/2),oe=Math.floor(oe/2),N=this.tiles[ir(j,ee,oe)];return N&&N.source?(V>1&&console.log("found parent tile z%d-%d-%d",j,ee,oe),V>1&&console.time("drilling down"),this.splitTile(N.source,j,ee,oe,P,b,I),V>1&&console.timeEnd("drilling down"),this.tiles[$]?fr(this.tiles[$],D):null):null};class Sn extends vt{constructor(b,I,M,D){super(b,I,M,In),D&&(this.loadGeoJSON=D)}loadData(b,I){var M;(M=this._pendingRequest)===null||M===void 0||M.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const D=!!(b&&b.request&&b.request.collectResourceTiming)&&new h.RequestPerformance(b.request);this._pendingCallback=I,this._pendingRequest=this.loadGeoJSON(b,(V,G)=>{if(delete this._pendingCallback,delete this._pendingRequest,V||!G)return I(V);if(typeof G!="object")return I(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{yn(G,!0);try{if(b.filter){const N=h.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(N.result==="error")throw new Error(N.value.map(ee=>`${ee.key}: ${ee.message}`).join(", "));G={type:"FeatureCollection",features:G.features.filter(ee=>N.value.evaluate({zoom:0},ee))}}this._geoJSONIndex=b.cluster?new rs(function({superclusterOptions:N,clusterProperties:j}){if(!j||!N)return N;const ee={},oe={},se={accumulated:null,zoom:0},Ie={properties:null},be=Object.keys(j);for(const ze of be){const[Pe,Ne]=j[ze],Xe=h.createExpression(Ne),qe=h.createExpression(typeof Pe=="string"?[Pe,["accumulated"],["get",ze]]:Pe);ee[ze]=Xe.value,oe[ze]=qe.value}return N.map=ze=>{Ie.properties=ze;const Pe={};for(const Ne of be)Pe[Ne]=ee[Ne].evaluate(se,Ie);return Pe},N.reduce=(ze,Pe)=>{Ie.properties=Pe;for(const Ne of be)se.accumulated=ze[Ne],ze[Ne]=oe[Ne].evaluate(se,Ie)},N}(b)).load(G.features):function(N,j){return new gr(N,j)}(G,b.geojsonVtOptions)}catch(N){return I(N)}this.loaded={};const $={};if(D){const N=D.finish();N&&($.resourceTiming={},$.resourceTiming[b.source]=JSON.parse(JSON.stringify(N)))}I(null,$)}})}reloadTile(b,I){const M=this.loaded;return M&&M[b.uid]?super.reloadTile(b,I):this.loadTile(b,I)}loadGeoJSON(b,I){if(b.request)return h.getJSON(b.request,I);if(typeof b.data=="string")try{I(null,JSON.parse(b.data))}catch{I(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}else I(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(b,I){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),I()}getClusterExpansionZoom(b,I){try{I(null,this._geoJSONIndex.getClusterExpansionZoom(b.clusterId))}catch(M){I(M)}}getClusterChildren(b,I){try{I(null,this._geoJSONIndex.getChildren(b.clusterId))}catch(M){I(M)}}getClusterLeaves(b,I){try{I(null,this._geoJSONIndex.getLeaves(b.clusterId,b.limit,b.offset))}catch(M){I(M)}}}class rr{constructor(b){this.self=b,this.actor=new h.Actor(b,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:vt,geojson:Sn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(I,M)=>{if(this.workerSourceTypes[I])throw new Error(`Worker source with name "${I}" already registered.`);this.workerSourceTypes[I]=M},this.self.registerRTLTextPlugin=I=>{if(h.plugin.isParsed())throw new Error("RTL text plugin already registered.");h.plugin.applyArabicShaping=I.applyArabicShaping,h.plugin.processBidirectionalText=I.processBidirectionalText,h.plugin.processStyledBidirectionalText=I.processStyledBidirectionalText}}setReferrer(b,I){this.referrer=I}setImages(b,I,M){this.availableImages[b]=I;for(const D in this.workerSources[b]){const V=this.workerSources[b][D];for(const G in V)V[G].availableImages=I}M()}setLayers(b,I,M){this.getLayerIndex(b).replace(I),M()}updateLayers(b,I,M){this.getLayerIndex(b).update(I.layers,I.removedIds),M()}loadTile(b,I,M){this.getWorkerSource(b,I.type,I.source).loadTile(I,M)}loadDEMTile(b,I,M){this.getDEMWorkerSource(b,I.source).loadTile(I,M)}reloadTile(b,I,M){this.getWorkerSource(b,I.type,I.source).reloadTile(I,M)}abortTile(b,I,M){this.getWorkerSource(b,I.type,I.source).abortTile(I,M)}removeTile(b,I,M){this.getWorkerSource(b,I.type,I.source).removeTile(I,M)}removeDEMTile(b,I){this.getDEMWorkerSource(b,I.source).removeTile(I)}removeSource(b,I,M){if(!this.workerSources[b]||!this.workerSources[b][I.type]||!this.workerSources[b][I.type][I.source])return;const D=this.workerSources[b][I.type][I.source];delete this.workerSources[b][I.type][I.source],D.removeSource!==void 0?D.removeSource(I,M):M()}loadWorkerSource(b,I,M){try{this.self.importScripts(I.url),M()}catch(D){M(D.toString())}}syncRTLPluginState(b,I,M){try{h.plugin.setState(I);const D=h.plugin.getPluginURL();if(h.plugin.isLoaded()&&!h.plugin.isParsed()&&D!=null){this.self.importScripts(D);const V=h.plugin.isParsed();M(V?void 0:new Error(`RTL Text Plugin failed to import scripts from ${D}`),V)}}catch(D){M(D.toString())}}getAvailableImages(b){let I=this.availableImages[b];return I||(I=[]),I}getLayerIndex(b){let I=this.layerIndexes[b];return I||(I=this.layerIndexes[b]=new Wi),I}getWorkerSource(b,I,M){if(this.workerSources[b]||(this.workerSources[b]={}),this.workerSources[b][I]||(this.workerSources[b][I]={}),!this.workerSources[b][I][M]){const D={send:(V,G,$)=>{this.actor.send(V,G,$,b)}};this.workerSources[b][I][M]=new this.workerSourceTypes[I](D,this.getLayerIndex(b),this.getAvailableImages(b))}return this.workerSources[b][I][M]}getDEMWorkerSource(b,I){return this.demWorkerSources[b]||(this.demWorkerSources[b]={}),this.demWorkerSources[b][I]||(this.demWorkerSources[b][I]=new is),this.demWorkerSources[b][I]}enforceCacheSizeLimit(b,I){h.enforceCacheSizeLimit(I)}}return h.isWorker()&&(self.worker=new rr(self)),rr}),_n(["./shared"],function(h){var bi=lr;function lr(o){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var a,c,p=new Blob([""],{type:"text/javascript"}),m=URL.createObjectURL(p);try{c=new Worker(m),a=!0}catch{a=!1}return c&&c.terminate(),URL.revokeObjectURL(m),a}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var a=document.createElement("canvas");a.width=a.height=1;var c=a.getContext("2d");if(!c)return!1;var p=c.getImageData(0,0,1,1);return p&&p.width===a.width}()?(Wi[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(Wi[n]=function(a){var c,p=function(m){var _=document.createElement("canvas"),y=Object.create(lr.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=m,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(a);if(!p)return!1;try{c=p.createShader(p.VERTEX_SHADER)}catch{return!1}return!(!c||p.isContextLost())&&(p.shaderSource(c,"void main() {}"),p.compileShader(c),p.getShaderParameter(c,p.COMPILE_STATUS)===!0)}(n)),Wi[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(o)}var Wi={};function tt(o,t){if(Array.isArray(o)){if(!Array.isArray(t)||o.length!==t.length)return!1;for(let n=0;n{window.removeEventListener("click",ae.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new h.pointGeometry(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),c=[];for(let p=0;p-1);y++,p[y]=_,m[y]=v,m[y+1]=Hi}for(let _=0,y=0;_{let _=this.entries[c];_||(_=this.entries[c]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[p];if(y!==void 0)return void m(null,{stack:c,id:p,glyph:y});if(y=this._tinySDF(_,c,p),y)return _.glyphs[p]=y,void m(null,{stack:c,id:p,glyph:y});const v=Math.floor(p/256);if(256*v>65535)return void m(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void m(null,{stack:c,id:p,glyph:y});let T=_.requests[v];T||(T=_.requests[v]=[],Pt.loadGlyphRange(c,v,this.url,this.requestManager,(S,C)=>{if(C){for(const R in C)this._doesCharSupportLocalGlyph(+R)||(_.glyphs[+R]=C[+R]);_.ranges[v]=!0}for(const R of T)R(S,C);delete _.requests[v]})),T.push((S,C)=>{S?m(S):C&&m(null,{stack:c,id:p,glyph:C[p]||null})})},(c,p)=>{if(c)n(c);else if(p){const m={};for(const{stack:_,id:y,glyph:v}of p)(m[_]||(m[_]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(h.unicodeBlockLookup["CJK Unified Ideographs"](t)||h.unicodeBlockLookup["Hangul Syllables"](t)||h.unicodeBlockLookup.Hiragana(t)||h.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const c=this.localIdeographFontFamily;if(!c||!this._doesCharSupportLocalGlyph(a))return;let p=t.tinySDF;if(!p){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),p=t.tinySDF=new Pt.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:c,fontWeight:_})}const m=p.draw(String.fromCharCode(a));return{id:a,bitmap:new h.AlphaImage({width:m.width||30,height:m.height||30},m.data),metrics:{width:m.glyphWidth||24,height:m.glyphHeight||24,left:m.glyphLeft||0,top:m.glyphTop-27||-8,advance:m.glyphAdvance||24}}}}Pt.loadGlyphRange=function(o,t,n,a,c){const p=256*t,m=p+255,_=a.transformRequest(n.replace("{fontstack}",o).replace("{range}",`${p}-${m}`),h.ResourceType.Glyphs);h.getArrayBuffer(_,(y,v)=>{if(y)c(y);else if(v){const T={};for(const S of h.parseGlyphPbf(v))T[S.id]=S;c(null,T)}})},Pt.TinySDF=class{constructor({fontSize:o=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:c="sans-serif",fontWeight:p="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const _=this.size=o+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${m} ${p} ${o}px ${c}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(o){const t=document.createElement("canvas");return t.width=t.height=o,t}draw(o){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:c,actualBoundingBoxRight:p}=this.ctx.measureText(o),m=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(p-c)),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),v=_+2*this.buffer,T=y+2*this.buffer,S=Math.max(v*T,0),C=new Uint8ClampedArray(S),R={data:C,width:v,height:T,glyphWidth:_,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return R;const{ctx:L,buffer:B,gridInner:q,gridOuter:Z}=this;L.clearRect(B,B,_,y),L.fillText(o,B,B+m);const H=L.getImageData(B,B,_,y);Z.fill(Hi,0,S),q.fill(0,0,S);for(let F=0;F0?re*re:0,q[ie]=re<0?re*re:0}}si(Z,0,0,v,T,v,this.f,this.v,this.z),si(q,B,B,_,y,v,this.f,this.v,this.z);for(let F=0;F1&&(y=t[++_]);const T=Math.abs(v-y.left),S=Math.abs(v-y.right),C=Math.min(T,S);let R;const L=p/a*(c+1);if(y.isDash){const B=c-Math.abs(L);R=Math.sqrt(C*C+B*B)}else R=c-Math.sqrt(C*C+L*L);this.data[m+v]=Math.max(0,Math.min(255,R+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],v=t[_+1];y.zeroLength?t.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(_,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const c=this.width*this.nextRow;let p=0,m=t[p];for(let _=0;_1&&(m=t[++p]);const y=Math.abs(_-m.left),v=Math.abs(_-m.right),T=Math.min(y,v);this.data[c+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(t,n){const a=n?7:0,c=2*a+1;if(this.nextRow+c>this.height)return h.warnOnce("LineAtlas out of space"),null;let p=0;for(let _=0;_{c.send(t,n,p)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function Ir(o,t,n){const a=function(c,p){if(c)return n(c);if(p){const m=h.pick(h.extend(p,o),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(m.vectorLayers=p.vector_layers,m.vectorLayerIds=m.vectorLayers.map(_=>_.id)),n(null,m)}};return o.url?h.getJSON(t.transformRequest(o.url,h.ResourceType.Source),a):h.exported.frame(()=>a(null,o))}Ki.Actor=h.Actor;class Ji{constructor(t,n,a){this.bounds=h.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(h.mercatorXfromLng(this.bounds.getWest())*n),c=Math.floor(h.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(h.mercatorXfromLng(this.bounds.getEast())*n),m=Math.ceil(h.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x=c&&t.y{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new Ji(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c={request:this.map._requestManager.transformRequest(a,h.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(m,_){return delete t.request,t.aborted?n(null):m&&m.status!==404?n(m):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),h.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}c.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",c,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",c,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class hr extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.extend({type:"raster"},n),h.extend(this,h.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Ir(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new Ji(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=h.getImage(this.map._requestManager.transformRequest(a,h.ResourceType.Tile),(c,p,m)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(c)t.state="errored",n(c);else if(p){this.map._refreshExpiredTiles&&t.setExpiryData(m);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new vt(_,p,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",h.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let ur;class Re extends hr{constructor(t,n,a,c){super(t,n,a,c),this.type="raster-dem",this.maxzoom=22,this._options=h.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function c(p,m){p&&(t.state="errored",n(p)),m&&(t.dem=m,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=h.getImage(this.map._requestManager.transformRequest(a,h.ResourceType.Tile),(function(p,m){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(m){this.map._refreshExpiredTiles&&t.setExpiryData(m),delete m.cacheControl,delete m.expires;const _=h.isImageBitmap(m)&&(ur==null&&(ur=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ur)?m:h.exported.getImageData(m,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,c.bind(this)))}}).bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),c=(n.x-1+a)%a,p=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,_=n.x+1===a?t.wrap+1:t.wrap,y={};return y[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y).key]={backfilled:!1},y[new h.OverscaledTileID(t.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y-1).key]={backfilled:!1},y[new h.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new h.OverscaledTileID(t.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1{if(this._pendingLoads--,this._removed||p&&p.abandoned)return void this.fire(new h.Event("dataabort",{dataType:"source",sourceDataType:t}));let m=null;if(p&&p.resourceTiming&&p.resourceTiming[this.id]&&(m=p.resourceTiming[this.id].slice(0)),c)return void this.fire(new h.ErrorEvent(c));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&m&&m.length>0&&h.extend(_,{resourceTiming:m}),this.fire(new h.Event("data",_))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const c={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(a,c,(p,m)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(m,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return h.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Qi=h.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ti extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(t,n){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this.url=this.options.url,h.getImage(this.map._requestManager.transformRequest(this.url,h.ResourceType.Image),(a,c)=>{this._loaded=!0,a?this.fire(new h.ErrorEvent(a)):c&&(this.image=c,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(h.MercatorCoordinate.fromLngLat);this.tileID=function(c){let p=1/0,m=1/0,_=-1/0,y=-1/0;for(const C of c)p=Math.min(p,C.x),m=Math.min(m,C.y),_=Math.max(_,C.x),y=Math.max(y,C.y);const v=Math.max(_-p,y-m),T=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),S=Math.pow(2,T);return new h.CanonicalTileID(T,Math.floor((p+_)/2*S),Math.floor((m+y)/2*S))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(c=>this.tileID.getTilePoint(c)._round());return this._boundsArray=new h.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,h.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,h.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,h.EXTENT,h.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Qi.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new vt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const a in this.tiles){const c=this.tiles[a];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class pr extends Ti{constructor(t,n,a,c){super(t,n,a,c),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,h.ResourceType.Source).url);h.getVideo(this.urls,(n,a)=>{this._loaded=!0,n?this.fire(new h.ErrorEvent(n)):a&&(this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;tn.end(0)?this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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 t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Qi.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new vt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const a in this.tiles){const c=this.tiles[a];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class vn extends Ti{constructor(t,n,a,c){super(t,n,a,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,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 h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){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 h.ErrorEvent(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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Qi.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new vt(n,this.canvas,a.RGBA,{premultiply:!0});for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Zr={vector:qr,raster:hr,"raster-dem":Re,geojson:Yi,video:pr,image:Ti,canvas:vn};function bn(o,t){const n=h.create();return h.translate(n,n,[1,1,0]),h.scale(n,n,[.5*o.width,.5*o.height,1]),h.multiply(n,n,o.calculatePosMatrix(t.toUnwrapped()))}function jr(o,t,n,a,c,p){const m=function(S,C,R){if(S)for(const L of S){const B=C[L];if(B&&B.source===R&&B.type==="fill-extrusion")return!0}else for(const L in C){const B=C[L];if(B.source===R&&B.type==="fill-extrusion")return!0}return!1}(c&&c.layers,t,o.id),_=p.maxPitchScaleFactor(),y=o.tilesIn(a,_,m);y.sort(Oi);const v=[];for(const S of y)v.push({wrappedTileID:S.tileID.wrapped().key,queryResults:S.tile.queryRenderedFeatures(t,n,o._state,S.queryGeometry,S.cameraQueryGeometry,S.scale,c,p,_,bn(o.transform,S.tileID))});const T=function(S){const C={},R={};for(const L of S){const B=L.queryResults,q=L.wrappedTileID,Z=R[q]=R[q]||{};for(const H in B){const F=B[H],J=Z[H]=Z[H]||{},K=C[H]=C[H]||[];for(const ie of F)J[ie.featureIndex]||(J[ie.featureIndex]=!0,K.push(ie))}}return C}(v);for(const S in T)T[S].forEach(C=>{const R=C.feature,L=o.getFeatureState(R.layer["source-layer"],R.id);R.source=R.layer.source,R.layer["source-layer"]&&(R.sourceLayer=R.layer["source-layer"]),R.state=L});return T}function Oi(o,t){const n=o.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class Ui{constructor(t,n){this.tileID=t,this.uid=h.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;nt.saveTileTexture(n)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(c,p){const m={};if(!p)return m;for(const _ of c){const y=_.layerIds.map(v=>p.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(T=>T.id===v)[0]));for(const v of y)m[v.id]=_}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,h.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const c in this.buckets){const p=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new h.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const c=this.buckets[a];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new vt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new vt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,c,p,m,_,y,v,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*v},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const c=a.loadVTLayers(),p=n?n.sourceLayer:"",m=c._geojsonTileLayer||c[p];if(!m)return;const _=h.createFilter(n&&n.filter),{z:y,x:v,y:T}=this.tileID.canonical,S={z:y,x:v,y:T};for(let C=0;Ca)c=!1;else if(n)if(this.expirationTime{this.remove(t,p)},a)),this.data[c].push(p),this.order.push(c),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,c=n===void 0?0:this.data[a].indexOf(n),p=this.data[a][c];return this.data[a].splice(c,1),p.timeout&&clearTimeout(p.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(p.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const c of this.data[a])t(c.value)||n.push(c);for(const a of n)this.remove(a.value.tileID,a)}}class wn{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},h.extend(this.stateChanges[t][c],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==c&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const p in this.state[t][c])a[p]||(this.deletedStates[t][c][p]=null)}else for(const p in a)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][p]===null&&delete this.deletedStates[t][c][p]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(a in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][a]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),c=h.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const m in p)delete c[m]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const p={};for(const m in this.stateChanges[c])this.state[c][m]||(this.state[c][m]={}),h.extend(this.state[c][m],this.stateChanges[c][m]),p[m]=this.state[c][m];a[c]=p}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const p={};if(this.deletedStates[c]===null)for(const m in this.state[c])p[m]={},this.state[c][m]={};else for(const m in this.deletedStates[c]){if(this.deletedStates[c][m]===null)this.state[c][m]={};else for(const _ of Object.keys(this.deletedStates[c][m]))delete this.state[c][m][_];p[m]=this.state[c][m]}a[c]=a[c]||{},h.extend(a[c],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const c in t)t[c].setFeatureState(a,n)}}class ai extends h.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",c=>{c.dataType==="source"&&c.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&c.dataType==="source"&&c.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(c,p,m,_){const y=new Zr[p.type](c,p,m,_);if(y.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${y.id}`);return h.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,a,this),this._tiles={},this._cache=new er(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new wn}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new h.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Xr).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,c)=>{const p=a.tileID,m=c.tileID,_=new h.pointGeometry(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new h.pointGeometry(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-m.overscaledZ||y.y-_.y||y.x-_.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(Xr).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,c){if(c)return t.state="errored",void(c.status!==404?this._source.fire(new h.ErrorEvent(c,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=h.exported.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new h.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let c=0;c1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),p.dem&&c.dem&&(c.dem.backfillBorder(p.dem,m,_),c.neighboringTiles&&c.neighboringTiles[v]&&(c.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,c){for(const p in this._tiles){let m=this._tiles[p];if(c[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const v=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[v.key],m&&m.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){c[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const c=t.scaledTo(a),p=this._getLoadedTile(c);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*a*5),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const c in this._tiles){const p=this._tiles[c];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),a[p.tileID.key]=p}this._tiles=a;for(const c in this._timers)clearTimeout(this._timers[c]),delete this._timers[c];for(const c in this._tiles)this._setTileReloadTimer(c,this._tiles[c])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(v=>new h.OverscaledTileID(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.canonical.y)):(a=t.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:n}),this._source.hasTile&&(a=a.filter(v=>this._source.hasTile(v)))):a=[];const c=t.coveringZoomLevel(this._source),p=Math.max(c-ai.maxOverzooming,this._source.minzoom),m=Math.max(c+ai.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const T of a)if(T.canonical.z>this._source.minzoom){const S=T.scaledTo(T.canonical.z-1);v[S.key]=S;const C=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));v[C.key]=C}a=a.concat(Object.values(v))}const _=this._updateRetainedTiles(a,c);if(Tn(this._source.type)){const v={},T={},S=Object.keys(_);for(const C of S){const R=_[C],L=this._tiles[C];if(!L||L.fadeEndTime&&L.fadeEndTime<=h.exported.now())continue;const B=this.findLoadedParent(R,p);B&&(this._addTile(B.tileID),v[B.tileID.key]=B.tileID),T[C]=R}this._retainLoadedChildren(T,c,m,_);for(const C in v)_[C]||(this._coveredTiles[C]=!0,_[C]=v[C]);if(n){const C={},R={};for(const L of a)this._tiles[L.key].hasData()?C[L.key]=L:R[L.key]=L;for(const L in R){const B=R[L].children(this._source.maxzoom);this._tiles[B[0].key]&&this._tiles[B[1].key]&&this._tiles[B[2].key]&&this._tiles[B[3].key]&&(C[B[0].key]=_[B[0].key]=B[0],C[B[1].key]=_[B[1].key]=B[1],C[B[2].key]=_[B[2].key]=B[2],C[B[3].key]=_[B[3].key]=B[3],delete R[L])}for(const L in R){const B=this.findLoadedParent(R[L],this._source.minzoom);if(B){C[B.tileID.key]=_[B.tileID.key]=B.tileID;for(const q in C)C[q].isChildOf(B.tileID)&&delete C[q]}}for(const L in this._tiles)C[L]||(this._coveredTiles[L]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=h.keysDifference(this._tiles,_);for(const v of y){const T=this._tiles[v];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(v)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},c={},p=Math.max(n-ai.maxOverzooming,this._source.minzoom),m=Math.max(n+ai.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const v=this._addTile(y);a[y.key]=y,v.hasData()||nthis._source.maxzoom){const S=y.children(this._source.maxzoom)[0],C=this.getTile(S);if(C&&C.hasData()){a[S.key]=S;continue}}else{const S=y.children(this._source.maxzoom);if(a[S[0].key]&&a[S[1].key]&&a[S[2].key]&&a[S[3].key])continue}let T=v.wasRequested();for(let S=y.overscaledZ-1;S>=p;--S){const C=y.scaledTo(S);if(c[C.key]||(c[C.key]=!0,v=this.getTile(C),!v&&T&&(v=this._addTile(C)),v&&(a[C.key]=C,T=v.wasRequested(),v.hasData())))break}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,c=this._tiles[t].tileID;for(;c.overscaledZ>0;){if(c.key in this._loadedParentTiles){a=this._loadedParentTiles[c.key];break}n.push(c.key);const p=c.scaledTo(c.overscaledZ-1);if(a=this._getLoadedTile(p),a)break;c=p}for(const p of n)this._loadedParentTiles[p]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new Ui(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new h.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const c=[],p=this.transform;if(!p)return c;const m=a?p.getCameraQueryGeometry(t):t,_=t.map(L=>p.pointCoordinate(L,this.terrain)),y=m.map(L=>p.pointCoordinate(L,this.terrain)),v=this.getIds();let T=1/0,S=1/0,C=-1/0,R=-1/0;for(const L of y)T=Math.min(T,L.x),S=Math.min(S,L.y),C=Math.max(C,L.x),R=Math.max(R,L.y);for(let L=0;L=0&&F[1].y+H>=0){const J=_.map(ie=>q.getTilePoint(ie)),K=y.map(ie=>q.getTilePoint(ie));c.push({tile:B,tileID:q,queryGeometry:J,cameraQueryGeometry:K,scale:Z})}}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Tn(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=h.exported.now())return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const c=this._tiles[t];c&&c.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function Xr(o,t){const n=Math.abs(2*o.wrap)-+(o.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return o.overscaledZ-t.overscaledZ||a-n||t.canonical.y-o.canonical.y||t.canonical.x-o.canonical.x}function Tn(o){return o==="raster"||o==="image"||o==="video"}ai.maxOverzooming=10,ai.maxUnderzooming=3;const Ei="mapboxgl_preloaded_worker_pool";class _i{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<_i.workerCount;)this.workers.push(new Worker(Wn.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ei]}numActive(){return Object.keys(this.active).length}}const rs=Math.floor(h.exported.hardwareConcurrency/2);let tr;function Wr(){return tr||(tr=new _i),tr}function ns(o,t){const n={};for(const a in o)a!=="ref"&&(n[a]=o[a]);return h.refProperties.forEach(a=>{a in t&&(n[a]=t[a])}),n}function Hr(o){o=o.slice();const t=Object.create(null);for(let n=0;n0?(c-m)/_:0;return this.points[p].mult(1-y).add(this.points[n].mult(y))}}function de(o,t){let n=!0;return o==="always"||o!=="never"&&t!=="never"||(n=!1),n}class Sr{constructor(t,n,a){const c=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;mthis.width||c<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=c){if(p)return[{key:null,x1:t,y1:n,x2:a,y2:c}];for(let v=0;v0}hitTestCircle(t,n,a,c,p){const m=t-a,_=t+a,y=n-a,v=n+a;if(_<0||m>this.width||v<0||y>this.height)return!1;const T=[];return this._forEachCell(m,y,_,v,this._queryCellCircle,T,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},p),T.length>0}_queryCell(t,n,a,c,p,m,_,y){const{seenUids:v,hitTest:T,overlapMode:S}=_,C=this.boxCells[p];if(C!==null){const L=this.bboxes;for(const B of C)if(!v.box[B]){v.box[B]=!0;const q=4*B,Z=this.boxKeys[B];if(t<=L[q+2]&&n<=L[q+3]&&a>=L[q+0]&&c>=L[q+1]&&(!y||y(Z))&&(!T||!de(S,Z.overlapMode))&&(m.push({key:Z,x1:L[q],y1:L[q+1],x2:L[q+2],y2:L[q+3]}),T))return!0}}const R=this.circleCells[p];if(R!==null){const L=this.circles;for(const B of R)if(!v.circle[B]){v.circle[B]=!0;const q=3*B,Z=this.circleKeys[B];if(this._circleAndRectCollide(L[q],L[q+1],L[q+2],t,n,a,c)&&(!y||y(Z))&&(!T||!de(S,Z.overlapMode))){const H=L[q],F=L[q+1],J=L[q+2];if(m.push({key:Z,x1:H-J,y1:F-J,x2:H+J,y2:F+J}),T)return!0}}}return!1}_queryCellCircle(t,n,a,c,p,m,_,y){const{circle:v,seenUids:T,overlapMode:S}=_,C=this.boxCells[p];if(C!==null){const L=this.bboxes;for(const B of C)if(!T.box[B]){T.box[B]=!0;const q=4*B,Z=this.boxKeys[B];if(this._circleAndRectCollide(v.x,v.y,v.radius,L[q+0],L[q+1],L[q+2],L[q+3])&&(!y||y(Z))&&!de(S,Z.overlapMode))return m.push(!0),!0}}const R=this.circleCells[p];if(R!==null){const L=this.circles;for(const B of R)if(!T.circle[B]){T.circle[B]=!0;const q=3*B,Z=this.circleKeys[B];if(this._circlesCollide(L[q],L[q+1],L[q+2],v.x,v.y,v.radius)&&(!y||y(Z))&&!de(S,Z.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,c,p,m,_,y){const v=this._convertToXCellCoord(t),T=this._convertToYCellCoord(n),S=this._convertToXCellCoord(a),C=this._convertToYCellCoord(c);for(let R=v;R<=S;R++)for(let L=T;L<=C;L++)if(p.call(this,t,n,a,c,this.xCellCount*L+R,m,_,y))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,a,c,p,m){const _=c-t,y=p-n,v=a+m;return v*v>_*_+y*y}_circleAndRectCollide(t,n,a,c,p,m,_){const y=(m-c)/2,v=Math.abs(t-(c+y));if(v>y+a)return!1;const T=(_-p)/2,S=Math.abs(n-(p+T));if(S>T+a)return!1;if(v<=y||S<=T)return!0;const C=v-y,R=S-T;return C*C+R*R<=a*a}}function Si(o,t,n,a,c){const p=h.create();return t?(h.scale(p,p,[1/c,1/c,1]),n||h.rotateZ(p,p,a.angle)):h.multiply(p,a.labelPlaneMatrix,o),p}function ct(o,t,n,a,c){if(t){const p=h.clone(o);return h.scale(p,p,[c,c,1]),n||h.rotateZ(p,p,-a.angle),p}return a.glCoordMatrix}function bt(o,t,n){let a;n?(a=[o.x,o.y,n(o.x,o.y),1],h.transformMat4(a,a,t)):(a=[o.x,o.y,0,1],Ni(a,a,t));const c=a[3];return{point:new h.pointGeometry(a[0]/c,a[1]/c),signedDistanceFromCamera:c}}function Xt(o,t){return .5+o/t*.5}function Yr(o,t){const n=o[0]/o[3],a=o[1]/o[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function Wt(o,t,n,a,c,p,m,_,y,v){const T=a?o.textSizeData:o.iconSizeData,S=h.evaluateSizeForZoom(T,n.transform.zoom),C=[256/n.width*2+1,256/n.height*2+1],R=a?o.text.dynamicLayoutVertexArray:o.icon.dynamicLayoutVertexArray;R.clear();const L=o.lineVertexArray,B=a?o.text.placedSymbolArray:o.icon.placedSymbolArray,q=n.transform.width/n.transform.height;let Z=!1;for(let H=0;HMath.abs(n.x-t.x)*a?{useVertical:!0}:(o===h.WritingMode.vertical?t.yn.x)?{needsFlipping:!0}:null}function Oe(o,t,n,a,c,p,m,_,y,v,T,S,C,R,L,B){const q=t/24,Z=o.lineOffsetX*q,H=o.lineOffsetY*q;let F;if(o.numGlyphs>1){const J=o.glyphStartIndex+o.numGlyphs,K=o.lineStartIndex,ie=o.lineStartIndex+o.lineLength,re=ge(q,_,Z,H,n,T,S,o,y,p,C,L,B);if(!re)return{notEnoughRoom:!0};const he=bt(re.first.point,m,B).point,te=bt(re.last.point,m,B).point;if(a&&!n){const we=Ge(o.writingMode,he,te,R);if(we)return we}F=[re.first];for(let we=o.glyphStartIndex+1;we0?he.point:Ht(S,re,K,1,c,B),we=Ge(o.writingMode,K,te,R);if(we)return we}const J=oi(q*_.getoffsetX(o.glyphStartIndex),Z,H,n,T,S,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,y,p,C,L,B);if(!J)return{notEnoughRoom:!0};F=[J]}for(const J of F)h.addDynamicAttributes(v,J.point,J.angle);return{}}function Ht(o,t,n,a,c,p){const m=bt(o.add(o.sub(t)._unit()),c,p).point,_=n.sub(m);return n.add(_._mult(a/_.mag()))}function oi(o,t,n,a,c,p,m,_,y,v,T,S,C,R){const L=a?o-t:o+t;let B=L>0?1:-1,q=0;a&&(B*=-1,q=Math.PI),B<0&&(q+=Math.PI);let Z=B>0?_+m:_+m+1,H=c,F=c,J=0,K=0;const ie=Math.abs(L),re=[];for(;J+K<=ie;){if(Z+=B,Z<_||Z>=y)return null;if(F=H,re.push(H),H=S[Z],H===void 0){const Te=new h.pointGeometry(v.getx(Z),v.gety(Z)),Fe=bt(Te,T,R);if(Fe.signedDistanceFromCamera>0)H=S[Z]=Fe.point;else{const Ze=Z-B;H=Ht(J===0?p:new h.pointGeometry(v.getx(Ze),v.gety(Ze)),Te,F,ie-J+1,T,R)}}J+=K,K=F.dist(H)}const he=(ie-J)/K,te=H.sub(F),we=te.mult(he)._add(F);we._add(te._unit()._perp()._mult(n*B));const me=q+Math.atan2(H.y-F.y,H.x-F.x);return re.push(we),{point:we,angle:C?me:0,path:re}}const Ve=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ai(o,t){for(let n=0;n=1;Ke--)Le.push(Fe.path[Ke]);for(let Ke=1;Kebt(Je,y,L));Le=Ke.some(Je=>Je.signedDistanceFromCamera<=0)?[]:Ke.map(Je=>Je.point)}let st=[];if(Le.length>0){const Ke=Le[0].clone(),Je=Le[0].clone();for(let Ye=1;Ye=we.x&&Je.x<=me.x&&Ke.y>=we.y&&Je.y<=me.y?[Le]:Je.xme.x||Je.yme.y?[]:h.clipLine([Le],we.x,we.y,me.x,me.y)}for(const Ke of st){Te.reset(Ke,.25*te);let Je=0;Je=Te.length<=.5*te?1:Math.ceil(Te.paddedLength/nt)+1;for(let Ye=0;Ye=this.screenRightBoundary||cthis.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t=0&&na.collisionGroupID===n}}return this.collisionGroups[t]}}function Sn(o,t,n,a,c){const{horizontalAlign:p,verticalAlign:m}=h.getAnchorAlignment(o),_=-(p-.5)*t,y=-(m-.5)*n,v=h.evaluateVariableOffset(o,a);return new h.pointGeometry(_+v[0]*c,y+v[1]*c)}function rr(o,t,n,a,c,p){const{x1:m,x2:_,y1:y,y2:v,anchorPointX:T,anchorPointY:S}=o,C=new h.pointGeometry(t,n);return a&&C._rotate(c?p:-p),{x1:m+C.x,y1:y+C.y,x2:_+C.x,y2:v+C.y,anchorPointX:T,anchorPointY:S}}class P{constructor(t,n,a,c,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new fr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new In(c),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,c){const p=a.getBucket(n),m=a.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const _=a.collisionBoxArray,y=p.layers[0].layout,v=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),T=a.tileSize/h.EXTENT,S=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),C=y.get("text-pitch-alignment")==="map",R=y.get("text-rotation-alignment")==="map",L=ot(a,1,this.transform.zoom),B=Si(S,C,R,this.transform,L);let q=null;if(C){const H=ct(S,C,R,this.transform,L);q=h.multiply([],this.transform.labelPlaneMatrix,H)}this.retainedQueryData[p.bucketInstanceId]=new ir(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,a.tileID);const Z={bucket:p,layout:y,posMatrix:S,textLabelPlaneMatrix:B,labelToScreenMatrix:q,scale:v,textPixelRatio:T,holdingForFade:a.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:h.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(c)for(const H of p.sortKeyRanges){const{sortKey:F,symbolInstanceStart:J,symbolInstanceEnd:K}=H;t.push({sortKey:F,symbolInstanceStart:J,symbolInstanceEnd:K,parameters:Z})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:Z})}attemptAnchorPlacement(t,n,a,c,p,m,_,y,v,T,S,C,R,L,B,q){const Z=[C.textOffset0,C.textOffset1],H=Sn(t,a,c,Z,p),F=this.collisionIndex.placeCollisionBox(rr(n,H.x,H.y,m,_,this.transform.angle),S,y,v,T.predicate,q);if((!B||this.collisionIndex.placeCollisionBox(rr(B,H.x,H.y,m,_,this.transform.angle),S,y,v,T.predicate,q).box.length!==0)&&F.box.length>0){let J;if(this.prevPlacement&&this.prevPlacement.variableOffsets[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID].text&&(J=this.prevPlacement.variableOffsets[C.crossTileID].anchor),C.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[C.crossTileID]={textOffset:Z,width:a,height:c,anchor:t,textBoxScale:p,prevAnchor:J},this.markUsedJustification(R,t,C,L),R.allowVerticalPlacement&&(this.markUsedOrientation(R,L,C),this.placedOrientations[C.crossTileID]=L),{shift:H,placedGlyphBoxes:F}}}placeLayerBucketPart(t,n,a){const{bucket:c,layout:p,posMatrix:m,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:T,collisionBoxArray:S,partiallyEvaluatedTextSize:C,collisionGroup:R}=t.parameters,L=p.get("text-optional"),B=p.get("icon-optional"),q=h.getOverlapMode(p,"text-overlap","text-allow-overlap"),Z=q==="always",H=h.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),F=H==="always",J=p.get("text-rotation-alignment")==="map",K=p.get("text-pitch-alignment")==="map",ie=p.get("icon-text-fit")!=="none",re=p.get("symbol-z-order")==="viewport-y",he=Z&&(F||!c.hasIconData()||B),te=F&&(Z||!c.hasTextData()||L);!c.collisionArrays&&S&&c.deserializeCollisionBoxes(S);const we=(me,Te)=>{if(n[me.crossTileID])return;if(T)return void(this.placements[me.crossTileID]=new $i(!1,!1,!1));let Fe=!1,Ze=!1,Le=!0,nt=null,st={box:null,offscreen:null},Ke={box:null,offscreen:null},Je=null,Ye=null,hi=null,qi=0,zi=0,Mi=0;Te.textFeatureIndex?qi=Te.textFeatureIndex:me.useRuntimeCollisionCircles&&(qi=me.featureIndex),Te.verticalTextFeatureIndex&&(zi=Te.verticalTextFeatureIndex);const Br=this.retainedQueryData[c.bucketInstanceId].tileID,Ut=this.terrain?(Qe,pt)=>this.terrain.getElevation(Br,Qe,pt):null;for(const Qe of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const pt=Te[Qe];pt&&(pt.elevation=Ut?Ut(pt.anchorPointX,pt.anchorPointY):0)}const ki=Te.textBox;if(ki){const Qe=et=>{let zt=h.WritingMode.horizontal;if(c.allowVerticalPlacement&&!et&&this.prevPlacement){const ti=this.prevPlacement.placedOrientations[me.crossTileID];ti&&(this.placedOrientations[me.crossTileID]=ti,zt=ti,this.markUsedOrientation(c,zt,me))}return zt},pt=(et,zt)=>{if(c.allowVerticalPlacement&&me.numVerticalGlyphVertices>0&&Te.verticalTextBox){for(const ti of c.writingModes)if(ti===h.WritingMode.vertical?(st=zt(),Ke=st):st=et(),st&&st.box&&st.box.length)break}else st=et()};if(p.get("text-variable-anchor")){let et=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[me.crossTileID]){const ft=this.prevPlacement.variableOffsets[me.crossTileID];et.indexOf(ft.anchor)>0&&(et=et.filter(xi=>xi!==ft.anchor),et.unshift(ft.anchor))}const zt=(ft,xi,hn)=>{const un=ft.x2-ft.x1,ks=ft.y2-ft.y1,Aa=me.textBoxScale,Ps=ie&&H==="never"?xi:null;let Pi={box:[],offscreen:!1};const Ds=q!=="never"?2*et.length:et.length;for(let Hn=0;Hn=et.length?q:"never",me,c,hn,Ps,Ut);if(Ls&&(Pi=Ls.placedGlyphBoxes,Pi&&Pi.box&&Pi.box.length)){Fe=!0,nt=Ls.shift;break}}return Pi};pt(()=>zt(ki,Te.iconBox,h.WritingMode.horizontal),()=>{const ft=Te.verticalTextBox;return c.allowVerticalPlacement&&!(st&&st.box&&st.box.length)&&me.numVerticalGlyphVertices>0&&ft?zt(ft,Te.verticalIconBox,h.WritingMode.vertical):{box:null,offscreen:null}}),st&&(Fe=st.box,Le=st.offscreen);const ti=Qe(st&&st.box);if(!Fe&&this.prevPlacement){const ft=this.prevPlacement.variableOffsets[me.crossTileID];ft&&(this.variableOffsets[me.crossTileID]=ft,this.markUsedJustification(c,ft.anchor,me,ti))}}else{const et=(zt,ti)=>{const ft=this.collisionIndex.placeCollisionBox(zt,q,v,m,R.predicate,Ut);return ft&&ft.box&&ft.box.length&&(this.markUsedOrientation(c,ti,me),this.placedOrientations[me.crossTileID]=ti),ft};pt(()=>et(ki,h.WritingMode.horizontal),()=>{const zt=Te.verticalTextBox;return c.allowVerticalPlacement&&me.numVerticalGlyphVertices>0&&zt?et(zt,h.WritingMode.vertical):{box:null,offscreen:null}}),Qe(st&&st.box&&st.box.length)}}if(Je=st,Fe=Je&&Je.box&&Je.box.length>0,Le=Je&&Je.offscreen,me.useRuntimeCollisionCircles){const Qe=c.text.placedSymbolArray.get(me.centerJustifiedTextSymbolIndex),pt=h.evaluateSizeForFeature(c.textSizeData,C,Qe),et=p.get("text-padding");Ye=this.collisionIndex.placeCollisionCircles(q,Qe,c.lineVertexArray,c.glyphOffsetArray,pt,m,_,y,a,K,R.predicate,me.collisionCircleDiameter,et,Ut),Ye.circles.length&&Ye.collisionDetected&&!a&&h.warnOnce("Collisions detected, but collision boxes are not shown"),Fe=Z||Ye.circles.length>0&&!Ye.collisionDetected,Le=Le&&Ye.offscreen}if(Te.iconFeatureIndex&&(Mi=Te.iconFeatureIndex),Te.iconBox){const Qe=pt=>{const et=ie&&nt?rr(pt,nt.x,nt.y,J,K,this.transform.angle):pt;return this.collisionIndex.placeCollisionBox(et,H,v,m,R.predicate,Ut)};Ke&&Ke.box&&Ke.box.length&&Te.verticalIconBox?(hi=Qe(Te.verticalIconBox),Ze=hi.box.length>0):(hi=Qe(Te.iconBox),Ze=hi.box.length>0),Le=Le&&hi.offscreen}const Rr=L||me.numHorizontalGlyphVertices===0&&me.numVerticalGlyphVertices===0,Ms=B||me.numIconVertices===0;if(Rr||Ms?Ms?Rr||(Ze=Ze&&Fe):Fe=Ze&&Fe:Ze=Fe=Ze&&Fe,Fe&&Je&&Je.box&&this.collisionIndex.insertCollisionBox(Je.box,q,p.get("text-ignore-placement"),c.bucketInstanceId,Ke&&Ke.box&&zi?zi:qi,R.ID),Ze&&hi&&this.collisionIndex.insertCollisionBox(hi.box,H,p.get("icon-ignore-placement"),c.bucketInstanceId,Mi,R.ID),Ye&&(Fe&&this.collisionIndex.insertCollisionCircles(Ye.circles,q,p.get("text-ignore-placement"),c.bucketInstanceId,qi,R.ID),a)){const Qe=c.bucketInstanceId;let pt=this.collisionCircleArrays[Qe];pt===void 0&&(pt=this.collisionCircleArrays[Qe]=new gr);for(let et=0;et=0;--Te){const Fe=me[Te];we(c.symbolInstances.get(Fe),c.collisionArrays[Fe])}}else for(let me=t.symbolInstanceStart;me=0&&(t.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:a.crossTileID)}markUsedOrientation(t,n,a){const c=n===h.WritingMode.horizontal||n===h.WritingMode.horizontalOnly?n:0,p=n===h.WritingMode.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const _ of m)t.text.placedSymbolArray.get(_).placedOrientation=c;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],T=p[y];T?(this.opacities[y]=new Ar(T,c,v.text,v.icon),a=a||v.text!==T.text.placed||v.icon!==T.icon.placed):(this.opacities[y]=new Ar(null,c,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const y in p){const v=p[y];if(!this.opacities[y]){const T=new Ar(v,c,!1,!1);T.isHidden()||(this.opacities[y]=T,a=a||v.text.placed||v.icon.placed)}}for(const y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const c of n){const p=c.getBucket(t);p&&c.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,a,c.collisionBoxArray)}}updateBucketOpacities(t,n,a){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0].layout,p=new Ar(null,0,!1,!1,!0),m=c.get("text-allow-overlap"),_=c.get("icon-allow-overlap"),y=c.get("text-variable-anchor"),v=c.get("text-rotation-alignment")==="map",T=c.get("text-pitch-alignment")==="map",S=c.get("icon-text-fit")!=="none",C=new Ar(null,0,m&&(_||!t.hasIconData()||c.get("icon-optional")),_&&(m||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const R=(L,B,q)=>{for(let Z=0;Z0,K=this.placedOrientations[B.crossTileID],ie=K===h.WritingMode.vertical,re=K===h.WritingMode.horizontal||K===h.WritingMode.horizontalOnly;if(q>0||Z>0){const he=j(F.text);R(t.text,q,ie?ee:he),R(t.text,Z,re?ee:he);const te=F.text.isHidden();[B.rightJustifiedTextSymbolIndex,B.centerJustifiedTextSymbolIndex,B.leftJustifiedTextSymbolIndex].forEach(Te=>{Te>=0&&(t.text.placedSymbolArray.get(Te).hidden=te||ie?1:0)}),B.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(B.verticalPlacedTextSymbolIndex).hidden=te||re?1:0);const we=this.variableOffsets[B.crossTileID];we&&this.markUsedJustification(t,we.anchor,B,K);const me=this.placedOrientations[B.crossTileID];me&&(this.markUsedJustification(t,"left",B,me),this.markUsedOrientation(t,me,B))}if(J){const he=j(F.icon),te=!(S&&B.verticalPlacedIconSymbolIndex&&ie);B.placedIconSymbolIndex>=0&&(R(t.icon,B.numIconVertices,te?he:ee),t.icon.placedSymbolArray.get(B.placedIconSymbolIndex).hidden=F.icon.isHidden()),B.verticalPlacedIconSymbolIndex>=0&&(R(t.icon,B.numVerticalIconVertices,te?ee:he),t.icon.placedSymbolArray.get(B.verticalPlacedIconSymbolIndex).hidden=F.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const he=t.collisionArrays[L];if(he){let te=new h.pointGeometry(0,0);if(he.textBox||he.verticalTextBox){let me=!0;if(y){const Te=this.variableOffsets[H];Te?(te=Sn(Te.anchor,Te.width,Te.height,Te.textOffset,Te.textBoxScale),v&&te._rotate(T?this.transform.angle:-this.transform.angle)):me=!1}he.textBox&&b(t.textCollisionBox.collisionVertexArray,F.text.placed,!me||ie,te.x,te.y),he.verticalTextBox&&b(t.textCollisionBox.collisionVertexArray,F.text.placed,!me||re,te.x,te.y)}const we=!!(!re&&he.verticalIconBox);he.iconBox&&b(t.iconCollisionBox.collisionVertexArray,F.icon.placed,we,S?te.x:0,S?te.y:0),he.verticalIconBox&&b(t.iconCollisionBox.collisionVertexArray,F.icon.placed,!we,S?te.x:0,S?te.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const L=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=L.invProjMatrix,t.placementViewportMatrix=L.viewportMatrix,t.collisionCircleArray=L.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function b(o,t,n,a,c){o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0)}const I=Math.pow(2,25),M=Math.pow(2,24),D=Math.pow(2,17),V=Math.pow(2,16),G=Math.pow(2,9),$=Math.pow(2,8),N=Math.pow(2,1);function j(o){if(o.opacity===0&&!o.placed)return 0;if(o.opacity===1&&o.placed)return 4294967295;const t=o.placed?1:0,n=Math.floor(127*o.opacity);return n*I+t*M+n*D+t*V+n*G+t*$+n*N+t}const ee=0;class oe{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,c,p){const m=this._bucketParts;for(;this._currentTileIndex_.sortKey-y.sortKey));this._currentPartIndex{const m=h.exported.now()-c;return!this._forceFullPlacement&&m>2};for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new oe(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ie=512/h.EXTENT/2;class be{constructor(t,n,a){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=a;for(let c=0;ct.overscaledZ)for(const _ in m){const y=m[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,c)}else{const _=m[t.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,t,c)}}for(let p=0;p{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}var Xe=h.createLayout([{name:"a_pos",type:"Int16",components:2}]);class qe extends h.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const n=this._tiles[t];n.textures.forEach(a=>a.destroy()),n.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),h.ortho(a.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),this._tiles[a.key]=new Ui(a,this.tileSize))}removeOutdated(t){const n={};this.renderHistory=this.renderHistory.filter((a,c)=>this.renderHistory.indexOf(a)===c).slice(0,this.renderHistorySize);for(const a of this._renderableTilesKeys)n[a]=!0;for(const a of this.renderHistory)n[a]=!0;for(const a in this._tiles)n[a]||(this._tiles[a].clearTextures(t),delete this._tiles[a])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const c=this._tiles[a].tileID;if(c.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),n[a]=p}else if(c.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=c.canonical.z-t.canonical.z,_=c.canonical.x-(c.canonical.x>>m<>m<>m;h.ortho(p.posMatrix,0,v,0,v,0,1),h.translate(p.posMatrix,p.posMatrix,[-_*v,-y*v,0]),n[a]=p}else if(t.canonical.isChildOf(c.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=t.canonical.z-c.canonical.z,_=t.canonical.x-(t.canonical.x>>m<>m<>m;h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),h.translate(p.posMatrix,p.posMatrix,[_*v,y*v,0]),h.scale(p.posMatrix,p.posMatrix,[1/2**m,1/2**m,0]),n[a]=p}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let c=t.overscaledZ-this.deltaZoom;if(c>a.maxzoom&&(c=a.maxzoom),c=a.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(c--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeLoaded>=t)}}class $e{constructor(t,n,a){this.style=t,this.sourceCache=new qe(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.elevationOffset=typeof a.elevationOffset=="number"?a.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,a,c=h.EXTENT){if(!(n>=0&&n=0&&at.canonical.z&&(t.canonical.z>=c?p=t.canonical.z-c:h.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<>p<>8<<4|p>>8,n[m+3]=0;const a=new h.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new vt(t,a,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){const n=new Uint8Array(4),a=this.style.map.painter,c=a.context,p=c.gl;c.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(t.x,a.height/devicePixelRatio-t.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,n),c.bindFramebuffer.set(null);const m=n[0]+(n[2]>>4<<8),_=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],v=y&&this.sourceCache.getTileByID(y);if(!v)return null;const T=this._coordsTextureSize,S=(1<h.emitValidationErrors(o,t&&t.filter(n=>n.identifier!=="source.canvas")),It=h.pick(He,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),wt=h.pick(He,["setCenter","setZoom","setBearing","setPitch"]),At=function(){const o={},t=h.spec.$version;for(const n in h.spec.$root){const a=h.spec.$root[n];if(a.required){let c=null;c=n==="version"?t:a.type==="array"?[]:{},c!=null&&(o[n]=c)}}return o}();class Ot extends h.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new Ki(Wr(),this),this.imageManager=new yn,this.imageManager.setEventedParent(this),this.glyphManager=new Pt(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Zs(256,512),this.crossTileSymbolIndex=new Ne,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",h.getReferrer());const a=this;this._rtlTextPluginCallback=Ot.registerForPluginStateChange(c=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:c.pluginStatus,pluginURL:c.pluginURL},(p,m)=>{if(h.triggerPluginCompletionEvent(p),m&&m.every(_=>_))for(const _ in a.sourceCaches)a.sourceCaches[_].reload()})}),this.on("data",c=>{if(c.dataType!=="source"||c.sourceDataType!=="metadata")return;const p=this.sourceCaches[c.sourceId];if(!p)return;const m=p.getSource();if(m&&m.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===m.id&&this._validateLayer(y)}})}loadURL(t,n={}){this.fire(new h.Event("dataloading",{dataType:"style"}));const a=typeof n.validate!="boolean"||n.validate,c=this.map._requestManager.transformRequest(t,h.ResourceType.Style);this._request=h.getJSON(c,(p,m)=>{this._request=null,p?this.fire(new h.ErrorEvent(p)):m&&this._load(m,a)})}loadJSON(t,n={}){this.fire(new h.Event("dataloading",{dataType:"style"})),this._request=h.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new h.Event("dataloading",{dataType:"style"})),this._load(At,!1)}_load(t,n){if(n&&Ue(this,h.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const c in t.sources)this.addSource(c,t.sources[c],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const a=Hr(this.stylesheet.layers);this._order=a.map(c=>c.id),this._layers={},this._serializedLayers={};for(let c of a)c=h.createStyleLayer(c),c.setEventedParent(this,{layer:{id:c.id}}),this._layers[c.id]=c,this._serializedLayers[c.id]=c.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new gi(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new h.Event("data",{dataType:"style"})),this.fire(new h.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,a,c,p){let m,_,y;const v=c>1?"@2x":"";let T=h.getJSON(a.transformRequest(a.normalizeSpriteURL(n,v,".json"),h.ResourceType.SpriteJSON),(R,L)=>{T=null,y||(y=R,m=L,C())}),S=h.getImage(a.transformRequest(a.normalizeSpriteURL(n,v,".png"),h.ResourceType.SpriteImage),(R,L)=>{S=null,y||(y=R,_=L,C())});function C(){if(y)p(y);else if(m&&_){const R=h.exported.getImageData(_),L={};for(const B in m){const{width:q,height:Z,x:H,y:F,sdf:J,pixelRatio:K,stretchX:ie,stretchY:re,content:he}=m[B],te=new h.RGBAImage({width:q,height:Z});h.RGBAImage.copy(R,te,{x:H,y:F},{x:0,y:0},{width:q,height:Z}),L[B]={data:te,pixelRatio:K,sdf:J,stretchX:ie,stretchY:re,content:he}}p(null,L)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,a)=>{if(this._spriteRequest=null,n)this.fire(new h.ErrorEvent(n));else if(a)for(const c in a)this.imageManager.addImage(c,a[c]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(a)===-1)&&this.fire(new h.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const a of t){const c=this._layers[a];c.type!=="custom"&&n.push(c.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const c=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(c.length||p.length)&&this._updateWorkerLayers(c,p);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const c in this.sourceCaches){const p=this.sourceCaches[c];a[c]=p.used,p.used=!1}for(const c of this._order){const p=this._layers[c];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const c in a){const p=this.sourceCaches[c];a[c]!==p.used&&p.fire(new h.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new h.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const n=this.sourceCaches[t.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new $e(this,n,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=a=>{a.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=a=>{a.tile&&(a.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(a.sourceId,a.tile.tileID)):a.source.type==="geojson"&&this.terrain.rememberForRerender(a.sourceId,a.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new h.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),Ue(this,h.validateStyle(t)))return!1;(t=h.clone$1(t)).layers=Hr(t.layers);const n=function(c,p){if(!c)return[{command:He.setStyle,args:[p]}];let m=[];try{if(!tt(c.version,p.version))return[{command:He.setStyle,args:[p]}];tt(c.center,p.center)||m.push({command:He.setCenter,args:[p.center]}),tt(c.zoom,p.zoom)||m.push({command:He.setZoom,args:[p.zoom]}),tt(c.bearing,p.bearing)||m.push({command:He.setBearing,args:[p.bearing]}),tt(c.pitch,p.pitch)||m.push({command:He.setPitch,args:[p.pitch]}),tt(c.sprite,p.sprite)||m.push({command:He.setSprite,args:[p.sprite]}),tt(c.glyphs,p.glyphs)||m.push({command:He.setGlyphs,args:[p.glyphs]}),tt(c.transition,p.transition)||m.push({command:He.setTransition,args:[p.transition]}),tt(c.light,p.light)||m.push({command:He.setLight,args:[p.light]});const _={},y=[];(function(T,S,C,R){let L;for(L in S=S||{},T=T||{})Object.prototype.hasOwnProperty.call(T,L)&&(Object.prototype.hasOwnProperty.call(S,L)||En(L,C,R));for(L in S)Object.prototype.hasOwnProperty.call(S,L)&&(Object.prototype.hasOwnProperty.call(T,L)?tt(T[L],S[L])||(T[L].type==="geojson"&&S[L].type==="geojson"&&Kr(T,S,L)?C.push({command:He.setGeoJSONSourceData,args:[L,S[L].data]}):dr(L,S,C,R)):Ii(L,S,C))})(c.sources,p.sources,y,_);const v=[];c.layers&&c.layers.forEach(T=>{_[T.source]?m.push({command:He.removeLayer,args:[T.id]}):v.push(T)}),m=m.concat(y),function(T,S,C){S=S||[];const R=(T=T||[]).map(mr),L=S.map(mr),B=T.reduce(Jr,{}),q=S.reduce(Jr,{}),Z=R.slice(),H=Object.create(null);let F,J,K,ie,re,he,te;for(F=0,J=0;F!(c.command in wt));if(n.length===0)return!1;const a=n.filter(c=>!(c.command in It));if(a.length>0)throw new Error(`Unimplemented: ${a.map(c=>c.command).join(", ")}.`);return n.forEach(c=>{c.command!=="setTransition"&&this[c.command].apply(this,c.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(h.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.sourceCaches[t]=new ai(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:c.serialize(),sourceId:t})),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new h.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new h.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new h.ErrorEvent(new Error(`Layer "${c}" already exists on this map.`)));let p;if(t.type==="custom"){if(Ue(this,h.validateCustomStyleLayer(t)))return;p=h.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(c,t.source),t=h.clone$1(t),t=h.extend(t,{source:c})),this._validate(h.validateStyle.layer,`layers.${c}`,t,{arrayIndex:-1},a))return;p=h.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:c}}),this._serializedLayers[p.id]=p.serialize()}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new h.ErrorEvent(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,c),this._layerOrderChanged=!0,this._layers[c]=p,this._removedLayers[c]&&p.source&&p.type!=="custom"){const _=this._removedLayers[c];delete this._removedLayers[c],_.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new h.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new h.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new h.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===a||(n!=null&&(c.minzoom=n),a!=null&&(c.maxzoom=a),this._updateLayer(c)):this.fire(new h.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!tt(c.filter,n))return n==null?(c.filter=void 0,void this._updateLayer(c)):void(this._validate(h.validateStyle.filter,`layers.${c.id}.filter`,n,null,a)||(c.filter=h.clone$1(n),this._updateLayer(c)))}else this.fire(new h.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return h.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?tt(p.getLayoutProperty(n),a)||(p.setLayoutProperty(n,a,c),this._updateLayer(p)):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new h.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?tt(p.getPaintProperty(n),a)||(p.setPaintProperty(n,a,c)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,c=t.sourceLayer,p=this.sourceCaches[a];if(p===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&c?this.fire(new h.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||c?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(c,t.id,n)):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const p=c.getSource().type,m=p==="vector"?t.sourceLayer:void 0;p!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new h.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(m,t.id,n):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,c=this.sourceCaches[n];if(c!==void 0)return c.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),c.getFeatureState(a,t.id)):void this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return h.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return h.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:h.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},c=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){a[_]=m;for(const y of t){const v=y[_];if(v)for(const T of v)c.push(T)}}}c.sort((m,_)=>_.intersectionZ-m.intersectionZ);const p=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_))for(let y=c.length-1;y>=0;y--){const v=c[y].feature;if(a[v.layer.id]{const re=q.featureSortOrder;if(re){const he=re.indexOf(K.featureIndex);return re.indexOf(ie.featureIndex)-he}return ie.featureIndex-K.featureIndex});for(const K of J)F.push(K)}}for(const q in R)R[q].forEach(Z=>{const H=Z.feature,F=y[m[q].source].getFeatureState(H.layer["source-layer"],H.id);H.source=H.layer.source,H.layer["source-layer"]&&(H.sourceLayer=H.layer["source-layer"]),H.state=F});return R}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(h.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(c,p){const m=c.getRenderableIds().map(v=>c.getTileByID(v)),_=[],y={};for(let v=0;vC.getTileByID(R)).sort((R,L)=>L.tileID.overscaledZ-R.tileID.overscaledZ||(R.tileID.isLessThan(L.tileID)?-1:1))}const S=this.crossTileSymbolIndex.addLayer(T,y[T.source],t.center.lng);m=m||S}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(h.exported.now(),t.zoom))&&(this.pauseablePlacement=new se(t,this.terrain,this._order,p,n,a,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(h.exported.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const v of this._order){const T=this._layers[v];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(h.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a)}getResource(t,n,a){return h.makeRequest(n,a)}}Ot.getSourceType=function(o){return Zr[o]},Ot.setSourceType=function(o,t){Zr[o]=t},Ot.registerForPluginStateChange=h.registerForPluginStateChange;var js="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const An={prelude:rt(`#ifdef GL_ES precision mediump float; #else diff --git a/index.html b/index.html index 84e2e19..70671c2 100644 --- a/index.html +++ b/index.html @@ -28,8 +28,8 @@ } })() - - + +