@opengis/partsmap 0.0.103 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3545 -0
- package/index.umd.cjs +1 -0
- package/package.json +4 -39
- package/style.css +1 -0
- package/dist/PartsMap.js +0 -25344
- package/dist/PartsMap.umd.cjs +0 -590
- package/dist/style.css +0 -1
package/dist/PartsMap.umd.cjs
DELETED
@@ -1,590 +0,0 @@
|
|
1
|
-
(function(c,g){typeof exports=="object"&&typeof module<"u"?module.exports=g(require("vue")):typeof define=="function"&&define.amd?define(["vue"],g):(c=typeof globalThis<"u"?globalThis:c||self,c.PartsMap=g(c.Vue))})(this,function(vue){"use strict";const nn={class:"flex items-center w-full rounded-lg group hover:bg-gray-100"},rn={class:"flex items-center justify-between w-full text-sm"},on={class:"flex items-center cursor-pointer w-full"},ln={key:0,width:"16",height:"auto",src:"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTYgMTYnIGZpbGw9J3doaXRlJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPjxwYXRoIGQ9J00xMi4yMDcgNC43OTNhMSAxIDAgMDEwIDEuNDE0bC01IDVhMSAxIDAgMDEtMS40MTQgMGwtMi0yYTEgMSAwIDAxMS40MTQtMS40MTRMNi41IDkuMDg2bDQuMjkzLTQuMjkzYTEgMSAwIDAxMS40MTQgMHonLz48L3N2Zz4="},sn=["value"],an={class:"w-[calc(100%-18px)] flex flex-row items-center justify-between pl-[10px]"},un={class:"flex flex-row items-center font-normal text-gray-800 gap-x-1"},cn={key:0,class:"text-xs text-gray-500 dark:text-neutral-500 pr-1"},xt=vue.defineComponent({__name:"list-item",props:{layout:{},count:{},type:{},label:{},value:{},isSelected:{type:Boolean},color:{}},emits:["itemClick"],setup(c,{emit:g}){const x=c,v=g;function T(){v("itemClick",x.value)}return(B,S)=>(vue.openBlock(),vue.createElementBlock("div",nn,[vue.createElementVNode("div",rn,[vue.createElementVNode("div",on,[vue.createElementVNode("label",{for:"radio-9740",class:vue.normalizeClass(["inline","popover"].includes(B.layout)?"text-sm text-gray-500 px-2 w-full py-2 cursor-pointer !flex flex-row items-center":"flex flex-row items-center w-full px-2 py-2 text-sm text-gray-500 cursor-pointer"),onClick:vue.withModifiers(T,["stop","prevent"])},[vue.createElementVNode("div",{class:vue.normalizeClass(["w-[18px] h-[18px] border rounded-[4px] flex items-center justify-center",[B.type==="checkbox"?"rounded-[4px]":"rounded-full",B.color?`bg-[${B.color}] border-[#ffffff]`:B.isSelected?"bg-[#2563eb] border-[#ffffff]":"bg-[#ffffff] border-[#d9d9d9]"]])},[B.isSelected?(vue.openBlock(),vue.createElementBlock("img",ln)):vue.createCommentVNode("",!0)],2),vue.createElementVNode("input",{type:"checkbox",class:"hidden",id:"radio-9740",value:B.value},null,8,sn),vue.createElementVNode("div",an,[vue.createElementVNode("span",un,vue.toDisplayString(B.label??"Відсутні данні"),1),B.count?(vue.openBlock(),vue.createElementBlock("div",cn," ("+vue.toDisplayString(B.count)+") ",1)):vue.createCommentVNode("",!0)])],2)])])]))}});function wt(c,g){return function(){return c.apply(g,arguments)}}const{toString:dn}=Object.prototype,{getPrototypeOf:Je}=Object,{iterator:_e,toStringTag:kt}=Symbol,Ae=(c=>g=>{const x=dn.call(g);return c[x]||(c[x]=x.slice(8,-1).toLowerCase())})(Object.create(null)),Q=c=>(c=c.toLowerCase(),g=>Ae(g)===c),Oe=c=>g=>typeof g===c,{isArray:fe}=Array,ye=Oe("undefined");function ge(c){return c!==null&&!ye(c)&&c.constructor!==null&&!ye(c.constructor)&&K(c.constructor.isBuffer)&&c.constructor.isBuffer(c)}const Ct=Q("ArrayBuffer");function fn(c){let g;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?g=ArrayBuffer.isView(c):g=c&&c.buffer&&Ct(c.buffer),g}const pn=Oe("string"),K=Oe("function"),Rt=Oe("number"),be=c=>c!==null&&typeof c=="object",mn=c=>c===!0||c===!1,we=c=>{if(Ae(c)!=="object")return!1;const g=Je(c);return(g===null||g===Object.prototype||Object.getPrototypeOf(g)===null)&&!(kt in c)&&!(_e in c)},hn=c=>{if(!be(c)||ge(c))return!1;try{return Object.keys(c).length===0&&Object.getPrototypeOf(c)===Object.prototype}catch{return!1}},yn=Q("Date"),gn=Q("File"),bn=Q("Blob"),vn=Q("FileList"),xn=c=>be(c)&&K(c.pipe),wn=c=>{let g;return c&&(typeof FormData=="function"&&c instanceof FormData||K(c.append)&&((g=Ae(c))==="formdata"||g==="object"&&K(c.toString)&&c.toString()==="[object FormData]"))},kn=Q("URLSearchParams"),[Cn,Rn,Sn,En]=["ReadableStream","Request","Response","Headers"].map(Q),_n=c=>c.trim?c.trim():c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ve(c,g,{allOwnKeys:x=!1}={}){if(c===null||typeof c>"u")return;let v,T;if(typeof c!="object"&&(c=[c]),fe(c))for(v=0,T=c.length;v<T;v++)g.call(null,c[v],v,c);else{if(ge(c))return;const B=x?Object.getOwnPropertyNames(c):Object.keys(c),S=B.length;let u;for(v=0;v<S;v++)u=B[v],g.call(null,c[u],u,c)}}function St(c,g){if(ge(c))return null;g=g.toLowerCase();const x=Object.keys(c);let v=x.length,T;for(;v-- >0;)if(T=x[v],g===T.toLowerCase())return T;return null}const le=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Et=c=>!ye(c)&&c!==le;function Me(){const{caseless:c}=Et(this)&&this||{},g={},x=(v,T)=>{const B=c&&St(g,T)||T;we(g[B])&&we(v)?g[B]=Me(g[B],v):we(v)?g[B]=Me({},v):fe(v)?g[B]=v.slice():g[B]=v};for(let v=0,T=arguments.length;v<T;v++)arguments[v]&&ve(arguments[v],x);return g}const An=(c,g,x,{allOwnKeys:v}={})=>(ve(g,(T,B)=>{x&&K(T)?c[B]=wt(T,x):c[B]=T},{allOwnKeys:v}),c),On=c=>(c.charCodeAt(0)===65279&&(c=c.slice(1)),c),Tn=(c,g,x,v)=>{c.prototype=Object.create(g.prototype,v),c.prototype.constructor=c,Object.defineProperty(c,"super",{value:g.prototype}),x&&Object.assign(c.prototype,x)},Vn=(c,g,x,v)=>{let T,B,S;const u={};if(g=g||{},c==null)return g;do{for(T=Object.getOwnPropertyNames(c),B=T.length;B-- >0;)S=T[B],(!v||v(S,c,g))&&!u[S]&&(g[S]=c[S],u[S]=!0);c=x!==!1&&Je(c)}while(c&&(!x||x(c,g))&&c!==Object.prototype);return g},Bn=(c,g,x)=>{c=String(c),(x===void 0||x>c.length)&&(x=c.length),x-=g.length;const v=c.indexOf(g,x);return v!==-1&&v===x},$n=c=>{if(!c)return null;if(fe(c))return c;let g=c.length;if(!Rt(g))return null;const x=new Array(g);for(;g-- >0;)x[g]=c[g];return x},Dn=(c=>g=>c&&g instanceof c)(typeof Uint8Array<"u"&&Je(Uint8Array)),Fn=(c,g)=>{const x=(c&&c[_e]).call(c);let v;for(;(v=x.next())&&!v.done;){const T=v.value;g.call(c,T[0],T[1])}},Nn=(c,g)=>{let x;const v=[];for(;(x=c.exec(g))!==null;)v.push(x);return v},Mn=Q("HTMLFormElement"),Ln=c=>c.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(g,x,v){return x.toUpperCase()+v}),et=(({hasOwnProperty:c})=>(g,x)=>c.call(g,x))(Object.prototype),jn=Q("RegExp"),_t=(c,g)=>{const x=Object.getOwnPropertyDescriptors(c),v={};ve(x,(T,B)=>{let S;(S=g(T,B,c))!==!1&&(v[B]=S||T)}),Object.defineProperties(c,v)},Un=c=>{_t(c,(g,x)=>{if(K(c)&&["arguments","caller","callee"].indexOf(x)!==-1)return!1;const v=c[x];if(K(v)){if(g.enumerable=!1,"writable"in g){g.writable=!1;return}g.set||(g.set=()=>{throw Error("Can not rewrite read-only method '"+x+"'")})}})},Pn=(c,g)=>{const x={},v=T=>{T.forEach(B=>{x[B]=!0})};return fe(c)?v(c):v(String(c).split(g)),x},In=()=>{},qn=(c,g)=>c!=null&&Number.isFinite(c=+c)?c:g;function Hn(c){return!!(c&&K(c.append)&&c[kt]==="FormData"&&c[_e])}const zn=c=>{const g=new Array(10),x=(v,T)=>{if(be(v)){if(g.indexOf(v)>=0)return;if(ge(v))return v;if(!("toJSON"in v)){g[T]=v;const B=fe(v)?[]:{};return ve(v,(S,u)=>{const J=x(S,T+1);!ye(J)&&(B[u]=J)}),g[T]=void 0,B}}return v};return x(c,0)},Kn=Q("AsyncFunction"),Wn=c=>c&&(be(c)||K(c))&&K(c.then)&&K(c.catch),At=((c,g)=>c?setImmediate:g?((x,v)=>(le.addEventListener("message",({source:T,data:B})=>{T===le&&B===x&&v.length&&v.shift()()},!1),T=>{v.push(T),le.postMessage(x,"*")}))(`axios@${Math.random()}`,[]):x=>setTimeout(x))(typeof setImmediate=="function",K(le.postMessage)),Jn=typeof queueMicrotask<"u"?queueMicrotask.bind(le):typeof process<"u"&&process.nextTick||At,Yn=c=>c!=null&&K(c[_e]),m={isArray:fe,isArrayBuffer:Ct,isBuffer:ge,isFormData:wn,isArrayBufferView:fn,isString:pn,isNumber:Rt,isBoolean:mn,isObject:be,isPlainObject:we,isEmptyObject:hn,isReadableStream:Cn,isRequest:Rn,isResponse:Sn,isHeaders:En,isUndefined:ye,isDate:yn,isFile:gn,isBlob:bn,isRegExp:jn,isFunction:K,isStream:xn,isURLSearchParams:kn,isTypedArray:Dn,isFileList:vn,forEach:ve,merge:Me,extend:An,trim:_n,stripBOM:On,inherits:Tn,toFlatObject:Vn,kindOf:Ae,kindOfTest:Q,endsWith:Bn,toArray:$n,forEachEntry:Fn,matchAll:Nn,isHTMLForm:Mn,hasOwnProperty:et,hasOwnProp:et,reduceDescriptors:_t,freezeMethods:Un,toObjectSet:Pn,toCamelCase:Ln,noop:In,toFiniteNumber:qn,findKey:St,global:le,isContextDefined:Et,isSpecCompliantForm:Hn,toJSONObject:zn,isAsyncFn:Kn,isThenable:Wn,setImmediate:At,asap:Jn,isIterable:Yn};function A(c,g,x,v,T){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=c,this.name="AxiosError",g&&(this.code=g),x&&(this.config=x),v&&(this.request=v),T&&(this.response=T,this.status=T.status?T.status:null)}m.inherits(A,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:m.toJSONObject(this.config),code:this.code,status:this.status}}});const Ot=A.prototype,Tt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(c=>{Tt[c]={value:c}}),Object.defineProperties(A,Tt),Object.defineProperty(Ot,"isAxiosError",{value:!0}),A.from=(c,g,x,v,T,B)=>{const S=Object.create(Ot);return m.toFlatObject(c,S,function(u){return u!==Error.prototype},u=>u!=="isAxiosError"),A.call(S,c.message,g,x,v,T),S.cause=c,S.name=c.name,B&&Object.assign(S,B),S};const Qn=null;function Le(c){return m.isPlainObject(c)||m.isArray(c)}function Vt(c){return m.endsWith(c,"[]")?c.slice(0,-2):c}function tt(c,g,x){return c?c.concat(g).map(function(v,T){return v=Vt(v),!x&&T?"["+v+"]":v}).join(x?".":""):g}function Gn(c){return m.isArray(c)&&!c.some(Le)}const Xn=m.toFlatObject(m,{},null,function(c){return/^is[A-Z]/.test(c)});function Te(c,g,x){if(!m.isObject(c))throw new TypeError("target must be an object");g=g||new FormData,x=m.toFlatObject(x,{metaTokens:!0,dots:!1,indexes:!1},!1,function(oi,li){return!m.isUndefined(li[oi])});const v=x.metaTokens,T=x.visitor||te,B=x.dots,S=x.indexes,u=(x.Blob||typeof Blob<"u"&&Blob)&&m.isSpecCompliantForm(g);if(!m.isFunction(T))throw new TypeError("visitor must be a function");function J(oi){if(oi===null)return"";if(m.isDate(oi))return oi.toISOString();if(m.isBoolean(oi))return oi.toString();if(!u&&m.isBlob(oi))throw new A("Blob is not supported. Use a Buffer instead.");return m.isArrayBuffer(oi)||m.isTypedArray(oi)?u&&typeof Blob=="function"?new Blob([oi]):Buffer.from(oi):oi}function te(oi,li,bt){let mi=oi;if(oi&&!bt&&typeof oi=="object"){if(m.endsWith(li,"{}"))li=v?li:li.slice(0,-2),oi=JSON.stringify(oi);else if(m.isArray(oi)&&Gn(oi)||(m.isFileList(oi)||m.endsWith(li,"[]"))&&(mi=m.toArray(oi)))return li=Vt(li),mi.forEach(function(Ii,pi){!(m.isUndefined(Ii)||Ii===null)&&g.append(S===!0?tt([li],pi,B):S===null?li:li+"[]",J(Ii))}),!1}return Le(oi)?!0:(g.append(tt(bt,li,B),J(oi)),!1)}const ae=[],H=Object.assign(Xn,{defaultVisitor:te,convertValue:J,isVisitable:Le});function Y(oi,li){if(!m.isUndefined(oi)){if(ae.indexOf(oi)!==-1)throw Error("Circular reference detected in "+li.join("."));ae.push(oi),m.forEach(oi,function(bt,mi){(!(m.isUndefined(bt)||bt===null)&&T.call(g,bt,m.isString(mi)?mi.trim():mi,li,H))===!0&&Y(bt,li?li.concat(mi):[mi])}),ae.pop()}}if(!m.isObject(c))throw new TypeError("data must be an object");return Y(c),g}function nt(c){const g={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(c).replace(/[!'()~]|%20|%00/g,function(x){return g[x]})}function Ye(c,g){this._pairs=[],c&&Te(c,this,g)}const Bt=Ye.prototype;Bt.append=function(c,g){this._pairs.push([c,g])},Bt.toString=function(c){const g=c?function(x){return c.call(this,x,nt)}:nt;return this._pairs.map(function(x){return g(x[0])+"="+g(x[1])},"").join("&")};function Zn(c){return encodeURIComponent(c).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $t(c,g,x){if(!g)return c;const v=x&&x.encode||Zn;m.isFunction(x)&&(x={serialize:x});const T=x&&x.serialize;let B;if(T?B=T(g,x):B=m.isURLSearchParams(g)?g.toString():new Ye(g,x).toString(v),B){const S=c.indexOf("#");S!==-1&&(c=c.slice(0,S)),c+=(c.indexOf("?")===-1?"?":"&")+B}return c}class rt{constructor(){this.handlers=[]}use(g,x,v){return this.handlers.push({fulfilled:g,rejected:x,synchronous:v?v.synchronous:!1,runWhen:v?v.runWhen:null}),this.handlers.length-1}eject(g){this.handlers[g]&&(this.handlers[g]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(g){m.forEach(this.handlers,function(x){x!==null&&g(x)})}}const Dt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},er=typeof URLSearchParams<"u"?URLSearchParams:Ye,tr=typeof FormData<"u"?FormData:null,nr=typeof Blob<"u"?Blob:null,rr={isBrowser:!0,classes:{URLSearchParams:er,FormData:tr,Blob:nr},protocols:["http","https","file","blob","url","data"]},Qe=typeof window<"u"&&typeof document<"u",je=typeof navigator=="object"&&navigator||void 0,or=Qe&&(!je||["ReactNative","NativeScript","NS"].indexOf(je.product)<0),lr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",sr=Qe&&window.location.href||"http://localhost",ar=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Qe,hasStandardBrowserEnv:or,hasStandardBrowserWebWorkerEnv:lr,navigator:je,origin:sr},Symbol.toStringTag,{value:"Module"})),P={...ar,...rr};function ir(c,g){return Te(c,new P.classes.URLSearchParams,{visitor:function(x,v,T,B){return P.isNode&&m.isBuffer(x)?(this.append(v,x.toString("base64")),!1):B.defaultVisitor.apply(this,arguments)},...g})}function ur(c){return m.matchAll(/\w+|\[(\w*)]/g,c).map(g=>g[0]==="[]"?"":g[1]||g[0])}function cr(c){const g={},x=Object.keys(c);let v;const T=x.length;let B;for(v=0;v<T;v++)B=x[v],g[B]=c[B];return g}function Ft(c){function g(x,v,T,B){let S=x[B++];if(S==="__proto__")return!0;const u=Number.isFinite(+S),J=B>=x.length;return S=!S&&m.isArray(T)?T.length:S,J?(m.hasOwnProp(T,S)?T[S]=[T[S],v]:T[S]=v,!u):((!T[S]||!m.isObject(T[S]))&&(T[S]=[]),g(x,v,T[S],B)&&m.isArray(T[S])&&(T[S]=cr(T[S])),!u)}if(m.isFormData(c)&&m.isFunction(c.entries)){const x={};return m.forEachEntry(c,(v,T)=>{g(ur(v),T,x,0)}),x}return null}function dr(c,g,x){if(m.isString(c))try{return(g||JSON.parse)(c),m.trim(c)}catch(v){if(v.name!=="SyntaxError")throw v}return(0,JSON.stringify)(c)}const xe={transitional:Dt,adapter:["xhr","http","fetch"],transformRequest:[function(c,g){const x=g.getContentType()||"",v=x.indexOf("application/json")>-1,T=m.isObject(c);if(T&&m.isHTMLForm(c)&&(c=new FormData(c)),m.isFormData(c))return v?JSON.stringify(Ft(c)):c;if(m.isArrayBuffer(c)||m.isBuffer(c)||m.isStream(c)||m.isFile(c)||m.isBlob(c)||m.isReadableStream(c))return c;if(m.isArrayBufferView(c))return c.buffer;if(m.isURLSearchParams(c))return g.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),c.toString();let B;if(T){if(x.indexOf("application/x-www-form-urlencoded")>-1)return ir(c,this.formSerializer).toString();if((B=m.isFileList(c))||x.indexOf("multipart/form-data")>-1){const S=this.env&&this.env.FormData;return Te(B?{"files[]":c}:c,S&&new S,this.formSerializer)}}return T||v?(g.setContentType("application/json",!1),dr(c)):c}],transformResponse:[function(c){const g=this.transitional||xe.transitional,x=g&&g.forcedJSONParsing,v=this.responseType==="json";if(m.isResponse(c)||m.isReadableStream(c))return c;if(c&&m.isString(c)&&(x&&!this.responseType||v)){const T=!(g&&g.silentJSONParsing)&&v;try{return JSON.parse(c)}catch(B){if(T)throw B.name==="SyntaxError"?A.from(B,A.ERR_BAD_RESPONSE,this,null,this.response):B}}return c}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(c){return c>=200&&c<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};m.forEach(["delete","get","head","post","put","patch"],c=>{xe.headers[c]={}});const fr=m.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),pr=c=>{const g={};let x,v,T;return c&&c.split(`
|
2
|
-
`).forEach(function(B){T=B.indexOf(":"),x=B.substring(0,T).trim().toLowerCase(),v=B.substring(T+1).trim(),!(!x||g[x]&&fr[x])&&(x==="set-cookie"?g[x]?g[x].push(v):g[x]=[v]:g[x]=g[x]?g[x]+", "+v:v)}),g},ot=Symbol("internals");function me(c){return c&&String(c).trim().toLowerCase()}function ke(c){return c===!1||c==null?c:m.isArray(c)?c.map(ke):String(c)}function mr(c){const g=Object.create(null),x=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let v;for(;v=x.exec(c);)g[v[1]]=v[2];return g}const hr=c=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(c.trim());function De(c,g,x,v,T){if(m.isFunction(v))return v.call(this,g,x);if(T&&(g=x),!!m.isString(g)){if(m.isString(v))return g.indexOf(v)!==-1;if(m.isRegExp(v))return v.test(g)}}function yr(c){return c.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(g,x,v)=>x.toUpperCase()+v)}function gr(c,g){const x=m.toCamelCase(" "+g);["get","set","has"].forEach(v=>{Object.defineProperty(c,v+x,{value:function(T,B,S){return this[v].call(this,g,T,B,S)},configurable:!0})})}let W=class{constructor(c){c&&this.set(c)}set(c,g,x){const v=this;function T(S,u,J){const te=me(u);if(!te)throw new Error("header name must be a non-empty string");const ae=m.findKey(v,te);(!ae||v[ae]===void 0||J===!0||J===void 0&&v[ae]!==!1)&&(v[ae||u]=ke(S))}const B=(S,u)=>m.forEach(S,(J,te)=>T(J,te,u));if(m.isPlainObject(c)||c instanceof this.constructor)B(c,g);else if(m.isString(c)&&(c=c.trim())&&!hr(c))B(pr(c),g);else if(m.isObject(c)&&m.isIterable(c)){let S={},u,J;for(const te of c){if(!m.isArray(te))throw TypeError("Object iterator must return a key-value pair");S[J=te[0]]=(u=S[J])?m.isArray(u)?[...u,te[1]]:[u,te[1]]:te[1]}B(S,g)}else c!=null&&T(g,c,x);return this}get(c,g){if(c=me(c),c){const x=m.findKey(this,c);if(x){const v=this[x];if(!g)return v;if(g===!0)return mr(v);if(m.isFunction(g))return g.call(this,v,x);if(m.isRegExp(g))return g.exec(v);throw new TypeError("parser must be boolean|regexp|function")}}}has(c,g){if(c=me(c),c){const x=m.findKey(this,c);return!!(x&&this[x]!==void 0&&(!g||De(this,this[x],x,g)))}return!1}delete(c,g){const x=this;let v=!1;function T(B){if(B=me(B),B){const S=m.findKey(x,B);S&&(!g||De(x,x[S],S,g))&&(delete x[S],v=!0)}}return m.isArray(c)?c.forEach(T):T(c),v}clear(c){const g=Object.keys(this);let x=g.length,v=!1;for(;x--;){const T=g[x];(!c||De(this,this[T],T,c,!0))&&(delete this[T],v=!0)}return v}normalize(c){const g=this,x={};return m.forEach(this,(v,T)=>{const B=m.findKey(x,T);if(B){g[B]=ke(v),delete g[T];return}const S=c?yr(T):String(T).trim();S!==T&&delete g[T],g[S]=ke(v),x[S]=!0}),this}concat(...c){return this.constructor.concat(this,...c)}toJSON(c){const g=Object.create(null);return m.forEach(this,(x,v)=>{x!=null&&x!==!1&&(g[v]=c&&m.isArray(x)?x.join(", "):x)}),g}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([c,g])=>c+": "+g).join(`
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(c){return c instanceof this?c:new this(c)}static concat(c,...g){const x=new this(c);return g.forEach(v=>x.set(v)),x}static accessor(c){const g=(this[ot]=this[ot]={accessors:{}}).accessors,x=this.prototype;function v(T){const B=me(T);g[B]||(gr(x,T),g[B]=!0)}return m.isArray(c)?c.forEach(v):v(c),this}};W.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),m.reduceDescriptors(W.prototype,({value:c},g)=>{let x=g[0].toUpperCase()+g.slice(1);return{get:()=>c,set(v){this[x]=v}}}),m.freezeMethods(W);function Fe(c,g){const x=this||xe,v=g||x,T=W.from(v.headers);let B=v.data;return m.forEach(c,function(S){B=S.call(x,B,T.normalize(),g?g.status:void 0)}),T.normalize(),B}function Nt(c){return!!(c&&c.__CANCEL__)}function pe(c,g,x){A.call(this,c??"canceled",A.ERR_CANCELED,g,x),this.name="CanceledError"}m.inherits(pe,A,{__CANCEL__:!0});function Mt(c,g,x){const v=x.config.validateStatus;!x.status||!v||v(x.status)?c(x):g(new A("Request failed with status code "+x.status,[A.ERR_BAD_REQUEST,A.ERR_BAD_RESPONSE][Math.floor(x.status/100)-4],x.config,x.request,x))}function br(c){const g=/^([-+\w]{1,25})(:?\/\/|:)/.exec(c);return g&&g[1]||""}function vr(c,g){c=c||10;const x=new Array(c),v=new Array(c);let T=0,B=0,S;return g=g!==void 0?g:1e3,function(u){const J=Date.now(),te=v[B];S||(S=J),x[T]=u,v[T]=J;let ae=B,H=0;for(;ae!==T;)H+=x[ae++],ae=ae%c;if(T=(T+1)%c,T===B&&(B=(B+1)%c),J-S<g)return;const Y=te&&J-te;return Y?Math.round(H*1e3/Y):void 0}}function xr(c,g){let x=0,v=1e3/g,T,B;const S=(u,J=Date.now())=>{x=J,T=null,B&&(clearTimeout(B),B=null),c(...u)};return[(...u)=>{const J=Date.now(),te=J-x;te>=v?S(u,J):(T=u,B||(B=setTimeout(()=>{B=null,S(T)},v-te)))},()=>T&&S(T)]}const Se=(c,g,x=3)=>{let v=0;const T=vr(50,250);return xr(B=>{const S=B.loaded,u=B.lengthComputable?B.total:void 0,J=S-v,te=T(J),ae=S<=u;v=S;const H={loaded:S,total:u,progress:u?S/u:void 0,bytes:J,rate:te||void 0,estimated:te&&u&&ae?(u-S)/te:void 0,event:B,lengthComputable:u!=null,[g?"download":"upload"]:!0};c(H)},x)},lt=(c,g)=>{const x=c!=null;return[v=>g[0]({lengthComputable:x,total:c,loaded:v}),g[1]]},st=c=>(...g)=>m.asap(()=>c(...g)),wr=P.hasStandardBrowserEnv?((c,g)=>x=>(x=new URL(x,P.origin),c.protocol===x.protocol&&c.host===x.host&&(g||c.port===x.port)))(new URL(P.origin),P.navigator&&/(msie|trident)/i.test(P.navigator.userAgent)):()=>!0,kr=P.hasStandardBrowserEnv?{write(c,g,x,v,T,B){const S=[c+"="+encodeURIComponent(g)];m.isNumber(x)&&S.push("expires="+new Date(x).toGMTString()),m.isString(v)&&S.push("path="+v),m.isString(T)&&S.push("domain="+T),B===!0&&S.push("secure"),document.cookie=S.join("; ")},read(c){const g=document.cookie.match(new RegExp("(^|;\\s*)("+c+")=([^;]*)"));return g?decodeURIComponent(g[3]):null},remove(c){this.write(c,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Cr(c){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(c)}function Rr(c,g){return g?c.replace(/\/?\/$/,"")+"/"+g.replace(/^\/+/,""):c}function Lt(c,g,x){let v=!Cr(g);return c&&(v||x==!1)?Rr(c,g):g}const at=c=>c instanceof W?{...c}:c;function ue(c,g){g=g||{};const x={};function v(te,ae,H,Y){return m.isPlainObject(te)&&m.isPlainObject(ae)?m.merge.call({caseless:Y},te,ae):m.isPlainObject(ae)?m.merge({},ae):m.isArray(ae)?ae.slice():ae}function T(te,ae,H,Y){if(m.isUndefined(ae)){if(!m.isUndefined(te))return v(void 0,te,H,Y)}else return v(te,ae,H,Y)}function B(te,ae){if(!m.isUndefined(ae))return v(void 0,ae)}function S(te,ae){if(m.isUndefined(ae)){if(!m.isUndefined(te))return v(void 0,te)}else return v(void 0,ae)}function u(te,ae,H){if(H in g)return v(te,ae);if(H in c)return v(void 0,te)}const J={url:B,method:B,data:B,baseURL:S,transformRequest:S,transformResponse:S,paramsSerializer:S,timeout:S,timeoutMessage:S,withCredentials:S,withXSRFToken:S,adapter:S,responseType:S,xsrfCookieName:S,xsrfHeaderName:S,onUploadProgress:S,onDownloadProgress:S,decompress:S,maxContentLength:S,maxBodyLength:S,beforeRedirect:S,transport:S,httpAgent:S,httpsAgent:S,cancelToken:S,socketPath:S,responseEncoding:S,validateStatus:u,headers:(te,ae,H)=>T(at(te),at(ae),H,!0)};return m.forEach(Object.keys({...c,...g}),function(te){const ae=J[te]||T,H=ae(c[te],g[te],te);m.isUndefined(H)&&ae!==u||(x[te]=H)}),x}const jt=c=>{const g=ue({},c);let{data:x,withXSRFToken:v,xsrfHeaderName:T,xsrfCookieName:B,headers:S,auth:u}=g;g.headers=S=W.from(S),g.url=$t(Lt(g.baseURL,g.url,g.allowAbsoluteUrls),c.params,c.paramsSerializer),u&&S.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):"")));let J;if(m.isFormData(x)){if(P.hasStandardBrowserEnv||P.hasStandardBrowserWebWorkerEnv)S.setContentType(void 0);else if((J=S.getContentType())!==!1){const[te,...ae]=J?J.split(";").map(H=>H.trim()).filter(Boolean):[];S.setContentType([te||"multipart/form-data",...ae].join("; "))}}if(P.hasStandardBrowserEnv&&(v&&m.isFunction(v)&&(v=v(g)),v||v!==!1&&wr(g.url))){const te=T&&B&&kr.read(B);te&&S.set(T,te)}return g},Sr=typeof XMLHttpRequest<"u",Er=Sr&&function(c){return new Promise(function(g,x){const v=jt(c);let T=v.data;const B=W.from(v.headers).normalize();let{responseType:S,onUploadProgress:u,onDownloadProgress:J}=v,te,ae,H,Y,oi;function li(){Y&&Y(),oi&&oi(),v.cancelToken&&v.cancelToken.unsubscribe(te),v.signal&&v.signal.removeEventListener("abort",te)}let bt=new XMLHttpRequest;bt.open(v.method.toUpperCase(),v.url,!0),bt.timeout=v.timeout;function mi(){if(!bt)return;const pi=W.from("getAllResponseHeaders"in bt&&bt.getAllResponseHeaders()),si={data:!S||S==="text"||S==="json"?bt.responseText:bt.response,status:bt.status,statusText:bt.statusText,headers:pi,config:c,request:bt};Mt(function(ci){g(ci),li()},function(ci){x(ci),li()},si),bt=null}"onloadend"in bt?bt.onloadend=mi:bt.onreadystatechange=function(){!bt||bt.readyState!==4||bt.status===0&&!(bt.responseURL&&bt.responseURL.indexOf("file:")===0)||setTimeout(mi)},bt.onabort=function(){bt&&(x(new A("Request aborted",A.ECONNABORTED,c,bt)),bt=null)},bt.onerror=function(){x(new A("Network Error",A.ERR_NETWORK,c,bt)),bt=null},bt.ontimeout=function(){let pi=v.timeout?"timeout of "+v.timeout+"ms exceeded":"timeout exceeded";const si=v.transitional||Dt;v.timeoutErrorMessage&&(pi=v.timeoutErrorMessage),x(new A(pi,si.clarifyTimeoutError?A.ETIMEDOUT:A.ECONNABORTED,c,bt)),bt=null},T===void 0&&B.setContentType(null),"setRequestHeader"in bt&&m.forEach(B.toJSON(),function(pi,si){bt.setRequestHeader(si,pi)}),m.isUndefined(v.withCredentials)||(bt.withCredentials=!!v.withCredentials),S&&S!=="json"&&(bt.responseType=v.responseType),J&&([H,oi]=Se(J,!0),bt.addEventListener("progress",H)),u&&bt.upload&&([ae,Y]=Se(u),bt.upload.addEventListener("progress",ae),bt.upload.addEventListener("loadend",Y)),(v.cancelToken||v.signal)&&(te=pi=>{bt&&(x(!pi||pi.type?new pe(null,c,bt):pi),bt.abort(),bt=null)},v.cancelToken&&v.cancelToken.subscribe(te),v.signal&&(v.signal.aborted?te():v.signal.addEventListener("abort",te)));const Ii=br(v.url);if(Ii&&P.protocols.indexOf(Ii)===-1){x(new A("Unsupported protocol "+Ii+":",A.ERR_BAD_REQUEST,c));return}bt.send(T||null)})},_r=(c,g)=>{const{length:x}=c=c?c.filter(Boolean):[];if(g||x){let v=new AbortController,T;const B=function(te){if(!T){T=!0,u();const ae=te instanceof Error?te:this.reason;v.abort(ae instanceof A?ae:new pe(ae instanceof Error?ae.message:ae))}};let S=g&&setTimeout(()=>{S=null,B(new A(`timeout ${g} of ms exceeded`,A.ETIMEDOUT))},g);const u=()=>{c&&(S&&clearTimeout(S),S=null,c.forEach(te=>{te.unsubscribe?te.unsubscribe(B):te.removeEventListener("abort",B)}),c=null)};c.forEach(te=>te.addEventListener("abort",B));const{signal:J}=v;return J.unsubscribe=()=>m.asap(u),J}},Ar=function*(c,g){let x=c.byteLength;if(x<g){yield c;return}let v=0,T;for(;v<x;)T=v+g,yield c.slice(v,T),v=T},Or=async function*(c,g){for await(const x of Tr(c))yield*Ar(x,g)},Tr=async function*(c){if(c[Symbol.asyncIterator]){yield*c;return}const g=c.getReader();try{for(;;){const{done:x,value:v}=await g.read();if(x)break;yield v}}finally{await g.cancel()}},it=(c,g,x,v)=>{const T=Or(c,g);let B=0,S,u=J=>{S||(S=!0,v&&v(J))};return new ReadableStream({async pull(J){try{const{done:te,value:ae}=await T.next();if(te){u(),J.close();return}let H=ae.byteLength;if(x){let Y=B+=H;x(Y)}J.enqueue(new Uint8Array(ae))}catch(te){throw u(te),te}},cancel(J){return u(J),T.return()}},{highWaterMark:2})},Ve=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Ut=Ve&&typeof ReadableStream=="function",Vr=Ve&&(typeof TextEncoder=="function"?(c=>g=>c.encode(g))(new TextEncoder):async c=>new Uint8Array(await new Response(c).arrayBuffer())),Pt=(c,...g)=>{try{return!!c(...g)}catch{return!1}},Br=Ut&&Pt(()=>{let c=!1;const g=new Request(P.origin,{body:new ReadableStream,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!g}),ut=64*1024,Ue=Ut&&Pt(()=>m.isReadableStream(new Response("").body)),Ee={stream:Ue&&(c=>c.body)};Ve&&(c=>{["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!Ee[g]&&(Ee[g]=m.isFunction(c[g])?x=>x[g]():(x,v)=>{throw new A(`Response type '${g}' is not supported`,A.ERR_NOT_SUPPORT,v)})})})(new Response);const $r=async c=>{if(c==null)return 0;if(m.isBlob(c))return c.size;if(m.isSpecCompliantForm(c))return(await new Request(P.origin,{method:"POST",body:c}).arrayBuffer()).byteLength;if(m.isArrayBufferView(c)||m.isArrayBuffer(c))return c.byteLength;if(m.isURLSearchParams(c)&&(c=c+""),m.isString(c))return(await Vr(c)).byteLength},Dr=async(c,g)=>m.toFiniteNumber(c.getContentLength())??$r(g),Fr=Ve&&(async c=>{let{url:g,method:x,data:v,signal:T,cancelToken:B,timeout:S,onDownloadProgress:u,onUploadProgress:J,responseType:te,headers:ae,withCredentials:H="same-origin",fetchOptions:Y}=jt(c);te=te?(te+"").toLowerCase():"text";let oi=_r([T,B&&B.toAbortSignal()],S),li;const bt=oi&&oi.unsubscribe&&(()=>{oi.unsubscribe()});let mi;try{if(J&&Br&&x!=="get"&&x!=="head"&&(mi=await Dr(ae,v))!==0){let ri=new Request(g,{method:"POST",body:v,duplex:"half"}),gi;if(m.isFormData(v)&&(gi=ri.headers.get("content-type"))&&ae.setContentType(gi),ri.body){const[tn,Ws]=lt(mi,Se(st(J)));v=it(ri.body,ut,tn,Ws)}}m.isString(H)||(H=H?"include":"omit");const Ii="credentials"in Request.prototype;li=new Request(g,{...Y,signal:oi,method:x.toUpperCase(),headers:ae.normalize().toJSON(),body:v,duplex:"half",credentials:Ii?H:void 0});let pi=await fetch(li,Y);const si=Ue&&(te==="stream"||te==="response");if(Ue&&(u||si&&bt)){const ri={};["status","statusText","headers"].forEach(Ji=>{ri[Ji]=pi[Ji]});const gi=m.toFiniteNumber(pi.headers.get("content-length")),[tn,Ws]=u&<(gi,Se(st(u),!0))||[];pi=new Response(it(pi.body,ut,tn,()=>{Ws&&Ws(),bt&&bt()}),ri)}te=te||"text";let ci=await Ee[m.findKey(Ee,te)||"text"](pi,c);return!si&&bt&&bt(),await new Promise((ri,gi)=>{Mt(ri,gi,{data:ci,headers:W.from(pi.headers),status:pi.status,statusText:pi.statusText,config:c,request:li})})}catch(Ii){throw bt&&bt(),Ii&&Ii.name==="TypeError"&&/Load failed|fetch/i.test(Ii.message)?Object.assign(new A("Network Error",A.ERR_NETWORK,c,li),{cause:Ii.cause||Ii}):A.from(Ii,Ii&&Ii.code,c,li)}}),Pe={http:Qn,xhr:Er,fetch:Fr};m.forEach(Pe,(c,g)=>{if(c){try{Object.defineProperty(c,"name",{value:g})}catch{}Object.defineProperty(c,"adapterName",{value:g})}});const ct=c=>`- ${c}`,Nr=c=>m.isFunction(c)||c===null||c===!1,It={getAdapter:c=>{c=m.isArray(c)?c:[c];const{length:g}=c;let x,v;const T={};for(let B=0;B<g;B++){x=c[B];let S;if(v=x,!Nr(x)&&(v=Pe[(S=String(x)).toLowerCase()],v===void 0))throw new A(`Unknown adapter '${S}'`);if(v)break;T[S||"#"+B]=v}if(!v){const B=Object.entries(T).map(([u,J])=>`adapter ${u} `+(J===!1?"is not supported by the environment":"is not available in the build"));let S=g?B.length>1?`since :
|
4
|
-
`+B.map(ct).join(`
|
5
|
-
`):" "+ct(B[0]):"as no adapter specified";throw new A("There is no suitable adapter to dispatch the request "+S,"ERR_NOT_SUPPORT")}return v},adapters:Pe};function Ne(c){if(c.cancelToken&&c.cancelToken.throwIfRequested(),c.signal&&c.signal.aborted)throw new pe(null,c)}function dt(c){return Ne(c),c.headers=W.from(c.headers),c.data=Fe.call(c,c.transformRequest),["post","put","patch"].indexOf(c.method)!==-1&&c.headers.setContentType("application/x-www-form-urlencoded",!1),It.getAdapter(c.adapter||xe.adapter)(c).then(function(g){return Ne(c),g.data=Fe.call(c,c.transformResponse,g),g.headers=W.from(g.headers),g},function(g){return Nt(g)||(Ne(c),g&&g.response&&(g.response.data=Fe.call(c,c.transformResponse,g.response),g.response.headers=W.from(g.response.headers))),Promise.reject(g)})}const qt="1.11.0",Be={};["object","boolean","number","function","string","symbol"].forEach((c,g)=>{Be[c]=function(x){return typeof x===c||"a"+(g<1?"n ":" ")+c}});const ft={};Be.transitional=function(c,g,x){function v(T,B){return"[Axios v"+qt+"] Transitional option '"+T+"'"+B+(x?". "+x:"")}return(T,B,S)=>{if(c===!1)throw new A(v(B," has been removed"+(g?" in "+g:"")),A.ERR_DEPRECATED);return g&&!ft[B]&&(ft[B]=!0,console.warn(v(B," has been deprecated since v"+g+" and will be removed in the near future"))),c?c(T,B,S):!0}},Be.spelling=function(c){return(g,x)=>(console.warn(`${x} is likely a misspelling of ${c}`),!0)};function Mr(c,g,x){if(typeof c!="object")throw new A("options must be an object",A.ERR_BAD_OPTION_VALUE);const v=Object.keys(c);let T=v.length;for(;T-- >0;){const B=v[T],S=g[B];if(S){const u=c[B],J=u===void 0||S(u,B,c);if(J!==!0)throw new A("option "+B+" must be "+J,A.ERR_BAD_OPTION_VALUE);continue}if(x!==!0)throw new A("Unknown option "+B,A.ERR_BAD_OPTION)}}const Ce={assertOptions:Mr,validators:Be},X=Ce.validators;let se=class{constructor(c){this.defaults=c||{},this.interceptors={request:new rt,response:new rt}}async request(c,g){try{return await this._request(c,g)}catch(x){if(x instanceof Error){let v={};Error.captureStackTrace?Error.captureStackTrace(v):v=new Error;const T=v.stack?v.stack.replace(/^.+\n/,""):"";try{x.stack?T&&!String(x.stack).endsWith(T.replace(/^.+\n.+\n/,""))&&(x.stack+=`
|
6
|
-
`+T):x.stack=T}catch{}}throw x}}_request(c,g){typeof c=="string"?(g=g||{},g.url=c):g=c||{},g=ue(this.defaults,g);const{transitional:x,paramsSerializer:v,headers:T}=g;x!==void 0&&Ce.assertOptions(x,{silentJSONParsing:X.transitional(X.boolean),forcedJSONParsing:X.transitional(X.boolean),clarifyTimeoutError:X.transitional(X.boolean)},!1),v!=null&&(m.isFunction(v)?g.paramsSerializer={serialize:v}:Ce.assertOptions(v,{encode:X.function,serialize:X.function},!0)),g.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?g.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:g.allowAbsoluteUrls=!0),Ce.assertOptions(g,{baseUrl:X.spelling("baseURL"),withXsrfToken:X.spelling("withXSRFToken")},!0),g.method=(g.method||this.defaults.method||"get").toLowerCase();let B=T&&m.merge(T.common,T[g.method]);T&&m.forEach(["delete","get","head","post","put","patch","common"],oi=>{delete T[oi]}),g.headers=W.concat(B,T);const S=[];let u=!0;this.interceptors.request.forEach(function(oi){typeof oi.runWhen=="function"&&oi.runWhen(g)===!1||(u=u&&oi.synchronous,S.unshift(oi.fulfilled,oi.rejected))});const J=[];this.interceptors.response.forEach(function(oi){J.push(oi.fulfilled,oi.rejected)});let te,ae=0,H;if(!u){const oi=[dt.bind(this),void 0];for(oi.unshift(...S),oi.push(...J),H=oi.length,te=Promise.resolve(g);ae<H;)te=te.then(oi[ae++],oi[ae++]);return te}H=S.length;let Y=g;for(ae=0;ae<H;){const oi=S[ae++],li=S[ae++];try{Y=oi(Y)}catch(bt){li.call(this,bt);break}}try{te=dt.call(this,Y)}catch(oi){return Promise.reject(oi)}for(ae=0,H=J.length;ae<H;)te=te.then(J[ae++],J[ae++]);return te}getUri(c){c=ue(this.defaults,c);const g=Lt(c.baseURL,c.url,c.allowAbsoluteUrls);return $t(g,c.params,c.paramsSerializer)}};m.forEach(["delete","get","head","options"],function(c){se.prototype[c]=function(g,x){return this.request(ue(x||{},{method:c,url:g,data:(x||{}).data}))}}),m.forEach(["post","put","patch"],function(c){function g(x){return function(v,T,B){return this.request(ue(B||{},{method:c,headers:x?{"Content-Type":"multipart/form-data"}:{},url:v,data:T}))}}se.prototype[c]=g(),se.prototype[c+"Form"]=g(!0)});let Lr=class cy{constructor(g){if(typeof g!="function")throw new TypeError("executor must be a function.");let x;this.promise=new Promise(function(T){x=T});const v=this;this.promise.then(T=>{if(!v._listeners)return;let B=v._listeners.length;for(;B-- >0;)v._listeners[B](T);v._listeners=null}),this.promise.then=T=>{let B;const S=new Promise(u=>{v.subscribe(u),B=u}).then(T);return S.cancel=function(){v.unsubscribe(B)},S},g(function(T,B,S){v.reason||(v.reason=new pe(T,B,S),x(v.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(g){if(this.reason){g(this.reason);return}this._listeners?this._listeners.push(g):this._listeners=[g]}unsubscribe(g){if(!this._listeners)return;const x=this._listeners.indexOf(g);x!==-1&&this._listeners.splice(x,1)}toAbortSignal(){const g=new AbortController,x=v=>{g.abort(v)};return this.subscribe(x),g.signal.unsubscribe=()=>this.unsubscribe(x),g.signal}static source(){let g;return{token:new cy(function(x){g=x}),cancel:g}}};function jr(c){return function(g){return c.apply(null,g)}}function Ur(c){return m.isObject(c)&&c.isAxiosError===!0}const Ie={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(Ie).forEach(([c,g])=>{Ie[g]=c});function zt(c){const g=new se(c),x=wt(se.prototype.request,g);return m.extend(x,se.prototype,g,{allOwnKeys:!0}),m.extend(x,g,null,{allOwnKeys:!0}),x.create=function(v){return zt(ue(c,v))},x}const L=zt(xe);L.Axios=se,L.CanceledError=pe,L.CancelToken=Lr,L.isCancel=Nt,L.VERSION=qt,L.toFormData=Te,L.AxiosError=A,L.Cancel=L.CanceledError,L.all=function(c){return Promise.all(c)},L.spread=jr,L.isAxiosError=Ur,L.mergeConfig=ue,L.AxiosHeaders=W,L.formToJSON=c=>Ft(m.isHTMLForm(c)?new FormData(c):c),L.getAdapter=It.getAdapter,L.HttpStatusCode=Ie,L.default=L;function Kt(c,g){const{api:x,options:v=[],limit:T=20,dataKey:B="data"}=c,S=c.type==="checkbox";function u(Ji){return S?Array.isArray(Ji)?Ji:Ji?[Ji]:[]:Ji??""}const J=vue.ref(u(c.modelValue)),te=vue.ref(""),ae=vue.ref(!1),H=vue.ref([]),Y=vue.ref("id"),oi=vue.ref("text"),li=vue.ref(!1),bt=vue.ref(c.layout!=="popover"&&v.length>T);function mi(Ji){const $s=Ji.find(Boolean)??{},os=["id","value","code","key"].find(Fs=>Fs in $s)??"id",Gc=["text","label","name","title"].find(Fs=>Fs in $s)??"text";return{autoValueKey:os,autoLabelKey:Gc}}if(v.length>0){const Ji=mi(v);Y.value=Ji.autoValueKey,oi.value=Ji.autoLabelKey}const Ii=vue.computed(()=>{if(x)return H.value;const Ji=H.value;if(c.layout==="popover")return Ji;if(!te.value)return li.value?Ji:Ji.slice(0,T);const $s=te.value.toLowerCase();return Ji.filter(os=>os[oi.value].toLowerCase().includes($s))});let pi=null;async function si(Ji){if(x){ae.value=!0;try{const $s=await L.get(x,{params:{json:1,key:Ji,limit:T}});if(H.value=$s.data[B],H.value.length>0){const os=mi(H.value);Y.value=os.autoValueKey,oi.value=os.autoLabelKey}}catch($s){console.error("Failed to fetch remote options:",$s)}finally{ae.value=!1}}}vue.watch(te,Ji=>{x&&(pi&&clearTimeout(pi),pi=setTimeout(()=>{si(Ji)},200))}),vue.watch(()=>c.modelValue,Ji=>{J.value=u(Ji)},{immediate:!0}),x?si(""):H.value=v;function ci(Ji){return S&&Array.isArray(J.value)?J.value.includes(Ji[Y.value]):J.value===Ji[Y.value]}function ri(Ji){if(S&&!Array.isArray(J.value)&&(J.value=[]),S&&Array.isArray(J.value)){const $s=J.value.includes(Ji[Y.value]);J.value=$s?J.value.filter(os=>os!==Ji[Y.value]):[...J.value,Ji[Y.value]]}else J.value=Ji[Y.value];g("update:modelValue",J.value),g("change",{name:c.name,value:J.value})}function gi(){S?J.value=[]:J.value=void 0,g("update:modelValue",J.value),g("clear",c.name)}function tn(){pi&&clearTimeout(pi),te.value="",li.value=!1}function Ws(){li.value=!li.value}return vue.onBeforeUnmount(()=>{pi&&clearTimeout(pi)}),{innerValue:J,searchTerm:te,filteredOptions:Ii,isSelected:ci,selectItem:ri,clear:gi,resetSearch:tn,toggleShowAll:Ws,isReqProc:ae,showAll:li,isEnableShowAll:bt,labelKey:oi,valueKey:Y,allOptions:H}}const Z=(c,g)=>{const x=c.__vccOpts||c;for(const[v,T]of g)x[v]=T;return x},Pr={},Ir={class:"w-48 mx-auto",viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function qr(c,g){return vue.openBlock(),vue.createElementBlock("svg",Ir,g[0]||(g[0]=[vue.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const Wt=Z(Pr,[["render",qr]]),Hr={},zr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down w-[14px] rotate"};function Kr(c,g){return vue.openBlock(),vue.createElementBlock("svg",zr,g[0]||(g[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Ge=Z(Hr,[["render",Kr]]),Wr={},Jr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down w-[14px] rotate-[180deg]"};function Yr(c,g){return vue.openBlock(),vue.createElementBlock("svg",Jr,g[0]||(g[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Jt=Z(Wr,[["render",Yr]]),Qr={key:0,class:"h-[45px] shrink-0 px-[6px] py-[4px] flex items-center relative justify-center"},Gr={key:1,class:"w-full"},Xr={class:"flex flex-col items-center justify-center p-5 text-center"},Zr={key:0,class:"flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"},eo={key:1,class:"flex justify-between items-center text-xs text-gray-500 p-1 border-t"},pt=vue.defineComponent({__name:"radio",props:{id:{},name:{},type:{},label:{},width:{},options:{default:()=>[]},placeHolder:{},api:{},data:{},default:{},modelValue:{},disabled:{type:Boolean,default:!1},layout:{default:"inline"},cleanable:{type:Boolean},limit:{default:10},multi:{type:Boolean},dataKey:{},valueKey:{},mode:{},labelKey:{}},emits:["update:modelValue","change","clear"],setup(c,{expose:g,emit:x}){const v=c,T=vue.ref(null),B=x,{innerValue:S,searchTerm:u,filteredOptions:J,isSelected:te,selectItem:ae,clear:H,resetSearch:Y,toggleShowAll:oi,isReqProc:li,showAll:bt,isEnableShowAll:mi,labelKey:Ii,valueKey:pi,allOptions:si}=Kt({...v,modelValue:v.modelValue??v.default??""},B);return vue.onMounted(()=>{Y()}),g({clear:H,inputTextRef:T}),vue.watch(()=>v.modelValue,ci=>{ci===void 0&&(S.value=void 0)}),(ci,ri)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass([ci.layout==="popover"?"flex flex-col h-full":"flex flex-col vs-filter-checkbox"])},[ci.type==="select"?(vue.openBlock(),vue.createElementBlock("div",Qr,[vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":ri[0]||(ri[0]=gi=>vue.isRef(u)?u.value=gi:null),class:"w-full h-full text-[13px] px-4 border rounded-sm pl-9 focus:outline-none focus:ring-ring focus:ring-1 focus:ring-blue-500",placeholder:"Пошук",type:"text",ref_key:"inputTextRef",ref:T},null,512),[[vue.vModelText,vue.unref(u)]]),ri[7]||(ri[7]=vue.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search absolute text-gray-400 -translate-y-1/2 left-4 top-1/2"},[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),vue.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),vue.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)),(vue.openBlock(),vue.createElementBlock("svg",{onClick:ri[1]||(ri[1]=gi=>u.value=""),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x absolute text-gray-400 -translate-y-1/2 cursor-pointer hover:text-red-500 right-4 top-1/2",height:"16",width:"16"},ri[6]||(ri[6]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),vue.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])))])):vue.createCommentVNode("",!0),vue.createElementVNode("div",{class:vue.normalizeClass([ci.layout==="popover"?"flex-1 overflow-y-auto max-h-64 p-2":"",ci.layout==="inline"?"flex-1 overflow-y-auto max-h-80":""])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(J),gi=>(vue.openBlock(),vue.createBlock(xt,{layout:ci.layout,key:gi.id,count:gi.count,label:gi[vue.unref(Ii)],color:gi.color,type:"radio",value:gi[vue.unref(pi)],"is-selected":vue.unref(te)(gi),onItemClick:tn=>vue.unref(ae)(gi)},null,8,["layout","count","label","color","value","is-selected","onItemClick"]))),128))],2),ci.type==="select"&&vue.unref(J).length===0&&!vue.unref(li)?(vue.openBlock(),vue.createElementBlock("div",Gr,[vue.createElementVNode("div",Xr,[vue.createVNode(Wt),ri[8]||(ri[8]=vue.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[vue.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"За вашим запитом нічого не знайдено"),vue.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])):vue.createCommentVNode("",!0),ci.layout!=="popover"&&ci.type!=="select"?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:2},[!vue.unref(bt)&&vue.unref(mi)?(vue.openBlock(),vue.createElementBlock("div",{key:0,onClick:ri[2]||(ri[2]=(...gi)=>vue.unref(oi)&&vue.unref(oi)(...gi)),class:"inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"},[ri[9]||(ri[9]=vue.createTextVNode(" Показати більше ")),vue.createVNode(Ge)])):vue.createCommentVNode("",!0),vue.unref(bt)?(vue.openBlock(),vue.createElementBlock("div",{key:1,onClick:ri[3]||(ri[3]=(...gi)=>vue.unref(oi)&&vue.unref(oi)(...gi)),class:"inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"},[ri[10]||(ri[10]=vue.createTextVNode(" Показати менше ")),vue.createVNode(Jt)])):vue.createCommentVNode("",!0)],64)):vue.createCommentVNode("",!0),ci.cleanable?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:3},[ci.layout==="inline"?(vue.openBlock(),vue.createElementBlock("div",Zr,[vue.createTextVNode(vue.toDisplayString(vue.unref(S)?1:0)+" з "+vue.toDisplayString(vue.unref(si).length)+" обрано ",1),vue.withDirectives(vue.createElementVNode("button",{class:"text-gray-600 hover:text-gray-800",onClick:ri[4]||(ri[4]=(...gi)=>vue.unref(H)&&vue.unref(H)(...gi))}," Очистити ",512),[[vue.vShow,vue.unref(S)!==""&&vue.unref(S)!==void 0]])])):vue.createCommentVNode("",!0),ci.layout==="popover"?(vue.openBlock(),vue.createElementBlock("div",eo,[vue.createElementVNode("span",null,vue.toDisplayString(vue.unref(S)?1:0)+" з "+vue.toDisplayString(vue.unref(si).length)+" обрано",1),vue.withDirectives(vue.createElementVNode("button",{class:"text-gray-600 hover:text-gray-800",onClick:ri[5]||(ri[5]=(...gi)=>vue.unref(H)&&vue.unref(H)(...gi))}," Очистити ",512),[[vue.vShow,vue.unref(S)!==""&&vue.unref(S)!==void 0]])])):vue.createCommentVNode("",!0)],64)):vue.createCommentVNode("",!0)],2))}}),to={key:0,class:"h-[45px] shrink-0 px-[6px] py-[4px] flex items-center relative justify-center"},no={key:1,class:"w-full"},ro={class:"flex flex-col items-center justify-center p-5 text-center"},oo={key:0,class:"flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"},lo={key:1,class:"flex justify-between items-center text-xs text-gray-500 p-1 border-t"},qe=vue.defineComponent({__name:"checkbox",props:{id:{},name:{},type:{},label:{},width:{},options:{default:()=>[]},placeHolder:{},api:{},data:{},default:{},modelValue:{},disabled:{type:Boolean,default:!1},layout:{default:"inline"},cleanable:{type:Boolean},limit:{default:10},multi:{type:Boolean},dataKey:{},valueKey:{},mode:{},labelKey:{}},emits:["update:modelValue","change","clear"],setup(c,{expose:g,emit:x}){const v=c,T=x,B=vue.ref(null),{innerValue:S,filteredOptions:u,isSelected:J,selectItem:te,clear:ae,resetSearch:H,toggleShowAll:Y,isReqProc:oi,showAll:li,isEnableShowAll:bt,searchTerm:mi,labelKey:Ii,valueKey:pi,allOptions:si}=Kt({...v,type:"checkbox",modelValue:v.modelValue},T);return vue.onMounted(()=>{H()}),vue.watch(()=>v.modelValue,ci=>{ci===void 0&&(S.value=[])}),g({clear:ae,inputTextRef:B}),(ci,ri)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass([ci.layout==="popover"?"flex flex-col h-full":"flex flex-col vs-filter-checkbox space-y-0.5"])},[ci.type==="select"?(vue.openBlock(),vue.createElementBlock("div",to,[vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":ri[0]||(ri[0]=gi=>vue.isRef(mi)?mi.value=gi:null),class:"w-full h-full text-[13px] px-4 border rounded-sm pl-9 focus:outline-none focus:ring-ring focus:ring-1 focus:ring-blue-500",placeholder:"Пошук",type:"text",ref_key:"inputTextRef",ref:B},null,512),[[vue.vModelText,vue.unref(mi)]]),ri[7]||(ri[7]=vue.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search absolute text-gray-400 -translate-y-1/2 left-4 top-1/2"},[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),vue.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),vue.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)),(vue.openBlock(),vue.createElementBlock("svg",{onClick:ri[1]||(ri[1]=gi=>mi.value=""),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x absolute text-gray-400 -translate-y-1/2 cursor-pointer hover:text-red-500 right-4 top-1/2",height:"16",width:"16"},ri[6]||(ri[6]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),vue.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])))])):vue.createCommentVNode("",!0),vue.createElementVNode("div",{class:vue.normalizeClass([ci.layout==="popover"?"flex-1 overflow-y-auto max-h-64 p-2":"",ci.layout==="inline"?"flex-1 overflow-y-auto max-h-80":""])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(u),gi=>(vue.openBlock(),vue.createBlock(xt,{layout:ci.layout,count:gi.count,label:gi[vue.unref(Ii)],color:gi.color,type:"checkbox",value:gi[vue.unref(pi)],"is-selected":vue.unref(J)(gi),onItemClick:tn=>vue.unref(te)(gi)},null,8,["layout","count","label","color","value","is-selected","onItemClick"]))),256))],2),ci.type==="select"&&vue.unref(u).length===0&&!vue.unref(oi)?(vue.openBlock(),vue.createElementBlock("div",no,[vue.createElementVNode("div",ro,[vue.createVNode(Wt),ri[8]||(ri[8]=vue.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[vue.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"За вашим запитом нічого не знайдено"),vue.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])):vue.createCommentVNode("",!0),ci.layout!=="popover"&&ci.type!=="select"?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:2},[!vue.unref(li)&&vue.unref(bt)?(vue.openBlock(),vue.createElementBlock("div",{key:0,onClick:ri[2]||(ri[2]=(...gi)=>vue.unref(Y)&&vue.unref(Y)(...gi)),class:"inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"},[ri[9]||(ri[9]=vue.createTextVNode(" Показати більше ")),vue.createVNode(Ge)])):vue.createCommentVNode("",!0),vue.unref(li)?(vue.openBlock(),vue.createElementBlock("div",{key:1,onClick:ri[3]||(ri[3]=(...gi)=>vue.unref(Y)&&vue.unref(Y)(...gi)),class:"inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"},[ri[10]||(ri[10]=vue.createTextVNode(" Показати менше ")),vue.createVNode(Jt)])):vue.createCommentVNode("",!0)],64)):vue.createCommentVNode("",!0),ci.cleanable?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:3},[ci.layout==="inline"?(vue.openBlock(),vue.createElementBlock("div",oo,[vue.createTextVNode(vue.toDisplayString(vue.unref(S).length)+" з "+vue.toDisplayString(vue.unref(si).length)+" обрано ",1),vue.withDirectives(vue.createElementVNode("button",{class:"text-gray-600 hover:text-gray-800",onClick:ri[4]||(ri[4]=(...gi)=>vue.unref(ae)&&vue.unref(ae)(...gi))}," Очистити ",512),[[vue.vShow,vue.unref(S).length!==0]])])):vue.createCommentVNode("",!0),ci.layout==="popover"?(vue.openBlock(),vue.createElementBlock("div",lo,[vue.createElementVNode("span",null,vue.toDisplayString(vue.unref(S).length)+" з "+vue.toDisplayString(vue.unref(si).length)+" обрано",1),vue.withDirectives(vue.createElementVNode("button",{class:"text-gray-600 hover:text-gray-800",onClick:ri[5]||(ri[5]=(...gi)=>vue.unref(ae)&&vue.unref(ae)(...gi))}," Очистити ",512),[[vue.vShow,vue.unref(S).length!==0]])])):vue.createCommentVNode("",!0)],64)):vue.createCommentVNode("",!0)],2))}}),so={},ao={xmlns:"http://www.w3.org/2000/svg",width:"15px",height:"15px",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function io(c,g){return vue.openBlock(),vue.createElementBlock("svg",ao,g[0]||(g[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),vue.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const uo=Z(so,[["render",io]]),co={},fo={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x stroke-gray-500 hover:stroke-red-500 transition-all",width:"15px",height:"15px"};function po(c,g){return vue.openBlock(),vue.createElementBlock("svg",fo,g[0]||(g[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),vue.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const mo=Z(co,[["render",po]]);class He{static getWidthClass(g){return typeof g=="number"?`max-w-[${g}px]`:typeof g=="string"?g.endsWith("%")||g.endsWith("px")?`max-w-[${g}]`:`max-w-${g}`:"w-full"}}const ho={class:"absolute bottom-2/4 translate-y-2/4 cursor-pointer left-3"},yo=["placeholder"],go=vue.defineComponent({__name:"text-input",props:{id:{},name:{},type:{},label:{},width:{default:220},options:{},placeHolder:{},api:{},data:{},default:{},modelValue:{},disabled:{type:Boolean},layout:{default:"inline"},cleanable:{type:Boolean},limit:{},multi:{type:Boolean},dataKey:{},valueKey:{},mode:{},labelKey:{}},emits:["update:modelValue","change","clear"],setup(c,{emit:g}){const x=c,v=vue.ref((x.placeHolder||x.label).toString()),T=g,B=vue.ref(x.modelValue??"");vue.watch(()=>x.modelValue,J=>{J!==B.value&&(B.value=J??"")});function S(){T("update:modelValue",B.value),T("change",{name:x.name,value:B.value})}function u(){B.value="",T("update:modelValue",""),T("clear",x.name)}return(J,te)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(["vs-form-text relative bg-white rounded-lg [&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",J.layout==="inline"?vue.unref(He).getWidthClass(J.width):"w-full mb-2"])},[vue.createElementVNode("div",ho,[vue.createVNode(uo)]),B.value!==""?(vue.openBlock(),vue.createElementBlock("div",{key:0,onClick:u,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer"},[vue.createVNode(mo)])):vue.createCommentVNode("",!0),vue.withDirectives(vue.createElementVNode("input",{type:"text","onUpdate:modelValue":te[0]||(te[0]=ae=>B.value=ae),onInput:S,placeholder:v.value,class:"!pr-7 !pl-8 bg-white h-[38px] text-sm py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:border-2 focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,40,yo),[[vue.vModelText,B.value]])],2))}});function Yt(c={color:"blue"}){return vue.computed(()=>{const g=`w-full px-3 py-2 border-solid border border-gray-300 text-sm rounded focus:outline-none focus:ring-2 focus:ring-${c.color}-500 focus:border-transparent`;return(c==null?void 0:c.size)==="sm"?`${g}h-[32px]`:`${g}h-[38px]`})}function bo(){return"rounded-md font-medium border-gray-200 border-solid disabled:pointer-events-none disabled:opacity-50 px-4 py-2 w-full bg-transparent border text-black text-sm h-[38px]"}function vo(){return"font-medium border-solid disabled:pointer-events-none disabled:opacity-50 border h-7 rounded-md text-xs px-2 py-1 hover:bg-gray-100"}function xo(c){return c==="ghost"?"inline-flex relative py-2 px-4 items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent text-gray-600 hover:bg-blue-100 hover:text-gray-800 focus:outline-hidden focus:bg-gray-100 focus:text-gray-800 disabled:opacity-50 disabled:pointer-events-none dark:text-gray-500 dark:hover:bg-blue-800/30 dark:hover:text-blue-400 dark:focus:bg-blue-800/30 dark:focus:text-blue-400":c==="soft"?"inline-flex relative py-2 px-4 items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 hover:bg-gray-200 focus:outline-hidden focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:text-blue-400 dark:hover:bg-blue-900 dark:focus:bg-blue-900":"relative focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border-input hover:bg-gray-100 border px-4 py-2 gap-2 bg-transparent h-[38px]"}const wo={key:0,class:"block text-xs font-medium text-gray-600 mb-1"},ko=["placeholder","disabled"],Co={key:0,class:"block text-xs font-medium text-gray-600 mb-1"},Ro={key:0,class:"block text-xs font-medium text-gray-600 mb-1"},So=["placeholder","disabled"],Eo=["disabled"],_o=vue.defineComponent({__name:"range-input",props:{id:{},name:{},type:{},label:{},width:{},options:{},placeHolder:{},api:{},data:{},default:{},modelValue:{},disabled:{type:Boolean,default:!1},layout:{default:"inline"},cleanable:{type:Boolean},limit:{},multi:{type:Boolean},dataKey:{},valueKey:{},mode:{},labelKey:{}},emits:["update:modelValue","change","clear"],setup(c,{expose:g,emit:x}){const v=Yt(),T=bo(),B=c,S=vue.ref(B.modelValue??B.default??[]),u=x,J=vue.computed({get:()=>B.modelValue??S.value,set:H=>{B.modelValue!==void 0?u("update:modelValue",H):S.value=H}});function te(){u("change",{name:B.name,value:J.value||S.value})}function ae(){S.value=[],J.value=S.value,u("clear",B.name)}return vue.watch(()=>B.modelValue,H=>{H!==void 0&&B.layout!=="popover"?(S.value=H,u("update:modelValue",H)):S.value=[]}),g({clear:ae,currentValue:J}),(H,Y)=>{var oi,li;return vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",null,[vue.createElementVNode("div",{class:vue.normalizeClass(H.layout==="vertical"?"inline-flex items-center gap-2":"space-y-3 p-2")},[vue.createElementVNode("div",null,[H.layout!=="vertical"?(vue.openBlock(),vue.createElementBlock("label",wo,"Від")):vue.createCommentVNode("",!0),vue.withDirectives(vue.createElementVNode("input",{type:"number",class:vue.normalizeClass(vue.unref(v)),placeholder:((oi=H.placeHolder)==null?void 0:oi[0])??"min",step:"1",style:{outline:"none"},"onUpdate:modelValue":Y[0]||(Y[0]=bt=>J.value[0]=bt),disabled:H.disabled},null,10,ko),[[vue.vModelText,J.value[0]]])]),H.layout==="vertical"?(vue.openBlock(),vue.createElementBlock("label",Co," - ")):vue.createCommentVNode("",!0),vue.createElementVNode("div",null,[H.layout!=="vertical"?(vue.openBlock(),vue.createElementBlock("label",Ro,"До")):vue.createCommentVNode("",!0),vue.withDirectives(vue.createElementVNode("input",{type:"number",class:vue.normalizeClass(vue.unref(v)),placeholder:((li=H.placeHolder)==null?void 0:li[1])??"max",min:"0",max:"1000000000000000",step:"1",style:{outline:"none"},"onUpdate:modelValue":Y[1]||(Y[1]=bt=>J.value[1]=bt),disabled:H.disabled},null,10,So),[[vue.vModelText,J.value[1]]])]),["popover","inline","vertical"].includes(H.layout)?(vue.openBlock(),vue.createElementBlock("button",{key:1,onClick:te,class:vue.normalizeClass(vue.unref(T)+(H.layout==="vertical"?" w-[50px]":" bg-blue-100 hover:bg-blue-200"))},vue.toDisplayString(H.layout==="vertical"?"Ok":"Застосувати"),3)):vue.createCommentVNode("",!0),["popover","inline"].includes(H.layout)?(vue.openBlock(),vue.createElementBlock("button",{key:2,disabled:!(J.value[0]||J.value[1]),onClick:ae,class:vue.normalizeClass(vue.unref(T)+" hover:bg-gray-100")},"Очистити",10,Eo)):vue.createCommentVNode("",!0)],2)]),(H.cleanable&&S.value.length,vue.createCommentVNode("",!0))],64)}}}),Ao=["disabled","title"],Oo={key:0,class:"absolute top-0 end-0 inline-flex min-h-[10px] min-w-[10px] z-10 items-center py-0.5 rounded-full text-xs font-medium transform -translate-y-1/2 translate-x-1/2 bg-blue-600 text-white px-1"},To={class:"w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},Vo={class:"w-[360px] max-h-[500px] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 before:w-full p-2"},Qt=vue.defineComponent({__name:"popover-field",props:{disabled:{type:Boolean,default:!1},label:{},currentValue:{},fieldRef:{},width:{},mode:{},layout:{}},setup(c,{expose:g}){const x=c,v=vue.computed(()=>xo(x.mode)),T=vue.ref(!1),B=vue.ref({top:0,left:0}),S=vue.ref(null),u=vue.ref(null),J=vue.ref(null);function te(){const bt=u.value,mi=J.value;if(!bt||!mi)return;const Ii=bt.getBoundingClientRect();B.value={top:Ii.bottom+8,left:Ii.left}}function ae(){T.value=!T.value,T.value&&vue.nextTick(()=>{var bt,mi;te(),(bt=x.fieldRef)!=null&&bt.inputTextRef&&((mi=x.fieldRef)==null||mi.inputTextRef.focus())})}function H(bt){var mi,Ii;!((mi=S.value)!=null&&mi.contains(bt.target))&&!((Ii=J.value)!=null&&Ii.contains(bt.target))&&(T.value=!1)}function Y(bt){bt.key==="Escape"&&(T.value=!1)}const oi=vue.ref(!1);vue.onMounted(()=>oi.value=!0),vue.onMounted(()=>{document.addEventListener("click",H,!0),document.addEventListener("keydown",Y),window.addEventListener("scroll",te,!0)}),vue.onBeforeUnmount(()=>{document.removeEventListener("click",H,!0),document.removeEventListener("keydown",Y),window.removeEventListener("scroll",te,!0)});function li(){T.value=!1}return g({close:li}),(bt,mi)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("button",{onClick:ae,disabled:bt.disabled,ref_key:"triggerRef",ref:u,title:bt.label,class:vue.normalizeClass(v.value+(bt.width?vue.unref(He).getWidthClass(bt.width):"w-full"))},[vue.createElementVNode("span",{class:vue.normalizeClass(["truncate text-ellipsis block",bt.width?vue.unref(He).getWidthClass(bt.width-50):"w-full max-w-[200px]"])},vue.toDisplayString(bt.label),3),vue.createVNode(Ge,{class:"h-4 w-4"}),(Array.isArray(bt.currentValue)?bt.currentValue===null||bt.currentValue.length>0:bt.currentValue===null||bt.currentValue)&&bt.layout==="inline"?(vue.openBlock(),vue.createElementBlock("span",Oo)):vue.createCommentVNode("",!0)],10,Ao),oi.value?(vue.openBlock(),vue.createBlock(vue.Teleport,{key:0,to:"body"},[vue.withDirectives(vue.createElementVNode("div",{ref_key:"popperRef",ref:J,class:"vsTailwind vs-popover__content bottom-right w-fit fixed z-[1000]",style:vue.normalizeStyle({top:`${B.value.top}px`,left:`${B.value.left}px`}),"data-inside-popover":""},[vue.createElementVNode("div",To,[vue.createElementVNode("div",Vo,[vue.renderSlot(bt.$slots,"default")])])],4),[[vue.vShow,T.value]])])):vue.createCommentVNode("",!0)]))}});class N{static format(g){const x=g.getFullYear(),v=(g.getMonth()+1).toString().padStart(2,"0"),T=g.getDate().toString().padStart(2,"0");return`${x}-${v}-${T}`}static getShiftedDay(g,x=0){const v=g?new Date(g):new Date;return v.setDate(v.getDate()+x),this.format(v)}static getLastWeekRange(g,x,v=0){if(g&&x){const te=new Date(g),ae=new Date(x);return te.setDate(te.getDate()+v*7),ae.setDate(ae.getDate()+v*7),[this.format(te),this.format(ae)]}const T=new Date,B=T.getDay(),S=B===0?13:B-1+7,u=new Date(T);u.setDate(T.getDate()-S+v*7);const J=new Date(u);return J.setDate(u.getDate()+6),[this.format(u),this.format(J)]}static getMonthRange(g,x,v=0){let T;g?T=new Date(g):T=new Date,T=new Date(T.getFullYear(),T.getMonth()+v,1);const B=T,S=new Date(T.getFullYear(),T.getMonth()+1,0);return[this.format(B),this.format(S)]}static getQuarterRange(g,x,v=0){const T=g||x,B=T?new Date(T):new Date;let S=Math.floor(B.getMonth()/3);S+=v;const u=(S%4+4)%4*3,J=B.getFullYear()+Math.floor(S/4),te=new Date(J,u,1),ae=new Date(J,u+3,0);return[this.format(te),this.format(ae)]}static getYear(g,x=0){let v;return g&&/^\d{4}$/.test(g)?v=parseInt(g,10):g?v=new Date(g).getFullYear():v=new Date().getFullYear(),String(v+x)}static getYearRange(g,x=0){let v;return g&&/^\d{4}$/.test(g)?v=parseInt(g,10):g?v=new Date(g).getFullYear():v=new Date().getFullYear(),[this.format(new Date(v+x,0,1)),this.format(new Date(v+x+1,0,0))]}static getRangeFromDaysBefore(g){const x=new Date,v=new Date(x.getTime());return v.setDate(x.getDate()-g),[this.format(v),this.format(x)]}}const Bo={},$o={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-blue-600 w-[16px] h-[16px]"};function Do(c,g){return vue.openBlock(),vue.createElementBlock("svg",$o,g[0]||(g[0]=[vue.createElementVNode("path",{d:"M20 6 9 17l-5-5"},null,-1)]))}const oe=Z(Bo,[["render",Do]]),Fo={},No={xmlns:"http://www.w3.org/2000/svg",width:"15px",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down text-gray-800 rotate-[90deg]"};function Mo(c,g){return vue.openBlock(),vue.createElementBlock("svg",No,g[0]||(g[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Lo=Z(Fo,[["render",Mo]]),jo={},Uo={xmlns:"http://www.w3.org/2000/svg",width:"15px",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down text-gray-800 rotate-[270deg]"};function Po(c,g){return vue.openBlock(),vue.createElementBlock("svg",Uo,g[0]||(g[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Io=Z(jo,[["render",Po]]);function qo(c){return String(c).charAt(0).toUpperCase()+String(c).slice(1)}const Ho={class:"mb-1"},zo={class:"mb-1"},Ko={class:"inline-flex rounded-lg shrink-0 pl-1"},Wo={class:"inline-flex rounded-lg shrink-0 pl-1"},Jo={key:1,class:"flex gap-1 !w-[75%] rounded-lg"},Yo=["max","disabled"],Qo=["min","disabled"],Go={key:0,class:"block text-xs font-medium text-gray-600 mb-1"},Xo=["max","disabled"],Zo={key:0,class:"block text-xs font-medium text-gray-600 mb-1"},el={key:0,class:"block text-xs font-medium text-gray-600 mb-1"},tl=["min","disabled"],nl={class:"flex gap-1 pt-2"},rl=["onClick"],ol=vue.defineComponent({__name:"date-input",props:{id:{},name:{},type:{},label:{},width:{},options:{},placeHolder:{},api:{},data:{},default:{},modelValue:{},disabled:{type:Boolean},layout:{default:"inline"},cleanable:{type:Boolean},limit:{},multi:{type:Boolean},dataKey:{},valueKey:{},mode:{},labelKey:{}},emits:["update:modelValue","change","clear"],setup(c,{expose:g,emit:x}){const v=c,T=Yt(),B=vo(),S=x,u=vue.ref(null),J=vue.ref(v.modelValue??v.default??[]),te=vue.ref(""),ae=vue.ref(0);function H(){const ci=N.getRangeFromDaysBefore(ae.value);return J.value=[...ci],S("change",{name:v.name,value:J}),S("update:modelValue",J.value),ci}function Y(ci){var gi;te.value=ci,(gi=u.value)==null||gi.close();const ri=[];switch(te.value){case"today":ri.push(N.getShiftedDay()),ri.push(N.getShiftedDay());break;case"week":ri.push(...N.getLastWeekRange());break;case"month":ri.push(...N.getMonthRange());break;case"quarter":ri.push(...N.getQuarterRange());break;case"year":ri.push(...N.getYearRange());break;case"last_7_days":ae.value=7,H();break;case"range":ae.value=7,ri.push(...H());break}J.value=[...ri],S("change",{name:v.name,value:J}),S("update:modelValue",J.value)}function oi(){const ci=[];switch(te.value){case"today":ci.push(N.getShiftedDay(J.value[0],1));break;case"week":ci.push(...N.getLastWeekRange(J.value[0],J.value[1],1));break;case"month":ci.push(...N.getMonthRange(J.value[0],J.value[1],1));break;case"quarter":ci.push(...N.getQuarterRange(J.value[0],J.value[1],1));break;case"year":ci.push(...N.getYearRange(J.value[0],1));break}J.value=[...ci],S("change",{name:v.name,value:J}),S("update:modelValue",J.value)}function li(){const ci=[];switch(te.value){case"today":ci.push(N.getShiftedDay(J.value[0],-1));break;case"week":ci.push(...N.getLastWeekRange(J.value[0],J.value[1],-1));break;case"month":ci.push(...N.getMonthRange(J.value[0],J.value[1],-1));break;case"quarter":ci.push(...N.getQuarterRange(J.value[0],J.value[1],-1));break;case"year":ci.push(...N.getYearRange(J.value[0],-1));break}J.value=[...ci],S("change",{name:v.name,value:J}),S("update:modelValue",J.value)}vue.onMounted(()=>{let ci=[];if(Array.isArray(v.modelValue)?ci=v.modelValue:Array.isArray(v.default)&&(ci=v.default),ci.length===0)return;const[ri,...gi]=ci;te.value=ri;let tn=[];switch(ri){case"today":tn.push(N.getShiftedDay(gi[0]));break;case"week":tn=N.getLastWeekRange(gi[0],gi[1]);break;case"month":tn=N.getMonthRange(gi[0],gi[1]);break;case"quarter":tn=N.getQuarterRange(gi[0],gi[1]);break;case"year":tn.push(N.getYear(gi[0]));break;case"last_7_days":ae.value=Number(gi[0]??7);return;case"range":J.value=[gi[0]??"",gi[1]??""];return;default:return}J.value=[...tn],S("update:modelValue",J.value)});const bt=["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"];function mi(ci){const[ri,gi,tn]=ci.split("-");return`${tn}.${gi}.${ri}`}function Ii(ci){const{value:ri}=J;switch(ci){case"today":return mi(ri[0]);case"range":return"Період";case"week":return ri[0]&&ri[1]?`${mi(ri[0])} – ${mi(ri[1])}`:"";case"quarter":if(ri[0]){const gi=new Date(ri[0]),tn=gi.getFullYear(),Ws=gi.getMonth();return`${Math.floor(Ws/3)+1} квартал ${tn}`}return"";case"month":if(ri[0]){const[gi,tn]=ri[0].split("-");return`${bt[parseInt(tn,10)-1]} ${gi}`}return"";case"year":return ri[0]||"";case"last_7_days":return"За останні дні";default:return v.label??""}}const pi=vue.computed(()=>te.value?Ii(te.value):v.label??"");function si(){te.value="",J.value=[],S("update:modelValue",[]),S("clear",v.name)}return vue.watch(()=>v.modelValue,ci=>{ci!==void 0?(J.value=ci,S("update:modelValue",ci)):(te.value="",J.value=[])}),vue.watch(()=>J.value,ci=>{ci!==void 0&&S("update:modelValue",ci),S("change",{name:v.name,value:J.value})}),g({clear:si,popoverRef:u}),(ci,ri)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[ci.layout==="inline"?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(ci.layout!="inline"?"relative flex w-full h-auto gap-2 filter-date m-2 flex-wrap":"flex")},[vue.createVNode(Qt,{ref_key:"popoverRef",ref:u,label:pi.value,"current-value":J.value,mode:ci.mode,onClear:si,layout:ci.layout},{default:vue.withCtx(()=>[vue.createElementVNode("div",null,[vue.createElementVNode("button",{type:"button",onClick:ri[0]||(ri[0]=gi=>Y("range")),class:"flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"},[ri[11]||(ri[11]=vue.createTextVNode(" Період ")),te.value==="range"?(vue.openBlock(),vue.createBlock(oe,{key:0})):vue.createCommentVNode("",!0)])]),ri[18]||(ri[18]=vue.createElementVNode("div",null,[vue.createElementVNode("div",{class:"pt-1 mt-1 border-t"})],-1)),vue.createElementVNode("div",null,[vue.createElementVNode("button",{type:"button",onClick:ri[1]||(ri[1]=gi=>Y("today")),class:"flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"},[ri[12]||(ri[12]=vue.createTextVNode(" Сьогодні ")),te.value==="today"?(vue.openBlock(),vue.createBlock(oe,{key:0})):vue.createCommentVNode("",!0)])]),vue.createElementVNode("div",null,[vue.createElementVNode("button",{type:"button",onClick:ri[2]||(ri[2]=gi=>Y("week")),class:"flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"},[ri[13]||(ri[13]=vue.createTextVNode(" Тиждень ")),te.value==="week"?(vue.openBlock(),vue.createBlock(oe,{key:0})):vue.createCommentVNode("",!0)])]),vue.createElementVNode("div",null,[vue.createElementVNode("button",{type:"button",onClick:ri[3]||(ri[3]=gi=>Y("month")),class:"flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"},[ri[14]||(ri[14]=vue.createTextVNode(" Місяць ")),te.value==="month"?(vue.openBlock(),vue.createBlock(oe,{key:0})):vue.createCommentVNode("",!0)])]),vue.createElementVNode("div",null,[vue.createElementVNode("button",{type:"button",onClick:ri[4]||(ri[4]=gi=>Y("quarter")),class:"flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"},[ri[15]||(ri[15]=vue.createTextVNode(" Квартал ")),te.value==="quarter"?(vue.openBlock(),vue.createBlock(oe,{key:0})):vue.createCommentVNode("",!0)])]),vue.createElementVNode("div",Ho,[vue.createElementVNode("button",{type:"button",onClick:ri[5]||(ri[5]=gi=>Y("year")),class:"flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"},[ri[16]||(ri[16]=vue.createTextVNode(" Рік ")),te.value==="year"?(vue.openBlock(),vue.createBlock(oe,{key:0})):vue.createCommentVNode("",!0)])]),vue.createElementVNode("div",zo,[vue.createElementVNode("button",{type:"button",onClick:ri[6]||(ri[6]=gi=>si()),class:"flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"},[ri[17]||(ri[17]=vue.createTextVNode(" Весь час ")),J.value[0]?vue.createCommentVNode("",!0):(vue.openBlock(),vue.createBlock(oe,{key:0}))])])]),_:1,__:[18]},8,["label","current-value","mode","layout"]),te.value!==""&&te.value!=="range"&&te.value!=="last_7_days"?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[vue.createElementVNode("div",Ko,[vue.createElementVNode("button",{type:"button",title:"Попередній період",class:"inline-flex h-[38px] items-center px-2 text-sm text-gray-800 bg-gray-100 gap-x-2 -ms-px first:rounded-s-lg first:ms-0 last:rounded-e-lg focus:z-10 hover:bg-gray-200 focus:bg-gray-200 duration-300",onClick:li},[vue.createVNode(Lo)])]),vue.createElementVNode("div",Wo,[vue.createElementVNode("button",{type:"button",title:"Наступний період",class:"inline-flex h-[38px] items-center px-2 text-sm text-gray-800 gap-x-2 bg-gray-100 -ms-px first:rounded-s-lg first:ms-0 last:rounded-e-lg focus:z-10 hover:bg-gray-200 focus:bg-gray-200 duration-300",onClick:oi},[vue.createVNode(Io)])])],64)):vue.createCommentVNode("",!0),te.value!==""&&te.value==="range"?(vue.openBlock(),vue.createElementBlock("div",Jo,[vue.withDirectives(vue.createElementVNode("input",{type:"date",max:J.value[1],locale:"uk-UA","onUpdate:modelValue":ri[7]||(ri[7]=gi=>J.value[0]=gi),class:"px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600",disabled:ci.disabled},null,8,Yo),[[vue.vModelText,J.value[0]]]),vue.withDirectives(vue.createElementVNode("input",{type:"date",min:J.value[0],locale:"uk-UA","onUpdate:modelValue":ri[8]||(ri[8]=gi=>J.value[1]=gi),class:"px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600 appearance-auto",disabled:ci.disabled},null,8,Qo),[[vue.vModelText,J.value[1]]])])):vue.createCommentVNode("",!0)],2)):vue.createCommentVNode("",!0),ci.layout!=="inline"?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.createElementVNode("div",{class:vue.normalizeClass(ci.layout==="popover"?"space-y-3 p-2":"flex items-center gap-2")},[vue.createElementVNode("div",{class:vue.normalizeClass(ci.layout!=="popover"?"w-[48%]":"")},[ci.layout==="popover"?(vue.openBlock(),vue.createElementBlock("label",Go,"Від")):vue.createCommentVNode("",!0),vue.withDirectives(vue.createElementVNode("input",{type:"date",max:J.value[1],locale:"uk-UA","onUpdate:modelValue":ri[9]||(ri[9]=gi=>J.value[0]=gi),class:vue.normalizeClass(vue.unref(T)),disabled:ci.disabled},null,10,Xo),[[vue.vModelText,J.value[0]]])],2),ci.layout!=="popover"?(vue.openBlock(),vue.createElementBlock("label",Zo," - ")):vue.createCommentVNode("",!0),vue.createElementVNode("div",{class:vue.normalizeClass(ci.layout!=="popover"?"w-[48%]":"")},[ci.layout==="popover"?(vue.openBlock(),vue.createElementBlock("label",el,"До")):vue.createCommentVNode("",!0),vue.withDirectives(vue.createElementVNode("input",{type:"date",min:J.value[0],locale:"uk-UA","onUpdate:modelValue":ri[10]||(ri[10]=gi=>J.value[1]=gi),class:vue.normalizeClass(vue.unref(T)),disabled:ci.disabled},null,10,tl),[[vue.vModelText,J.value[1]]])],2)],2),vue.createElementVNode("div",nl,[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(["today","week","month","quarter","year"],gi=>vue.createElementVNode("button",{key:gi,class:vue.normalizeClass(vue.unref(B)+(te.value===gi?" bg-blue-100":"")),onClick:tn=>Y(gi)},vue.toDisplayString(vue.unref(qo)(gi)),11,rl)),64)),vue.createElementVNode("button",{class:vue.normalizeClass(vue.unref(B)),onClick:li}," < ",2),vue.createElementVNode("button",{class:vue.normalizeClass(vue.unref(B)),onClick:oi}," > ",2)])],64)):vue.createCommentVNode("",!0),(ci.cleanable,vue.createCommentVNode("",!0))],64))}}),mt={radio:pt,checkbox:qe,check:qe,text:go,range:_o,date:ol,select:pt};function Xe(c,g=!1){let x;switch(c.toLowerCase()){case"autocomplete":x="select";break;case"check":x="checkbox";break;default:x=c.toString().toLowerCase()}return["select"].includes(x)&&g?{component:qe,type:"select"}:{component:mt[x]||mt.text,type:x}}const ll={},sl={xmlns:"http://www.w3.org/2000/svg",width:"15px",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-reload absolute inline mr-1 text-gray-800 transition-all cursor-pointer active:rotate-90 right-1 top-1 hover:text-blue-500"};function al(c,g){return vue.openBlock(),vue.createElementBlock("svg",sl,g[0]||(g[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747"},null,-1),vue.createElementVNode("path",{d:"M20 4v5h-5"},null,-1)]))}const il=Z(ll,[["render",al]]),ul={style:{display:"inline-flex",margin:"0px",width:"100%"}},cl={class:"relative w-full mb-2 p-4 bg-white rounded-lg shadow-sm"},dl={class:"block mb-3 text-sm font-medium text-gray-800 dark:text-neutral-200"},fl={class:"flex items-center"},pl={class:"text-sm font-medium max-w-[80%] text-gray-800 flex items-center gap-x-1"},ml={class:"filter-layout__body"},hl=vue.defineComponent({__name:"vertical-layout",props:{id:{},name:{},type:{},label:{},width:{},options:{},placeHolder:{},api:{},data:{},default:{},modelValue:{},disabled:{type:Boolean},layout:{},cleanable:{type:Boolean},limit:{},multi:{type:Boolean},dataKey:{},valueKey:{},mode:{},labelKey:{}},emits:["update:modelValue","change","clear"],setup(c,{expose:g,emit:x}){const v=c,T=x,B=vue.ref(),S=Xe(v.type,v.multi),u=vue.computed({get:()=>v.modelValue,set:H=>T("update:modelValue",H)});function J(H){T("clear",H)}function te(H,Y){T("change",{name:H,value:Y}),v.modelValue!==void 0&&T("update:modelValue",Y)}function ae(){B.value&&B.value.clear(),T("clear",v.name)}return vue.watch(()=>v.default,H=>{u.value=H}),vue.watch(()=>v.modelValue,H=>{u.value=H}),g({filterRef:B}),(H,Y)=>{var oi,li;return vue.openBlock(),vue.createElementBlock("div",ul,[vue.createElementVNode("div",cl,[vue.createElementVNode("div",dl,[vue.createElementVNode("div",fl,[vue.createElementVNode("span",pl,vue.toDisplayString(H.label),1)]),typeof u.value=="string"&&u.value.trim()!==""||Array.isArray(u.value)&&u.value.length>0&&u.value.some(bt=>bt!=null&&String(bt).trim()!=="")?(vue.openBlock(),vue.createBlock(il,{key:0,onClick:ae})):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",ml,[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent((oi=vue.unref(S))==null?void 0:oi.component),vue.mergeProps(v,{type:(li=vue.unref(S))==null?void 0:li.type,onChange:Y[0]||(Y[0]=bt=>te(bt.name,bt.value)),onClear:Y[1]||(Y[1]=bt=>J(bt)),ref_key:"filterRef",ref:B}),null,16,["type"]))])])])}}}),ht=vue.defineComponent({__name:"inline-layout",props:{id:{},name:{},type:{},label:{},width:{},options:{},placeHolder:{},api:{},data:{},default:{},modelValue:{},disabled:{type:Boolean},layout:{},cleanable:{type:Boolean},limit:{},multi:{type:Boolean},dataKey:{},valueKey:{},mode:{},labelKey:{}},emits:["update:modelValue","change","clear"],setup(c,{expose:g,emit:x}){const v=c,T=x,B=vue.ref(),S=Xe(v.type,v.multi),u=vue.computed({get:()=>v.modelValue,set:H=>T("update:modelValue",H)});function J(H){T("clear",H)}function te(H,Y){T("change",{name:H,value:Y}),v.modelValue!==void 0&&T("update:modelValue",Y)}function ae(){B.value&&B.value.clear(),T("clear",v.name)}return vue.watch(()=>v.default,H=>{u.value=H}),vue.watch(()=>v.modelValue,H=>{u.value=H}),g({filterRef:B}),(H,Y)=>{var oi,li;return["text","date"].includes(H.type.toLocaleLowerCase())?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent((oi=vue.unref(S))==null?void 0:oi.component),vue.mergeProps({key:0},v,{type:(li=vue.unref(S))==null?void 0:li.type,onChange:Y[0]||(Y[0]=bt=>te(bt.name,bt.value)),onClear:Y[1]||(Y[1]=bt=>J(bt)),disabled:H.disabled}),null,16,["type","disabled"])):(vue.openBlock(),vue.createBlock(Qt,{key:1,"current-value":u.value,label:H.label,mode:H.mode,onClear:ae,fieldRef:B.value,width:v.width,disabled:H.disabled,layout:"inline"},{default:vue.withCtx(()=>{var bt,mi;return[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent((bt=vue.unref(S))==null?void 0:bt.component),vue.mergeProps({ref_key:"filterRef",ref:B},v,{type:(mi=vue.unref(S))==null?void 0:mi.type,onChange:Y[2]||(Y[2]=Ii=>te(Ii.name,Ii.value)),onClear:Y[3]||(Y[3]=Ii=>J(Ii))}),null,16,["type"]))]}),_:1},8,["current-value","label","mode","fieldRef","width","disabled"]))}}}),yl=vue.defineComponent({__name:"popover-layout",props:{id:{},name:{},type:{},label:{},width:{},options:{},placeHolder:{},api:{},data:{},default:{},modelValue:{},disabled:{type:Boolean},layout:{},cleanable:{type:Boolean},limit:{},multi:{type:Boolean},dataKey:{},valueKey:{},mode:{},labelKey:{}},emits:["update:modelValue","change","clear"],setup(c,{expose:g,emit:x}){const v=c,T=x,B=vue.ref(),S=vue.ref(Xe(v.type,v.multi)),u=vue.computed({get:()=>v.modelValue,set:ae=>T("update:modelValue",ae)});function J(ae){T("clear",ae)}function te(ae,H){T("change",{name:ae,value:H}),v.modelValue!==void 0&&T("update:modelValue",H)}return vue.watch(()=>v.default,ae=>{u.value=ae}),vue.watch(()=>v.modelValue,ae=>{u.value=ae}),vue.watch(()=>v,ae=>{u.value=ae}),g({filterRef:B}),(ae,H)=>{var Y,oi;return vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent((Y=S.value)==null?void 0:Y.component),vue.mergeProps(v,{type:(oi=S.value)==null?void 0:oi.type,modelValue:u.value,"onUpdate:modelValue":H[0]||(H[0]=li=>u.value=li),onChange:H[1]||(H[1]=li=>te(li.name,li.value)),onClear:H[2]||(H[2]=li=>J(li)),ref_key:"filterRef",ref:B}),null,16,["type","modelValue"])}}}),ce=vue.defineComponent({__name:"filter-field",props:{id:{},name:{},type:{},label:{},width:{},options:{default:()=>[]},placeHolder:{},api:{},data:{},default:{},modelValue:{},disabled:{type:Boolean,default:!1},layout:{default:"inline"},cleanable:{type:Boolean},limit:{default:10},multi:{type:Boolean,default:!0},dataKey:{},valueKey:{},mode:{},labelKey:{}},emits:["update:modelValue","change","clear"],setup(c,{expose:g,emit:x}){const v=c,T=x,B=vue.ref(),S=vue.computed({get:()=>v.modelValue,set:ae=>T("update:modelValue",ae)});function u(ae){T("clear",ae)}function J(ae,H){T("change",{name:ae,value:H}),v.modelValue!==void 0&&T("update:modelValue",H)}vue.watch(()=>v.default,ae=>{S.value=ae}),vue.watch(()=>v.modelValue,ae=>{S.value=ae}),g({filterRef:B});function te(){switch(v.layout){case"inline":return ht;case"vertical":return hl;case"popover":return yl;default:return ht}}return(ae,H)=>(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(te()),vue.mergeProps(v,{onChange:H[0]||(H[0]=Y=>J(Y.name,Y.value)),onClear:H[1]||(H[1]=Y=>u(Y)),modelValue:S.value,"onUpdate:modelValue":H[2]||(H[2]=Y=>S.value=Y)}),null,16,["modelValue"]))}});function Ze(c,g){const{slots:x}=c,v=vue.ref(c.value??{}),T=vue.computed(()=>{var pi;return(vue.toRaw((pi=x==null?void 0:x.default)==null?void 0:pi.call(x))??[]).flatMap(si=>Array.isArray(si.children)?si.children:[si])});function B(pi){delete v.value[pi],g("clear",{data:vue.toRaw(v.value),name:pi})}function S(pi,si){si===void 0?(B(pi),g("change",{data:vue.toRaw(v.value),name:pi,undefined:void 0})):v.value={...v.value,[pi]:si},g("change",{data:vue.toRaw(v.value),name:pi,value:si})}const u=vue.computed(()=>T.value.map(pi=>{var ci;const si=(ci=pi.props)==null?void 0:ci.name;return vue.cloneVNode(pi,{...pi.props,layout:c.view,showClean:!0,modelValue:v[si],"onUpdate:modelValue":ri=>{S(si,ri)},onClear:()=>B(si)})})),J=vue.computed(()=>new Map(u.value.map(pi=>{var ci;const si=(ci=pi.props)==null?void 0:ci.name;return si?[si,pi]:null}).filter(pi=>pi!==null)));function te(){v.value={},g("clearAll",{data:vue.toRaw(v.value),name:"ALL"})}const ae=vue.ref(""),H=vue.computed(()=>Object.values(v.value).filter(pi=>Array.isArray(pi)?pi.some(si=>si!==""&&si!==null&&si!==void 0):pi!==""&&pi!==null&&pi!==void 0).length),Y=vue.ref();vue.watch(ae,async()=>{var pi,si;await vue.nextTick(),(si=(pi=Y==null?void 0:Y.value)==null?void 0:pi.filterRef)!=null&&si.inputTextRef&&Y.value.filterRef.inputTextRef.focus()});const oi=vue.computed(()=>{var pi,si;return(pi=c.schema)!=null&&pi.value?Object.fromEntries(Object.entries((si=c.schema)==null?void 0:si.value).slice(0,c.limit)):{}}),li=vue.computed(()=>{var pi,si,ci;return(pi=c.schema)!=null&&pi.value?c.view!=="inline"?(si=c.schema)==null?void 0:si.value:Object.fromEntries(Object.entries((ci=c.schema)==null?void 0:ci.value).slice(c.limit)):{}}),bt=vue.computed(()=>{var si;if(u.value.length===0)return[];let pi=0;if((si=c.schema)!=null&&si.value){const ci=Object.entries(c.schema.value).length;ci<c.limit?pi=c.limit-ci:pi=0}return u.value.slice(0,pi)}),mi=vue.computed(()=>u.value.length===0?[]:c.view!=="inline"?u.value:u.value.slice(bt.value.length));function Ii(){if(li.value){const[pi]=Object.keys(li.value);ae.value=pi}else mi.value.length>0?ae.value=mi.value[0].props.name:ae.value=""}return{activeFilter:v,activeFilterCount:H,onFilterChange:S,clearFilter:B,clearAllFilters:te,limitedSchema:oi,popoverSchema:li,filtersSlot:u,limitedFiltersSlot:bt,popoverFiltersSlot:mi,vnodeMap:J,onPopoverOpen:Ii,selectedFilter:ae,filterRef:Y}}const gl=vue.defineComponent({__name:"popover",emits:["open","close"],setup(c,{emit:g}){const x=vue.ref(!1),v=vue.ref(null),T=vue.ref(null),B=vue.ref(null),S=vue.ref({top:"0px",left:"0px",position:"absolute"});function u(){x.value=!x.value}function J(){const Y=B.value,oi=v.value;if(!Y||!oi)return;const li=Y.getBoundingClientRect();S.value={position:"absolute",top:`${li.bottom+window.scrollY+8}px`,left:`${li.left+window.scrollX}px`}}function te(Y){var li,bt;const oi=Y.target;!((li=B.value)!=null&&li.contains(Y.target))&&!((bt=v.value)!=null&&bt.contains(Y.target))&&!oi.closest("[data-inside-popover]")&&(x.value=!1)}const ae=vue.ref(!1);vue.onMounted(()=>ae.value=!0),vue.onMounted(()=>{var Y,oi;B.value=((Y=T.value)==null?void 0:Y.querySelector("[data-popover-trigger]"))||null,(oi=B.value)==null||oi.addEventListener("click",u),document.addEventListener("click",te),window.addEventListener("resize",J),window.addEventListener("scroll",J,!0)}),vue.onBeforeUnmount(()=>{var Y;(Y=B.value)==null||Y.removeEventListener("click",u),document.removeEventListener("click",te),window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0)});const H=g;return vue.watch(x,async Y=>{Y?(await vue.nextTick(J),H("open")):H("close")}),(Y,oi)=>(vue.openBlock(),vue.createElementBlock("div",{ref_key:"wrapperRef",ref:T},[vue.renderSlot(Y.$slots,"trigger"),ae.value?(vue.openBlock(),vue.createBlock(vue.Teleport,{key:0,to:"body"},[x.value?(vue.openBlock(),vue.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:v,class:"absolute z-[50] w-[600px] rounded-md border bg-white shadow-md",style:vue.normalizeStyle(S.value)},[vue.renderSlot(Y.$slots,"default")],4)):vue.createCommentVNode("",!0)])):vue.createCommentVNode("",!0)],512))}}),bl={},vl={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-filter h-4 w-4"};function xl(c,g){return vue.openBlock(),vue.createElementBlock("svg",vl,g[0]||(g[0]=[vue.createElementVNode("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"},null,-1)]))}const wl=Z(bl,[["render",xl]]),kl={key:0,class:"inline-flex items-center rounded-full border font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent hover:bg-secondary/80 bg-blue-500 text-white text-xs px-1.5 py-0.5"},Cl={class:"flex"},Rl={class:"w-64 border-r border-gray-200"},Sl={class:"p-2"},El=["onClick"],_l={class:"flex items-center gap-2"},Al={class:"text-sm font-medium"},Ol={key:0,class:"inline-flex items-center rounded-full border font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent hover:bg-secondary/80 bg-blue-100 text-blue-700 text-xs p-2"},Tl=["onClick"],Vl={class:"flex items-center gap-2"},Bl={class:"text-sm font-medium"},$l={key:0,class:"inline-flex items-center rounded-full border font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent hover:bg-secondary/80 bg-blue-100 text-blue-700 text-xs p-2"},Dl={key:0,class:"p-2 border-t"},Fl={class:"flex-1 min-h-[300px] overflow-y-auto"},Nl={key:0,class:"flex items-center justify-center h-full text-gray-500"},Gt=vue.defineComponent({__name:"popover-filter-layout",props:{schema:{},view:{},value:{},history:{type:Boolean},mode:{},limit:{default:3}},emits:["change","clear","clearAll"],setup(c,{expose:g,emit:x}){const v=c,T=vue.useSlots(),B=x,S=vue.ref({}),{activeFilter:u,activeFilterCount:J,onFilterChange:te,clearFilter:ae,clearAllFilters:H,popoverSchema:Y,popoverFiltersSlot:oi,onPopoverOpen:li,selectedFilter:bt,filterRef:mi}=Ze({...v,schema:S,slots:T},B);return vue.watch(()=>v.schema,Ii=>{S.value=Ii},{deep:!0,immediate:!0}),g({clearFilter:ae,clearAllFilters:H}),(Ii,pi)=>(vue.openBlock(),vue.createBlock(gl,{onOpen:vue.unref(li),onClose:pi[5]||(pi[5]=si=>bt.value="")},{trigger:vue.withCtx(()=>[vue.createElementVNode("button",{"data-popover-trigger":"","aria-haspopup":"dialog","aria-expanded":"false",class:vue.normalizeClass(["ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border-input hover:bg-accent hover:text-accent-foreground border px-4 py-2 gap-2 bg-transparent h-[38px]",vue.unref(J)>0?"bg-blue-50 border-blue-200 text-blue-700 hover:bg-blue-100":"text-gray-800 hover:bg-gray-200 focus:bg-gray-200"]),type:"button"},[vue.createVNode(wl),pi[6]||(pi[6]=vue.createTextVNode(" Фільтр ")),vue.unref(J)>0?(vue.openBlock(),vue.createElementBlock("div",kl,vue.toDisplayString(vue.unref(J)),1)):vue.createCommentVNode("",!0)],2)]),default:vue.withCtx(()=>[vue.createElementVNode("div",Cl,[vue.createElementVNode("div",Rl,[pi[7]||(pi[7]=vue.createElementVNode("div",{class:"p-4 border-b"},[vue.createElementVNode("p",{class:"text-sm text-gray-600"},"Select a field to start creating a filter.")],-1)),vue.createElementVNode("div",Sl,[Ii.schema?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(Object.entries(vue.unref(Y)),([si,ci])=>(vue.openBlock(),vue.createElementBlock("button",{key:si,onClick:()=>{bt.value=si},class:vue.normalizeClass(["w-full flex items-center justify-between px-3 py-2 text-left hover:bg-gray-50 transition-colors",vue.unref(bt)===si?"bg-blue-50 text-blue-700 border-l-2 border-blue-500":""])},[vue.createElementVNode("div",_l,[vue.createElementVNode("span",Al,vue.toDisplayString(ci.label),1)]),(Array.isArray(vue.unref(u)[si])?vue.unref(u)[si].length>0:vue.unref(u)[si])?(vue.openBlock(),vue.createElementBlock("div",Ol)):vue.createCommentVNode("",!0)],10,El))),128)):vue.createCommentVNode("",!0),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(oi),(si,ci)=>{var ri;return vue.openBlock(),vue.createElementBlock("button",{key:"slot-"+ci,onClick:gi=>bt.value=si.props.name,class:vue.normalizeClass(["w-full flex items-center justify-between px-3 py-2 text-left hover:bg-gray-50 transition-colors",vue.unref(bt)===si.props.name?"bg-blue-50 text-blue-700 border-l-2 border-blue-500":""])},[vue.createElementVNode("div",Vl,[vue.createElementVNode("span",Bl,vue.toDisplayString(si.props.label),1)]),((ri=vue.unref(u)[si.props.name])==null?void 0:ri.length)>0?(vue.openBlock(),vue.createElementBlock("div",$l)):vue.createCommentVNode("",!0)],10,Tl)}),128))]),vue.unref(J)>0?(vue.openBlock(),vue.createElementBlock("div",Dl,[vue.createElementVNode("button",{class:"w-full px-3 py-2 text-left text-sm text-gray-600 hover:bg-gray-50 transition-colors",onClick:pi[0]||(pi[0]=(...si)=>vue.unref(H)&&vue.unref(H)(...si)),"data-inside-popover":""}," Очистити всі ")])):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",Fl,[vue.unref(bt)===""?(vue.openBlock(),vue.createElementBlock("div",Nl,pi[8]||(pi[8]=[vue.createElementVNode("p",{class:"text-sm"},"Select a field to start creating a filter.",-1)]))):vue.createCommentVNode("",!0),vue.unref(bt)?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.unref(Y)?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(Object.entries(vue.unref(Y)),([si,ci])=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.unref(bt)===si?(vue.openBlock(),vue.createBlock(ce,vue.mergeProps({key:0,name:si,layout:"popover",ref_for:!0,ref_key:"filterRef",ref:mi},{ref_for:!0},ci,{onChange:pi[1]||(pi[1]=ri=>vue.unref(te)(ri.name,ri.value)),onClear:pi[2]||(pi[2]=ri=>{vue.unref(ae)(ri),vue.unref(te)(ri,void 0)}),modelValue:vue.unref(u)[si],"onUpdate:modelValue":ri=>vue.unref(u)[si]=ri,cleanable:!0}),null,16,["name","modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0)],64))),256)):vue.createCommentVNode("",!0),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(oi),(si,ci)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:"slot-"+ci},[vue.unref(bt)===si.props.name?(vue.openBlock(),vue.createBlock(ce,vue.mergeProps({key:0,layout:"popover"},{ref_for:!0},si.props,{ref_for:!0,ref_key:"filterRef",ref:mi,onChange:pi[3]||(pi[3]=ri=>vue.unref(te)(ri.name,ri.value)),onClear:pi[4]||(pi[4]=ri=>{vue.unref(ae)(ri),vue.unref(te)(ri,void 0)}),modelValue:vue.unref(u)[si.props.name],"onUpdate:modelValue":ri=>vue.unref(u)[si.props.name]=ri,cleanable:!0}),null,16,["modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0)],64))),128))],64)):vue.createCommentVNode("",!0)])])]),_:1},8,["onOpen"]))}}),Ml={class:"flex gap-1 items-center flex-wrap"},yt=vue.defineComponent({__name:"inline-filter-layout",props:{schema:{},view:{},value:{},history:{type:Boolean},mode:{},limit:{default:3}},emits:["change","clear","clearAll"],setup(c,{emit:g}){const x=c,v=g,T=vue.useSlots(),B=vue.ref({}),{activeFilter:S,activeFilterCount:u,onFilterChange:J,clearFilter:te,clearAllFilters:ae,limitedSchema:H,popoverSchema:Y,filtersSlot:oi,limitedFiltersSlot:li,popoverFiltersSlot:bt}=Ze({...x,schema:B,slots:T},v),mi=vue.ref();function Ii(){console.log(mi.value),mi.value&&mi.value.clearAllFilters(),ae()}return vue.watch(()=>x.schema,pi=>{B.value=pi},{deep:!0,immediate:!0}),(pi,si)=>(vue.openBlock(),vue.createElementBlock("div",Ml,[pi.schema?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(Object.entries(vue.unref(H)),([ci,ri])=>(vue.openBlock(),vue.createBlock(ce,vue.mergeProps({key:ci,name:ci,mode:pi.mode},{ref_for:!0},ri,{onChange:si[0]||(si[0]=gi=>vue.unref(J)(gi.name,gi.value)),onClear:si[1]||(si[1]=gi=>{vue.unref(te)(gi),vue.unref(J)(gi,void 0)}),layout:"inline",cleanable:!0,modelValue:vue.unref(S)[ci],"onUpdate:modelValue":gi=>vue.unref(S)[ci]=gi}),null,16,["name","mode","modelValue","onUpdate:modelValue"]))),128)):vue.createCommentVNode("",!0),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(li),(ci,ri)=>(vue.openBlock(),vue.createBlock(ce,vue.mergeProps({key:"slot-"+ri,layout:"vertical"},{ref_for:!0},ci.props,{onChange:si[2]||(si[2]=gi=>vue.unref(J)(gi.name,gi.value)),onClear:si[3]||(si[3]=gi=>{vue.unref(te)(gi),vue.unref(J)(gi,void 0)}),cleanable:!0,modelValue:vue.unref(S)[ci.props.name],"onUpdate:modelValue":gi=>vue.unref(S)[ci.props.name]=gi}),null,16,["modelValue","onUpdate:modelValue"]))),128)),Object.entries(vue.unref(Y)).length>0||vue.unref(bt).length>0?(vue.openBlock(),vue.createBlock(Gt,vue.mergeProps({key:1},x,{onChange:si[4]||(si[4]=ci=>vue.unref(J)(ci.name,ci.value)),onClearAll:vue.unref(ae),onClear:si[5]||(si[5]=ci=>vue.unref(te)(ci.name)),ref_key:"popoverRef",ref:mi,cleanable:!0}),{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(oi),(ci,ri)=>(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(ci),vue.mergeProps({key:"slot-"+ri,layout:"inline"},{ref_for:!0},ci.props,{cleanable:!0}),null,16))),128))]),_:1},16,["onClearAll"])):vue.createCommentVNode("",!0),vue.unref(u)>0?(vue.openBlock(),vue.createElementBlock("button",{key:2,onClick:Ii,class:"relative py-2 px-3 inline-flex justify-center items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 border border-transparent text-gray-800 hover:bg-gray-200 focus:bg-gray-200"}," Очистити ")):vue.createCommentVNode("",!0)]))}}),Ll={key:0,class:"p-2 overflow-y-auto overflow-hidden [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 dark:bg-neutral-800 max-h-[calc(100%-142px)] h-full bg-gray-100"},jl={class:"flex items-center vst-filters vsTailwind flex-col w-full"},Ul=vue.defineComponent({__name:"vertical-filter-layout",props:{schema:{},view:{},value:{},history:{type:Boolean},mode:{},limit:{default:3}},emits:["change","clear","clearAll"],setup(c,{emit:g}){const x=c,v=g,T=vue.useSlots(),{activeFilter:B,activeFilterCount:S,onFilterChange:u,clearFilter:J,clearAllFilters:te,filtersSlot:ae}=Ze({...x,slots:T},v);return(H,Y)=>H.view==="vertical"?(vue.openBlock(),vue.createElementBlock("div",Ll,[vue.createElementVNode("div",jl,[vue.unref(S)>0?(vue.openBlock(),vue.createElementBlock("button",{key:0,onClick:Y[0]||(Y[0]=(...oi)=>vue.unref(te)&&vue.unref(te)(...oi)),"data-popover-trigger":"","aria-haspopup":"dialog","aria-expanded":"false",class:"w-full ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:text-accent-foreground border h-10 px-4 py-2 gap-2 m-2 bg-white text-gray-800 hover:bg-gray-200 focus:bg-gray-200",type:"button"}," Очистити ")):vue.createCommentVNode("",!0),H.schema?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:1},vue.renderList(Object.entries(H.schema),([oi,li])=>(vue.openBlock(),vue.createBlock(ce,vue.mergeProps({name:oi,layout:"vertical"},{ref_for:!0},li,{onChange:Y[1]||(Y[1]=bt=>vue.unref(u)(bt.name,bt.value)),onClear:Y[2]||(Y[2]=bt=>{vue.unref(J)(bt),vue.unref(u)(bt,void 0)}),modelValue:vue.unref(B)[oi],"onUpdate:modelValue":bt=>vue.unref(B)[oi]=bt,showClean:!0}),null,16,["name","modelValue","onUpdate:modelValue"]))),256)):vue.createCommentVNode("",!0),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(ae),(oi,li)=>(vue.openBlock(),vue.createBlock(ce,vue.mergeProps({key:"slot-"+li,layout:"vertical"},{ref_for:!0},oi.props,{onChange:Y[3]||(Y[3]=bt=>vue.unref(u)(bt.name,bt.value)),onClear:Y[4]||(Y[4]=bt=>{vue.unref(J)(bt),vue.unref(u)(bt,void 0)}),modelValue:vue.unref(B)[oi.props.name],"onUpdate:modelValue":bt=>vue.unref(B)[oi.props.name]=bt,showClean:!0}),null,16,["modelValue","onUpdate:modelValue"]))),128))])])):vue.createCommentVNode("",!0)}}),Pl=vue.defineComponent({__name:"filter",props:{schema:{},view:{default:"inline"},value:{},history:{type:Boolean},mode:{},limit:{default:3}},emits:["change","clear","clearAll"],setup(c,{emit:g}){const x=c,v=vue.ref(x.value??{}),T=g;function B(ae,H){v.value={...v.value,[ae]:H},T("change",{data:vue.toRaw(v.value),name:ae,value:H})}function S(ae){delete v.value[ae],T("clear",{data:vue.toRaw(v.value),name:ae})}function u(){v.value={},T("clear",{data:vue.toRaw(v.value),name:"ALL"}),T("change",{data:vue.toRaw(v.value),name:"ALL",value:null})}const J=vue.ref({});function te(){switch(x.view){case"inline":return yt;case"vertical":return Ul;case"popover":return Gt;default:return yt}}return vue.watch(()=>x.schema,ae=>{if(!ae){J.value={};return}Array.isArray(ae)?J.value=ae.filter(H=>H.type).reduce((H,Y)=>(Object.assign(Y,{name:Y.id||Y.name,type:Y.type.toLowerCase()}),H[Y.name]=Y,Y.data&&!Y.api&&!Y.options&&Object.assign(Y,{api:`/api/suggest/${Y.data}`}),H),{}):(Object.entries(ae).forEach(([,H])=>{Object.assign(H,{name:H.name||H.id,type:H.type.toLowerCase()})}),J.value={...ae})},{immediate:!0,deep:!0}),(ae,H)=>(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(te()),vue.mergeProps(x,{schema:J.value,onChange:H[0]||(H[0]=Y=>B(Y.name,Y.value)),onClear:H[1]||(H[1]=Y=>S(Y.name)),onClearAll:u}),{default:vue.withCtx(()=>[vue.renderSlot(ae.$slots,"default")]),_:3},16,["schema"]))}});var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var maplibreGl={exports:{}};/**
|
7
|
-
* MapLibre GL JS
|
8
|
-
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.5.2/LICENSE.txt
|
9
|
-
*/(function(c,g){(function(x,v){c.exports=v()})(commonjsGlobal,function(){var x={},v={};function T(S,u,J){if(v[S]=J,S==="index"){var te="var sharedModule = {}; ("+v.shared+")(sharedModule); ("+v.worker+")(sharedModule);",ae={};return v.shared(ae),v.index(x,ae),typeof window<"u"&&x.setWorkerUrl(window.URL.createObjectURL(new Blob([te],{type:"text/javascript"}))),x}}T("shared",["exports"],function(S){function u(i,e,r,o){return new(r||(r=Promise))(function(l,p){function f(k){try{b(o.next(k))}catch(I){p(I)}}function y(k){try{b(o.throw(k))}catch(I){p(I)}}function b(k){var I;k.done?l(k.value):(I=k.value,I instanceof r?I:new r(function(M){M(I)})).then(f,y)}b((o=o.apply(i,e||[])).next())})}function J(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var te=ae;function ae(i,e){this.x=i,this.y=e}ae.prototype={clone:function(){return new ae(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),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,e){var r=Math.cos(i),o=Math.sin(i),l=e.y+o*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ae.convert=function(i){return i instanceof ae?i:Array.isArray(i)?new ae(i[0],i[1]):i};var H=J(te),Y=oi;function oi(i,e,r,o){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*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}oi.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,o=0;o<8;o++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var p=this.sampleCurveDerivativeX(r);if(Math.abs(p)<1e-6)break;r-=l/p}var f=0,y=1;for(r=i,o=0;o<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));o++)i>l?f=r:y=r,r=.5*(y-f)+f;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var li=J(Y);let bt,mi;function Ii(){return bt==null&&(bt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),bt}function pi(){if(mi==null&&(mi=!1,Ii())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let o=0;o<5*5;o++){const l=4*o;e.fillStyle=`rgb(${l},${l+1},${l+2})`,e.fillRect(o%5,Math.floor(o/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let o=0;o<5*5*4;o++)if(o%4!=3&&r[o]!==o){mi=!0;break}}}return mi||!1}function si(i,e,r,o){const l=new li(i,e,r,o);return p=>l.solve(p)}const ci=si(.25,.1,.25,1);function ri(i,e,r){return Math.min(r,Math.max(e,i))}function gi(i,e,r){const o=r-e,l=((i-e)%o+o)%o+e;return l===e?r:l}function tn(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let Ws=1;function Ji(i,e,r){const o={};for(const l in i)o[l]=e.call(this,i[l],l,i);return o}function $s(i,e,r){const o={};for(const l in i)e.call(this,i[l],l,i)&&(o[l]=i[l]);return o}function os(i){return Array.isArray(i)?i.map(os):typeof i=="object"&&i?Ji(i,os):i}const Gc={};function Fs(i){Gc[i]||(typeof console<"u"&&console.warn(i),Gc[i]=!0)}function ca(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Xl(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let Hc=null;function Xa(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const th="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Tc(i,e,r,o,l){return u(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const p=new VideoFrame(i,{timestamp:0});try{const f=p==null?void 0:p.format;if(!f||!f.startsWith("BGR")&&!f.startsWith("RGB"))throw new Error(`Unrecognized format ${f}`);const y=f.startsWith("BGR"),b=new Uint8ClampedArray(o*l*4);if(yield p.copyTo(b,function(k,I,M,R,V){const j=4*Math.max(-I,0),q=(Math.max(0,M)-M)*R*4+j,ne=4*R,$e=Math.max(0,I),ii=Math.max(0,M);return{rect:{x:$e,y:ii,width:Math.min(k.width,I+R)-$e,height:Math.min(k.height,M+V)-ii},layout:[{offset:q,stride:ne}]}}(i,e,r,o,l)),y)for(let k=0;k<b.length;k+=4){const I=b[k];b[k]=b[k+2],b[k+2]=I}return b}finally{p.close()}})}let Jl,ma;const Fa="AbortError";function Wc(){return new Error(Fa)}const lc={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Ja(i){return lc.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const Kc="global-dispatcher";class ka extends Error{constructor(e,r,o,l){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=l}}const Oa=()=>Xl(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Cc=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const o=Ja(i.url);if(o)return o(i,e);if(Xl(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:Kc},e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(Oa())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(o,l){return u(this,void 0,void 0,function*(){const p=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,cache:o.cache,referrer:Oa(),signal:l.signal});o.type!=="json"||p.headers.has("Accept")||p.headers.set("Accept","application/json");const f=yield fetch(p);if(!f.ok){const k=yield f.blob();throw new ka(f.status,f.statusText,o.url,k)}let y;y=o.type==="arrayBuffer"||o.type==="image"?f.arrayBuffer():o.type==="json"?f.json():f.text();const b=yield y;if(l.signal.aborted)throw Wc();return{data:b,cacheControl:f.headers.get("Cache-Control"),expires:f.headers.get("Expires")}})}(i,e);if(Xl(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:Kc},e)}var r;return function(o,l){return new Promise((p,f)=>{var y;const b=new XMLHttpRequest;b.open(o.method||"GET",o.url,!0),o.type!=="arrayBuffer"&&o.type!=="image"||(b.responseType="arraybuffer");for(const k in o.headers)b.setRequestHeader(k,o.headers[k]);o.type==="json"&&(b.responseType="text",!((y=o.headers)===null||y===void 0)&&y.Accept||b.setRequestHeader("Accept","application/json")),b.withCredentials=o.credentials==="include",b.onerror=()=>{f(new Error(b.statusText))},b.onload=()=>{if(!l.signal.aborted)if((b.status>=200&&b.status<300||b.status===0)&&b.response!==null){let k=b.response;if(o.type==="json")try{k=JSON.parse(b.response)}catch(I){return void f(I)}p({data:k,cacheControl:b.getResponseHeader("Cache-Control"),expires:b.getResponseHeader("Expires")})}else{const k=new Blob([b.response],{type:b.getResponseHeader("Content-Type")});f(new ka(b.status,b.statusText,o.url,k))}},l.signal.addEventListener("abort",()=>{b.abort(),f(Wc())}),b.send(o.body)})}(i,e)};function Ac(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function xu(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Yl(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class cc{constructor(e,r={}){tn(this,r),this.type=e}}class uc extends cc{constructor(e,r={}){super("error",tn({error:e},r))}}class Xc{on(e,r){return this._listeners=this._listeners||{},xu(e,r,this._listeners),this}off(e,r){return Yl(e,r,this._listeners),Yl(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},xu(e,r,this._oneTimeListeners),this):new Promise(o=>this.once(e,o))}fire(e,r){typeof e=="string"&&(e=new cc(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const l=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const y of l)y.call(this,e);const p=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const y of p)Yl(o,y,this._oneTimeListeners),y.call(this,e);const f=this._eventedParent;f&&(tn(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),f.fire(e))}else e instanceof uc&&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 ui={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Pc=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function bu(i,e){const r={};for(const o in i)o!=="ref"&&(r[o]=i[o]);return Pc.forEach(o=>{o in e&&(r[o]=e[o])}),r}function us(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!us(i[r],e[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&e!==null){if(typeof e!="object"||Object.keys(i).length!==Object.keys(e).length)return!1;for(const r in i)if(!us(i[r],e[r]))return!1;return!0}return i===e}function Is(i,e){i.push(e)}function wu(i,e,r){Is(r,{command:"addSource",args:[i,e[i]]})}function hc(i,e,r){Is(e,{command:"removeSource",args:[i]}),r[i]=!0}function Ql(i,e,r,o){hc(i,r,o),wu(i,e,r)}function Jc(i,e,r){let o;for(o in i[r])if(Object.prototype.hasOwnProperty.call(i[r],o)&&o!=="data"&&!us(i[r][o],e[r][o]))return!1;for(o in e[r])if(Object.prototype.hasOwnProperty.call(e[r],o)&&o!=="data"&&!us(i[r][o],e[r][o]))return!1;return!0}function Da(i,e,r,o,l,p){i=i||{},e=e||{};for(const f in i)Object.prototype.hasOwnProperty.call(i,f)&&(us(i[f],e[f])||r.push({command:p,args:[o,f,e[f],l]}));for(const f in e)Object.prototype.hasOwnProperty.call(e,f)&&!Object.prototype.hasOwnProperty.call(i,f)&&(us(i[f],e[f])||r.push({command:p,args:[o,f,e[f],l]}))}function Su(i){return i.id}function ku(i,e){return i[e.id]=e,i}class Si{constructor(e,r,o,l){this.message=(e?`${e}: `:"")+o,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function Ya(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}class ua extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Qa{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,l]of r)this.bindings[o]=l}concat(e){return new Qa(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 dc={kind:"null"},Ti={kind:"number"},ts={kind:"string"},Hi={kind:"boolean"},ga={kind:"color"},Va={kind:"object"},Yi={kind:"value"},Il={kind:"collator"},ec={kind:"formatted"},pc={kind:"padding"},zl={kind:"resolvedImage"},ze={kind:"variableAnchorOffsetCollection"};function O(i,e){return{kind:"array",itemType:i,N:e}}function F(i){if(i.kind==="array"){const e=F(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const G=[dc,Ti,ts,Hi,ga,ec,Va,O(Yi),pc,zl,ze];function he(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!he(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 G)if(!he(r,e))return null}}return`Expected ${F(i)} but found ${F(e)} instead.`}function vt(i,e){return e.some(r=>r.kind===i.kind)}function Ht(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)}function ei(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const We=.96422,di=.82521,_i=4/29,ai=6/29,ki=3*ai*ai,Ui=ai*ai*ai,qi=Math.PI/180,en=180/Math.PI;function as(i){return(i%=360)<0&&(i+=360),i}function Qi([i,e,r,o]){let l,p;const f=Ms((.2225045*(i=ys(i))+.7168786*(e=ys(e))+.0606169*(r=ys(r)))/1);i===e&&e===r?l=p=f:(l=Ms((.4360747*i+.3850649*e+.1430804*r)/We),p=Ms((.0139322*i+.0971045*e+.7141733*r)/di));const y=116*f-16;return[y<0?0:y,500*(l-f),200*(f-p),o]}function ys(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ms(i){return i>Ui?Math.pow(i,1/3):i/ki+_i}function Os([i,e,r,o]){let l=(i+16)/116,p=isNaN(e)?l:l+e/500,f=isNaN(r)?l:l-r/200;return l=1*ds(l),p=We*ds(p),f=di*ds(f),[is(3.1338561*p-1.6168667*l-.4906146*f),is(-.9787684*p+1.9161415*l+.033454*f),is(.0719453*p-.2289914*l+1.4052427*f),o]}function is(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function ds(i){return i>ai?i*i*i:ki*(i-_i)}function Cs(i){return parseInt(i.padEnd(2,i),16)/255}function js(i,e){return Js(e?i/100:i,0,1)}function Js(i,e,r){return Math.min(Math.max(e,i),r)}function Ys(i){return!i.some(Number.isNaN)}const Eu={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class ps{constructor(e,r,o,l=1,p=!0){this.r=e,this.g=r,this.b=o,this.a=l,p||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,o,l]))}static parse(e){if(e instanceof ps)return e;if(typeof e!="string")return;const r=function(o){if((o=o.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=Eu[o];if(l){const[f,y,b]=l;return[f/255,y/255,b/255,1]}if(o.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)){const f=o.length<6?1:2;let y=1;return[Cs(o.slice(y,y+=f)),Cs(o.slice(y,y+=f)),Cs(o.slice(y,y+=f)),Cs(o.slice(y,y+f)||"ff")]}if(o.startsWith("rgb")){const f=o.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(f){const[y,b,k,I,M,R,V,j,q,ne,$e,ii]=f,gt=[I||" ",V||" ",ne].join("");if(gt===" "||gt===" /"||gt===",,"||gt===",,,"){const Xt=[k,R,q].join(""),hi=Xt==="%%%"?100:Xt===""?255:0;if(hi){const vi=[Js(+b/hi,0,1),Js(+M/hi,0,1),Js(+j/hi,0,1),$e?js(+$e,ii):1];if(Ys(vi))return vi}}return}}const p=o.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[f,y,b,k,I,M,R,V,j]=p,q=[b||" ",I||" ",R].join("");if(q===" "||q===" /"||q===",,"||q===",,,"){const ne=[+y,Js(+k,0,100),Js(+M,0,100),V?js(+V,j):1];if(Ys(ne))return function([$e,ii,gt,Xt]){function hi(vi){const Di=(vi+$e/30)%12,Zi=ii*Math.min(gt,1-gt);return gt-Zi*Math.max(-1,Math.min(Di-3,9-Di,1))}return $e=as($e),ii/=100,gt/=100,[hi(0),hi(8),hi(4),Xt]}(ne)}}}(e);return r?new ps(...r,!1):void 0}get rgb(){const{r:e,g:r,b:o,a:l}=this,p=l||1/0;return this.overwriteGetter("rgb",[e/p,r/p,o/p,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,o,l,p]=Qi(e),f=Math.sqrt(o*o+l*l);return[Math.round(1e4*f)?as(Math.atan2(l,o)*en):NaN,f,r,p]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Qi(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,o,l]=this.rgb;return`rgba(${[e,r,o].map(p=>Math.round(255*p)).join(",")},${l})`}}ps.black=new ps(0,0,0,1),ps.white=new ps(1,1,1,1),ps.transparent=new ps(0,0,0,0),ps.red=new ps(1,0,0,1);class Kh{constructor(e,r,o){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=o,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 Xh{constructor(e,r,o,l,p){this.text=e,this.image=r,this.scale=o,this.fontStack=l,this.textColor=p}}class Ea{constructor(e){this.sections=e}static fromString(e){return new Ea([new Xh(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 Ea?e:Ea.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Ta{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ta)return e;if(typeof e=="number")return new Ta([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 Ta(e)}}toString(){return JSON.stringify(this.values)}}const yf=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ca{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ca)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const o=e[r],l=e[r+1];if(typeof o!="string"||!yf.has(o)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new Ca(e)}}toString(){return JSON.stringify(this.values)}}class Qs{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Qs({name:e,available:!1}):null}}function ih(i,e,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,e,r,o]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Tu(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof ps||i instanceof Kh||i instanceof Ea||i instanceof Ta||i instanceof Ca||i instanceof Qs)return!0;if(Array.isArray(i)){for(const e of i)if(!Tu(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Tu(i[e]))return!1;return!0}return!1}function Vs(i){if(i===null)return dc;if(typeof i=="string")return ts;if(typeof i=="boolean")return Hi;if(typeof i=="number")return Ti;if(i instanceof ps)return ga;if(i instanceof Kh)return Il;if(i instanceof Ea)return ec;if(i instanceof Ta)return pc;if(i instanceof Ca)return ze;if(i instanceof Qs)return zl;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const l=Vs(o);if(r){if(r===l)continue;r=Yi;break}r=l}return O(r||Yi,e)}return Va}function tc(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof ps||i instanceof Ea||i instanceof Ta||i instanceof Ca||i instanceof Qs?i.toString():JSON.stringify(i)}class Ic{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(!Tu(e[1]))return r.error("invalid value");const o=e[1];let l=Vs(o);const p=r.expectedType;return l.kind!=="array"||l.N!==0||!p||p.kind!=="array"||typeof p.N=="number"&&p.N!==0||(l=p),new Ic(l,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Rs{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const rh={string:ts,number:Ti,boolean:Hi,object:Va};class Ba{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 o,l=1;const p=e[0];if(p==="array"){let y,b;if(e.length>2){const k=e[1];if(typeof k!="string"||!(k in rh)||k==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);y=rh[k],l++}else y=Yi;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);b=e[2],l++}o=O(y,b)}else{if(!rh[p])throw new Error(`Types doesn't contain name = ${p}`);o=rh[p]}const f=[];for(;l<e.length;l++){const y=r.parse(e[l],l,Yi);if(!y)return null;f.push(y)}return new Ba(o,f)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!he(this.type,Vs(o)))return o;if(r===this.args.length-1)throw new Rs(`Expected value to be of type ${F(this.type)}, but found ${F(Vs(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Cu={"to-boolean":Hi,"to-color":ga,"to-number":Ti,"to-string":ts};class fc{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 o=e[0];if(!Cu[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=Cu[o],p=[];for(let f=1;f<e.length;f++){const y=r.parse(e[f],f,Yi);if(!y)return null;p.push(y)}return new fc(l,p)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,o;for(const l of this.args){if(r=l.evaluate(e),o=null,r instanceof ps)return r;if(typeof r=="string"){const p=e.parseColor(r);if(p)return p}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ih(r[0],r[1],r[2],r[3]),!o))return new ps(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Rs(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const o of this.args){r=o.evaluate(e);const l=Ta.parse(r);if(l)return l}throw new Rs(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const o of this.args){r=o.evaluate(e);const l=Ca.parse(r);if(l)return l}throw new Rs(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Rs(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ea.fromString(tc(this.args[0].evaluate(e)));case"resolvedImage":return Qs.fromString(tc(this.args[0].evaluate(e)));default:return tc(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Jh=["Unknown","Point","LineString","Polygon"];class Au{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"?Jh[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]=ps.parse(e)),r}}class mc{constructor(e,r,o=[],l,p=new Qa,f=[]){this.registry=e,this.path=o,this.key=o.map(y=>`[${y}]`).join(""),this.scope=p,this.errors=f,this.expectedType=l,this._isConstant=r}parse(e,r,o,l,p={}){return r?this.concat(r,o,l)._parse(e,p):this._parse(e,p)}_parse(e,r){function o(l,p,f){return f==="assert"?new Ba(p,[l]):f==="coerce"?new fc(p,[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 p=this.registry[l];if(p){let f=p.parse(e,this);if(!f)return null;if(this.expectedType){const y=this.expectedType,b=f.type;if(y.kind!=="string"&&y.kind!=="number"&&y.kind!=="boolean"&&y.kind!=="object"&&y.kind!=="array"||b.kind!=="value")if(y.kind!=="color"&&y.kind!=="formatted"&&y.kind!=="resolvedImage"||b.kind!=="value"&&b.kind!=="string")if(y.kind!=="padding"||b.kind!=="value"&&b.kind!=="number"&&b.kind!=="array")if(y.kind!=="variableAnchorOffsetCollection"||b.kind!=="value"&&b.kind!=="array"){if(this.checkSubtype(y,b))return null}else f=o(f,y,r.typeAnnotation||"coerce");else f=o(f,y,r.typeAnnotation||"coerce");else f=o(f,y,r.typeAnnotation||"coerce");else f=o(f,y,r.typeAnnotation||"assert")}if(!(f instanceof Ic)&&f.type.kind!=="resolvedImage"&&this._isConstant(f)){const y=new Au;try{f=new Ic(f.type,f.evaluate(y))}catch(b){return this.error(b.message),null}}return f}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,o){const l=typeof e=="number"?this.path.concat(e):this.path,p=o?this.scope.concat(o):this.scope;return new mc(this.registry,this._isConstant,l,r||null,p,this.errors)}error(e,...r){const o=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new ua(o,e))}checkSubtype(e,r){const o=he(e,r);return o&&this.error(o),o}}class hs{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 o=[];for(let p=1;p<e.length-1;p+=2){const f=e[p];if(typeof f!="string")return r.error(`Expected string, but found ${typeof f} instead.`,p);if(/[^a-zA-Z0-9_]/.test(f))return r.error("Variable names must contain only alphanumeric characters or '_'.",p);const y=r.parse(e[p+1],p+1);if(!y)return null;o.push([f,y])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return l?new hs(o,l):null}outputDefined(){return this.result.outputDefined()}}class nh{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 o=e[1];return r.scope.has(o)?new nh(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Yh{constructor(e,r,o){this.type=e,this.index=r,this.input=o}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Ti),l=r.parse(e[2],2,O(r.expectedType||Yi));return o&&l?new Yh(l.type.itemType,o,l):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new Rs(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new Rs(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new Rs(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Pu{constructor(e,r){this.type=Hi,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 o=r.parse(e[1],1,Yi),l=r.parse(e[2],2,Yi);return o&&l?vt(o.type,[Hi,ts,Ti,dc,Yi])?new Pu(o,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Ht(r,["boolean","string","number","null"]))throw new Rs(`Expected first argument to be of type boolean, string, number or null, but found ${F(Vs(r))} instead.`);if(!Ht(o,["string","array"]))throw new Rs(`Expected second argument to be of type array or string, but found ${F(Vs(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class oh{constructor(e,r,o){this.type=Ti,this.needle=e,this.haystack=r,this.fromIndex=o}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 o=r.parse(e[1],1,Yi),l=r.parse(e[2],2,Yi);if(!o||!l)return null;if(!vt(o.type,[Hi,ts,Ti,dc,Yi]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(o.type)} instead`);if(e.length===4){const p=r.parse(e[3],3,Ti);return p?new oh(o,l,p):null}return new oh(o,l)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Ht(r,["boolean","string","number","null"]))throw new Rs(`Expected first argument to be of type boolean, string, number or null, but found ${F(Vs(r))} instead.`);if(!Ht(o,["string","array"]))throw new Rs(`Expected second argument to be of type array or string, but found ${F(Vs(o))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return o.indexOf(r,l)}return o.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class sh{constructor(e,r,o,l,p,f){this.inputType=e,this.type=r,this.input=o,this.cases=l,this.outputs=p,this.otherwise=f}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 o,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const p={},f=[];for(let k=2;k<e.length-1;k+=2){let I=e[k];const M=e[k+1];Array.isArray(I)||(I=[I]);const R=r.concat(k);if(I.length===0)return R.error("Expected at least one branch label.");for(const j of I){if(typeof j!="number"&&typeof j!="string")return R.error("Branch labels must be numbers or strings.");if(typeof j=="number"&&Math.abs(j)>Number.MAX_SAFE_INTEGER)return R.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof j=="number"&&Math.floor(j)!==j)return R.error("Numeric branch labels must be integer values.");if(o){if(R.checkSubtype(o,Vs(j)))return null}else o=Vs(j);if(p[String(j)]!==void 0)return R.error("Branch labels must be unique.");p[String(j)]=f.length}const V=r.parse(M,k,l);if(!V)return null;l=l||V.type,f.push(V)}const y=r.parse(e[1],1,Yi);if(!y)return null;const b=r.parse(e[e.length-1],e.length-1,l);return b?y.type.kind!=="value"&&r.concat(1).checkSubtype(o,y.type)?null:new sh(o,l,y,p,f,b):null}evaluate(e){const r=this.input.evaluate(e);return(Vs(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 ah{constructor(e,r,o){this.type=e,this.branches=r,this.otherwise=o}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 o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const l=[];for(let f=1;f<e.length-1;f+=2){const y=r.parse(e[f],f,Hi);if(!y)return null;const b=r.parse(e[f+1],f+1,o);if(!b)return null;l.push([y,b]),o=o||b.type}const p=r.parse(e[e.length-1],e.length-1,o);if(!p)return null;if(!o)throw new Error("Can't infer output type");return new ah(o,l,p)}evaluate(e){for(const[r,o]of this.branches)if(r.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,o]of this.branches)e(r),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class lh{constructor(e,r,o,l){this.type=e,this.input=r,this.beginIndex=o,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 o=r.parse(e[1],1,Yi),l=r.parse(e[2],2,Ti);if(!o||!l)return null;if(!vt(o.type,[O(Yi),ts,Yi]))return r.error(`Expected first argument to be of type array or string, but found ${F(o.type)} instead`);if(e.length===4){const p=r.parse(e[3],3,Ti);return p?new lh(o.type,o,l,p):null}return new lh(o.type,o,l)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Ht(r,["string","array"]))throw new Rs(`Expected first argument to be of type array or string, but found ${F(Vs(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(o,l)}return r.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Iu(i,e){const r=i.length-1;let o,l,p=0,f=r,y=0;for(;p<=f;)if(y=Math.floor((p+f)/2),o=i[y],l=i[y+1],o<=e){if(y===r||e<l)return y;p=y+1}else{if(!(o>e))throw new Rs("Input is not a number.");f=y-1}return 0}class Yc{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,p]of o)this.labels.push(l),this.outputs.push(p)}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 o=r.parse(e[1],1,Ti);if(!o)return null;const l=[];let p=null;r.expectedType&&r.expectedType.kind!=="value"&&(p=r.expectedType);for(let f=1;f<e.length;f+=2){const y=f===1?-1/0:e[f],b=e[f+1],k=f,I=f+1;if(typeof y!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',k);if(l.length&&l[l.length-1][0]>=y)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',k);const M=r.parse(b,I,p);if(!M)return null;p=p||M.type,l.push([y,M])}return new Yc(p,o,l)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return o[0].evaluate(e);const p=r.length;return l>=r[p-1]?o[p-1].evaluate(e):o[Iu(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 _f(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var vf=hp;function hp(i,e,r,o){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*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}hp.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,o=0;o<8;o++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var p=this.sampleCurveDerivativeX(r);if(Math.abs(p)<1e-6)break;r-=l/p}var f=0,y=1;for(r=i,o=0;o<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));o++)i>l?f=r:y=r,r=.5*(y-f)+f;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var xf=_f(vf);function gc(i,e,r){return i+r*(e-i)}function Mu(i,e,r){return i.map((o,l)=>gc(o,e[l],r))}const Aa={number:gc,color:function(i,e,r,o="rgb"){switch(o){case"rgb":{const[l,p,f,y]=Mu(i.rgb,e.rgb,r);return new ps(l,p,f,y,!1)}case"hcl":{const[l,p,f,y]=i.hcl,[b,k,I,M]=e.hcl;let R,V;if(isNaN(l)||isNaN(b))isNaN(l)?isNaN(b)?R=NaN:(R=b,f!==1&&f!==0||(V=k)):(R=l,I!==1&&I!==0||(V=p));else{let ii=b-l;b>l&&ii>180?ii-=360:b<l&&l-b>180&&(ii+=360),R=l+r*ii}const[j,q,ne,$e]=function([ii,gt,Xt,hi]){return ii=isNaN(ii)?0:ii*qi,Os([Xt,Math.cos(ii)*gt,Math.sin(ii)*gt,hi])}([R,V??gc(p,k,r),gc(f,I,r),gc(y,M,r)]);return new ps(j,q,ne,$e,!1)}case"lab":{const[l,p,f,y]=Os(Mu(i.lab,e.lab,r));return new ps(l,p,f,y,!1)}}},array:Mu,padding:function(i,e,r){return new Ta(Mu(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const o=i.values,l=e.values;if(o.length!==l.length)throw new Rs(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const p=[];for(let f=0;f<o.length;f+=2){if(o[f]!==l[f])throw new Rs(`Cannot interpolate values containing mismatched anchors. from[${f}]: ${o[f]}, to[${f}]: ${l[f]}`);p.push(o[f]);const[y,b]=o[f+1],[k,I]=l[f+1];p.push([gc(y,k,r),gc(b,I,r)])}return new Ca(p)}};class Pa{constructor(e,r,o,l,p){this.type=e,this.operator=r,this.interpolation=o,this.input=l,this.labels=[],this.outputs=[];for(const[f,y]of p)this.labels.push(f),this.outputs.push(y)}static interpolationFactor(e,r,o,l){let p=0;if(e.name==="exponential")p=zu(r,e.base,o,l);else if(e.name==="linear")p=zu(r,1,o,l);else if(e.name==="cubic-bezier"){const f=e.controlPoints;p=new xf(f[0],f[1],f[2],f[3]).solve(zu(r,1,o,l))}return p}static parse(e,r){let[o,l,p,...f]=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 k=l[1];if(typeof k!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:k}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const k=l.slice(1);if(k.length!==4||k.some(I=>typeof I!="number"||I<0||I>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:k}}}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(p=r.parse(p,2,Ti),!p)return null;const y=[];let b=null;o==="interpolate-hcl"||o==="interpolate-lab"?b=ga:r.expectedType&&r.expectedType.kind!=="value"&&(b=r.expectedType);for(let k=0;k<f.length;k+=2){const I=f[k],M=f[k+1],R=k+3,V=k+4;if(typeof I!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',R);if(y.length&&y[y.length-1][0]>=I)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',R);const j=r.parse(M,V,b);if(!j)return null;b=b||j.type,y.push([I,j])}return ei(b,Ti)||ei(b,ga)||ei(b,pc)||ei(b,ze)||ei(b,O(Ti))?new Pa(b,o,l,p,y):r.error(`Type ${F(b)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return o[0].evaluate(e);const p=r.length;if(l>=r[p-1])return o[p-1].evaluate(e);const f=Iu(r,l),y=Pa.interpolationFactor(this.interpolation,l,r[f],r[f+1]),b=o[f].evaluate(e),k=o[f+1].evaluate(e);switch(this.operator){case"interpolate":return Aa[this.type.kind](b,k,y);case"interpolate-hcl":return Aa.color(b,k,y,"hcl");case"interpolate-lab":return Aa.color(b,k,y,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function zu(i,e,r,o){const l=o-r,p=i-r;return l===0?0:e===1?p/l:(Math.pow(e,p)-1)/(Math.pow(e,l)-1)}class ch{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 o=null;const l=r.expectedType;l&&l.kind!=="value"&&(o=l);const p=[];for(const y of e.slice(1)){const b=r.parse(y,1+p.length,o,void 0,{typeAnnotation:"omit"});if(!b)return null;o=o||b.type,p.push(b)}if(!o)throw new Error("No output type");const f=l&&p.some(y=>he(l,y.type));return new ch(f?Yi:o,p)}evaluate(e){let r,o=null,l=0;for(const p of this.args)if(l++,o=p.evaluate(e),o&&o instanceof Qs&&!o.available&&(r||(r=o.name),o=null,l===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function dp(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 pp(i,e,r,o){return o.compare(e,r)===0}function Mc(i,e,r){const o=i!=="=="&&i!=="!=";return class uy{constructor(p,f,y){this.type=Hi,this.lhs=p,this.rhs=f,this.collator=y,this.hasUntypedArgument=p.type.kind==="value"||f.type.kind==="value"}static parse(p,f){if(p.length!==3&&p.length!==4)return f.error("Expected two or three arguments.");const y=p[0];let b=f.parse(p[1],1,Yi);if(!b)return null;if(!dp(y,b.type))return f.concat(1).error(`"${y}" comparisons are not supported for type '${F(b.type)}'.`);let k=f.parse(p[2],2,Yi);if(!k)return null;if(!dp(y,k.type))return f.concat(2).error(`"${y}" comparisons are not supported for type '${F(k.type)}'.`);if(b.type.kind!==k.type.kind&&b.type.kind!=="value"&&k.type.kind!=="value")return f.error(`Cannot compare types '${F(b.type)}' and '${F(k.type)}'.`);o&&(b.type.kind==="value"&&k.type.kind!=="value"?b=new Ba(k.type,[b]):b.type.kind!=="value"&&k.type.kind==="value"&&(k=new Ba(b.type,[k])));let I=null;if(p.length===4){if(b.type.kind!=="string"&&k.type.kind!=="string"&&b.type.kind!=="value"&&k.type.kind!=="value")return f.error("Cannot use collator to compare non-string types.");if(I=f.parse(p[3],3,Il),!I)return null}return new uy(b,k,I)}evaluate(p){const f=this.lhs.evaluate(p),y=this.rhs.evaluate(p);if(o&&this.hasUntypedArgument){const b=Vs(f),k=Vs(y);if(b.kind!==k.kind||b.kind!=="string"&&b.kind!=="number")throw new Rs(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${b.kind}, ${k.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const b=Vs(f),k=Vs(y);if(b.kind!=="string"||k.kind!=="string")return e(p,f,y)}return this.collator?r(p,f,y,this.collator.evaluate(p)):e(p,f,y)}eachChild(p){p(this.lhs),p(this.rhs),this.collator&&p(this.collator)}outputDefined(){return!0}}}const fp=Mc("==",function(i,e,r){return e===r},pp),bf=Mc("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!pp(0,e,r,o)}),wf=Mc("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),mp=Mc(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),gp=Mc("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),Sf=Mc(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class uh{constructor(e,r,o){this.type=Il,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const l=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,Hi);if(!l)return null;const p=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,Hi);if(!p)return null;let f=null;return o.locale&&(f=r.parse(o.locale,1,ts),!f)?null:new uh(l,p,f)}evaluate(e){return new Kh(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Qh{constructor(e,r,o,l,p){this.type=ts,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=l,this.maxFractionDigits=p}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Ti);if(!o)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let p=null;if(l.locale&&(p=r.parse(l.locale,1,ts),!p))return null;let f=null;if(l.currency&&(f=r.parse(l.currency,1,ts),!f))return null;let y=null;if(l["min-fraction-digits"]&&(y=r.parse(l["min-fraction-digits"],1,Ti),!y))return null;let b=null;return l["max-fraction-digits"]&&(b=r.parse(l["max-fraction-digits"],1,Ti),!b)?null:new Qh(o,p,f,y,b)}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 hh{constructor(e){this.type=ec,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const l=[];let p=!1;for(let f=1;f<=e.length-1;++f){const y=e[f];if(p&&typeof y=="object"&&!Array.isArray(y)){p=!1;let b=null;if(y["font-scale"]&&(b=r.parse(y["font-scale"],1,Ti),!b))return null;let k=null;if(y["text-font"]&&(k=r.parse(y["text-font"],1,O(ts)),!k))return null;let I=null;if(y["text-color"]&&(I=r.parse(y["text-color"],1,ga),!I))return null;const M=l[l.length-1];M.scale=b,M.font=k,M.textColor=I}else{const b=r.parse(e[f],1,Yi);if(!b)return null;const k=b.type.kind;if(k!=="string"&&k!=="value"&&k!=="null"&&k!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");p=!0,l.push({content:b,scale:null,font:null,textColor:null})}}return new hh(l)}evaluate(e){return new Ea(this.sections.map(r=>{const o=r.content.evaluate(e);return Vs(o)===zl?new Xh("",o,null,null,null):new Xh(tc(o),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 ed{constructor(e){this.type=zl,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,ts);return o?new ed(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=Qs.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class td{constructor(e){this.type=Ti,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=r.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${F(o.type)} instead.`):new td(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Rs(`Expected value to be of type string or array, but found ${F(Vs(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ql=8192;function rd(i,e){const r=(180+i[0])/360,o=(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*ql),Math.round(o*l*ql)]}function Qc(i,e){const r=Math.pow(2,e.z);return[(l=(i[0]/ql+e.x)/r,360*l-180),(o=(i[1]/ql+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*o)*Math.PI/180))-90)];var o,l}function ss(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Du(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function kf(i,e,r){const o=i[0]-e[0],l=i[1]-e[1],p=i[0]-r[0],f=i[1]-r[1];return o*f-p*l==0&&o*p<=0&&l*f<=0}function dh(i,e,r,o){return(l=[o[0]-r[0],o[1]-r[1]])[0]*(p=[e[0]-i[0],e[1]-i[1]])[1]-l[1]*p[0]!=0&&!(!_p(i,e,r,o)||!_p(r,o,i,e));var l,p}function Ef(i,e,r){for(const o of r)for(let l=0;l<o.length-1;++l)if(dh(i,e,o[l],o[l+1]))return!0;return!1}function eu(i,e,r=!1){let o=!1;for(const y of e)for(let b=0;b<y.length-1;b++){if(kf(i,y[b],y[b+1]))return r;(p=y[b])[1]>(l=i)[1]!=(f=y[b+1])[1]>l[1]&&l[0]<(f[0]-p[0])*(l[1]-p[1])/(f[1]-p[1])+p[0]&&(o=!o)}var l,p,f;return o}function Tf(i,e){for(const r of e)if(eu(i,r))return!0;return!1}function yp(i,e){for(const r of i)if(!eu(r,e))return!1;for(let r=0;r<i.length-1;++r)if(Ef(i[r],i[r+1],e))return!1;return!0}function Cf(i,e){for(const r of e)if(yp(i,r))return!0;return!1}function _p(i,e,r,o){const l=o[0]-r[0],p=o[1]-r[1],f=(i[0]-r[0])*p-l*(i[1]-r[1]),y=(e[0]-r[0])*p-l*(e[1]-r[1]);return f>0&&y<0||f<0&&y>0}function nd(i,e,r){const o=[];for(let l=0;l<i.length;l++){const p=[];for(let f=0;f<i[l].length;f++){const y=rd(i[l][f],r);ss(e,y),p.push(y)}o.push(p)}return o}function vp(i,e,r){const o=[];for(let l=0;l<i.length;l++){const p=nd(i[l],e,r);o.push(p)}return o}function xp(i,e,r,o){if(i[0]<r[0]||i[0]>r[2]){const l=.5*o;let p=i[0]-r[0]>l?-o:r[0]-i[0]>l?o:0;p===0&&(p=i[0]-r[2]>l?-o:r[2]-i[0]>l?o:0),i[0]+=p}ss(e,i)}function bp(i,e,r,o){const l=Math.pow(2,o.z)*ql,p=[o.x*ql,o.y*ql],f=[];for(const y of i)for(const b of y){const k=[b.x+p[0],b.y+p[1]];xp(k,e,r,l),f.push(k)}return f}function wp(i,e,r,o){const l=Math.pow(2,o.z)*ql,p=[o.x*ql,o.y*ql],f=[];for(const b of i){const k=[];for(const I of b){const M=[I.x+p[0],I.y+p[1]];ss(e,M),k.push(M)}f.push(k)}if(e[2]-e[0]<=l/2){(y=e)[0]=y[1]=1/0,y[2]=y[3]=-1/0;for(const b of f)for(const k of b)xp(k,e,r,l)}var y;return f}class zc{constructor(e,r){this.type=Hi,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(Tu(e[1])){const o=e[1];if(o.type==="FeatureCollection"){const l=[];for(const p of o.features){const{type:f,coordinates:y}=p.geometry;f==="Polygon"&&l.push(y),f==="MultiPolygon"&&l.push(...y)}if(l.length)return new zc(o,{type:"MultiPolygon",coordinates:l})}else if(o.type==="Feature"){const l=o.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new zc(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new zc(o,o)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,o){const l=[1/0,1/0,-1/0,-1/0],p=[1/0,1/0,-1/0,-1/0],f=r.canonicalID();if(o.type==="Polygon"){const y=nd(o.coordinates,p,f),b=bp(r.geometry(),l,p,f);if(!Du(l,p))return!1;for(const k of b)if(!eu(k,y))return!1}if(o.type==="MultiPolygon"){const y=vp(o.coordinates,p,f),b=bp(r.geometry(),l,p,f);if(!Du(l,p))return!1;for(const k of b)if(!Tf(k,y))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const l=[1/0,1/0,-1/0,-1/0],p=[1/0,1/0,-1/0,-1/0],f=r.canonicalID();if(o.type==="Polygon"){const y=nd(o.coordinates,p,f),b=wp(r.geometry(),l,p,f);if(!Du(l,p))return!1;for(const k of b)if(!yp(k,y))return!1}if(o.type==="MultiPolygon"){const y=vp(o.coordinates,p,f),b=wp(r.geometry(),l,p,f);if(!Du(l,p))return!1;for(const k of b)if(!Cf(k,y))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Sp=class{constructor(i=[],e=Af){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:r}=this,o=e[i];for(;i>0;){const l=i-1>>1,p=e[l];if(r(o,p)>=0)break;e[i]=p,i=l}e[i]=o}_down(i){const{data:e,compare:r}=this,o=this.length>>1,l=e[i];for(;i<o;){let p=1+(i<<1),f=e[p];const y=p+1;if(y<this.length&&r(e[y],f)<0&&(p=y,f=e[y]),r(f,l)>=0)break;e[i]=f,i=p}e[i]=l}};function Af(i,e){return i<e?-1:i>e?1:0}function Pf(i,e,r,o,l){kp(i,e,r,o||i.length-1,l||If)}function kp(i,e,r,o,l){for(;o>r;){if(o-r>600){var p=o-r+1,f=e-r+1,y=Math.log(p),b=.5*Math.exp(2*y/3),k=.5*Math.sqrt(y*b*(p-b)/p)*(f-p/2<0?-1:1);kp(i,e,Math.max(r,Math.floor(e-f*b/p+k)),Math.min(o,Math.floor(e+(p-f)*b/p+k)),l)}var I=i[e],M=r,R=o;for(Bu(i,r,e),l(i[o],I)>0&&Bu(i,r,o);M<R;){for(Bu(i,M,R),M++,R--;l(i[M],I)<0;)M++;for(;l(i[R],I)>0;)R--}l(i[r],I)===0?Bu(i,r,R):Bu(i,++R,o),R<=e&&(r=R+1),e<=R&&(o=R-1)}}function Bu(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function If(i,e){return i<e?-1:i>e?1:0}function ph(i,e){if(i.length<=1)return[i];const r=[];let o,l;for(const p of i){const f=zf(p);f!==0&&(p.area=Math.abs(f),l===void 0&&(l=f<0),l===f<0?(o&&r.push(o),o=[p]):o.push(p))}if(o&&r.push(o),e>1)for(let p=0;p<r.length;p++)r[p].length<=e||(Pf(r[p],e,1,r[p].length-1,Mf),r[p]=r[p].slice(0,e));return r}function Mf(i,e){return e.area-i.area}function zf(i){let e=0;for(let r,o,l=0,p=i.length,f=p-1;l<p;f=l++)r=i[l],o=i[f],e+=(o.x-r.x)*(r.y+o.y);return e}const Ep=1/298.257223563,Tp=Ep*(2-Ep),Cp=Math.PI/180;class od{constructor(e){const r=6378.137*Cp*1e3,o=Math.cos(e*Cp),l=1/(1-Tp*(1-o*o)),p=Math.sqrt(l);this.kx=r*p*o,this.ky=r*p*l*(1-Tp)}distance(e,r){const o=this.wrap(e[0]-r[0])*this.kx,l=(e[1]-r[1])*this.ky;return Math.sqrt(o*o+l*l)}pointOnLine(e,r){let o,l,p,f,y=1/0;for(let b=0;b<e.length-1;b++){let k=e[b][0],I=e[b][1],M=this.wrap(e[b+1][0]-k)*this.kx,R=(e[b+1][1]-I)*this.ky,V=0;M===0&&R===0||(V=(this.wrap(r[0]-k)*this.kx*M+(r[1]-I)*this.ky*R)/(M*M+R*R),V>1?(k=e[b+1][0],I=e[b+1][1]):V>0&&(k+=M/this.kx*V,I+=R/this.ky*V)),M=this.wrap(r[0]-k)*this.kx,R=(r[1]-I)*this.ky;const j=M*M+R*R;j<y&&(y=j,o=k,l=I,p=b,f=V)}return{point:[o,l],index:p,t:Math.max(0,Math.min(1,f))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Ap(i,e){return e[0]-i[0]}function fh(i){return i[1]-i[0]+1}function ic(i,e){return i[1]>=i[0]&&i[1]<e}function Ru(i,e){if(i[0]>i[1])return[null,null];const r=fh(i);if(e){if(r===2)return[i,null];const l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];const o=Math.floor(r/2)-1;return[[i[0],i[0]+o],[i[0]+o+1,i[1]]]}function sd(i,e){if(!ic(e,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let o=e[0];o<=e[1];++o)ss(r,i[o]);return r}function ad(i){const e=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const o of r)ss(e,o);return e}function Pp(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function ld(i,e,r){if(!Pp(i)||!Pp(e))return NaN;let o=0,l=0;return i[2]<e[0]&&(o=e[0]-i[2]),i[0]>e[2]&&(o=i[0]-e[2]),i[1]>e[3]&&(l=i[1]-e[3]),i[3]<e[1]&&(l=e[1]-i[3]),r.distance([0,0],[o,l])}function _s(i,e,r){const o=r.pointOnLine(e,i);return r.distance(i,o.point)}function cd(i,e,r,o,l){const p=Math.min(_s(i,[r,o],l),_s(e,[r,o],l)),f=Math.min(_s(r,[i,e],l),_s(o,[i,e],l));return Math.min(p,f)}function rs(i,e,r,o,l){if(!ic(e,i.length)||!ic(o,r.length))return 1/0;let p=1/0;for(let f=e[0];f<e[1];++f){const y=i[f],b=i[f+1];for(let k=o[0];k<o[1];++k){const I=r[k],M=r[k+1];if(dh(y,b,I,M))return 0;p=Math.min(p,cd(y,b,I,M,l))}}return p}function ud(i,e,r,o,l){if(!ic(e,i.length)||!ic(o,r.length))return NaN;let p=1/0;for(let f=e[0];f<=e[1];++f)for(let y=o[0];y<=o[1];++y)if(p=Math.min(p,l.distance(i[f],r[y])),p===0)return p;return p}function As(i,e,r){if(eu(i,e,!0))return 0;let o=1/0;for(const l of e){const p=l[0],f=l[l.length-1];if(p!==f&&(o=Math.min(o,_s(i,[f,p],r)),o===0))return o;const y=r.pointOnLine(l,i);if(o=Math.min(o,r.distance(i,y.point)),o===0)return o}return o}function bs(i,e,r,o){if(!ic(e,i.length))return NaN;for(let p=e[0];p<=e[1];++p)if(eu(i[p],r,!0))return 0;let l=1/0;for(let p=e[0];p<e[1];++p){const f=i[p],y=i[p+1];for(const b of r)for(let k=0,I=b.length,M=I-1;k<I;M=k++){const R=b[M],V=b[k];if(dh(f,y,R,V))return 0;l=Math.min(l,cd(f,y,R,V,o))}}return l}function Lu(i,e){for(const r of i)for(const o of r)if(eu(o,e,!0))return!0;return!1}function Ip(i,e,r,o=1/0){const l=ad(i),p=ad(e);if(o!==1/0&&ld(l,p,r)>=o)return o;if(Du(l,p)){if(Lu(i,e))return 0}else if(Lu(e,i))return 0;let f=1/0;for(const y of i)for(let b=0,k=y.length,I=k-1;b<k;I=b++){const M=y[I],R=y[b];for(const V of e)for(let j=0,q=V.length,ne=q-1;j<q;ne=j++){const $e=V[ne],ii=V[j];if(dh(M,R,$e,ii))return 0;f=Math.min(f,cd(M,R,$e,ii,r))}}return f}function hd(i,e,r,o,l,p){if(!p)return;const f=ld(sd(o,p),l,r);f<e&&i.push([f,p,[0,0]])}function mh(i,e,r,o,l,p,f){if(!p||!f)return;const y=ld(sd(o,p),sd(l,f),r);y<e&&i.push([y,p,f])}function gh(i,e,r,o,l=1/0){let p=Math.min(o.distance(i[0],r[0][0]),l);if(p===0)return p;const f=new Sp([[0,[0,i.length-1],[0,0]]],Ap),y=ad(r);for(;f.length>0;){const b=f.pop();if(b[0]>=p)continue;const k=b[1],I=e?50:100;if(fh(k)<=I){if(!ic(k,i.length))return NaN;if(e){const M=bs(i,k,r,o);if(isNaN(M)||M===0)return M;p=Math.min(p,M)}else for(let M=k[0];M<=k[1];++M){const R=As(i[M],r,o);if(p=Math.min(p,R),p===0)return 0}}else{const M=Ru(k,e);hd(f,p,o,i,y,M[0]),hd(f,p,o,i,y,M[1])}}return p}function yh(i,e,r,o,l,p=1/0){let f=Math.min(p,l.distance(i[0],r[0]));if(f===0)return f;const y=new Sp([[0,[0,i.length-1],[0,r.length-1]]],Ap);for(;y.length>0;){const b=y.pop();if(b[0]>=f)continue;const k=b[1],I=b[2],M=e?50:100,R=o?50:100;if(fh(k)<=M&&fh(I)<=R){if(!ic(k,i.length)&&ic(I,r.length))return NaN;let V;if(e&&o)V=rs(i,k,r,I,l),f=Math.min(f,V);else if(e&&!o){const j=i.slice(k[0],k[1]+1);for(let q=I[0];q<=I[1];++q)if(V=_s(r[q],j,l),f=Math.min(f,V),f===0)return f}else if(!e&&o){const j=r.slice(I[0],I[1]+1);for(let q=k[0];q<=k[1];++q)if(V=_s(i[q],j,l),f=Math.min(f,V),f===0)return f}else V=ud(i,k,r,I,l),f=Math.min(f,V)}else{const V=Ru(k,e),j=Ru(I,o);mh(y,f,l,i,r,V[0],j[0]),mh(y,f,l,i,r,V[0],j[1]),mh(y,f,l,i,r,V[1],j[0]),mh(y,f,l,i,r,V[1],j[1])}}return f}function dd(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class yc{constructor(e,r){this.type=Ti,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Tu(e[1])){const o=e[1];if(o.type==="FeatureCollection")return new yc(o,o.features.map(l=>dd(l.geometry)).flat());if(o.type==="Feature")return new yc(o,dd(o.geometry));if("type"in o&&"coordinates"in o)return new yc(o,dd(o))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,o){const l=r.geometry(),p=l.flat().map(b=>Qc([b.x,b.y],r.canonical));if(l.length===0)return NaN;const f=new od(p[0][1]);let y=1/0;for(const b of o){switch(b.type){case"Point":y=Math.min(y,yh(p,!1,[b.coordinates],!1,f,y));break;case"LineString":y=Math.min(y,yh(p,!1,b.coordinates,!0,f,y));break;case"Polygon":y=Math.min(y,gh(p,!1,b.coordinates,f,y))}if(y===0)return y}return y}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const l=r.geometry(),p=l.flat().map(b=>Qc([b.x,b.y],r.canonical));if(l.length===0)return NaN;const f=new od(p[0][1]);let y=1/0;for(const b of o){switch(b.type){case"Point":y=Math.min(y,yh(p,!0,[b.coordinates],!1,f,y));break;case"LineString":y=Math.min(y,yh(p,!0,b.coordinates,!0,f,y));break;case"Polygon":y=Math.min(y,gh(p,!0,b.coordinates,f,y))}if(y===0)return y}return y}(e,this.geometries);if(e.geometryType()==="Polygon")return function(r,o){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const p=ph(l,0).map(b=>b.map(k=>k.map(I=>Qc([I.x,I.y],r.canonical)))),f=new od(p[0][0][0][1]);let y=1/0;for(const b of o)for(const k of p){switch(b.type){case"Point":y=Math.min(y,gh([b.coordinates],!1,k,f,y));break;case"LineString":y=Math.min(y,gh(b.coordinates,!0,k,f,y));break;case"Polygon":y=Math.min(y,Ip(k,b.coordinates,f,y))}if(y===0)return y}return y}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Dc={"==":fp,"!=":bf,">":mp,"<":wf,">=":Sf,"<=":gp,array:Ba,at:Yh,boolean:Ba,case:ah,coalesce:ch,collator:uh,format:hh,image:ed,in:Pu,"index-of":oh,interpolate:Pa,"interpolate-hcl":Pa,"interpolate-lab":Pa,length:td,let:hs,literal:Ic,match:sh,number:Ba,"number-format":Qh,object:Ba,slice:lh,step:Yc,string:Ba,"to-boolean":fc,"to-color":fc,"to-number":fc,"to-string":fc,var:nh,within:zc,distance:yc};class Ia{constructor(e,r,o,l){this.name=e,this.type=r,this._evaluate=o,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 o=e[0],l=Ia.definitions[o];if(!l)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const p=Array.isArray(l)?l[0]:l.type,f=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,y=f.filter(([k])=>!Array.isArray(k)||k.length===e.length-1);let b=null;for(const[k,I]of y){b=new mc(r.registry,vh,r.path,null,r.scope);const M=[];let R=!1;for(let V=1;V<e.length;V++){const j=e[V],q=Array.isArray(k)?k[V-1]:k.type,ne=b.parse(j,1+M.length,q);if(!ne){R=!0;break}M.push(ne)}if(!R)if(Array.isArray(k)&&k.length!==M.length)b.error(`Expected ${k.length} arguments, but found ${M.length} instead.`);else{for(let V=0;V<M.length;V++){const j=Array.isArray(k)?k[V]:k.type,q=M[V];b.concat(V+1).checkSubtype(j,q.type)}if(b.errors.length===0)return new Ia(o,p,I,M)}}if(y.length===1)r.errors.push(...b.errors);else{const k=(y.length?y:f).map(([M])=>{return R=M,Array.isArray(R)?`(${R.map(F).join(", ")})`:`(${F(R.type)}...)`;var R}).join(" | "),I=[];for(let M=1;M<e.length;M++){const R=r.parse(e[M],1+I.length);if(!R)return null;I.push(F(R.type))}r.error(`Expected arguments of type ${k}, but found (${I.join(", ")}) instead.`)}return null}static register(e,r){Ia.definitions=r;for(const o in r)e[o]=Ia}}function pd(i,[e,r,o,l]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const p=l?l.evaluate(i):1,f=ih(e,r,o,p);if(f)throw new Rs(f);return new ps(e/255,r/255,o/255,p,!1)}function _h(i,e){return i in e}function fd(i,e){const r=e[i];return r===void 0?null:r}function Bc(i){return{type:i}}function vh(i){if(i instanceof nh)return vh(i.boundExpression);if(i instanceof Ia&&i.name==="error"||i instanceof uh||i instanceof zc||i instanceof yc)return!1;const e=i instanceof fc||i instanceof Ba;let r=!0;return i.eachChild(o=>{r=e?r&&vh(o):r&&o instanceof Ic}),!!r&&xh(i)&&bh(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function xh(i){if(i instanceof Ia&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof zc||i instanceof yc)return!1;let e=!0;return i.eachChild(r=>{e&&!xh(r)&&(e=!1)}),e}function Fu(i){if(i instanceof Ia&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Fu(r)&&(e=!1)}),e}function bh(i,e){if(i instanceof Ia&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!bh(o,e)&&(r=!1)}),r}function Mp(i){return{result:"success",value:i}}function tu(i){return{result:"error",value:i}}function Rc(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function md(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function iu(i){return!!i.expression&&i.expression.interpolated}function ls(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ou(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function zp(i){return i}function Dp(i,e){const r=e.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",l=o||!(o||i.property!==void 0),p=i.type||(iu(e)?"exponential":"interval");if(r||e.type==="padding"){const I=r?ps.parse:Ta.parse;(i=Ya({},i)).stops&&(i.stops=i.stops.map(M=>[M[0],I(M[1])])),i.default=I(i.default?i.default:e.default)}if(i.colorSpace&&(f=i.colorSpace)!=="rgb"&&f!=="hcl"&&f!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var f;let y,b,k;if(p==="exponential")y=gd;else if(p==="interval")y=Sh;else if(p==="categorical"){y=wh,b=Object.create(null);for(const I of i.stops)b[I[0]]=I[1];k=typeof i.stops[0][0]}else{if(p!=="identity")throw new Error(`Unknown function type "${p}"`);y=yd}if(o){const I={},M=[];for(let j=0;j<i.stops.length;j++){const q=i.stops[j],ne=q[0].zoom;I[ne]===void 0&&(I[ne]={zoom:ne,type:i.type,property:i.property,default:i.default,stops:[]},M.push(ne)),I[ne].stops.push([q[0].value,q[1]])}const R=[];for(const j of M)R.push([I[j].zoom,Dp(I[j],e)]);const V={name:"linear"};return{kind:"composite",interpolationType:V,interpolationFactor:Pa.interpolationFactor.bind(void 0,V),zoomStops:R.map(j=>j[0]),evaluate:({zoom:j},q)=>gd({stops:R,base:i.base},e,j).evaluate(j,q)}}if(l){const I=p==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:I,interpolationFactor:Pa.interpolationFactor.bind(void 0,I),zoomStops:i.stops.map(M=>M[0]),evaluate:({zoom:M})=>y(i,e,M,b,k)}}return{kind:"source",evaluate(I,M){const R=M&&M.properties?M.properties[i.property]:void 0;return R===void 0?Lc(i.default,e.default):y(i,e,R,b,k)}}}function Lc(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function wh(i,e,r,o,l){return Lc(typeof r===l?o[r]:void 0,i.default,e.default)}function Sh(i,e,r){if(ls(r)!=="number")return Lc(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const l=Iu(i.stops.map(p=>p[0]),r);return i.stops[l][1]}function gd(i,e,r){const o=i.base!==void 0?i.base:1;if(ls(r)!=="number")return Lc(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 p=Iu(i.stops.map(I=>I[0]),r),f=function(I,M,R,V){const j=V-R,q=I-R;return j===0?0:M===1?q/j:(Math.pow(M,q)-1)/(Math.pow(M,j)-1)}(r,o,i.stops[p][0],i.stops[p+1][0]),y=i.stops[p][1],b=i.stops[p+1][1],k=Aa[e.type]||zp;return typeof y.evaluate=="function"?{evaluate(...I){const M=y.evaluate.apply(void 0,I),R=b.evaluate.apply(void 0,I);if(M!==void 0&&R!==void 0)return k(M,R,f,i.colorSpace)}}:k(y,b,f,i.colorSpace)}function yd(i,e,r){switch(e.type){case"color":r=ps.parse(r);break;case"formatted":r=Ea.fromString(r.toString());break;case"resolvedImage":r=Qs.fromString(r.toString());break;case"padding":r=Ta.parse(r);break;default:ls(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Lc(r,i.default,e.default)}Ia.register(Dc,{error:[{kind:"error"},[ts],(i,[e])=>{throw new Rs(e.evaluate(i))}],typeof:[ts,[Yi],(i,[e])=>F(Vs(e.evaluate(i)))],"to-rgba":[O(Ti,4),[ga],(i,[e])=>{const[r,o,l,p]=e.evaluate(i).rgb;return[255*r,255*o,255*l,p]}],rgb:[ga,[Ti,Ti,Ti],pd],rgba:[ga,[Ti,Ti,Ti,Ti],pd],has:{type:Hi,overloads:[[[ts],(i,[e])=>_h(e.evaluate(i),i.properties())],[[ts,Va],(i,[e,r])=>_h(e.evaluate(i),r.evaluate(i))]]},get:{type:Yi,overloads:[[[ts],(i,[e])=>fd(e.evaluate(i),i.properties())],[[ts,Va],(i,[e,r])=>fd(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Yi,[ts],(i,[e])=>fd(e.evaluate(i),i.featureState||{})],properties:[Va,[],i=>i.properties()],"geometry-type":[ts,[],i=>i.geometryType()],id:[Yi,[],i=>i.id()],zoom:[Ti,[],i=>i.globals.zoom],"heatmap-density":[Ti,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ti,[],i=>i.globals.lineProgress||0],accumulated:[Yi,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ti,Bc(Ti),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Ti,Bc(Ti),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Ti,overloads:[[[Ti,Ti],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ti],(i,[e])=>-e.evaluate(i)]]},"/":[Ti,[Ti,Ti],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ti,[Ti,Ti],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ti,[],()=>Math.LN2],pi:[Ti,[],()=>Math.PI],e:[Ti,[],()=>Math.E],"^":[Ti,[Ti,Ti],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ti,[Ti],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ti,[Ti],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ti,[Ti],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ti,[Ti],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ti,[Ti],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ti,[Ti],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ti,[Ti],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ti,[Ti],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ti,[Ti],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ti,[Ti],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ti,Bc(Ti),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ti,Bc(Ti),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ti,[Ti],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ti,[Ti],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ti,[Ti],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ti,[Ti],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Hi,[ts,Yi],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Hi,[Yi],(i,[e])=>i.id()===e.value],"filter-type-==":[Hi,[ts],(i,[e])=>i.geometryType()===e.value],"filter-<":[Hi,[ts,Yi],(i,[e,r])=>{const o=i.properties()[e.value],l=r.value;return typeof o==typeof l&&o<l}],"filter-id-<":[Hi,[Yi],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[Hi,[ts,Yi],(i,[e,r])=>{const o=i.properties()[e.value],l=r.value;return typeof o==typeof l&&o>l}],"filter-id->":[Hi,[Yi],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[Hi,[ts,Yi],(i,[e,r])=>{const o=i.properties()[e.value],l=r.value;return typeof o==typeof l&&o<=l}],"filter-id-<=":[Hi,[Yi],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[Hi,[ts,Yi],(i,[e,r])=>{const o=i.properties()[e.value],l=r.value;return typeof o==typeof l&&o>=l}],"filter-id->=":[Hi,[Yi],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[Hi,[Yi],(i,[e])=>e.value in i.properties()],"filter-has-id":[Hi,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Hi,[O(ts)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Hi,[O(Yi)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Hi,[ts,O(Yi)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Hi,[ts,O(Yi)],(i,[e,r])=>function(o,l,p,f){for(;p<=f;){const y=p+f>>1;if(l[y]===o)return!0;l[y]>o?f=y-1:p=y+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Hi,overloads:[[[Hi,Hi],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Bc(Hi),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Hi,overloads:[[[Hi,Hi],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Bc(Hi),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Hi,[Hi],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Hi,[ts],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[ts,[ts],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ts,[ts],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ts,Bc(Yi),(i,e)=>e.map(r=>tc(r.evaluate(i))).join("")],"resolved-locale":[ts,[Il],(i,[e])=>e.evaluate(i).resolvedLocale()]});class kh{constructor(e,r){var o;this.expression=e,this._warningHistory={},this._evaluator=new Au,this._defaultValue=r?(o=r).type==="color"&&Ou(o.default)?new ps(0,0,0,0):o.type==="color"?ps.parse(o.default)||null:o.type==="padding"?Ta.parse(o.default)||null:o.type==="variableAnchorOffsetCollection"?Ca.parse(o.default)||null:o.default===void 0?null:o.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,o,l,p,f){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=l,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=f,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,l,p,f){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=l,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=f||null;try{const y=this.expression.evaluate(this._evaluator);if(y==null||typeof y=="number"&&y!=y)return this._defaultValue;if(this._enumValues&&!(y in this._enumValues))throw new Rs(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(y)} instead.`);return y}catch(y){return this._warningHistory[y.message]||(this._warningHistory[y.message]=!0,typeof console<"u"&&console.warn(y.message)),this._defaultValue}}}function Vu(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Dc}function Fc(i,e){const r=new mc(Dc,vh,[],e?function(l){const p={color:ga,string:ts,number:Ti,enum:ts,boolean:Hi,formatted:ec,padding:pc,resolvedImage:zl,variableAnchorOffsetCollection:ze};return l.type==="array"?O(p[l.value]||Yi,l.length):p[l.type]}(e):void 0),o=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?Mp(new kh(o,e)):tu(r.errors)}class _d{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Fu(r.expression)}evaluateWithoutErrorHandling(e,r,o,l,p,f){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,l,p,f)}evaluate(e,r,o,l,p,f){return this._styleExpression.evaluate(e,r,o,l,p,f)}}class vd{constructor(e,r,o,l){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Fu(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,o,l,p,f){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,l,p,f)}evaluate(e,r,o,l,p,f){return this._styleExpression.evaluate(e,r,o,l,p,f)}interpolationFactor(e,r,o){return this.interpolationType?Pa.interpolationFactor(this.interpolationType,e,r,o):0}}function Bp(i,e){const r=Fc(i,e);if(r.result==="error")return r;const o=r.value.expression,l=xh(o);if(!l&&!Rc(e))return tu([new ua("","data expressions not supported")]);const p=bh(o,["zoom"]);if(!p&&!md(e))return tu([new ua("","zoom expressions not supported")]);const f=Th(o);return f||p?f instanceof ua?tu([f]):f instanceof Pa&&!iu(e)?tu([new ua("",'"interpolate" expressions cannot be used with this property')]):Mp(f?new vd(l?"camera":"composite",r.value,f.labels,f instanceof Pa?f.interpolation:void 0):new _d(l?"constant":"source",r.value)):tu([new ua("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Eh{constructor(e,r){this._parameters=e,this._specification=r,Ya(this,Dp(this._parameters,this._specification))}static deserialize(e){return new Eh(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Th(i){let e=null;if(i instanceof hs)e=Th(i.result);else if(i instanceof ch){for(const r of i.args)if(e=Th(r),e)break}else(i instanceof Yc||i instanceof Pa)&&i.input instanceof Ia&&i.input.name==="zoom"&&(e=i);return e instanceof ua||i.eachChild(r=>{const o=Th(r);o instanceof ua?e=o:!e&&o?e=new ua("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new ua("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function ru(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(!ru(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Ch={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ha(i){if(i==null)return{filter:()=>!0,needGeometry:!1};ru(i)||(i=Ah(i));const e=Fc(i,Ch);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,l)=>e.value.evaluate(r,o,{},l),needGeometry:xd(i)}}function Nu(i,e){return i<e?-1:i>e?1:0}function xd(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(xd(i[e]))return!0;return!1}function Ah(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?bd(i[1],i[2],"=="):e==="!="?ou(bd(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?bd(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Ah))):e==="all"?["all"].concat(i.slice(1).map(Ah)):e==="none"?["all"].concat(i.slice(1).map(Ah).map(ou)):e==="in"?nu(i[1],i.slice(2)):e==="!in"?ou(nu(i[1],i.slice(2))):e==="has"?wd(i[1]):e!=="!has"||ou(wd(i[1]));var r}function bd(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 nu(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(Nu)]]:["filter-in-small",i,["literal",e]]}}function wd(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function ou(i){return["!",i]}function Sd(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const p of i)l+=`${Sd(p)},`;return`${l}]`}const r=Object.keys(i).sort();let o="{";for(let l=0;l<r.length;l++)o+=`${JSON.stringify(r[l])}:${Sd(i[r[l]])},`;return`${o}}`}function kd(i){let e="";for(const r of Pc)e+=`/${Sd(i[r])}`;return e}function Rp(i){const e=i.value;return e?[new Si(i.key,e,"constants have been deprecated as of v8")]:[]}function ws(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Oc(i){if(Array.isArray(i))return i.map(Oc);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Oc(i[r]);return e}return ws(i)}function ya(i){const e=i.key,r=i.value,o=i.valueSpec||{},l=i.objectElementValidators||{},p=i.style,f=i.styleSpec,y=i.validateSpec;let b=[];const k=ls(r);if(k!=="object")return[new Si(e,r,`object expected, ${k} found`)];for(const I in r){const M=I.split(".")[0],R=o[M]||o["*"];let V;if(l[M])V=l[M];else if(o[M])V=y;else if(l["*"])V=l["*"];else{if(!o["*"]){b.push(new Si(e,r[I],`unknown property "${I}"`));continue}V=y}b=b.concat(V({key:(e&&`${e}.`)+I,value:r[I],valueSpec:R,style:p,styleSpec:f,object:r,objectKey:I,validateSpec:y},r))}for(const I in o)l[I]||o[I].required&&o[I].default===void 0&&r[I]===void 0&&b.push(new Si(e,r,`missing required property "${I}"`));return b}function Ph(i){const e=i.value,r=i.valueSpec,o=i.style,l=i.styleSpec,p=i.key,f=i.arrayElementValidator||i.validateSpec;if(ls(e)!=="array")return[new Si(p,e,`array expected, ${ls(e)} found`)];if(r.length&&e.length!==r.length)return[new Si(p,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Si(p,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let y={type:r.value,values:r.values};l.$version<7&&(y.function=r.function),ls(r.value)==="object"&&(y=r.value);let b=[];for(let k=0;k<e.length;k++)b=b.concat(f({array:e,arrayIndex:k,value:e[k],valueSpec:y,validateSpec:i.validateSpec,style:o,styleSpec:l,key:`${p}[${k}]`}));return b}function $u(i){const e=i.key,r=i.value,o=i.valueSpec;let l=ls(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new Si(e,r,`number expected, ${l} found`)]:"minimum"in o&&r<o.minimum?[new Si(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Si(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function Ed(i){const e=i.valueSpec,r=ws(i.value.type);let o,l,p,f={};const y=r!=="categorical"&&i.value.property===void 0,b=!y,k=ls(i.value.stops)==="array"&&ls(i.value.stops[0])==="array"&&ls(i.value.stops[0][0])==="object",I=ya({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(V){if(r==="identity")return[new Si(V.key,V.value,'identity function may not have a "stops" property')];let j=[];const q=V.value;return j=j.concat(Ph({key:V.key,value:q,valueSpec:V.valueSpec,validateSpec:V.validateSpec,style:V.style,styleSpec:V.styleSpec,arrayElementValidator:M})),ls(q)==="array"&&q.length===0&&j.push(new Si(V.key,q,"array must have at least one stop")),j},default:function(V){return V.validateSpec({key:V.key,value:V.value,valueSpec:e,validateSpec:V.validateSpec,style:V.style,styleSpec:V.styleSpec})}}});return r==="identity"&&y&&I.push(new Si(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||I.push(new Si(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!iu(i.valueSpec)&&I.push(new Si(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(b&&!Rc(i.valueSpec)?I.push(new Si(i.key,i.value,"property functions not supported")):y&&!md(i.valueSpec)&&I.push(new Si(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!k||i.value.property!==void 0||I.push(new Si(i.key,i.value,'"property" property is required')),I;function M(V){let j=[];const q=V.value,ne=V.key;if(ls(q)!=="array")return[new Si(ne,q,`array expected, ${ls(q)} found`)];if(q.length!==2)return[new Si(ne,q,`array length 2 expected, length ${q.length} found`)];if(k){if(ls(q[0])!=="object")return[new Si(ne,q,`object expected, ${ls(q[0])} found`)];if(q[0].zoom===void 0)return[new Si(ne,q,"object stop key must have zoom")];if(q[0].value===void 0)return[new Si(ne,q,"object stop key must have value")];if(p&&p>ws(q[0].zoom))return[new Si(ne,q[0].zoom,"stop zoom values must appear in ascending order")];ws(q[0].zoom)!==p&&(p=ws(q[0].zoom),l=void 0,f={}),j=j.concat(ya({key:`${ne}[0]`,value:q[0],valueSpec:{zoom:{}},validateSpec:V.validateSpec,style:V.style,styleSpec:V.styleSpec,objectElementValidators:{zoom:$u,value:R}}))}else j=j.concat(R({key:`${ne}[0]`,value:q[0],valueSpec:{},validateSpec:V.validateSpec,style:V.style,styleSpec:V.styleSpec},q));return Vu(Oc(q[1]))?j.concat([new Si(`${ne}[1]`,q[1],"expressions are not allowed in function stops.")]):j.concat(V.validateSpec({key:`${ne}[1]`,value:q[1],valueSpec:e,validateSpec:V.validateSpec,style:V.style,styleSpec:V.styleSpec}))}function R(V,j){const q=ls(V.value),ne=ws(V.value),$e=V.value!==null?V.value:j;if(o){if(q!==o)return[new Si(V.key,$e,`${q} stop domain type must match previous stop domain type ${o}`)]}else o=q;if(q!=="number"&&q!=="string"&&q!=="boolean")return[new Si(V.key,$e,"stop domain value must be a number, string, or boolean")];if(q!=="number"&&r!=="categorical"){let ii=`number expected, ${q} found`;return Rc(e)&&r===void 0&&(ii+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Si(V.key,$e,ii)]}return r!=="categorical"||q!=="number"||isFinite(ne)&&Math.floor(ne)===ne?r!=="categorical"&&q==="number"&&l!==void 0&&ne<l?[new Si(V.key,$e,"stop domain values must appear in ascending order")]:(l=ne,r==="categorical"&&ne in f?[new Si(V.key,$e,"stop domain values must be unique")]:(f[ne]=!0,[])):[new Si(V.key,$e,`integer expected, found ${ne}`)]}}function Vc(i){const e=(i.expressionContext==="property"?Bp:Fc)(Oc(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Si(`${i.key}${o.key}`,i.value,o.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Si(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"&&!Fu(r))return[new Si(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Fu(r))return[new Si(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!bh(r,["zoom","feature-state"]))return[new Si(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!xh(r))return[new Si(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ju(i){const e=i.key,r=i.value,o=i.valueSpec,l=[];return Array.isArray(o.values)?o.values.indexOf(ws(r))===-1&&l.push(new Si(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(ws(r))===-1&&l.push(new Si(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Uu(i){return ru(Oc(i.value))?Vc(Ya({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):qu(i)}function qu(i){const e=i.value,r=i.key;if(ls(e)!=="array")return[new Si(r,e,`array expected, ${ls(e)} found`)];const o=i.styleSpec;let l,p=[];if(e.length<1)return[new Si(r,e,"filter array must have at least 1 element")];switch(p=p.concat(ju({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),ws(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ws(e[1])==="$type"&&p.push(new Si(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&p.push(new Si(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=ls(e[1]),l!=="string"&&p.push(new Si(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let f=2;f<e.length;f++)l=ls(e[f]),ws(e[1])==="$type"?p=p.concat(ju({key:`${r}[${f}]`,value:e[f],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&p.push(new Si(`${r}[${f}]`,e[f],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let f=1;f<e.length;f++)p=p.concat(qu({key:`${r}[${f}]`,value:e[f],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=ls(e[1]),e.length!==2?p.push(new Si(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&p.push(new Si(`${r}[1]`,e[1],`string expected, ${l} found`))}return p}function Td(i,e){const r=i.key,o=i.validateSpec,l=i.style,p=i.styleSpec,f=i.value,y=i.objectKey,b=p[`${e}_${i.layerType}`];if(!b)return[];const k=y.match(/^(.*)-transition$/);if(e==="paint"&&k&&b[k[1]]&&b[k[1]].transition)return o({key:r,value:f,valueSpec:p.transition,style:l,styleSpec:p});const I=i.valueSpec||b[y];if(!I)return[new Si(r,f,`unknown property "${y}"`)];let M;if(ls(f)==="string"&&Rc(I)&&!I.tokens&&(M=/^{([^}]+)}$/.exec(f)))return[new Si(r,f,`"${y}" does not support interpolation syntax
|
10
|
-
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(M[1])} }\`.`)];const R=[];return i.layerType==="symbol"&&(y==="text-field"&&l&&!l.glyphs&&R.push(new Si(r,f,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&Ou(Oc(f))&&ws(f.type)==="identity"&&R.push(new Si(r,f,'"text-font" does not support identity functions'))),R.concat(o({key:i.key,value:f,valueSpec:I,style:l,styleSpec:p,expressionContext:"property",propertyType:e,propertyKey:y}))}function Cd(i){return Td(i,"paint")}function Ad(i){return Td(i,"layout")}function Pd(i){let e=[];const r=i.value,o=i.key,l=i.style,p=i.styleSpec;r.type||r.ref||e.push(new Si(o,r,'either "type" or "ref" is required'));let f=ws(r.type);const y=ws(r.ref);if(r.id){const b=ws(r.id);for(let k=0;k<i.arrayIndex;k++){const I=l.layers[k];ws(I.id)===b&&e.push(new Si(o,r.id,`duplicate layer id "${r.id}", previously used at line ${I.id.__line__}`))}}if("ref"in r){let b;["type","source","source-layer","filter","layout"].forEach(k=>{k in r&&e.push(new Si(o,r[k],`"${k}" is prohibited for ref layers`))}),l.layers.forEach(k=>{ws(k.id)===y&&(b=k)}),b?b.ref?e.push(new Si(o,r.ref,"ref cannot reference another ref layer")):f=ws(b.type):e.push(new Si(o,r.ref,`ref layer "${y}" not found`))}else if(f!=="background")if(r.source){const b=l.sources&&l.sources[r.source],k=b&&ws(b.type);b?k==="vector"&&f==="raster"?e.push(new Si(o,r.source,`layer "${r.id}" requires a raster source`)):k!=="raster-dem"&&f==="hillshade"?e.push(new Si(o,r.source,`layer "${r.id}" requires a raster-dem source`)):k==="raster"&&f!=="raster"?e.push(new Si(o,r.source,`layer "${r.id}" requires a vector source`)):k!=="vector"||r["source-layer"]?k==="raster-dem"&&f!=="hillshade"?e.push(new Si(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):f!=="line"||!r.paint||!r.paint["line-gradient"]||k==="geojson"&&b.lineMetrics||e.push(new Si(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Si(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Si(o,r.source,`source "${r.source}" not found`))}else e.push(new Si(o,r,'missing required property "source"'));return e=e.concat(ya({key:o,value:r,valueSpec:p.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${o}.type`,value:r.type,valueSpec:p.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Uu,layout:b=>ya({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,validateSpec:b.validateSpec,objectElementValidators:{"*":k=>Ad(Ya({layerType:f},k))}}),paint:b=>ya({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,validateSpec:b.validateSpec,objectElementValidators:{"*":k=>Cd(Ya({layerType:f},k))}})}})),e}function rc(i){const e=i.value,r=i.key,o=ls(e);return o!=="string"?[new Si(r,e,`string expected, ${o} found`)]:[]}const Id={promoteId:function({key:i,value:e}){if(ls(e)==="string")return rc({key:i,value:e});{const r=[];for(const o in e)r.push(...rc({key:`${i}.${o}`,value:e[o]}));return r}}};function Lp(i){const e=i.value,r=i.key,o=i.styleSpec,l=i.style,p=i.validateSpec;if(!e.type)return[new Si(r,e,'"type" is required')];const f=ws(e.type);let y;switch(f){case"vector":case"raster":return y=ya({key:r,value:e,valueSpec:o[`source_${f.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Id,validateSpec:p}),y;case"raster-dem":return y=function(b){var k;const I=(k=b.sourceName)!==null&&k!==void 0?k:"",M=b.value,R=b.styleSpec,V=R.source_raster_dem,j=b.style;let q=[];const ne=ls(M);if(M===void 0)return q;if(ne!=="object")return q.push(new Si("source_raster_dem",M,`object expected, ${ne} found`)),q;const $e=ws(M.encoding)==="custom",ii=["redFactor","greenFactor","blueFactor","baseShift"],gt=b.value.encoding?`"${b.value.encoding}"`:"Default";for(const Xt in M)!$e&&ii.includes(Xt)?q.push(new Si(Xt,M[Xt],`In "${I}": "${Xt}" is only valid when "encoding" is set to "custom". ${gt} encoding found`)):V[Xt]?q=q.concat(b.validateSpec({key:Xt,value:M[Xt],valueSpec:V[Xt],validateSpec:b.validateSpec,style:j,styleSpec:R})):q.push(new Si(Xt,M[Xt],`unknown property "${Xt}"`));return q}({sourceName:r,value:e,style:i.style,styleSpec:o,validateSpec:p}),y;case"geojson":if(y=ya({key:r,value:e,valueSpec:o.source_geojson,style:l,styleSpec:o,validateSpec:p,objectElementValidators:Id}),e.cluster)for(const b in e.clusterProperties){const[k,I]=e.clusterProperties[b],M=typeof k=="string"?[k,["accumulated"],["get",b]]:k;y.push(...Vc({key:`${r}.${b}.map`,value:I,validateSpec:p,expressionContext:"cluster-map"})),y.push(...Vc({key:`${r}.${b}.reduce`,value:M,validateSpec:p,expressionContext:"cluster-reduce"}))}return y;case"video":return ya({key:r,value:e,valueSpec:o.source_video,style:l,validateSpec:p,styleSpec:o});case"image":return ya({key:r,value:e,valueSpec:o.source_image,style:l,validateSpec:p,styleSpec:o});case"canvas":return[new Si(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ju({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:p,styleSpec:o})}}function Md(i){const e=i.value,r=i.styleSpec,o=r.light,l=i.style;let p=[];const f=ls(e);if(e===void 0)return p;if(f!=="object")return p=p.concat([new Si("light",e,`object expected, ${f} found`)]),p;for(const y in e){const b=y.match(/^(.*)-transition$/);p=p.concat(b&&o[b[1]]&&o[b[1]].transition?i.validateSpec({key:y,value:e[y],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):o[y]?i.validateSpec({key:y,value:e[y],valueSpec:o[y],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Si(y,e[y],`unknown property "${y}"`)])}return p}function Fp(i){const e=i.value,r=i.styleSpec,o=r.sky,l=i.style,p=ls(e);if(e===void 0)return[];if(p!=="object")return[new Si("sky",e,`object expected, ${p} found`)];let f=[];for(const y in e)f=f.concat(o[y]?i.validateSpec({key:y,value:e[y],valueSpec:o[y],style:l,styleSpec:r}):[new Si(y,e[y],`unknown property "${y}"`)]);return f}function zd(i){const e=i.value,r=i.styleSpec,o=r.terrain,l=i.style;let p=[];const f=ls(e);if(e===void 0)return p;if(f!=="object")return p=p.concat([new Si("terrain",e,`object expected, ${f} found`)]),p;for(const y in e)p=p.concat(o[y]?i.validateSpec({key:y,value:e[y],valueSpec:o[y],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Si(y,e[y],`unknown property "${y}"`)]);return p}function Dd(i){let e=[];const r=i.value,o=i.key;if(Array.isArray(r)){const l=[],p=[];for(const f in r)r[f].id&&l.includes(r[f].id)&&e.push(new Si(o,r,`all the sprites' ids must be unique, but ${r[f].id} is duplicated`)),l.push(r[f].id),r[f].url&&p.includes(r[f].url)&&e.push(new Si(o,r,`all the sprites' URLs must be unique, but ${r[f].url} is duplicated`)),p.push(r[f].url),e=e.concat(ya({key:`${o}[${f}]`,value:r[f],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return rc({key:o,value:r})}const Bd={"*":()=>[],array:Ph,boolean:function(i){const e=i.value,r=i.key,o=ls(e);return o!=="boolean"?[new Si(r,e,`boolean expected, ${o} found`)]:[]},number:$u,color:function(i){const e=i.key,r=i.value,o=ls(r);return o!=="string"?[new Si(e,r,`color expected, ${o} found`)]:ps.parse(String(r))?[]:[new Si(e,r,`color expected, "${r}" found`)]},constants:Rp,enum:ju,filter:Uu,function:Ed,layer:Pd,object:ya,source:Lp,light:Md,sky:Fp,terrain:zd,projection:function(i){const e=i.value,r=i.styleSpec,o=r.projection,l=i.style,p=ls(e);if(e===void 0)return[];if(p!=="object")return[new Si("projection",e,`object expected, ${p} found`)];let f=[];for(const y in e)f=f.concat(o[y]?i.validateSpec({key:y,value:e[y],valueSpec:o[y],style:l,styleSpec:r}):[new Si(y,e[y],`unknown property "${y}"`)]);return f},string:rc,formatted:function(i){return rc(i).length===0?[]:Vc(i)},resolvedImage:function(i){return rc(i).length===0?[]:Vc(i)},padding:function(i){const e=i.key,r=i.value;if(ls(r)==="array"){if(r.length<1||r.length>4)return[new Si(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let l=[];for(let p=0;p<r.length;p++)l=l.concat(i.validateSpec({key:`${e}[${p}]`,value:r[p],validateSpec:i.validateSpec,valueSpec:o}));return l}return $u({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const e=i.key,r=i.value,o=ls(r),l=i.styleSpec;if(o!=="array"||r.length<1||r.length%2!=0)return[new Si(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let p=[];for(let f=0;f<r.length;f+=2)p=p.concat(ju({key:`${e}[${f}]`,value:r[f],valueSpec:l.layout_symbol["text-anchor"]})),p=p.concat(Ph({key:`${e}[${f+1}]`,value:r[f+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return p},sprite:Dd};function Zu(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return i.validateSpec=Zu,r.expression&&Ou(ws(e))?Ed(i):r.expression&&Vu(Oc(e))?Vc(i):r.type&&Bd[r.type]?Bd[r.type](i):ya(Ya({},i,{valueSpec:r.type?o[r.type]:r}))}function Op(i){const e=i.value,r=i.key,o=rc(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Si(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Si(r,e,'"glyphs" url must include a "{range}" token'))),o}function Ra(i,e=ui){let r=[];return r=r.concat(Zu({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:Zu,objectElementValidators:{glyphs:Op,"*":()=>[]}})),i.constants&&(r=r.concat(Rp({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:Zu}))),Rd(r)}function Na(i){return function(e){return i({...e,validateSpec:Zu})}}function Rd(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function $a(i){return function(...e){return Rd(i.apply(this,e))}}Ra.source=$a(Na(Lp)),Ra.sprite=$a(Na(Dd)),Ra.glyphs=$a(Na(Op)),Ra.light=$a(Na(Md)),Ra.sky=$a(Na(Fp)),Ra.terrain=$a(Na(zd)),Ra.layer=$a(Na(Pd)),Ra.filter=$a(Na(Uu)),Ra.paintProperty=$a(Na(Cd)),Ra.layoutProperty=$a(Na(Ad));const nc=Ra,Df=nc.light,Ld=nc.sky,Bf=nc.paintProperty,Rf=nc.layoutProperty;function Fd(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new uc(new Error(o.message))),r=!0;return r}class su{constructor(e,r,o){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const f=new Int32Array(this.arrayBuffer);e=f[0],this.d=(r=f[1])+2*(o=f[2]);for(let b=0;b<this.d*this.d;b++){const k=f[3+b],I=f[3+b+1];l.push(k===I?null:f.subarray(k,I))}const y=f[3+l.length+1];this.keys=f.subarray(f[3+l.length],y),this.bboxes=f.subarray(y),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let f=0;f<this.d*this.d;f++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const p=o/r*e;this.min=-p,this.max=e+p}insert(e,r,o,l,p){this._forEachCell(r,o,l,p,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(l),this.bboxes.push(p)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,l,p,f){this.cells[p].push(f)}query(e,r,o,l,p){const f=this.min,y=this.max;if(e<=f&&r<=f&&y<=o&&y<=l&&!p)return Array.prototype.slice.call(this.keys);{const b=[];return this._forEachCell(e,r,o,l,this._queryCell,b,{},p),b}}_queryCell(e,r,o,l,p,f,y,b){const k=this.cells[p];if(k!==null){const I=this.keys,M=this.bboxes;for(let R=0;R<k.length;R++){const V=k[R];if(y[V]===void 0){const j=4*V;(b?b(M[j+0],M[j+1],M[j+2],M[j+3]):e<=M[j+2]&&r<=M[j+3]&&o>=M[j+0]&&l>=M[j+1])?(y[V]=!0,f.push(I[V])):y[V]=!1}}}}_forEachCell(e,r,o,l,p,f,y,b){const k=this._convertToCellCoord(e),I=this._convertToCellCoord(r),M=this._convertToCellCoord(o),R=this._convertToCellCoord(l);for(let V=k;V<=M;V++)for(let j=I;j<=R;j++){const q=this.d*j+V;if((!b||b(this._convertFromCellCoord(V),this._convertFromCellCoord(j),this._convertFromCellCoord(V+1),this._convertFromCellCoord(j+1)))&&p.call(this,e,r,o,l,q,f,y,b))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 o=0;for(let f=0;f<this.cells.length;f++)o+=this.cells[f].length;const l=new Int32Array(r+o+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let p=r;for(let f=0;f<e.length;f++){const y=e[f];l[3+f]=p,l.set(y,p),p+=y.length}return l[3+e.length]=p,l.set(this.keys,p),p+=this.keys.length,l[3+e.length+1]=p,l.set(this.bboxes,p),p+=this.bboxes.length,l.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new su(e.buffer)}}const Zl={};function Li(i,e,r={}){if(Zl[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),Zl[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Li("Object",Object),Li("TransferableGridIndex",su),Li("Color",ps),Li("Error",Error),Li("AJAXError",ka),Li("ResolvedImage",Qs),Li("StylePropertyFunction",Eh),Li("StyleExpression",kh,{omit:["_evaluator"]}),Li("ZoomDependentExpression",vd),Li("ZoomConstantExpression",_d),Li("CompoundExpression",Ia,{omit:["_evaluate"]});for(const i in Dc)Dc[i]._classRegistryKey||Li(`Expression_${i}`,Dc[i]);function Vp(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Od(i){return i.$name||i.constructor._classRegistryKey}function Np(i){return!function(e){if(e===null||typeof e!="object")return!1;const r=Od(e);return!(!r||r==="Object")}(i)&&(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||i instanceof Error||Vp(i)||Xa(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function Gu(i,e){if(Np(i))return(Vp(i)||Xa(i))&&e&&e.push(i),ArrayBuffer.isView(i)&&e&&e.push(i.buffer),i instanceof ImageData&&e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const p=[];for(const f of i)p.push(Gu(f,e));return p}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);const r=Od(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!Zl[r])throw new Error(`${r} is not registered.`);const{klass:o}=Zl[r],l=o.serialize?o.serialize(i,e):{};if(o.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const p in i){if(!i.hasOwnProperty(p)||Zl[r].omit.indexOf(p)>=0)continue;const f=i[p];l[p]=Zl[r].shallow.indexOf(p)>=0?f:Gu(f,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function Gl(i){if(Np(i))return i;if(Array.isArray(i))return i.map(Gl);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=Od(i)||"Object";if(!Zl[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Zl[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const o=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const p=i[l];o[l]=Zl[e].shallow.indexOf(l)>=0?p:Gl(p)}return o}class $p{constructor(){this.first=!0}update(e,r){const o=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=o,!0))}}const Mi={"Latin-1 Supplement":i=>i>=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 Vd(i){for(const e of i)if(Nd(e.charCodeAt(0)))return!0;return!1}function Lf(i){for(const e of i)if(!jp(e.charCodeAt(0)))return!1;return!0}function jp(i){return!(Mi.Arabic(i)||Mi["Arabic Supplement"](i)||Mi["Arabic Extended-A"](i)||Mi["Arabic Presentation Forms-A"](i)||Mi["Arabic Presentation Forms-B"](i))}function Nd(i){return!(i!==746&&i!==747&&(i<4352||!(Mi["Bopomofo Extended"](i)||Mi.Bopomofo(i)||Mi["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Mi["CJK Compatibility Ideographs"](i)||Mi["CJK Compatibility"](i)||Mi["CJK Radicals Supplement"](i)||Mi["CJK Strokes"](i)||!(!Mi["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Mi["CJK Unified Ideographs Extension A"](i)||Mi["CJK Unified Ideographs"](i)||Mi["Enclosed CJK Letters and Months"](i)||Mi["Hangul Compatibility Jamo"](i)||Mi["Hangul Jamo Extended-A"](i)||Mi["Hangul Jamo Extended-B"](i)||Mi["Hangul Jamo"](i)||Mi["Hangul Syllables"](i)||Mi.Hiragana(i)||Mi["Ideographic Description Characters"](i)||Mi.Kanbun(i)||Mi["Kangxi Radicals"](i)||Mi["Katakana Phonetic Extensions"](i)||Mi.Katakana(i)&&i!==12540||!(!Mi["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)||!(!Mi["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Mi["Unified Canadian Aboriginal Syllabics"](i)||Mi["Unified Canadian Aboriginal Syllabics Extended"](i)||Mi["Vertical Forms"](i)||Mi["Yijing Hexagram Symbols"](i)||Mi["Yi Syllables"](i)||Mi["Yi Radicals"](i))))}function Up(i){return!(Nd(i)||function(e){return!!(Mi["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Mi["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)||Mi["Letterlike Symbols"](e)||Mi["Number Forms"](e)||Mi["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)||Mi["Control Pictures"](e)&&e!==9251||Mi["Optical Character Recognition"](e)||Mi["Enclosed Alphanumerics"](e)||Mi["Geometric Shapes"](e)||Mi["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Mi["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Mi["CJK Symbols and Punctuation"](e)||Mi.Katakana(e)||Mi["Private Use Area"](e)||Mi["CJK Compatibility Forms"](e)||Mi["Small Form Variants"](e)||Mi["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 _c(i){return i>=1424&&i<=2303||Mi["Arabic Presentation Forms-A"](i)||Mi["Arabic Presentation Forms-B"](i)}function qp(i,e){return!(!e&&_c(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Mi.Khmer(i))}function $d(i){for(const e of i)if(_c(e.charCodeAt(0)))return!0;return!1}const vc=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class vs{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 $p,this.transition={})}isSupportedScript(e){return function(r,o){for(const l of r)if(!qp(l.charCodeAt(0),o))return!1;return!0}(e,vc.getRTLTextPluginStatus()==="loaded")}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),o=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class Ih{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,l){if(Ou(o))return new Eh(o,l);if(Vu(o)){const p=Bp(o,l);if(p.result==="error")throw new Error(p.value.map(f=>`${f.key}: ${f.message}`).join(", "));return p.value}{let p=o;return l.type==="color"&&typeof o=="string"?p=ps.parse(o):l.type!=="padding"||typeof o!="number"&&!Array.isArray(o)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(o)&&(p=Ca.parse(o)):p=Ta.parse(o),{kind:"constant",evaluate:()=>p}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class au{constructor(e){this.property=e,this.value=new Ih(e,void 0)}transitioned(e,r){return new Zp(this.property,this.value,r,tn({},e.transition,this.transition),e.now)}untransitioned(){return new Zp(this.property,this.value,null,{},0)}}class lu{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return os(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new au(this._values[e].property)),this._values[e].value=new Ih(this._values[e].property,r===null?void 0:os(r))}getTransition(e){return os(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new au(this._values[e].property)),this._values[e].transition=os(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const o=new jd(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].transitioned(e,r._values[l]);return o}untransitioned(){const e=new jd(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Zp{constructor(e,r,o,l,p){this.property=e,this.value=r,this.begin=p+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const l=e.now||0,p=this.value.possiblyEvaluate(e,r,o),f=this.prior;if(f){if(l>this.end)return this.prior=null,p;if(this.value.isDataDriven())return this.prior=null,p;if(l<this.begin)return f.possiblyEvaluate(e,r,o);{const y=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(f.possiblyEvaluate(e,r,o),p,function(b){if(b<=0)return 0;if(b>=1)return 1;const k=b*b,I=k*b;return 4*(b<.5?I:3*(b-k)+I-.75)}(y))}}return p}}class jd{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const l=new Mh(this._properties);for(const p of Object.keys(this._values))l._values[p]=this._values[p].possiblyEvaluate(e,r,o);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Hu{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return os(this._values[e].value)}setValue(e,r){this._values[e]=new Ih(this._values[e].property,r===null?void 0:os(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o)}return e}possiblyEvaluate(e,r,o){const l=new Mh(this._properties);for(const p of Object.keys(this._values))l._values[p]=this._values[p].possiblyEvaluate(e,r,o);return l}}class Hl{constructor(e,r,o){this.property=e,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,o,l){return this.property.evaluate(this.value,this.parameters,e,r,o,l)}}class Mh{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class $i{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,o){const l=Aa[this.specification.type];return l?l(e,r,o):e}}class Gi{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,l){return new Hl(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,l)}:e.expression,r)}interpolate(e,r,o){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Hl(this,{kind:"constant",value:void 0},e.parameters);const l=Aa[this.specification.type];if(l){const p=l(e.value.value,r.value.value,o);return new Hl(this,{kind:"constant",value:p},e.parameters)}return e}evaluate(e,r,o,l,p,f){return e.kind==="constant"?e.value:e.evaluate(r,o,l,p,f)}}class d extends Gi{possiblyEvaluate(e,r,o,l){if(e.value===void 0)return new Hl(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const p=e.expression.evaluate(r,null,{},o,l),f=e.property.specification.type==="resolvedImage"&&typeof p!="string"?p.name:p,y=this._calculate(f,f,f,r);return new Hl(this,{kind:"constant",value:y},r)}if(e.expression.kind==="camera"){const p=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 Hl(this,{kind:"constant",value:p},r)}return new Hl(this,e.expression,r)}evaluate(e,r,o,l,p,f){if(e.kind==="source"){const y=e.evaluate(r,o,l,p,f);return this._calculate(y,y,y,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,l),e.evaluate({zoom:Math.floor(r.zoom)},o,l),e.evaluate({zoom:Math.floor(r.zoom)+1},o,l),r):e.value}_calculate(e,r,o,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class t{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const p=e.expression.evaluate(r,null,{},o,l);return this._calculate(p,p,p,r)}return this._calculate(e.expression.evaluate(new vs(Math.floor(r.zoom-1),r)),e.expression.evaluate(new vs(Math.floor(r.zoom),r)),e.expression.evaluate(new vs(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class n{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,l){return!!e.expression.evaluate(r,null,{},o,l)}interpolate(){return!1}}class s{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const o=e[r];o.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Ih(o,void 0),p=this.defaultTransitionablePropertyValues[r]=new au(o);this.defaultTransitioningPropertyValues[r]=p.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Li("DataDrivenProperty",Gi),Li("DataConstantProperty",$i),Li("CrossFadedDataDrivenProperty",d),Li("CrossFadedProperty",t),Li("ColorRampProperty",n);const a="-transition";class h extends Xc{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 Hu(r.layout)),r.paint)){this._transitionablePaint=new lu(r.paint);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Mh(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,o={}){r!=null&&this._validate(Rf,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(a)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Bf,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(a))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],p=l.property.specification["property-type"]==="cross-faded-data-driven",f=l.value.isDataDriven(),y=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const b=this._transitionablePaint._values[e].value;return b.isDataDriven()||f||p||this._handleOverridablePaintPropertyUpdate(e,y,b)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,o){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&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),$s(e,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(e,r,o,l,p={}){return(!p||p.validate!==!1)&&Fd(this,e.call(nc,{key:r,layerType:this.type,objectKey:o,value:l,styleSpec:ui,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 Hl&&Rc(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const _={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class w{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 E{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 C(i,e=1){let r=0,o=0;return{members:i.map(l=>{const p=_[l.type].BYTES_PER_ELEMENT,f=r=z(r,Math.max(e,p)),y=l.components||1;return o=Math.max(o,p),r+=p*y,{name:l.name,type:l.type,components:y,offset:f}}),size:z(r,Math.max(o,e)),alignment:e}}function z(i,e){return Math.ceil(i/e)*e}class D extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=o,e}}D.prototype.bytesPerElement=4,Li("StructArrayLayout2i4",D);class $ extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,o)}emplace(e,r,o,l){const p=3*e;return this.int16[p+0]=r,this.int16[p+1]=o,this.int16[p+2]=l,e}}$.prototype.bytesPerElement=6,Li("StructArrayLayout3i6",$);class U extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,o,l)}emplace(e,r,o,l,p){const f=4*e;return this.int16[f+0]=r,this.int16[f+1]=o,this.int16[f+2]=l,this.int16[f+3]=p,e}}U.prototype.bytesPerElement=8,Li("StructArrayLayout4i8",U);class ee extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,p,f){const y=this.length;return this.resize(y+1),this.emplace(y,e,r,o,l,p,f)}emplace(e,r,o,l,p,f,y){const b=6*e;return this.int16[b+0]=r,this.int16[b+1]=o,this.int16[b+2]=l,this.int16[b+3]=p,this.int16[b+4]=f,this.int16[b+5]=y,e}}ee.prototype.bytesPerElement=12,Li("StructArrayLayout2i4i12",ee);class de extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,p,f){const y=this.length;return this.resize(y+1),this.emplace(y,e,r,o,l,p,f)}emplace(e,r,o,l,p,f,y){const b=4*e,k=8*e;return this.int16[b+0]=r,this.int16[b+1]=o,this.uint8[k+4]=l,this.uint8[k+5]=p,this.uint8[k+6]=f,this.uint8[k+7]=y,e}}de.prototype.bytesPerElement=8,Li("StructArrayLayout2i4ub8",de);class re extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=o,e}}re.prototype.bytesPerElement=8,Li("StructArrayLayout2f8",re);class Re extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,p,f,y,b,k,I){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,o,l,p,f,y,b,k,I)}emplace(e,r,o,l,p,f,y,b,k,I,M){const R=10*e;return this.uint16[R+0]=r,this.uint16[R+1]=o,this.uint16[R+2]=l,this.uint16[R+3]=p,this.uint16[R+4]=f,this.uint16[R+5]=y,this.uint16[R+6]=b,this.uint16[R+7]=k,this.uint16[R+8]=I,this.uint16[R+9]=M,e}}Re.prototype.bytesPerElement=20,Li("StructArrayLayout10ui20",Re);class Ke extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,p,f,y,b,k,I,M,R){const V=this.length;return this.resize(V+1),this.emplace(V,e,r,o,l,p,f,y,b,k,I,M,R)}emplace(e,r,o,l,p,f,y,b,k,I,M,R,V){const j=12*e;return this.int16[j+0]=r,this.int16[j+1]=o,this.int16[j+2]=l,this.int16[j+3]=p,this.uint16[j+4]=f,this.uint16[j+5]=y,this.uint16[j+6]=b,this.uint16[j+7]=k,this.int16[j+8]=I,this.int16[j+9]=M,this.int16[j+10]=R,this.int16[j+11]=V,e}}Ke.prototype.bytesPerElement=24,Li("StructArrayLayout4i4ui4i24",Ke);class ie extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,o)}emplace(e,r,o,l){const p=3*e;return this.float32[p+0]=r,this.float32[p+1]=o,this.float32[p+2]=l,e}}ie.prototype.bytesPerElement=12,Li("StructArrayLayout3f12",ie);class Zt extends E{_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}}Zt.prototype.bytesPerElement=4,Li("StructArrayLayout1ul4",Zt);class ti extends E{_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,o,l,p,f,y,b,k){const I=this.length;return this.resize(I+1),this.emplace(I,e,r,o,l,p,f,y,b,k)}emplace(e,r,o,l,p,f,y,b,k,I){const M=10*e,R=5*e;return this.int16[M+0]=r,this.int16[M+1]=o,this.int16[M+2]=l,this.int16[M+3]=p,this.int16[M+4]=f,this.int16[M+5]=y,this.uint32[R+3]=b,this.uint16[M+8]=k,this.uint16[M+9]=I,e}}ti.prototype.bytesPerElement=20,Li("StructArrayLayout6i1ul2ui20",ti);class ni extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,p,f){const y=this.length;return this.resize(y+1),this.emplace(y,e,r,o,l,p,f)}emplace(e,r,o,l,p,f,y){const b=6*e;return this.int16[b+0]=r,this.int16[b+1]=o,this.int16[b+2]=l,this.int16[b+3]=p,this.int16[b+4]=f,this.int16[b+5]=y,e}}ni.prototype.bytesPerElement=12,Li("StructArrayLayout2i2i2i12",ni);class yi extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,o,l,p)}emplace(e,r,o,l,p,f){const y=4*e,b=8*e;return this.float32[y+0]=r,this.float32[y+1]=o,this.float32[y+2]=l,this.int16[b+6]=p,this.int16[b+7]=f,e}}yi.prototype.bytesPerElement=16,Li("StructArrayLayout2f1f2i16",yi);class xi extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,p,f){const y=this.length;return this.resize(y+1),this.emplace(y,e,r,o,l,p,f)}emplace(e,r,o,l,p,f,y){const b=16*e,k=4*e,I=8*e;return this.uint8[b+0]=r,this.uint8[b+1]=o,this.float32[k+1]=l,this.float32[k+2]=p,this.int16[I+6]=f,this.int16[I+7]=y,e}}xi.prototype.bytesPerElement=16,Li("StructArrayLayout2ub2f2i16",xi);class zi extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,o)}emplace(e,r,o,l){const p=3*e;return this.uint16[p+0]=r,this.uint16[p+1]=o,this.uint16[p+2]=l,e}}zi.prototype.bytesPerElement=6,Li("StructArrayLayout3ui6",zi);class Bi extends E{_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,o,l,p,f,y,b,k,I,M,R,V,j,q,ne,$e){const ii=this.length;return this.resize(ii+1),this.emplace(ii,e,r,o,l,p,f,y,b,k,I,M,R,V,j,q,ne,$e)}emplace(e,r,o,l,p,f,y,b,k,I,M,R,V,j,q,ne,$e,ii){const gt=24*e,Xt=12*e,hi=48*e;return this.int16[gt+0]=r,this.int16[gt+1]=o,this.uint16[gt+2]=l,this.uint16[gt+3]=p,this.uint32[Xt+2]=f,this.uint32[Xt+3]=y,this.uint32[Xt+4]=b,this.uint16[gt+10]=k,this.uint16[gt+11]=I,this.uint16[gt+12]=M,this.float32[Xt+7]=R,this.float32[Xt+8]=V,this.uint8[hi+36]=j,this.uint8[hi+37]=q,this.uint8[hi+38]=ne,this.uint32[Xt+10]=$e,this.int16[gt+22]=ii,e}}Bi.prototype.bytesPerElement=48,Li("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Bi);class bi extends E{_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,o,l,p,f,y,b,k,I,M,R,V,j,q,ne,$e,ii,gt,Xt,hi,vi,Di,Zi,Pi,Ci,Ni,Fi){const Ri=this.length;return this.resize(Ri+1),this.emplace(Ri,e,r,o,l,p,f,y,b,k,I,M,R,V,j,q,ne,$e,ii,gt,Xt,hi,vi,Di,Zi,Pi,Ci,Ni,Fi)}emplace(e,r,o,l,p,f,y,b,k,I,M,R,V,j,q,ne,$e,ii,gt,Xt,hi,vi,Di,Zi,Pi,Ci,Ni,Fi,Ri){const fi=32*e,ji=16*e;return this.int16[fi+0]=r,this.int16[fi+1]=o,this.int16[fi+2]=l,this.int16[fi+3]=p,this.int16[fi+4]=f,this.int16[fi+5]=y,this.int16[fi+6]=b,this.int16[fi+7]=k,this.uint16[fi+8]=I,this.uint16[fi+9]=M,this.uint16[fi+10]=R,this.uint16[fi+11]=V,this.uint16[fi+12]=j,this.uint16[fi+13]=q,this.uint16[fi+14]=ne,this.uint16[fi+15]=$e,this.uint16[fi+16]=ii,this.uint16[fi+17]=gt,this.uint16[fi+18]=Xt,this.uint16[fi+19]=hi,this.uint16[fi+20]=vi,this.uint16[fi+21]=Di,this.uint16[fi+22]=Zi,this.uint32[ji+12]=Pi,this.float32[ji+13]=Ci,this.float32[ji+14]=Ni,this.uint16[fi+30]=Fi,this.uint16[fi+31]=Ri,e}}bi.prototype.bytesPerElement=64,Li("StructArrayLayout8i15ui1ul2f2ui64",bi);class wi extends E{_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}}wi.prototype.bytesPerElement=4,Li("StructArrayLayout1f4",wi);class Oi extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,o)}emplace(e,r,o,l){const p=3*e;return this.uint16[6*e+0]=r,this.float32[p+1]=o,this.float32[p+2]=l,e}}Oi.prototype.bytesPerElement=12,Li("StructArrayLayout1ui2f12",Oi);class Xi extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,o)}emplace(e,r,o,l){const p=4*e;return this.uint32[2*e+0]=r,this.uint16[p+2]=o,this.uint16[p+3]=l,e}}Xi.prototype.bytesPerElement=8,Li("StructArrayLayout1ul2ui8",Xi);class Ei extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=o,e}}Ei.prototype.bytesPerElement=4,Li("StructArrayLayout2ui4",Ei);class Ai extends E{_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}}Ai.prototype.bytesPerElement=2,Li("StructArrayLayout1ui2",Ai);class Wi extends E{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,o,l)}emplace(e,r,o,l,p){const f=4*e;return this.float32[f+0]=r,this.float32[f+1]=o,this.float32[f+2]=l,this.float32[f+3]=p,e}}Wi.prototype.bytesPerElement=16,Li("StructArrayLayout4f16",Wi);class Ss extends w{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 H(this.anchorPointX,this.anchorPointY)}}Ss.prototype.size=20;class es extends ti{get(e){return new Ss(this,e)}}Li("CollisionBoxArray",es);class ns extends w{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]}}ns.prototype.size=48;class ks extends Bi{get(e){return new ns(this,e)}}Li("PlacedSymbolArray",ks);class ea extends w{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 collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}ea.prototype.size=64;class ja extends bi{get(e){return new ea(this,e)}}Li("SymbolInstanceArray",ja);class Es extends wi{getoffsetX(e){return this.float32[1*e+0]}}Li("GlyphOffsetArray",Es);class _a extends ${getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Li("SymbolLineVertexArray",_a);class da extends w{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}da.prototype.size=12;class ta extends Oi{get(e){return new da(this,e)}}Li("TextAnchorOffsetArray",ta);class ia extends w{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]}}ia.prototype.size=8;class Ua extends Xi{get(e){return new ia(this,e)}}Li("FeatureIndexArray",Ua);class Nc extends D{}class zh extends D{}class cu extends D{}class $c extends ee{}class Dh extends de{}class Ud extends re{}class Ks extends Re{}class qa extends Ke{}class xc extends ie{}class uu extends Zt{}class ra extends ni{}class na extends xi{}class Zs extends zi{}class Ps extends Ei{}const hu=C([{name:"a_pos",components:2,type:"Int16"}],4),{members:qd}=hu;class Us{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,l){let p=this.segments[this.segments.length-1];return e>Us.MAX_VERTEX_ARRAY_LENGTH&&Fs(`Max vertices per segment is ${Us.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!p||p.vertexLength+e>Us.MAX_VERTEX_ARRAY_LENGTH||p.sortKey!==l)&&(p={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},l!==void 0&&(p.sortKey=l),this.segments.push(p)),p}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,o,l){return new Us([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:l,vaos:{},sortKey:0}])}}function Gp(i,e){return 256*(i=ri(Math.floor(i),0,255))+ri(Math.floor(e),0,255)}Us.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Li("SegmentVector",Us);const Bh=C([{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 Rh={exports:{}},bc={exports:{}};bc.exports=function(i,e){var r,o,l,p,f,y,b,k;for(o=i.length-(r=3&i.length),l=e,f=3432918353,y=461845907,k=0;k<o;)b=255&i.charCodeAt(k)|(255&i.charCodeAt(++k))<<8|(255&i.charCodeAt(++k))<<16|(255&i.charCodeAt(++k))<<24,++k,l=27492+(65535&(p=5*(65535&(l=(l^=b=(65535&(b=(b=(65535&b)*f+(((b>>>16)*f&65535)<<16)&4294967295)<<15|b>>>17))*y+(((b>>>16)*y&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(p>>>16)&65535)<<16);switch(b=0,r){case 3:b^=(255&i.charCodeAt(k+2))<<16;case 2:b^=(255&i.charCodeAt(k+1))<<8;case 1:l^=b=(65535&(b=(b=(65535&(b^=255&i.charCodeAt(k)))*f+(((b>>>16)*f&65535)<<16)&4294967295)<<15|b>>>17))*y+(((b>>>16)*y&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 Hp=bc.exports,Zd={exports:{}};Zd.exports=function(i,e){for(var r,o=i.length,l=e^o,p=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(p)|(255&i.charCodeAt(++p))<<8|(255&i.charCodeAt(++p))<<16|(255&i.charCodeAt(++p))<<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)),o-=4,++p;switch(o){case 3:l^=(255&i.charCodeAt(p+2))<<16;case 2:l^=(255&i.charCodeAt(p+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(p)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Gd=Hp,Hd=Zd.exports;Rh.exports=Gd,Rh.exports.murmur3=Gd,Rh.exports.murmur2=Hd;var Lh=J(Rh.exports);class du{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,l){this.ids.push(Em(e)),this.positions.push(r,o,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Em(e);let o=0,l=this.ids.length-1;for(;o<l;){const f=o+l>>1;this.ids[f]>=r?l=f:o=f+1}const p=[];for(;this.ids[o]===r;)p.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return p}static serialize(e,r){const o=new Float64Array(e.ids),l=new Uint32Array(e.positions);return Ff(o,l,0,o.length-1),r&&r.push(o.buffer,l.buffer),{ids:o,positions:l}}static deserialize(e){const r=new du;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Em(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Lh(String(i))}function Ff(i,e,r,o){for(;r<o;){const l=i[r+o>>1];let p=r-1,f=o+1;for(;;){do p++;while(i[p]<l);do f--;while(i[f]>l);if(p>=f)break;Wp(i,p,f),Wp(e,3*p,3*f),Wp(e,3*p+1,3*f+1),Wp(e,3*p+2,3*f+2)}f-r<o-f?(Ff(i,e,r,f),r=f+1):(Ff(i,e,f+1,o),o=f)}}function Wp(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}Li("FeaturePositionMap",du);class Wu{constructor(e,r){this.gl=e.gl,this.location=r}}class Kp extends Wu{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Tm extends Wu{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Cm extends Wu{constructor(e,r){super(e,r),this.current=ps.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const hy=new Float32Array(16);function Of(i){return[Gp(255*i.r,255*i.g),Gp(255*i.b,255*i.a)]}class Wd{constructor(e,r,o){this.value=e,this.uniformNames=r.map(l=>`u_${l}`),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new Cm(e,r):new Kp(e,r)}}class Fh{constructor(e,r){this.uniformNames=r.map(o=>`u_${o}`),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,o,l){const p=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;p&&e.set(p)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"?new Tm(e,r):new Kp(e,r)}}class jc{constructor(e,r,o,l){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(p=>({name:`a_${p}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,o,l,p){const f=this.paintVertexArray.length,y=this.expression.evaluate(new vs(0),r,{},l,[],p);this.paintVertexArray.resize(e),this._setPaintValue(f,e,y)}updatePaintArray(e,r,o,l){const p=this.expression.evaluate({zoom:0},o,l);this._setPaintValue(e,r,p)}_setPaintValue(e,r,o){if(this.type==="color"){const l=Of(o);for(let p=e;p<r;p++)this.paintVertexArray.emplace(p,l[0],l[1])}else{for(let l=e;l<r;l++)this.paintVertexArray.emplace(l,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class oc{constructor(e,r,o,l,p,f){this.expression=e,this.uniformNames=r.map(y=>`u_${y}_t`),this.type=o,this.useIntegerZoom=l,this.zoom=p,this.maxValue=0,this.paintVertexAttributes=r.map(y=>({name:`a_${y}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new f}populatePaintArray(e,r,o,l,p){const f=this.expression.evaluate(new vs(this.zoom),r,{},l,[],p),y=this.expression.evaluate(new vs(this.zoom+1),r,{},l,[],p),b=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(b,e,f,y)}updatePaintArray(e,r,o,l){const p=this.expression.evaluate({zoom:this.zoom},o,l),f=this.expression.evaluate({zoom:this.zoom+1},o,l);this._setPaintValue(e,r,p,f)}_setPaintValue(e,r,o,l){if(this.type==="color"){const p=Of(o),f=Of(l);for(let y=e;y<r;y++)this.paintVertexArray.emplace(y,p[0],p[1],f[0],f[1])}else{for(let p=e;p<r;p++)this.paintVertexArray.emplace(p,o,l);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(l))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=ri(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,o){return new Kp(e,r)}}class pu{constructor(e,r,o,l,p,f){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=l,this.layerId=f,this.zoomInPaintVertexArray=new p,this.zoomOutPaintVertexArray=new p}populatePaintArray(e,r,o){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(l,e,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(e,r,o,l,p){this._setPaintValues(e,r,o.patterns&&o.patterns[this.layerId],p)}_setPaintValues(e,r,o,l){if(!l||!o)return;const{min:p,mid:f,max:y}=o,b=l[p],k=l[f],I=l[y];if(b&&k&&I)for(let M=e;M<r;M++)this.zoomInPaintVertexArray.emplace(M,k.tl[0],k.tl[1],k.br[0],k.br[1],b.tl[0],b.tl[1],b.br[0],b.br[1],k.pixelRatio,b.pixelRatio),this.zoomOutPaintVertexArray.emplace(M,k.tl[0],k.tl[1],k.br[0],k.br[1],I.tl[0],I.tl[1],I.br[0],I.br[1],k.pixelRatio,I.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Bh.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Bh.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Am{constructor(e,r,o){this.binders={},this._buffers=[];const l=[];for(const p in e.paint._values){if(!o(p))continue;const f=e.paint.get(p);if(!(f instanceof Hl&&Rc(f.property.specification)))continue;const y=dy(p,e.type),b=f.value,k=f.property.specification.type,I=f.property.useIntegerZoom,M=f.property.specification["property-type"],R=M==="cross-faded"||M==="cross-faded-data-driven";if(b.kind==="constant")this.binders[p]=R?new Fh(b.value,y):new Wd(b.value,y,k),l.push(`/u_${p}`);else if(b.kind==="source"||R){const V=Pm(p,k,"source");this.binders[p]=R?new pu(b,k,I,r,V,e.id):new jc(b,y,k,V),l.push(`/a_${p}`)}else{const V=Pm(p,k,"composite");this.binders[p]=new oc(b,y,k,I,r,V),l.push(`/z_${p}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof jc||r instanceof oc?r.maxValue:0}populatePaintArrays(e,r,o,l,p){for(const f in this.binders){const y=this.binders[f];(y instanceof jc||y instanceof oc||y instanceof pu)&&y.populatePaintArray(e,r,o,l,p)}}setConstantPatternPositions(e,r){for(const o in this.binders){const l=this.binders[o];l instanceof Fh&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,l,p){let f=!1;for(const y in e){const b=r.getPositions(y);for(const k of b){const I=o.feature(k.index);for(const M in this.binders){const R=this.binders[M];if((R instanceof jc||R instanceof oc||R instanceof pu)&&R.expression.isStateDependent===!0){const V=l.paint.get(M);R.expression=V.value,R.updatePaintArray(k.start,k.end,I,e[y],p),f=!0}}}}return f}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Wd||o instanceof Fh)&&e.push(...o.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof jc||o instanceof oc)for(let l=0;l<o.paintVertexAttributes.length;l++)e.push(o.paintVertexAttributes[l].name);else if(o instanceof pu)for(let l=0;l<Bh.members.length;l++)e.push(Bh.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Wd||o instanceof Fh||o instanceof oc)for(const l of o.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const l in this.binders){const p=this.binders[l];if(p instanceof Wd||p instanceof Fh||p instanceof oc){for(const f of p.uniformNames)if(r[f]){const y=p.getBinding(e,r[f],f);o.push({name:f,property:l,binding:y})}}}return o}setUniforms(e,r,o,l){for(const{name:p,property:f,binding:y}of r)this.binders[f].setUniform(y,l,o.get(f),p)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof pu){const l=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(o instanceof jc||o instanceof oc)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof jc||o instanceof oc||o instanceof pu)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof jc||r instanceof oc||r instanceof pu)&&r.destroy()}}}class Ku{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Am(l,r,o);this.needsUpload=!1,this._featureMap=new du,this._bufferOffset=0}populatePaintArrays(e,r,o,l,p,f){for(const y in this.programConfigurations)this.programConfigurations[y].populatePaintArrays(e,r,l,p,f);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,l){for(const p of o)this.needsUpload=this.programConfigurations[p.id].updatePaintArrays(e,this._featureMap,r,p,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 dy(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 Pm(i,e,r){const o={color:{source:re,composite:Wi},number:{source:wi,composite:re}},l=function(p){return{"line-pattern":{source:Ks,composite:Ks},"fill-pattern":{source:Ks,composite:Ks},"fill-extrusion-pattern":{source:Ks,composite:Ks}}[p]}(i);return l&&l[r]||o[e][r]}Li("ConstantBinder",Wd),Li("CrossFadedConstantBinder",Fh),Li("SourceExpressionBinder",jc),Li("CrossFadedCompositeBinder",pu),Li("CompositeExpressionBinder",oc),Li("ProgramConfiguration",Am,{omit:["_buffers"]}),Li("ProgramConfigurationSet",Ku);const Ns=8192,Vf=Math.pow(2,14)-1,Im=-Vf-1;function Xu(i){const e=Ns/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){const l=r[o];for(let p=0;p<l.length;p++){const f=l[p],y=Math.round(f.x*e),b=Math.round(f.y*e);f.x=ri(y,Im,Vf),f.y=ri(b,Im,Vf),(y<f.x||y>f.x+1||b<f.y||b>f.y+1)&&Fs("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ju(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Xu(i):[]}}function Xp(i,e,r,o,l){i.emplaceBack(2*e+(o+1)/2,2*r+(l+1)/2)}class Nf{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 zh,this.indexArray=new Zs,this.segments=new Us,this.programConfigurations=new Ku(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){const l=this.layers[0],p=[];let f=null,y=!1;l.type==="circle"&&(f=l.layout.get("circle-sort-key"),y=!f.isConstant());for(const{feature:b,id:k,index:I,sourceLayerIndex:M}of e){const R=this.layers[0]._featureFilter.needGeometry,V=Ju(b,R);if(!this.layers[0]._featureFilter.filter(new vs(this.zoom),V,o))continue;const j=y?f.evaluate(V,{},o):void 0,q={id:k,properties:b.properties,type:b.type,sourceLayerIndex:M,index:I,geometry:R?V.geometry:Xu(b),patterns:{},sortKey:j};p.push(q)}y&&p.sort((b,k)=>b.sortKey-k.sortKey);for(const b of p){const{geometry:k,index:I,sourceLayerIndex:M}=b,R=e[I].feature;this.addFeature(b,k,I,o),r.featureIndex.insert(R,k,I,M,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,qd),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,o,l){for(const p of r)for(const f of p){const y=f.x,b=f.y;if(y<0||y>=Ns||b<0||b>=Ns)continue;const k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),I=k.vertexLength;Xp(this.layoutVertexArray,y,b,-1,-1),Xp(this.layoutVertexArray,y,b,1,-1),Xp(this.layoutVertexArray,y,b,1,1),Xp(this.layoutVertexArray,y,b,-1,1),this.indexArray.emplaceBack(I,I+1,I+2),this.indexArray.emplaceBack(I,I+3,I+2),k.vertexLength+=4,k.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},l)}}function Mm(i,e){for(let r=0;r<i.length;r++)if(Oh(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Oh(i,e[r]))return!0;return!!$f(i,e)}function py(i,e,r){return!!Oh(i,e)||!!jf(e,i,r)}function zm(i,e){if(i.length===1)return Bm(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let l=0;l<o.length;l++)if(Oh(i,o[l]))return!0}for(let r=0;r<i.length;r++)if(Bm(e,i[r]))return!0;for(let r=0;r<e.length;r++)if($f(i,e[r]))return!0;return!1}function fy(i,e,r){if(i.length>1){if($f(i,e))return!0;for(let o=0;o<e.length;o++)if(jf(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(jf(i[o],e,r))return!0;return!1}function $f(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const o=i[r],l=i[r+1];for(let p=0;p<e.length-1;p++)if(my(o,l,e[p],e[p+1]))return!0}return!1}function my(i,e,r,o){return ca(i,r,o)!==ca(e,r,o)&&ca(i,e,r)!==ca(i,e,o)}function jf(i,e,r){const o=r*r;if(e.length===1)return i.distSqr(e[0])<o;for(let l=1;l<e.length;l++)if(Dm(i,e[l-1],e[l])<o)return!0;return!1}function Dm(i,e,r){const o=e.distSqr(r);if(o===0)return i.distSqr(e);const l=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/o;return i.distSqr(l<0?e:l>1?r:r.sub(e)._mult(l)._add(e))}function Bm(i,e){let r,o,l,p=!1;for(let f=0;f<i.length;f++){r=i[f];for(let y=0,b=r.length-1;y<r.length;b=y++)o=r[y],l=r[b],o.y>e.y!=l.y>e.y&&e.x<(l.x-o.x)*(e.y-o.y)/(l.y-o.y)+o.x&&(p=!p)}return p}function Oh(i,e){let r=!1;for(let o=0,l=i.length-1;o<i.length;l=o++){const p=i[o],f=i[l];p.y>e.y!=f.y>e.y&&e.x<(f.x-p.x)*(e.y-p.y)/(f.y-p.y)+p.x&&(r=!r)}return r}function gy(i,e,r){const o=r[0],l=r[2];if(i.x<o.x&&e.x<o.x||i.x>l.x&&e.x>l.x||i.y<o.y&&e.y<o.y||i.y>l.y&&e.y>l.y)return!1;const p=ca(i,e,r[0]);return p!==ca(i,e,r[1])||p!==ca(i,e,r[2])||p!==ca(i,e,r[3])}function Kd(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Jp(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Yp(i,e,r,o,l){if(!e[0]&&!e[1])return i;const p=H.convert(e)._mult(l);r==="viewport"&&p._rotate(-o);const f=[];for(let y=0;y<i.length;y++)f.push(i[y].sub(p));return f}let Rm,Lm;Li("CircleBucket",Nf,{omit:["layers"]});var yy={get paint(){return Lm=Lm||new s({"circle-radius":new Gi(ui.paint_circle["circle-radius"]),"circle-color":new Gi(ui.paint_circle["circle-color"]),"circle-blur":new Gi(ui.paint_circle["circle-blur"]),"circle-opacity":new Gi(ui.paint_circle["circle-opacity"]),"circle-translate":new $i(ui.paint_circle["circle-translate"]),"circle-translate-anchor":new $i(ui.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new $i(ui.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new $i(ui.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Gi(ui.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Gi(ui.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Gi(ui.paint_circle["circle-stroke-opacity"])})},get layout(){return Rm=Rm||new s({"circle-sort-key":new Gi(ui.layout_circle["circle-sort-key"])})}},va=1e-6,Vh=typeof Float32Array<"u"?Float32Array:Array;function Uf(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Fm(i,e,r){var o=e[0],l=e[1],p=e[2],f=e[3],y=e[4],b=e[5],k=e[6],I=e[7],M=e[8],R=e[9],V=e[10],j=e[11],q=e[12],ne=e[13],$e=e[14],ii=e[15],gt=r[0],Xt=r[1],hi=r[2],vi=r[3];return i[0]=gt*o+Xt*y+hi*M+vi*q,i[1]=gt*l+Xt*b+hi*R+vi*ne,i[2]=gt*p+Xt*k+hi*V+vi*$e,i[3]=gt*f+Xt*I+hi*j+vi*ii,i[4]=(gt=r[4])*o+(Xt=r[5])*y+(hi=r[6])*M+(vi=r[7])*q,i[5]=gt*l+Xt*b+hi*R+vi*ne,i[6]=gt*p+Xt*k+hi*V+vi*$e,i[7]=gt*f+Xt*I+hi*j+vi*ii,i[8]=(gt=r[8])*o+(Xt=r[9])*y+(hi=r[10])*M+(vi=r[11])*q,i[9]=gt*l+Xt*b+hi*R+vi*ne,i[10]=gt*p+Xt*k+hi*V+vi*$e,i[11]=gt*f+Xt*I+hi*j+vi*ii,i[12]=(gt=r[12])*o+(Xt=r[13])*y+(hi=r[14])*M+(vi=r[15])*q,i[13]=gt*l+Xt*b+hi*R+vi*ne,i[14]=gt*p+Xt*k+hi*V+vi*$e,i[15]=gt*f+Xt*I+hi*j+vi*ii,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Xd,_y=Fm;function Qp(i,e,r){var o=e[0],l=e[1],p=e[2],f=e[3];return i[0]=r[0]*o+r[4]*l+r[8]*p+r[12]*f,i[1]=r[1]*o+r[5]*l+r[9]*p+r[13]*f,i[2]=r[2]*o+r[6]*l+r[10]*p+r[14]*f,i[3]=r[3]*o+r[7]*l+r[11]*p+r[15]*f,i}Xd=new Vh(4),Vh!=Float32Array&&(Xd[0]=0,Xd[1]=0,Xd[2]=0,Xd[3]=0);class vy extends h{constructor(e){super(e,yy)}createBucket(e){return new Nf(e)}queryRadius(e){const r=e;return Kd("circle-radius",this,r)+Kd("circle-stroke-width",this,r)+Jp(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,o,l,p,f,y,b){const k=Yp(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),f.angle,y),I=this.paint.get("circle-radius").evaluate(r,o)+this.paint.get("circle-stroke-width").evaluate(r,o),M=this.paint.get("circle-pitch-alignment")==="map",R=M?k:function(j,q){return j.map(ne=>Om(ne,q))}(k,b),V=M?I*y:I;for(const j of l)for(const q of j){const ne=M?q:Om(q,b);let $e=V;const ii=Qp([],[q.x,q.y,0,1],b);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$e*=ii[3]/f.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($e*=f.cameraToCenterDistance/ii[3]),py(R,ne,$e))return!0}return!1}}function Om(i,e){const r=Qp([],[i.x,i.y,0,1],e);return new H(r[0]/r[3],r[1]/r[3])}class Vm extends Nf{}let Nm;Li("HeatmapBucket",Vm,{omit:["layers"]});var xy={get paint(){return Nm=Nm||new s({"heatmap-radius":new Gi(ui.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Gi(ui.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new $i(ui.paint_heatmap["heatmap-intensity"]),"heatmap-color":new n(ui.paint_heatmap["heatmap-color"]),"heatmap-opacity":new $i(ui.paint_heatmap["heatmap-opacity"])})}};function qf(i,{width:e,height:r},o,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*o}`)}else l=new Uint8Array(e*r*o);return i.width=e,i.height=r,i.data=l,i}function $m(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const l=qf({},{width:e,height:r},o);Zf(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},o),i.width=e,i.height=r,i.data=l.data}function Zf(i,e,r,o,l,p){if(l.width===0||l.height===0)return e;if(l.width>i.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||o.x>e.width-l.width||o.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const f=i.data,y=e.data;if(f===y)throw new Error("srcData equals dstData, so image is already copied");for(let b=0;b<l.height;b++){const k=((r.y+b)*i.width+r.x)*p,I=((o.y+b)*e.width+o.x)*p;for(let M=0;M<l.width*p;M++)y[I+M]=f[k+M]}return e}class Jd{constructor(e,r){qf(this,e,1,r)}resize(e){$m(this,e,1)}clone(){return new Jd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,l,p){Zf(e,r,o,l,p,1)}}class Za{constructor(e,r){qf(this,e,4,r)}resize(e){$m(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Za({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,l,p){Zf(e,r,o,l,p,4)}}function jm(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,l=i.image||new Za({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const p=(f,y,b)=>{e[i.evaluationKey]=b;const k=i.expression.evaluate(e);l.data[f+y+0]=Math.floor(255*k.r/k.a),l.data[f+y+1]=Math.floor(255*k.g/k.a),l.data[f+y+2]=Math.floor(255*k.b/k.a),l.data[f+y+3]=Math.floor(255*k.a)};if(i.clips)for(let f=0,y=0;f<o;++f,y+=4*r)for(let b=0,k=0;b<r;b++,k+=4){const I=b/(r-1),{start:M,end:R}=i.clips[f];p(y,k,M*(1-I)+R*I)}else for(let f=0,y=0;f<r;f++,y+=4)p(0,y,f/(r-1));return l}Li("AlphaImage",Jd),Li("RGBAImage",Za);class by extends h{createBucket(e){return new Vm(e)}constructor(e){super(e,xy),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=jm({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"}}let Um;var wy={get paint(){return Um=Um||new s({"hillshade-illumination-direction":new $i(ui.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new $i(ui.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new $i(ui.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new $i(ui.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new $i(ui.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new $i(ui.paint_hillshade["hillshade-accent-color"])})}};class Sy extends h{constructor(e){super(e,wy)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const ky=C([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ey}=ky;function qm(i,e,r=2){const o=e&&e.length,l=o?e[0]*r:i.length;let p=Zm(i,0,l,r,!0);const f=[];if(!p||p.next===p.prev)return f;let y,b,k;if(o&&(p=function(I,M,R,V){const j=[];for(let q=0,ne=M.length;q<ne;q++){const $e=Zm(I,M[q]*V,q<ne-1?M[q+1]*V:I.length,V,!1);$e===$e.next&&($e.steiner=!0),j.push(Dy($e))}j.sort(Iy);for(let q=0;q<j.length;q++)R=My(j[q],R);return R}(i,e,p,r)),i.length>80*r){y=1/0,b=1/0;let I=-1/0,M=-1/0;for(let R=r;R<l;R+=r){const V=i[R],j=i[R+1];V<y&&(y=V),j<b&&(b=j),V>I&&(I=V),j>M&&(M=j)}k=Math.max(I-y,M-b),k=k!==0?32767/k:0}return Yd(p,f,r,y,b,k,0),f}function Zm(i,e,r,o,l){let p;if(l===function(f,y,b,k){let I=0;for(let M=y,R=b-k;M<b;M+=k)I+=(f[R]-f[M])*(f[M+1]+f[R+1]),R=M;return I}(i,e,r,o)>0)for(let f=e;f<r;f+=o)p=Wm(f/o|0,i[f],i[f+1],p);else for(let f=r-o;f>=e;f-=o)p=Wm(f/o|0,i[f],i[f+1],p);return p&&ef(p,p.next)&&(ep(p),p=p.next),p}function Yu(i,e){if(!i)return i;e||(e=i);let r,o=i;do if(r=!1,o.steiner||!ef(o,o.next)&&Ls(o.prev,o,o.next)!==0)o=o.next;else{if(ep(o),o=e=o.prev,o===o.next)break;r=!0}while(r||o!==e);return e}function Yd(i,e,r,o,l,p,f){if(!i)return;!f&&p&&function(b,k,I,M){let R=b;do R.z===0&&(R.z=Gf(R.x,R.y,k,I,M)),R.prevZ=R.prev,R.nextZ=R.next,R=R.next;while(R!==b);R.prevZ.nextZ=null,R.prevZ=null,function(V){let j,q=1;do{let ne,$e=V;V=null;let ii=null;for(j=0;$e;){j++;let gt=$e,Xt=0;for(let vi=0;vi<q&&(Xt++,gt=gt.nextZ,gt);vi++);let hi=q;for(;Xt>0||hi>0&>)Xt!==0&&(hi===0||!gt||$e.z<=gt.z)?(ne=$e,$e=$e.nextZ,Xt--):(ne=gt,gt=gt.nextZ,hi--),ii?ii.nextZ=ne:V=ne,ne.prevZ=ii,ii=ne;$e=gt}ii.nextZ=null,q*=2}while(j>1)}(R)}(i,o,l,p);let y=i;for(;i.prev!==i.next;){const b=i.prev,k=i.next;if(p?Cy(i,o,l,p):Ty(i))e.push(b.i,i.i,k.i),ep(i),i=k.next,y=k.next;else if((i=k)===y){f?f===1?Yd(i=Ay(Yu(i),e),e,r,o,l,p,2):f===2&&Py(i,e,r,o,l,p):Yd(Yu(i),e,r,o,l,p,1);break}}}function Ty(i){const e=i.prev,r=i,o=i.next;if(Ls(e,r,o)>=0)return!1;const l=e.x,p=r.x,f=o.x,y=e.y,b=r.y,k=o.y,I=l<p?l<f?l:f:p<f?p:f,M=y<b?y<k?y:k:b<k?b:k,R=l>p?l>f?l:f:p>f?p:f,V=y>b?y>k?y:k:b>k?b:k;let j=o.next;for(;j!==e;){if(j.x>=I&&j.x<=R&&j.y>=M&&j.y<=V&&Nh(l,y,p,b,f,k,j.x,j.y)&&Ls(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function Cy(i,e,r,o){const l=i.prev,p=i,f=i.next;if(Ls(l,p,f)>=0)return!1;const y=l.x,b=p.x,k=f.x,I=l.y,M=p.y,R=f.y,V=y<b?y<k?y:k:b<k?b:k,j=I<M?I<R?I:R:M<R?M:R,q=y>b?y>k?y:k:b>k?b:k,ne=I>M?I>R?I:R:M>R?M:R,$e=Gf(V,j,e,r,o),ii=Gf(q,ne,e,r,o);let gt=i.prevZ,Xt=i.nextZ;for(;gt&>.z>=$e&&Xt&&Xt.z<=ii;){if(gt.x>=V&>.x<=q&>.y>=j&>.y<=ne&>!==l&>!==f&&Nh(y,I,b,M,k,R,gt.x,gt.y)&&Ls(gt.prev,gt,gt.next)>=0||(gt=gt.prevZ,Xt.x>=V&&Xt.x<=q&&Xt.y>=j&&Xt.y<=ne&&Xt!==l&&Xt!==f&&Nh(y,I,b,M,k,R,Xt.x,Xt.y)&&Ls(Xt.prev,Xt,Xt.next)>=0))return!1;Xt=Xt.nextZ}for(;gt&>.z>=$e;){if(gt.x>=V&>.x<=q&>.y>=j&>.y<=ne&>!==l&>!==f&&Nh(y,I,b,M,k,R,gt.x,gt.y)&&Ls(gt.prev,gt,gt.next)>=0)return!1;gt=gt.prevZ}for(;Xt&&Xt.z<=ii;){if(Xt.x>=V&&Xt.x<=q&&Xt.y>=j&&Xt.y<=ne&&Xt!==l&&Xt!==f&&Nh(y,I,b,M,k,R,Xt.x,Xt.y)&&Ls(Xt.prev,Xt,Xt.next)>=0)return!1;Xt=Xt.nextZ}return!0}function Ay(i,e){let r=i;do{const o=r.prev,l=r.next.next;!ef(o,l)&&Gm(o,r,r.next,l)&&Qd(o,l)&&Qd(l,o)&&(e.push(o.i,r.i,l.i),ep(r),ep(r.next),r=i=l),r=r.next}while(r!==i);return Yu(r)}function Py(i,e,r,o,l,p){let f=i;do{let y=f.next.next;for(;y!==f.prev;){if(f.i!==y.i&&By(f,y)){let b=Hm(f,y);return f=Yu(f,f.next),b=Yu(b,b.next),Yd(f,e,r,o,l,p,0),void Yd(b,e,r,o,l,p,0)}y=y.next}f=f.next}while(f!==i)}function Iy(i,e){return i.x-e.x}function My(i,e){const r=function(l,p){let f=p;const y=l.x,b=l.y;let k,I=-1/0;do{if(b<=f.y&&b>=f.next.y&&f.next.y!==f.y){const q=f.x+(b-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(q<=y&&q>I&&(I=q,k=f.x<f.next.x?f:f.next,q===y))return k}f=f.next}while(f!==p);if(!k)return null;const M=k,R=k.x,V=k.y;let j=1/0;f=k;do{if(y>=f.x&&f.x>=R&&y!==f.x&&Nh(b<V?y:I,b,R,V,b<V?I:y,b,f.x,f.y)){const q=Math.abs(b-f.y)/(y-f.x);Qd(f,l)&&(q<j||q===j&&(f.x>k.x||f.x===k.x&&zy(k,f)))&&(k=f,j=q)}f=f.next}while(f!==M);return k}(i,e);if(!r)return e;const o=Hm(r,i);return Yu(o,o.next),Yu(r,r.next)}function zy(i,e){return Ls(i.prev,i,e.prev)<0&&Ls(e.next,i,i.next)<0}function Gf(i,e,r,o,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-o)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Dy(i){let e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Nh(i,e,r,o,l,p,f,y){return(l-f)*(e-y)>=(i-f)*(p-y)&&(i-f)*(o-y)>=(r-f)*(e-y)&&(r-f)*(p-y)>=(l-f)*(o-y)}function By(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,o){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==o.i&&l.next.i!==o.i&&Gm(l,l.next,r,o))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(Qd(i,e)&&Qd(e,i)&&function(r,o){let l=r,p=!1;const f=(r.x+o.x)/2,y=(r.y+o.y)/2;do l.y>y!=l.next.y>y&&l.next.y!==l.y&&f<(l.next.x-l.x)*(y-l.y)/(l.next.y-l.y)+l.x&&(p=!p),l=l.next;while(l!==r);return p}(i,e)&&(Ls(i.prev,i,e.prev)||Ls(i,e.prev,e))||ef(i,e)&&Ls(i.prev,i,i.next)>0&&Ls(e.prev,e,e.next)>0)}function Ls(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function ef(i,e){return i.x===e.x&&i.y===e.y}function Gm(i,e,r,o){const l=rf(Ls(i,e,r)),p=rf(Ls(i,e,o)),f=rf(Ls(r,o,i)),y=rf(Ls(r,o,e));return l!==p&&f!==y||!(l!==0||!tf(i,r,e))||!(p!==0||!tf(i,o,e))||!(f!==0||!tf(r,i,o))||!(y!==0||!tf(r,e,o))}function tf(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 rf(i){return i>0?1:i<0?-1:0}function Qd(i,e){return Ls(i.prev,i,i.next)<0?Ls(i,e,i.next)>=0&&Ls(i,i.prev,e)>=0:Ls(i,e,i.prev)<0||Ls(i,i.next,e)<0}function Hm(i,e){const r=Hf(i.i,i.x,i.y),o=Hf(e.i,e.x,e.y),l=i.next,p=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,o.next=r,r.prev=o,p.next=o,o.prev=p,o}function Wm(i,e,r,o){const l=Hf(i,e,r);return o?(l.next=o.next,l.prev=o,o.next.prev=l,o.next=l):(l.prev=l,l.next=l),l}function ep(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 Hf(i,e,r){return{i,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Wf(i,e,r){const o=r.patternDependencies;let l=!1;for(const p of e){const f=p.paint.get(`${i}-pattern`);f.isConstant()||(l=!0);const y=f.constantOr(null);y&&(l=!0,o[y.to]=!0,o[y.from]=!0)}return l}function Kf(i,e,r,o,l){const p=l.patternDependencies;for(const f of e){const y=f.paint.get(`${i}-pattern`).value;if(y.kind!=="constant"){let b=y.evaluate({zoom:o-1},r,{},l.availableImages),k=y.evaluate({zoom:o},r,{},l.availableImages),I=y.evaluate({zoom:o+1},r,{},l.availableImages);b=b&&b.name?b.name:b,k=k&&k.name?k.name:k,I=I&&I.name?I.name:I,p[b]=!0,p[k]=!0,p[I]=!0,r.patterns[f.id]={min:b,mid:k,max:I}}}return r}class Xf{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 cu,this.indexArray=new Zs,this.indexArray2=new Ps,this.programConfigurations=new Ku(e.layers,e.zoom),this.segments=new Us,this.segments2=new Us,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=Wf("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),p=!l.isConstant(),f=[];for(const{feature:y,id:b,index:k,sourceLayerIndex:I}of e){const M=this.layers[0]._featureFilter.needGeometry,R=Ju(y,M);if(!this.layers[0]._featureFilter.filter(new vs(this.zoom),R,o))continue;const V=p?l.evaluate(R,{},o,r.availableImages):void 0,j={id:b,properties:y.properties,type:y.type,sourceLayerIndex:I,index:k,geometry:M?R.geometry:Xu(y),patterns:{},sortKey:V};f.push(j)}p&&f.sort((y,b)=>y.sortKey-b.sortKey);for(const y of f){const{geometry:b,index:k,sourceLayerIndex:I}=y;if(this.hasPattern){const M=Kf("fill",this.layers,y,this.zoom,r);this.patternFeatures.push(M)}else this.addFeature(y,b,k,o,{});r.featureIndex.insert(e[k].feature,b,k,I,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ey),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,o,l,p){for(const f of ph(r,500)){let y=0;for(const V of f)y+=V.length;const b=this.segments.prepareSegment(y,this.layoutVertexArray,this.indexArray),k=b.vertexLength,I=[],M=[];for(const V of f){if(V.length===0)continue;V!==f[0]&&M.push(I.length/2);const j=this.segments2.prepareSegment(V.length,this.layoutVertexArray,this.indexArray2),q=j.vertexLength;this.layoutVertexArray.emplaceBack(V[0].x,V[0].y),this.indexArray2.emplaceBack(q+V.length-1,q),I.push(V[0].x),I.push(V[0].y);for(let ne=1;ne<V.length;ne++)this.layoutVertexArray.emplaceBack(V[ne].x,V[ne].y),this.indexArray2.emplaceBack(q+ne-1,q+ne),I.push(V[ne].x),I.push(V[ne].y);j.vertexLength+=V.length,j.primitiveLength+=V.length}const R=qm(I,M);for(let V=0;V<R.length;V+=3)this.indexArray.emplaceBack(k+R[V],k+R[V+1],k+R[V+2]);b.vertexLength+=y,b.primitiveLength+=R.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,p,l)}}let Km,Xm;Li("FillBucket",Xf,{omit:["layers","patternFeatures"]});var Ry={get paint(){return Xm=Xm||new s({"fill-antialias":new $i(ui.paint_fill["fill-antialias"]),"fill-opacity":new Gi(ui.paint_fill["fill-opacity"]),"fill-color":new Gi(ui.paint_fill["fill-color"]),"fill-outline-color":new Gi(ui.paint_fill["fill-outline-color"]),"fill-translate":new $i(ui.paint_fill["fill-translate"]),"fill-translate-anchor":new $i(ui.paint_fill["fill-translate-anchor"]),"fill-pattern":new d(ui.paint_fill["fill-pattern"])})},get layout(){return Km=Km||new s({"fill-sort-key":new Gi(ui.layout_fill["fill-sort-key"])})}};class Ly extends h{constructor(e){super(e,Ry)}recalculate(e,r){super.recalculate(e,r);const o=this.paint._values["fill-outline-color"];o.value.kind==="constant"&&o.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Xf(e)}queryRadius(){return Jp(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,o,l,p,f,y){return zm(Yp(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),f.angle,y),l)}isTileClipped(){return!0}}const Fy=C([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Oy=C([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Vy}=Fy;var fu={},Ny=te,Jm=$h;function $h(i,e,r,o,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=l,i.readFields($y,this,e)}function $y(i,e,r){i==1?e.id=r.readVarint():i==2?function(o,l){for(var p=o.readVarint()+o.pos;o.pos<p;){var f=l._keys[o.readVarint()],y=l._values[o.readVarint()];l.properties[f]=y}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function jy(i){for(var e,r,o=0,l=0,p=i.length,f=p-1;l<p;f=l++)o+=((r=i[f]).x-(e=i[l]).x)*(e.y+r.y);return o}$h.types=["Unknown","Point","LineString","Polygon"],$h.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,o=1,l=0,p=0,f=0,y=[];i.pos<r;){if(l<=0){var b=i.readVarint();o=7&b,l=b>>3}if(l--,o===1||o===2)p+=i.readSVarint(),f+=i.readSVarint(),o===1&&(e&&y.push(e),e=[]),e.push(new Ny(p,f));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&y.push(e),y},$h.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,o=0,l=0,p=0,f=1/0,y=-1/0,b=1/0,k=-1/0;i.pos<e;){if(o<=0){var I=i.readVarint();r=7&I,o=I>>3}if(o--,r===1||r===2)(l+=i.readSVarint())<f&&(f=l),l>y&&(y=l),(p+=i.readSVarint())<b&&(b=p),p>k&&(k=p);else if(r!==7)throw new Error("unknown command "+r)}return[f,b,y,k]},$h.prototype.toGeoJSON=function(i,e,r){var o,l,p=this.extent*Math.pow(2,r),f=this.extent*i,y=this.extent*e,b=this.loadGeometry(),k=$h.types[this.type];function I(V){for(var j=0;j<V.length;j++){var q=V[j];V[j]=[360*(q.x+f)/p-180,360/Math.PI*Math.atan(Math.exp((180-360*(q.y+y)/p)*Math.PI/180))-90]}}switch(this.type){case 1:var M=[];for(o=0;o<b.length;o++)M[o]=b[o][0];I(b=M);break;case 2:for(o=0;o<b.length;o++)I(b[o]);break;case 3:for(b=function(V){var j=V.length;if(j<=1)return[V];for(var q,ne,$e=[],ii=0;ii<j;ii++){var gt=jy(V[ii]);gt!==0&&(ne===void 0&&(ne=gt<0),ne===gt<0?(q&&$e.push(q),q=[V[ii]]):q.push(V[ii]))}return q&&$e.push(q),$e}(b),o=0;o<b.length;o++)for(l=0;l<b[o].length;l++)I(b[o][l])}b.length===1?b=b[0]:k="Multi"+k;var R={type:"Feature",geometry:{type:k,coordinates:b},properties:this.properties};return"id"in this&&(R.id=this.id),R};var Uy=Jm,Ym=Qm;function Qm(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(qy,this,e),this.length=this._features.length}function qy(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(o){for(var l=null,p=o.readVarint()+o.pos;o.pos<p;){var f=o.readVarint()>>3;l=f===1?o.readString():f===2?o.readFloat():f===3?o.readDouble():f===4?o.readVarint64():f===5?o.readVarint():f===6?o.readSVarint():f===7?o.readBoolean():null}return l}(r))}Qm.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 Uy(this._pbf,e,this.extent,this._keys,this._values)};var Zy=Ym;function Gy(i,e,r){if(i===3){var o=new Zy(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}fu.VectorTile=function(i,e){this.layers=i.readFields(Gy,{},e)},fu.VectorTileFeature=Jm,fu.VectorTileLayer=Ym;const Hy=fu.VectorTileFeature.types,Jf=Math.pow(2,13);function tp(i,e,r,o,l,p,f,y){i.emplaceBack(e,r,2*Math.floor(o*Jf)+f,l*Jf*2,p*Jf*2,Math.round(y))}class Yf{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 $c,this.centroidVertexArray=new Nc,this.indexArray=new Zs,this.programConfigurations=new Ku(e.layers,e.zoom),this.segments=new Us,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=Wf("fill-extrusion",this.layers,r);for(const{feature:l,id:p,index:f,sourceLayerIndex:y}of e){const b=this.layers[0]._featureFilter.needGeometry,k=Ju(l,b);if(!this.layers[0]._featureFilter.filter(new vs(this.zoom),k,o))continue;const I={id:p,sourceLayerIndex:y,index:f,geometry:b?k.geometry:Xu(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Kf("fill-extrusion",this.layers,I,this.zoom,r)):this.addFeature(I,I.geometry,f,o,{}),r.featureIndex.insert(l,I.geometry,f,y,this.index,!0)}}addFeatures(e,r,o){for(const l of this.features){const{geometry:p}=l;this.addFeature(l,p,l.index,r,o)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}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,Vy),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Oy.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,o,l,p){for(const f of ph(r,500)){const y={x:0,y:0,vertexCount:0};let b=0;for(const j of f)b+=j.length;let k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const j of f){if(j.length===0||Ky(j))continue;let q=0;for(let ne=0;ne<j.length;ne++){const $e=j[ne];if(ne>=1){const ii=j[ne-1];if(!Wy($e,ii)){k.vertexLength+4>Us.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const gt=$e.sub(ii)._perp()._unit(),Xt=ii.dist($e);q+Xt>32768&&(q=0),tp(this.layoutVertexArray,$e.x,$e.y,gt.x,gt.y,0,0,q),tp(this.layoutVertexArray,$e.x,$e.y,gt.x,gt.y,0,1,q),y.x+=2*$e.x,y.y+=2*$e.y,y.vertexCount+=2,q+=Xt,tp(this.layoutVertexArray,ii.x,ii.y,gt.x,gt.y,0,0,q),tp(this.layoutVertexArray,ii.x,ii.y,gt.x,gt.y,0,1,q),y.x+=2*ii.x,y.y+=2*ii.y,y.vertexCount+=2;const hi=k.vertexLength;this.indexArray.emplaceBack(hi,hi+2,hi+1),this.indexArray.emplaceBack(hi+1,hi+2,hi+3),k.vertexLength+=4,k.primitiveLength+=2}}}}if(k.vertexLength+b>Us.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray)),Hy[e.type]!=="Polygon")continue;const I=[],M=[],R=k.vertexLength;for(const j of f)if(j.length!==0){j!==f[0]&&M.push(I.length/2);for(let q=0;q<j.length;q++){const ne=j[q];tp(this.layoutVertexArray,ne.x,ne.y,0,0,1,1,0),y.x+=ne.x,y.y+=ne.y,y.vertexCount+=1,I.push(ne.x),I.push(ne.y)}}const V=qm(I,M);for(let j=0;j<V.length;j+=3)this.indexArray.emplaceBack(R+V[j],R+V[j+2],R+V[j+1]);k.primitiveLength+=V.length/3,k.vertexLength+=b;for(let j=0;j<y.vertexCount;j++){const q=Math.floor(y.x/y.vertexCount),ne=Math.floor(y.y/y.vertexCount);this.centroidVertexArray.emplaceBack(q,ne)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,p,l)}}function Wy(i,e){return i.x===e.x&&(i.x<0||i.x>Ns)||i.y===e.y&&(i.y<0||i.y>Ns)}function Ky(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Ns)||i.every(e=>e.y<0)||i.every(e=>e.y>Ns)}let eg;Li("FillExtrusionBucket",Yf,{omit:["layers","features"]});var Xy={get paint(){return eg=eg||new s({"fill-extrusion-opacity":new $i(ui["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Gi(ui["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new $i(ui["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new $i(ui["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new d(ui["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Gi(ui["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Gi(ui["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new $i(ui["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Jy extends h{constructor(e){super(e,Xy)}createBucket(e){return new Yf(e)}queryRadius(){return Jp(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,o,l,p,f,y,b){const k=Yp(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),f.angle,y),I=this.paint.get("fill-extrusion-height").evaluate(r,o),M=this.paint.get("fill-extrusion-base").evaluate(r,o),R=function(j,q,ne,$e){const ii=[];for(const gt of j){const Xt=[gt.x,gt.y,0,1];Qp(Xt,Xt,q),ii.push(new H(Xt[0]/Xt[3],Xt[1]/Xt[3]))}return ii}(k,b),V=function(j,q,ne,$e){const ii=[],gt=[],Xt=$e[8]*q,hi=$e[9]*q,vi=$e[10]*q,Di=$e[11]*q,Zi=$e[8]*ne,Pi=$e[9]*ne,Ci=$e[10]*ne,Ni=$e[11]*ne;for(const Fi of j){const Ri=[],fi=[];for(const ji of Fi){const Vi=ji.x,Ki=ji.y,gs=$e[0]*Vi+$e[4]*Ki+$e[12],ms=$e[1]*Vi+$e[5]*Ki+$e[13],Gs=$e[2]*Vi+$e[6]*Ki+$e[14],Wl=$e[3]*Vi+$e[7]*Ki+$e[15],sa=Gs+vi,Ds=Wl+Di,xa=gs+Zi,ba=ms+Pi,wa=Gs+Ci,Bs=Wl+Ni,Hs=new H((gs+Xt)/Ds,(ms+hi)/Ds);Hs.z=sa/Ds,Ri.push(Hs);const pa=new H(xa/Bs,ba/Bs);pa.z=wa/Bs,fi.push(pa)}ii.push(Ri),gt.push(fi)}return[ii,gt]}(l,M,I,b);return function(j,q,ne){let $e=1/0;zm(ne,q)&&($e=tg(ne,q[0]));for(let ii=0;ii<q.length;ii++){const gt=q[ii],Xt=j[ii];for(let hi=0;hi<gt.length-1;hi++){const vi=gt[hi],Di=[vi,gt[hi+1],Xt[hi+1],Xt[hi],vi];Mm(ne,Di)&&($e=Math.min($e,tg(ne,Di)))}}return $e!==1/0&&$e}(V[0],V[1],R)}}function ip(i,e){return i.x*e.x+i.y*e.y}function tg(i,e){if(i.length===1){let r=0;const o=e[r++];let l;for(;!l||o.equals(l);)if(l=e[r++],!l)return 1/0;for(;r<e.length;r++){const p=e[r],f=i[0],y=l.sub(o),b=p.sub(o),k=f.sub(o),I=ip(y,y),M=ip(y,b),R=ip(b,b),V=ip(k,y),j=ip(k,b),q=I*R-M*M,ne=(R*V-M*j)/q,$e=(I*j-M*V)/q,ii=o.z*(1-ne-$e)+l.z*ne+p.z*$e;if(isFinite(ii))return ii}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const Yy=C([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Qy}=Yy,e_=C([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:t_}=e_,i_=fu.VectorTileFeature.types,r_=Math.cos(Math.PI/180*37.5),ig=Math.pow(2,14)/.5;class Qf{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.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Dh,this.layoutVertexArray2=new Ud,this.indexArray=new Zs,this.programConfigurations=new Ku(e.layers,e.zoom),this.segments=new Us,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=Wf("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),p=!l.isConstant(),f=[];for(const{feature:y,id:b,index:k,sourceLayerIndex:I}of e){const M=this.layers[0]._featureFilter.needGeometry,R=Ju(y,M);if(!this.layers[0]._featureFilter.filter(new vs(this.zoom),R,o))continue;const V=p?l.evaluate(R,{},o):void 0,j={id:b,properties:y.properties,type:y.type,sourceLayerIndex:I,index:k,geometry:M?R.geometry:Xu(y),patterns:{},sortKey:V};f.push(j)}p&&f.sort((y,b)=>y.sortKey-b.sortKey);for(const y of f){const{geometry:b,index:k,sourceLayerIndex:I}=y;if(this.hasPattern){const M=Kf("line",this.layers,y,this.zoom,r);this.patternFeatures.push(M)}else this.addFeature(y,b,k,o,{});r.featureIndex.insert(e[k].feature,b,k,I,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,o)}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,t_)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Qy),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,o,l,p){const f=this.layers[0].layout,y=f.get("line-join").evaluate(e,{}),b=f.get("line-cap"),k=f.get("line-miter-limit"),I=f.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const M of r)this.addLine(M,e,y,b,k,I);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,p,l)}addLine(e,r,o,l,p,f){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $e=0;$e<e.length-1;$e++)this.totalDistance+=e[$e].dist(e[$e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const y=i_[r.type]==="Polygon";let b=e.length;for(;b>=2&&e[b-1].equals(e[b-2]);)b--;let k=0;for(;k<b-1&&e[k].equals(e[k+1]);)k++;if(b<(y?3:2))return;o==="bevel"&&(p=1.05);const I=this.overscaling<=16?15*Ns/(512*this.overscaling):0,M=this.segments.prepareSegment(10*b,this.layoutVertexArray,this.indexArray);let R,V,j,q,ne;this.e1=this.e2=-1,y&&(R=e[b-2],ne=e[k].sub(R)._unit()._perp());for(let $e=k;$e<b;$e++){if(j=$e===b-1?y?e[k+1]:void 0:e[$e+1],j&&e[$e].equals(j))continue;ne&&(q=ne),R&&(V=R),R=e[$e],ne=j?j.sub(R)._unit()._perp():q,q=q||ne;let ii=q.add(ne);ii.x===0&&ii.y===0||ii._unit();const gt=q.x*ne.x+q.y*ne.y,Xt=ii.x*ne.x+ii.y*ne.y,hi=Xt!==0?1/Xt:1/0,vi=2*Math.sqrt(2-2*Xt),Di=Xt<r_&&V&&j,Zi=q.x*ne.y-q.y*ne.x>0;if(Di&&$e>k){const Ni=R.dist(V);if(Ni>2*I){const Fi=R.sub(R.sub(V)._mult(I/Ni)._round());this.updateDistance(V,Fi),this.addCurrentVertex(Fi,q,0,0,M),V=Fi}}const Pi=V&&j;let Ci=Pi?o:y?"butt":l;if(Pi&&Ci==="round"&&(hi<f?Ci="miter":hi<=2&&(Ci="fakeround")),Ci==="miter"&&hi>p&&(Ci="bevel"),Ci==="bevel"&&(hi>2&&(Ci="flipbevel"),hi<p&&(Ci="miter")),V&&this.updateDistance(V,R),Ci==="miter")ii._mult(hi),this.addCurrentVertex(R,ii,0,0,M);else if(Ci==="flipbevel"){if(hi>100)ii=ne.mult(-1);else{const Ni=hi*q.add(ne).mag()/q.sub(ne).mag();ii._perp()._mult(Ni*(Zi?-1:1))}this.addCurrentVertex(R,ii,0,0,M),this.addCurrentVertex(R,ii.mult(-1),0,0,M)}else if(Ci==="bevel"||Ci==="fakeround"){const Ni=-Math.sqrt(hi*hi-1),Fi=Zi?Ni:0,Ri=Zi?0:Ni;if(V&&this.addCurrentVertex(R,q,Fi,Ri,M),Ci==="fakeround"){const fi=Math.round(180*vi/Math.PI/20);for(let ji=1;ji<fi;ji++){let Vi=ji/fi;if(Vi!==.5){const gs=Vi-.5;Vi+=Vi*gs*(Vi-1)*((1.0904+gt*(gt*(3.55645-1.43519*gt)-3.2452))*gs*gs+(.848013+gt*(.215638*gt-1.06021)))}const Ki=ne.sub(q)._mult(Vi)._add(q)._unit()._mult(Zi?-1:1);this.addHalfVertex(R,Ki.x,Ki.y,!1,Zi,0,M)}}j&&this.addCurrentVertex(R,ne,-Fi,-Ri,M)}else if(Ci==="butt")this.addCurrentVertex(R,ii,0,0,M);else if(Ci==="square"){const Ni=V?1:-1;this.addCurrentVertex(R,ii,Ni,Ni,M)}else Ci==="round"&&(V&&(this.addCurrentVertex(R,q,0,0,M),this.addCurrentVertex(R,q,1,1,M,!0)),j&&(this.addCurrentVertex(R,ne,-1,-1,M,!0),this.addCurrentVertex(R,ne,0,0,M)));if(Di&&$e<b-1){const Ni=R.dist(j);if(Ni>2*I){const Fi=R.add(j.sub(R)._mult(I/Ni)._round());this.updateDistance(R,Fi),this.addCurrentVertex(Fi,ne,0,0,M),R=Fi}}}}addCurrentVertex(e,r,o,l,p,f=!1){const y=r.y*l-r.x,b=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,f,!1,o,p),this.addHalfVertex(e,y,b,f,!0,-l,p),this.distance>ig/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,o,l,p,f))}addHalfVertex({x:e,y:r},o,l,p,f,y,b){const k=.5*(this.lineClips?this.scaledDistance*(ig-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(p?1:0),(r<<1)+(f?1:0),Math.round(63*o)+128,Math.round(63*l)+128,1+(y===0?0:y<0?-1:1)|(63&k)<<2,k>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const I=b.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,I),b.primitiveLength++),f?this.e2=I:this.e1=I}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()}}let rg,ng;Li("LineBucket",Qf,{omit:["layers","patternFeatures"]});var og={get paint(){return ng=ng||new s({"line-opacity":new Gi(ui.paint_line["line-opacity"]),"line-color":new Gi(ui.paint_line["line-color"]),"line-translate":new $i(ui.paint_line["line-translate"]),"line-translate-anchor":new $i(ui.paint_line["line-translate-anchor"]),"line-width":new Gi(ui.paint_line["line-width"]),"line-gap-width":new Gi(ui.paint_line["line-gap-width"]),"line-offset":new Gi(ui.paint_line["line-offset"]),"line-blur":new Gi(ui.paint_line["line-blur"]),"line-dasharray":new t(ui.paint_line["line-dasharray"]),"line-pattern":new d(ui.paint_line["line-pattern"]),"line-gradient":new n(ui.paint_line["line-gradient"])})},get layout(){return rg=rg||new s({"line-cap":new $i(ui.layout_line["line-cap"]),"line-join":new Gi(ui.layout_line["line-join"]),"line-miter-limit":new $i(ui.layout_line["line-miter-limit"]),"line-round-limit":new $i(ui.layout_line["line-round-limit"]),"line-sort-key":new Gi(ui.layout_line["line-sort-key"])})}};class n_ extends Gi{possiblyEvaluate(e,r){return r=new vs(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,o,l){return r=tn({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,o,l)}}let nf;class o_ extends h{constructor(e){super(e,og),this.gradientVersion=0,nf||(nf=new n_(og.paint.properties["line-width"].specification),nf.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(o){return o._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Yc,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=nf.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Qf(e)}queryRadius(e){const r=e,o=sg(Kd("line-width",this,r),Kd("line-gap-width",this,r)),l=Kd("line-offset",this,r);return o/2+Math.abs(l)+Jp(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,o,l,p,f,y){const b=Yp(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),f.angle,y),k=y/2*sg(this.paint.get("line-width").evaluate(r,o),this.paint.get("line-gap-width").evaluate(r,o)),I=this.paint.get("line-offset").evaluate(r,o);return I&&(l=function(M,R){const V=[];for(let j=0;j<M.length;j++){const q=M[j],ne=[];for(let $e=0;$e<q.length;$e++){const ii=q[$e-1],gt=q[$e],Xt=q[$e+1],hi=$e===0?new H(0,0):gt.sub(ii)._unit()._perp(),vi=$e===q.length-1?new H(0,0):Xt.sub(gt)._unit()._perp(),Di=hi._add(vi)._unit(),Zi=Di.x*vi.x+Di.y*vi.y;Zi!==0&&Di._mult(1/Zi),ne.push(Di._mult(R)._add(gt))}V.push(ne)}return V}(l,I*y)),function(M,R,V){for(let j=0;j<R.length;j++){const q=R[j];if(M.length>=3){for(let ne=0;ne<q.length;ne++)if(Oh(M,q[ne]))return!0}if(fy(M,q,V))return!0}return!1}(b,l,k)}isTileClipped(){return!0}}function sg(i,e){return e>0?e+2*i:i}const s_=C([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),a_=C([{name:"a_projected_pos",components:3,type:"Float32"}],4);C([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const l_=C([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);C([{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 ag=C([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),c_=C([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function u_(i,e,r){return i.sections.forEach(o=>{o.text=function(l,p,f){const y=p.layout.get("text-transform").evaluate(f,{});return y==="uppercase"?l=l.toLocaleUpperCase():y==="lowercase"&&(l=l.toLocaleLowerCase()),vc.applyArabicShaping&&(l=vc.applyArabicShaping(l)),l}(o.text,e,r)}),i}C([{name:"triangle",components:3,type:"Uint16"}]),C([{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"}]),C([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),C([{type:"Float32",name:"offsetX"}]),C([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),C([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const rp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var qs=24,lg=fs,cg=function(i,e,r,o,l){var p,f,y=8*l-o-1,b=(1<<y)-1,k=b>>1,I=-7,M=l-1,R=-1,V=i[e+M];for(M+=R,p=V&(1<<-I)-1,V>>=-I,I+=y;I>0;p=256*p+i[e+M],M+=R,I-=8);for(f=p&(1<<-I)-1,p>>=-I,I+=o;I>0;f=256*f+i[e+M],M+=R,I-=8);if(p===0)p=1-k;else{if(p===b)return f?NaN:1/0*(V?-1:1);f+=Math.pow(2,o),p-=k}return(V?-1:1)*f*Math.pow(2,p-o)},ug=function(i,e,r,o,l,p){var f,y,b,k=8*p-l-1,I=(1<<k)-1,M=I>>1,R=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,V=0,j=1,q=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(y=isNaN(e)?1:0,f=I):(f=Math.floor(Math.log(e)/Math.LN2),e*(b=Math.pow(2,-f))<1&&(f--,b*=2),(e+=f+M>=1?R/b:R*Math.pow(2,1-M))*b>=2&&(f++,b/=2),f+M>=I?(y=0,f=I):f+M>=1?(y=(e*b-1)*Math.pow(2,l),f+=M):(y=e*Math.pow(2,M-1)*Math.pow(2,l),f=0));l>=8;i[r+V]=255&y,V+=j,y/=256,l-=8);for(f=f<<l|y,k+=l;k>0;i[r+V]=255&f,V+=j,f/=256,k-=8);i[r+V-j]|=128*q};function fs(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}fs.Varint=0,fs.Fixed64=1,fs.Bytes=2,fs.Fixed32=5;var em=4294967296,hg=1/em,dg=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Uc(i){return i.type===fs.Bytes?i.readVarint()+i.pos:i.pos+1}function jh(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function pg(i,e,r){var o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(var l=r.pos-1;l>=i;l--)r.buf[l+o]=r.buf[l]}function h_(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function d_(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function p_(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function f_(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function m_(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function g_(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function y_(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function __(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function v_(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function of(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Uh(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function fg(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}fs.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),l=o>>3,p=this.pos;this.type=7&o,i(l,e,this),this.pos===p&&this.skip(o)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=of(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=fg(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=of(this.buf,this.pos)+of(this.buf,this.pos+4)*em;return this.pos+=8,i},readSFixed64:function(){var i=of(this.buf,this.pos)+fg(this.buf,this.pos+4)*em;return this.pos+=8,i},readFloat:function(){var i=cg(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=cg(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,o=this.buf;return e=127&(r=o[this.pos++]),r<128?e:(e|=(127&(r=o[this.pos++]))<<7,r<128?e:(e|=(127&(r=o[this.pos++]))<<14,r<128?e:(e|=(127&(r=o[this.pos++]))<<21,r<128?e:function(l,p,f){var y,b,k=f.buf;if(y=(112&(b=k[f.pos++]))>>4,b<128||(y|=(127&(b=k[f.pos++]))<<3,b<128)||(y|=(127&(b=k[f.pos++]))<<10,b<128)||(y|=(127&(b=k[f.pos++]))<<17,b<128)||(y|=(127&(b=k[f.pos++]))<<24,b<128)||(y|=(1&(b=k[f.pos++]))<<31,b<128))return jh(l,y,p);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=o[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&&dg?function(r,o,l){return dg.decode(r.subarray(o,l))}(this.buf,e,i):function(r,o,l){for(var p="",f=o;f<l;){var y,b,k,I=r[f],M=null,R=I>239?4:I>223?3:I>191?2:1;if(f+R>l)break;R===1?I<128&&(M=I):R===2?(192&(y=r[f+1]))==128&&(M=(31&I)<<6|63&y)<=127&&(M=null):R===3?(b=r[f+2],(192&(y=r[f+1]))==128&&(192&b)==128&&((M=(15&I)<<12|(63&y)<<6|63&b)<=2047||M>=55296&&M<=57343)&&(M=null)):R===4&&(b=r[f+2],k=r[f+3],(192&(y=r[f+1]))==128&&(192&b)==128&&(192&k)==128&&((M=(15&I)<<18|(63&y)<<12|(63&b)<<6|63&k)<=65535||M>=1114112)&&(M=null)),M===null?(M=65533,R=1):M>65535&&(M-=65536,p+=String.fromCharCode(M>>>10&1023|55296),M=56320|1023&M),p+=String.fromCharCode(M),f+=R}return p}(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!==fs.Bytes)return i.push(this.readVarint(e));var r=Uc(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==fs.Bytes)return i.push(this.readSVarint());var e=Uc(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==fs.Bytes)return i.push(this.readBoolean());var e=Uc(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==fs.Bytes)return i.push(this.readFloat());var e=Uc(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==fs.Bytes)return i.push(this.readDouble());var e=Uc(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==fs.Bytes)return i.push(this.readFixed32());var e=Uc(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==fs.Bytes)return i.push(this.readSFixed32());var e=Uc(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==fs.Bytes)return i.push(this.readFixed64());var e=Uc(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==fs.Bytes)return i.push(this.readSFixed64());var e=Uc(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===fs.Varint)for(;this.buf[this.pos++]>127;);else if(e===fs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===fs.Fixed32)this.pos+=4;else{if(e!==fs.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;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Uh(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Uh(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Uh(this.buf,-1&i,this.pos),Uh(this.buf,Math.floor(i*hg),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Uh(this.buf,-1&i,this.pos),Uh(this.buf,Math.floor(i*hg),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var o,l;if(e>=0?(o=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(o=~(-e%4294967296))?o=o+1|0:(o=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(p,f,y){y.buf[y.pos++]=127&p|128,p>>>=7,y.buf[y.pos++]=127&p|128,p>>>=7,y.buf[y.pos++]=127&p|128,p>>>=7,y.buf[y.pos++]=127&p|128,y.buf[y.pos]=127&(p>>>=7)}(o,0,r),function(p,f){var y=(7&p)<<4;f.buf[f.pos++]|=y|((p>>>=3)?128:0),p&&(f.buf[f.pos++]=127&p|((p>>>=7)?128:0),p&&(f.buf[f.pos++]=127&p|((p>>>=7)?128:0),p&&(f.buf[f.pos++]=127&p|((p>>>=7)?128:0),p&&(f.buf[f.pos++]=127&p|((p>>>=7)?128:0),p&&(f.buf[f.pos++]=127&p)))))}(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(o,l,p){for(var f,y,b=0;b<l.length;b++){if((f=l.charCodeAt(b))>55295&&f<57344){if(!y){f>56319||b+1===l.length?(o[p++]=239,o[p++]=191,o[p++]=189):y=f;continue}if(f<56320){o[p++]=239,o[p++]=191,o[p++]=189,y=f;continue}f=y-55296<<10|f-56320|65536,y=null}else y&&(o[p++]=239,o[p++]=191,o[p++]=189,y=null);f<128?o[p++]=f:(f<2048?o[p++]=f>>6|192:(f<65536?o[p++]=f>>12|224:(o[p++]=f>>18|240,o[p++]=f>>12&63|128),o[p++]=f>>6&63|128),o[p++]=63&f|128)}return p}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&pg(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),ug(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),ug(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<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var o=this.pos-r;o>=128&&pg(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,fs.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,h_,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,d_,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,m_,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,p_,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,f_,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,g_,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,y_,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,__,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,v_,e)},writeBytesField:function(i,e){this.writeTag(i,fs.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,fs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,fs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,fs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,fs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,fs.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,fs.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,fs.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,fs.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,fs.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var tm=J(lg);const im=3;function x_(i,e,r){i===1&&r.readMessage(b_,e)}function b_(i,e,r){if(i===3){const{id:o,bitmap:l,width:p,height:f,left:y,top:b,advance:k}=r.readMessage(w_,{});e.push({id:o,bitmap:new Jd({width:p+2*im,height:f+2*im},l),metrics:{width:p,height:f,left:y,top:b,advance:k}})}}function w_(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())}const mg=im;function gg(i){let e=0,r=0;for(const f of i)e+=f.w*f.h,r=Math.max(r,f.w);i.sort((f,y)=>y.h-f.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,p=0;for(const f of i)for(let y=o.length-1;y>=0;y--){const b=o[y];if(!(f.w>b.w||f.h>b.h)){if(f.x=b.x,f.y=b.y,p=Math.max(p,f.y+f.h),l=Math.max(l,f.x+f.w),f.w===b.w&&f.h===b.h){const k=o.pop();y<o.length&&(o[y]=k)}else f.h===b.h?(b.x+=f.w,b.w-=f.w):f.w===b.w?(b.y+=f.h,b.h-=f.h):(o.push({x:b.x+f.w,y:b.y,w:b.w-f.w,h:f.h}),b.y+=f.h,b.h-=f.h);break}}return{w:l,h:p,fill:e/(l*p)||0}}const Ma=1;class rm{constructor(e,{pixelRatio:r,version:o,stretchX:l,stretchY:p,content:f,textFitWidth:y,textFitHeight:b}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=p,this.content=f,this.version=o,this.textFitWidth=y,this.textFitHeight=b}get tl(){return[this.paddedRect.x+Ma,this.paddedRect.y+Ma]}get br(){return[this.paddedRect.x+this.paddedRect.w-Ma,this.paddedRect.y+this.paddedRect.h-Ma]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Ma)/this.pixelRatio,(this.paddedRect.h-2*Ma)/this.pixelRatio]}}class yg{constructor(e,r){const o={},l={};this.haveRenderCallbacks=[];const p=[];this.addImages(e,o,p),this.addImages(r,l,p);const{w:f,h:y}=gg(p),b=new Za({width:f||1,height:y||1});for(const k in e){const I=e[k],M=o[k].paddedRect;Za.copy(I.data,b,{x:0,y:0},{x:M.x+Ma,y:M.y+Ma},I.data)}for(const k in r){const I=r[k],M=l[k].paddedRect,R=M.x+Ma,V=M.y+Ma,j=I.data.width,q=I.data.height;Za.copy(I.data,b,{x:0,y:0},{x:R,y:V},I.data),Za.copy(I.data,b,{x:0,y:q-1},{x:R,y:V-1},{width:j,height:1}),Za.copy(I.data,b,{x:0,y:0},{x:R,y:V+q},{width:j,height:1}),Za.copy(I.data,b,{x:j-1,y:0},{x:R-1,y:V},{width:1,height:q}),Za.copy(I.data,b,{x:0,y:0},{x:R+j,y:V},{width:1,height:q})}this.image=b,this.iconPositions=o,this.patternPositions=l}addImages(e,r,o){for(const l in e){const p=e[l],f={x:0,y:0,w:p.data.width+2*Ma,h:p.data.height+2*Ma};o.push(f),r[l]=new rm(f,p),p.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in e.updatedImages)this.patchUpdatedImage(this.iconPositions[o],e.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o),r)}patchUpdatedImage(e,r,o){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,p]=e.tl;o.update(r.data,void 0,{x:l,y:p})}}var mu;Li("ImagePosition",rm),Li("ImageAtlas",yg),S.ai=void 0,(mu=S.ai||(S.ai={}))[mu.none=0]="none",mu[mu.horizontal=1]="horizontal",mu[mu.vertical=2]="vertical",mu[mu.horizontalOnly=3]="horizontalOnly";const np=-17;class op{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new op;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new op;return r.imageName=e,r}}class qh{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new qh;for(let l=0;l<e.sections.length;l++){const p=e.sections[l];p.image?o.addImageSection(p):o.addTextSection(p,r)}return o}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let o=0;o<e.length;o++){const l=e.charCodeAt(o+1)||null,p=e.charCodeAt(o-1)||null;r+=l&&Up(l)&&!rp[e[o+1]]||p&&Up(p)&&!rp[e[o-1]]||!rp[e[o]]?e[o]:rp[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&af[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&af[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const o=new qh;return o.text=this.text.substring(e,r),o.sectionIndex=this.sectionIndex.slice(e,r),o.sections=this.sections,o}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(op.forText(e.scale,e.fontStack||r));const o=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(o)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void Fs("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(op.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Fs("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function sf(i,e,r,o,l,p,f,y,b,k,I,M,R,V,j){const q=qh.fromFeature(i,l);let ne;M===S.ai.vertical&&q.verticalizePunctuation();const{processBidirectionalText:$e,processStyledBidirectionalText:ii}=vc;if($e&&q.sections.length===1){ne=[];const hi=$e(q.toString(),nm(q,k,p,e,o,V));for(const vi of hi){const Di=new qh;Di.text=vi,Di.sections=q.sections;for(let Zi=0;Zi<vi.length;Zi++)Di.sectionIndex.push(0);ne.push(Di)}}else if(ii){ne=[];const hi=ii(q.text,q.sectionIndex,nm(q,k,p,e,o,V));for(const vi of hi){const Di=new qh;Di.text=vi[0],Di.sectionIndex=vi[1],Di.sections=q.sections,ne.push(Di)}}else ne=function(hi,vi){const Di=[],Zi=hi.text;let Pi=0;for(const Ci of vi)Di.push(hi.substring(Pi,Ci)),Pi=Ci;return Pi<Zi.length&&Di.push(hi.substring(Pi,Zi.length)),Di}(q,nm(q,k,p,e,o,V));const gt=[],Xt={positionedLines:gt,text:q.toString(),top:I[1],bottom:I[1],left:I[0],right:I[0],writingMode:M,iconsInText:!1,verticalizable:!1};return function(hi,vi,Di,Zi,Pi,Ci,Ni,Fi,Ri,fi,ji,Vi){let Ki=0,gs=np,ms=0,Gs=0;const Wl=Fi==="right"?1:Fi==="left"?0:.5;let sa=0;for(const Bs of Pi){Bs.trim();const Hs=Bs.getMaxScale(),pa=(Hs-1)*qs,aa={positionedGlyphs:[],lineOffset:0};hi.positionedLines[sa]=aa;const Sa=aa.positionedGlyphs;let la=0;if(!Bs.length()){gs+=Ci,++sa;continue}for(let za=0;za<Bs.length();za++){const cs=Bs.getSection(za),xs=Bs.getSectionIndex(za),Ts=Bs.getCharCode(za);let La=0,zs=null,Wh=null,Sc=null,kc=qs;const Kl=!(Ri===S.ai.horizontal||!ji&&!Nd(Ts)||ji&&(af[Ts]||(Ds=Ts,Mi.Arabic(Ds)||Mi["Arabic Supplement"](Ds)||Mi["Arabic Extended-A"](Ds)||Mi["Arabic Presentation Forms-A"](Ds)||Mi["Arabic Presentation Forms-B"](Ds))));if(cs.imageName){const Wa=Zi[cs.imageName];if(!Wa)continue;Sc=cs.imageName,hi.iconsInText=hi.iconsInText||!0,Wh=Wa.paddedRect;const Xs=Wa.displaySize;cs.scale=cs.scale*qs/Vi,zs={width:Xs[0],height:Xs[1],left:Ma,top:-mg,advance:Kl?Xs[1]:Xs[0]},La=pa+(qs-Xs[1]*cs.scale),kc=zs.advance;const qc=Kl?Xs[0]*cs.scale-qs*Hs:Xs[1]*cs.scale-qs*Hs;qc>0&&qc>la&&(la=qc)}else{const Wa=Di[cs.fontStack],Xs=Wa&&Wa[Ts];if(Xs&&Xs.rect)Wh=Xs.rect,zs=Xs.metrics;else{const qc=vi[cs.fontStack],up=qc&&qc[Ts];if(!up)continue;zs=up.metrics}La=(Hs-cs.scale)*qs}Kl?(hi.verticalizable=!0,Sa.push({glyph:Ts,imageName:Sc,x:Ki,y:gs+La,vertical:Kl,scale:cs.scale,fontStack:cs.fontStack,sectionIndex:xs,metrics:zs,rect:Wh}),Ki+=kc*cs.scale+fi):(Sa.push({glyph:Ts,imageName:Sc,x:Ki,y:gs+La,vertical:Kl,scale:cs.scale,fontStack:cs.fontStack,sectionIndex:xs,metrics:zs,rect:Wh}),Ki+=zs.advance*cs.scale+fi)}Sa.length!==0&&(ms=Math.max(Ki-fi,ms),T_(Sa,0,Sa.length-1,Wl,la)),Ki=0;const Ha=Ci*Hs+la;aa.lineOffset=Math.max(la,pa),gs+=Ha,Gs=Math.max(Ha,Gs),++sa}var Ds;const xa=gs-np,{horizontalAlign:ba,verticalAlign:wa}=om(Ni);(function(Bs,Hs,pa,aa,Sa,la,Ha,za,cs){const xs=(Hs-pa)*Sa;let Ts=0;Ts=la!==Ha?-za*aa-np:(-aa*cs+.5)*Ha;for(const La of Bs)for(const zs of La.positionedGlyphs)zs.x+=xs,zs.y+=Ts})(hi.positionedLines,Wl,ba,wa,ms,Gs,Ci,xa,Pi.length),hi.top+=-wa*xa,hi.bottom=hi.top+xa,hi.left+=-ba*ms,hi.right=hi.left+ms}(Xt,e,r,o,ne,f,y,b,M,k,R,j),!function(hi){for(const vi of hi)if(vi.positionedGlyphs.length!==0)return!1;return!0}(gt)&&Xt}const af={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},S_={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},k_={40:!0};function _g(i,e,r,o,l,p){if(e.imageName){const f=o[e.imageName];return f?f.displaySize[0]*e.scale*qs/p+l:0}{const f=r[e.fontStack],y=f&&f[i];return y?y.metrics.advance*e.scale+l:0}}function vg(i,e,r,o){const l=Math.pow(i-e,2);return o?i<e?l/2:2*l:l+Math.abs(r)*r}function E_(i,e,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function xg(i,e,r,o,l,p){let f=null,y=vg(e,r,l,p);for(const b of o){const k=vg(e-b.x,r,l,p)+b.badness;k<=y&&(f=b,y=k)}return{index:i,x:e,priorBreak:f,badness:y}}function bg(i){return i?bg(i.priorBreak).concat(i.index):[]}function nm(i,e,r,o,l,p){if(!i)return[];const f=[],y=function(M,R,V,j,q,ne){let $e=0;for(let ii=0;ii<M.length();ii++){const gt=M.getSection(ii);$e+=_g(M.getCharCode(ii),gt,j,q,R,ne)}return $e/Math.max(1,Math.ceil($e/V))}(i,e,r,o,l,p),b=i.text.indexOf("")>=0;let k=0;for(let M=0;M<i.length();M++){const R=i.getSection(M),V=i.getCharCode(M);if(af[V]||(k+=_g(V,R,o,l,e,p)),M<i.length()-1){const j=!((I=V)<11904||!(Mi["Bopomofo Extended"](I)||Mi.Bopomofo(I)||Mi["CJK Compatibility Forms"](I)||Mi["CJK Compatibility Ideographs"](I)||Mi["CJK Compatibility"](I)||Mi["CJK Radicals Supplement"](I)||Mi["CJK Strokes"](I)||Mi["CJK Symbols and Punctuation"](I)||Mi["CJK Unified Ideographs Extension A"](I)||Mi["CJK Unified Ideographs"](I)||Mi["Enclosed CJK Letters and Months"](I)||Mi["Halfwidth and Fullwidth Forms"](I)||Mi.Hiragana(I)||Mi["Ideographic Description Characters"](I)||Mi["Kangxi Radicals"](I)||Mi["Katakana Phonetic Extensions"](I)||Mi.Katakana(I)||Mi["Vertical Forms"](I)||Mi["Yi Radicals"](I)||Mi["Yi Syllables"](I)));(S_[V]||j||R.imageName||M!==i.length()-2&&k_[i.getCharCode(M+1)])&&f.push(xg(M+1,k,y,f,E_(V,i.getCharCode(M+1),j&&b),!1))}}var I;return bg(xg(i.length(),k,y,f,0,!0))}function om(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function T_(i,e,r,o,l){if(!o&&!l)return;const p=i[r],f=(i[r].x+p.metrics.advance*p.scale)*o;for(let y=e;y<=r;y++)i[y].x-=f,i[y].y+=l}function C_(i,e,r){const{horizontalAlign:o,verticalAlign:l}=om(r),p=e[0]-i.displaySize[0]*o,f=e[1]-i.displaySize[1]*l;return{image:i,top:f,bottom:f+i.displaySize[1],left:p,right:p+i.displaySize[0]}}function wg(i){var e,r;let o=i.left,l=i.top,p=i.right-o,f=i.bottom-l;const y=(e=i.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",b=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",k=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(b==="proportional"){if(y==="stretchOnly"&&p/f<k||y==="proportional"){const I=Math.ceil(f*k);o*=I/p,p=I}}else if(y==="proportional"&&b==="stretchOnly"&&k!==0&&p/f>k){const I=Math.ceil(p/k);l*=I/f,f=I}return{x1:o,y1:l,x2:o+p,y2:l+f}}function Sg(i,e,r,o,l,p){const f=i.image;let y;if(f.content){const ne=f.content,$e=f.pixelRatio||1;y=[ne[0]/$e,ne[1]/$e,f.displaySize[0]-ne[2]/$e,f.displaySize[1]-ne[3]/$e]}const b=e.left*p,k=e.right*p;let I,M,R,V;r==="width"||r==="both"?(V=l[0]+b-o[3],M=l[0]+k+o[1]):(V=l[0]+(b+k-f.displaySize[0])/2,M=V+f.displaySize[0]);const j=e.top*p,q=e.bottom*p;return r==="height"||r==="both"?(I=l[1]+j-o[0],R=l[1]+q+o[2]):(I=l[1]+(j+q-f.displaySize[1])/2,R=I+f.displaySize[1]),{image:f,top:I,right:M,bottom:R,left:V,collisionPadding:y}}const sp=255,wc=128,gu=sp*wc;function kg(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new vs(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:l}=r;let p=0;for(;p<o.length&&o[p]<=i;)p++;p=Math.max(0,p-1);let f=p;for(;f<o.length&&o[f]<i+1;)f++;f=Math.min(o.length-1,f);const y=o[p],b=o[f];return r.kind==="composite"?{kind:"composite",minZoom:y,maxZoom:b,interpolationType:l}:{kind:"camera",minZoom:y,maxZoom:b,minSize:r.evaluate(new vs(y)),maxSize:r.evaluate(new vs(b)),interpolationType:l}}}function sm(i,e,r){let o="never";const l=i.get(e);return l?o=l:i.get(r)&&(o="always"),o}const A_=fu.VectorTileFeature.types,P_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function lf(i,e,r,o,l,p,f,y,b,k,I,M,R){const V=y?Math.min(gu,Math.round(y[0])):0,j=y?Math.min(gu,Math.round(y[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*l),p,f,(V<<1)+(b?1:0),j,16*k,16*I,256*M,256*R)}function am(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function I_(i){for(const e of i.sections)if($d(e.text))return!0;return!1}class lm{constructor(e){this.layoutVertexArray=new qa,this.indexArray=new Zs,this.programConfigurations=e,this.segments=new Us,this.dynamicLayoutVertexArray=new xc,this.opacityVertexArray=new uu,this.hasVisibleVertices=!1,this.placedSymbolArray=new ks}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,l){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,s_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,a_.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,P_,!0),this.opacityVertexBuffer.itemSize=1),(o||l)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Li("SymbolBuffers",lm);class cm{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new Us,this.collisionVertexArray=new na}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,l_.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Li("CollisionBuffers",cm);class Zh{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(f=>f.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=Uf([]),this.placementViewportMatrix=Uf([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=kg(this.zoom,r["text-size"]),this.iconSizeData=kg(this.zoom,r["icon-size"]);const o=this.layers[0].layout,l=o.get("symbol-sort-key"),p=o.get("symbol-z-order");this.canOverlap=sm(o,"text-overlap","text-allow-overlap")!=="never"||sm(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=p!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(p==="viewport-y"||p==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(f=>S.ai[f])),this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id),this.sourceID=e.sourceID}createArrays(){this.text=new lm(new Ku(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new lm(new Ku(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Es,this.lineVertexArray=new _a,this.symbolInstances=new ja,this.textAnchorOffsets=new ta}calculateGlyphDependencies(e,r,o,l,p){for(let f=0;f<e.length;f++)if(r[e.charCodeAt(f)]=!0,(o||l)&&p){const y=rp[e.charAt(f)];y&&(r[y.charCodeAt(0)]=!0)}}populate(e,r,o){const l=this.layers[0],p=l.layout,f=p.get("text-font"),y=p.get("text-field"),b=p.get("icon-image"),k=(y.value.kind!=="constant"||y.value.value instanceof Ea&&!y.value.value.isEmpty()||y.value.value.toString().length>0)&&(f.value.kind!=="constant"||f.value.value.length>0),I=b.value.kind!=="constant"||!!b.value.value||Object.keys(b.parameters).length>0,M=p.get("symbol-sort-key");if(this.features=[],!k&&!I)return;const R=r.iconDependencies,V=r.glyphDependencies,j=r.availableImages,q=new vs(this.zoom);for(const{feature:ne,id:$e,index:ii,sourceLayerIndex:gt}of e){const Xt=l._featureFilter.needGeometry,hi=Ju(ne,Xt);if(!l._featureFilter.filter(q,hi,o))continue;let vi,Di;if(Xt||(hi.geometry=Xu(ne)),k){const Pi=l.getValueAndResolveTokens("text-field",hi,o,j),Ci=Ea.factory(Pi),Ni=this.hasRTLText=this.hasRTLText||I_(Ci);(!Ni||vc.getRTLTextPluginStatus()==="unavailable"||Ni&&vc.isParsed())&&(vi=u_(Ci,l,hi))}if(I){const Pi=l.getValueAndResolveTokens("icon-image",hi,o,j);Di=Pi instanceof Qs?Pi:Qs.fromString(Pi)}if(!vi&&!Di)continue;const Zi=this.sortFeaturesByKey?M.evaluate(hi,{},o):void 0;if(this.features.push({id:$e,text:vi,icon:Di,index:ii,sourceLayerIndex:gt,geometry:hi.geometry,properties:ne.properties,type:A_[ne.type],sortKey:Zi}),Di&&(R[Di.name]=!0),vi){const Pi=f.evaluate(hi,{},o).join(","),Ci=p.get("text-rotation-alignment")!=="viewport"&&p.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(S.ai.vertical)>=0;for(const Ni of vi.sections)if(Ni.image)R[Ni.image.name]=!0;else{const Fi=Vd(vi.toString()),Ri=Ni.fontStack||Pi,fi=V[Ri]=V[Ri]||{};this.calculateGlyphDependencies(Ni.text,fi,Ci,this.allowVerticalPlacement,Fi)}}}p.get("symbol-placement")==="line"&&(this.features=function(ne){const $e={},ii={},gt=[];let Xt=0;function hi(Pi){gt.push(ne[Pi]),Xt++}function vi(Pi,Ci,Ni){const Fi=ii[Pi];return delete ii[Pi],ii[Ci]=Fi,gt[Fi].geometry[0].pop(),gt[Fi].geometry[0]=gt[Fi].geometry[0].concat(Ni[0]),Fi}function Di(Pi,Ci,Ni){const Fi=$e[Ci];return delete $e[Ci],$e[Pi]=Fi,gt[Fi].geometry[0].shift(),gt[Fi].geometry[0]=Ni[0].concat(gt[Fi].geometry[0]),Fi}function Zi(Pi,Ci,Ni){const Fi=Ni?Ci[0][Ci[0].length-1]:Ci[0][0];return`${Pi}:${Fi.x}:${Fi.y}`}for(let Pi=0;Pi<ne.length;Pi++){const Ci=ne[Pi],Ni=Ci.geometry,Fi=Ci.text?Ci.text.toString():null;if(!Fi){hi(Pi);continue}const Ri=Zi(Fi,Ni),fi=Zi(Fi,Ni,!0);if(Ri in ii&&fi in $e&&ii[Ri]!==$e[fi]){const ji=Di(Ri,fi,Ni),Vi=vi(Ri,fi,gt[ji].geometry);delete $e[Ri],delete ii[fi],ii[Zi(Fi,gt[Vi].geometry,!0)]=Vi,gt[ji].geometry=null}else Ri in ii?vi(Ri,fi,Ni):fi in $e?Di(Ri,fi,Ni):(hi(Pi),$e[Ri]=Xt-1,ii[fi]=Xt-1)}return gt.filter(Pi=>Pi.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ne,$e)=>ne.sortKey-$e.sortKey)}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,o))}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 o=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),p=e.dist(r[e.segment]);const f={};for(let y=e.segment+1;y<r.length;y++)f[y]={x:r[y].x,y:r[y].y,tileUnitDistanceFromAnchor:l},y<r.length-1&&(l+=r[y+1].dist(r[y]));for(let y=e.segment||0;y>=0;y--)f[y]={x:r[y].x,y:r[y].y,tileUnitDistanceFromAnchor:p},y>0&&(p+=r[y-1].dist(r[y]));for(let y=0;y<r.length;y++){const b=f[y];this.lineVertexArray.emplaceBack(b.x,b.y,b.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,l,p,f,y,b,k,I,M,R){const V=e.indexArray,j=e.layoutVertexArray,q=e.segments.prepareSegment(4*r.length,j,V,this.canOverlap?f.sortKey:void 0),ne=this.glyphOffsetArray.length,$e=q.vertexLength,ii=this.allowVerticalPlacement&&y===S.ai.vertical?Math.PI/2:0,gt=f.text&&f.text.sections;for(let Xt=0;Xt<r.length;Xt++){const{tl:hi,tr:vi,bl:Di,br:Zi,tex:Pi,pixelOffsetTL:Ci,pixelOffsetBR:Ni,minFontScaleX:Fi,minFontScaleY:Ri,glyphOffset:fi,isSDF:ji,sectionIndex:Vi}=r[Xt],Ki=q.vertexLength,gs=fi[1];lf(j,b.x,b.y,hi.x,gs+hi.y,Pi.x,Pi.y,o,ji,Ci.x,Ci.y,Fi,Ri),lf(j,b.x,b.y,vi.x,gs+vi.y,Pi.x+Pi.w,Pi.y,o,ji,Ni.x,Ci.y,Fi,Ri),lf(j,b.x,b.y,Di.x,gs+Di.y,Pi.x,Pi.y+Pi.h,o,ji,Ci.x,Ni.y,Fi,Ri),lf(j,b.x,b.y,Zi.x,gs+Zi.y,Pi.x+Pi.w,Pi.y+Pi.h,o,ji,Ni.x,Ni.y,Fi,Ri),am(e.dynamicLayoutVertexArray,b,ii),V.emplaceBack(Ki,Ki+1,Ki+2),V.emplaceBack(Ki+1,Ki+2,Ki+3),q.vertexLength+=4,q.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(fi[0]),Xt!==r.length-1&&Vi===r[Xt+1].sectionIndex||e.programConfigurations.populatePaintArrays(j.length,f,f.index,{},R,gt&>[Vi])}e.placedSymbolArray.emplaceBack(b.x,b.y,ne,this.glyphOffsetArray.length-ne,$e,k,I,b.segment,o?o[0]:0,o?o[1]:0,l[0],l[1],y,0,!1,0,M)}_addCollisionDebugVertex(e,r,o,l,p,f){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,l,p,Math.round(f.x),Math.round(f.y))}addCollisionDebugVertices(e,r,o,l,p,f,y){const b=p.segments.prepareSegment(4,p.layoutVertexArray,p.indexArray),k=b.vertexLength,I=p.layoutVertexArray,M=p.collisionVertexArray,R=y.anchorX,V=y.anchorY;this._addCollisionDebugVertex(I,M,f,R,V,new H(e,r)),this._addCollisionDebugVertex(I,M,f,R,V,new H(o,r)),this._addCollisionDebugVertex(I,M,f,R,V,new H(o,l)),this._addCollisionDebugVertex(I,M,f,R,V,new H(e,l)),b.vertexLength+=4;const j=p.indexArray;j.emplaceBack(k,k+1),j.emplaceBack(k+1,k+2),j.emplaceBack(k+2,k+3),j.emplaceBack(k+3,k),b.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,l){for(let p=e;p<r;p++){const f=this.collisionBoxArray.get(p);this.addCollisionDebugVertices(f.x1,f.y1,f.x2,f.y2,l?this.textCollisionBox:this.iconCollisionBox,f.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new cm(ra,ag.members,Ps),this.iconCollisionBox=new cm(ra,ag.members,Ps);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,o,l,p,f,y,b,k){const I={};for(let M=r;M<o;M++){const R=e.get(M);I.textBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},I.textFeatureIndex=R.featureIndex;break}for(let M=l;M<p;M++){const R=e.get(M);I.verticalTextBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},I.verticalTextFeatureIndex=R.featureIndex;break}for(let M=f;M<y;M++){const R=e.get(M);I.iconBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},I.iconFeatureIndex=R.featureIndex;break}for(let M=b;M<k;M++){const R=e.get(M);I.verticalIconBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},I.verticalIconFeatureIndex=R.featureIndex;break}return I}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}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 o=e.placedSymbolArray.get(r),l=o.vertexStartIndex+4*o.numGlyphs;for(let p=o.vertexStartIndex;p<l;p+=4)e.indexArray.emplaceBack(p,p+1,p+2),e.indexArray.emplaceBack(p+1,p+2,p+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),l=[],p=[],f=[];for(let y=0;y<this.symbolInstances.length;++y){f.push(y);const b=this.symbolInstances.get(y);l.push(0|Math.round(r*b.anchorX+o*b.anchorY)),p.push(b.featureIndex)}return f.sort((y,b)=>l[y]-l[b]||p[b]-p[y]),f}addToSortKeyRanges(e,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.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 o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((l,p,f)=>{l>=0&&f.indexOf(l)===p&&this.addIndicesForPlacedSymbol(this.text,l)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Eg,Tg;Li("SymbolBucket",Zh,{omit:["layers","collisionBoxArray","features","compareText"]}),Zh.MAX_GLYPHS=65535,Zh.addDynamicAttributes=am;var um={get paint(){return Tg=Tg||new s({"icon-opacity":new Gi(ui.paint_symbol["icon-opacity"]),"icon-color":new Gi(ui.paint_symbol["icon-color"]),"icon-halo-color":new Gi(ui.paint_symbol["icon-halo-color"]),"icon-halo-width":new Gi(ui.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Gi(ui.paint_symbol["icon-halo-blur"]),"icon-translate":new $i(ui.paint_symbol["icon-translate"]),"icon-translate-anchor":new $i(ui.paint_symbol["icon-translate-anchor"]),"text-opacity":new Gi(ui.paint_symbol["text-opacity"]),"text-color":new Gi(ui.paint_symbol["text-color"],{runtimeType:ga,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Gi(ui.paint_symbol["text-halo-color"]),"text-halo-width":new Gi(ui.paint_symbol["text-halo-width"]),"text-halo-blur":new Gi(ui.paint_symbol["text-halo-blur"]),"text-translate":new $i(ui.paint_symbol["text-translate"]),"text-translate-anchor":new $i(ui.paint_symbol["text-translate-anchor"])})},get layout(){return Eg=Eg||new s({"symbol-placement":new $i(ui.layout_symbol["symbol-placement"]),"symbol-spacing":new $i(ui.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new $i(ui.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Gi(ui.layout_symbol["symbol-sort-key"]),"symbol-z-order":new $i(ui.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new $i(ui.layout_symbol["icon-allow-overlap"]),"icon-overlap":new $i(ui.layout_symbol["icon-overlap"]),"icon-ignore-placement":new $i(ui.layout_symbol["icon-ignore-placement"]),"icon-optional":new $i(ui.layout_symbol["icon-optional"]),"icon-rotation-alignment":new $i(ui.layout_symbol["icon-rotation-alignment"]),"icon-size":new Gi(ui.layout_symbol["icon-size"]),"icon-text-fit":new $i(ui.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new $i(ui.layout_symbol["icon-text-fit-padding"]),"icon-image":new Gi(ui.layout_symbol["icon-image"]),"icon-rotate":new Gi(ui.layout_symbol["icon-rotate"]),"icon-padding":new Gi(ui.layout_symbol["icon-padding"]),"icon-keep-upright":new $i(ui.layout_symbol["icon-keep-upright"]),"icon-offset":new Gi(ui.layout_symbol["icon-offset"]),"icon-anchor":new Gi(ui.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new $i(ui.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new $i(ui.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new $i(ui.layout_symbol["text-rotation-alignment"]),"text-field":new Gi(ui.layout_symbol["text-field"]),"text-font":new Gi(ui.layout_symbol["text-font"]),"text-size":new Gi(ui.layout_symbol["text-size"]),"text-max-width":new Gi(ui.layout_symbol["text-max-width"]),"text-line-height":new $i(ui.layout_symbol["text-line-height"]),"text-letter-spacing":new Gi(ui.layout_symbol["text-letter-spacing"]),"text-justify":new Gi(ui.layout_symbol["text-justify"]),"text-radial-offset":new Gi(ui.layout_symbol["text-radial-offset"]),"text-variable-anchor":new $i(ui.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Gi(ui.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Gi(ui.layout_symbol["text-anchor"]),"text-max-angle":new $i(ui.layout_symbol["text-max-angle"]),"text-writing-mode":new $i(ui.layout_symbol["text-writing-mode"]),"text-rotate":new Gi(ui.layout_symbol["text-rotate"]),"text-padding":new $i(ui.layout_symbol["text-padding"]),"text-keep-upright":new $i(ui.layout_symbol["text-keep-upright"]),"text-transform":new Gi(ui.layout_symbol["text-transform"]),"text-offset":new Gi(ui.layout_symbol["text-offset"]),"text-allow-overlap":new $i(ui.layout_symbol["text-allow-overlap"]),"text-overlap":new $i(ui.layout_symbol["text-overlap"]),"text-ignore-placement":new $i(ui.layout_symbol["text-ignore-placement"]),"text-optional":new $i(ui.layout_symbol["text-optional"])})}};class Cg{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:dc,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}}Li("FormatSectionOverride",Cg,{omit:["defaultValue"]});class cf extends h{constructor(e){super(e,um)}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 o=this.layout.get("text-writing-mode");if(o){const l=[];for(const p of o)l.indexOf(p)<0&&l.push(p);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,l){const p=this.layout.get(e).evaluate(r,{},o,l),f=this._unevaluatedLayout._values[e];return f.isDataDriven()||Vu(f.value)||!p?p:function(y,b){return b.replace(/{([^{}]+)}/g,(k,I)=>y&&I in y?String(y[I]):"")}(r.properties,p)}createBucket(e){return new Zh(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of um.paint.overridableProperties){if(!cf.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new Cg(r),l=new kh(o,r.property.specification);let p=null;p=r.value.kind==="constant"||r.value.kind==="source"?new _d("source",l):new vd("composite",l,r.value.zoomStops),this.paint._values[e]=new Hl(r.property,p,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&cf.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),l=um.paint.properties[r];let p=!1;const f=y=>{for(const b of y)if(l.overrides&&l.overrides.hasOverride(b))return void(p=!0)};if(o.value.kind==="constant"&&o.value.value instanceof Ea)f(o.value.value.sections);else if(o.value.kind==="source"){const y=k=>{p||(k instanceof Ic&&Vs(k.value)===ec?f(k.value.sections):k instanceof hh?f(k.sections):k.eachChild(y))},b=o.value;b._styleExpression&&y(b._styleExpression.expression)}return p}}let Ag;var M_={get paint(){return Ag=Ag||new s({"background-color":new $i(ui.paint_background["background-color"]),"background-pattern":new t(ui.paint_background["background-pattern"]),"background-opacity":new $i(ui.paint_background["background-opacity"])})}};class z_ extends h{constructor(e){super(e,M_)}}let Pg;var D_={get paint(){return Pg=Pg||new s({"raster-opacity":new $i(ui.paint_raster["raster-opacity"]),"raster-hue-rotate":new $i(ui.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new $i(ui.paint_raster["raster-brightness-min"]),"raster-brightness-max":new $i(ui.paint_raster["raster-brightness-max"]),"raster-saturation":new $i(ui.paint_raster["raster-saturation"]),"raster-contrast":new $i(ui.paint_raster["raster-contrast"]),"raster-resampling":new $i(ui.paint_raster["raster-resampling"]),"raster-fade-duration":new $i(ui.paint_raster["raster-fade-duration"])})}};class B_ extends h{constructor(e){super(e,D_)}}class R_ extends h{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")}}class L_{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const hm=63710088e-1;class yu{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 yu(gi(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,o=this.lat*r,l=e.lat*r,p=Math.sin(o)*Math.sin(l)+Math.cos(o)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return hm*Math.acos(Math.min(p,1))}static convert(e){if(e instanceof yu)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new yu(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new yu(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: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Ig=2*Math.PI*hm;function Mg(i){return Ig*Math.cos(i*Math.PI/180)}function zg(i){return(180+i)/360}function Dg(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Bg(i,e){return i/Mg(e)}function dm(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class uf{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=yu.convert(e);return new uf(zg(o.lng),Dg(o.lat),Bg(r,o.lat))}toLngLat(){return new yu(360*this.x-180,dm(this.y))}toAltitude(){return this.z*Mg(dm(this.y))}meterInMercatorCoordinateUnits(){return 1/Ig*(e=dm(this.y),1/Math.cos(e*Math.PI/180));var e}}function Rg(i,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class pm{constructor(e,r,o){if(e<0||e>25||o<0||o>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${o}, 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=o,this.key=ap(0,e,e,r,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,o){const l=(f=this.y,y=this.z,b=Rg(256*(p=this.x),256*(f=Math.pow(2,y)-f-1),y),k=Rg(256*(p+1),256*(f+1),y),b[0]+","+b[1]+","+k[0]+","+k[1]);var p,f,y,b,k;const I=function(M,R,V){let j,q="";for(let ne=M;ne>0;ne--)j=1<<ne-1,q+=(R&j?1:0)+(V&j?2:0);return q}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,I).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 H((e.x*r-this.x)*Ns,(e.y*r-this.y)*Ns)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Lg{constructor(e,r){this.wrap=e,this.canonical=r,this.key=ap(e,r.z,r.z,r.x,r.y)}}class Ga{constructor(e,r,o,l,p){if(e<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new pm(o,+l,+p),this.key=ap(r,e,o,l,p)}clone(){return new Ga(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 Ga(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ga(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 o=this.canonical.z-e;return e>this.canonical.z?ap(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):ap(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Ga(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,l=2*this.canonical.y;return[new Ga(r,this.wrap,r,o,l),new Ga(r,this.wrap,r,o+1,l),new Ga(r,this.wrap,r,o,l+1),new Ga(r,this.wrap,r,o+1,l+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Ga(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Ga(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Lg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new uf(e.x-this.wrap,e.y))}}function ap(i,e,r,o,l){(i*=2)<0&&(i=-1*i-1);const p=1<<r;return(p*p*i+p*l+o).toString(36)+r.toString(36)+e.toString(36)}Li("CanonicalTileID",pm),Li("OverscaledTileID",Ga,{omit:["posMatrix"]});class Fg{constructor(e,r,o,l=1,p=1,f=1,y=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&!["mapbox","terrarium","custom"].includes(o))return void Fs(`"${o}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const b=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),o){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=p,this.blueFactor=f,this.baseShift=y;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let k=0;k<b;k++)this.data[this._idx(-1,k)]=this.data[this._idx(0,k)],this.data[this._idx(b,k)]=this.data[this._idx(b-1,k)],this.data[this._idx(k,-1)]=this.data[this._idx(k,0)],this.data[this._idx(k,b)]=this.data[this._idx(k,b-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(b,-1)]=this.data[this._idx(b-1,0)],this.data[this._idx(-1,b)]=this.data[this._idx(0,b-1)],this.data[this._idx(b,b)]=this.data[this._idx(b-1,b-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let k=0;k<b;k++)for(let I=0;I<b;I++){const M=this.get(k,I);M>this.max&&(this.max=M),M<this.min&&(this.min=M)}}get(e,r){const o=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return this.unpack(o[l],o[l+1],o[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=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)}unpack(e,r,o){return e*this.redFactor+r*this.greenFactor+o*this.blueFactor-this.baseShift}getPixels(){return new Za({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,p=r*this.dim+this.dim,f=o*this.dim,y=o*this.dim+this.dim;switch(r){case-1:l=p-1;break;case 1:p=l+1}switch(o){case-1:f=y-1;break;case 1:y=f+1}const b=-r*this.dim,k=-o*this.dim;for(let I=f;I<y;I++)for(let M=l;M<p;M++)this.data[this._idx(M,I)]=e.data[this._idx(M+b,I+k)]}}Li("DEMData",Fg);class Og{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const o=e[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=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 Vg{constructor(e,r,o,l,p){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=o,e._y=l,this.properties=e.properties,this.id=p}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 Ng{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new su(Ns,16,0),this.grid3D=new su(Ns,16,0),this.featureIndexArray=new Ua,this.promoteId=r}insert(e,r,o,l,p,f){const y=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,l,p);const b=f?this.grid3D:this.grid;for(let k=0;k<r.length;k++){const I=r[k],M=[1/0,1/0,-1/0,-1/0];for(let R=0;R<I.length;R++){const V=I[R];M[0]=Math.min(M[0],V.x),M[1]=Math.min(M[1],V.y),M[2]=Math.max(M[2],V.x),M[3]=Math.max(M[3],V.y)}M[0]<Ns&&M[1]<Ns&&M[2]>=0&&M[3]>=0&&b.insert(y,M[0],M[1],M[2],M[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new fu.VectorTile(new tm(this.rawTileData)).layers,this.sourceLayerCoder=new Og(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,l){this.loadVTLayers();const p=e.params||{},f=Ns/e.tileSize/e.scale,y=ha(p.filter),b=e.queryGeometry,k=e.queryPadding*f,I=jg(b),M=this.grid.query(I.minX-k,I.minY-k,I.maxX+k,I.maxY+k),R=jg(e.cameraQueryGeometry),V=this.grid3D.query(R.minX-k,R.minY-k,R.maxX+k,R.maxY+k,(ne,$e,ii,gt)=>function(Xt,hi,vi,Di,Zi){for(const Ci of Xt)if(hi<=Ci.x&&vi<=Ci.y&&Di>=Ci.x&&Zi>=Ci.y)return!0;const Pi=[new H(hi,vi),new H(hi,Zi),new H(Di,Zi),new H(Di,vi)];if(Xt.length>2){for(const Ci of Pi)if(Oh(Xt,Ci))return!0}for(let Ci=0;Ci<Xt.length-1;Ci++)if(gy(Xt[Ci],Xt[Ci+1],Pi))return!0;return!1}(e.cameraQueryGeometry,ne-k,$e-k,ii+k,gt+k));for(const ne of V)M.push(ne);M.sort(F_);const j={};let q;for(let ne=0;ne<M.length;ne++){const $e=M[ne];if($e===q)continue;q=$e;const ii=this.featureIndexArray.get($e);let gt=null;this.loadMatchingFeature(j,ii.bucketIndex,ii.sourceLayerIndex,ii.featureIndex,y,p.layers,p.availableImages,r,o,l,(Xt,hi,vi)=>(gt||(gt=Xu(Xt)),hi.queryIntersectsFeature(b,Xt,vi,gt,this.z,e.transform,f,e.pixelPosMatrix)))}return j}loadMatchingFeature(e,r,o,l,p,f,y,b,k,I,M){const R=this.bucketLayerIDs[r];if(f&&!function(ne,$e){for(let ii=0;ii<ne.length;ii++)if($e.indexOf(ne[ii])>=0)return!0;return!1}(f,R))return;const V=this.sourceLayerCoder.decode(o),j=this.vtLayers[V].feature(l);if(p.needGeometry){const ne=Ju(j,!0);if(!p.filter(new vs(this.tileID.overscaledZ),ne,this.tileID.canonical))return}else if(!p.filter(new vs(this.tileID.overscaledZ),j))return;const q=this.getId(j,V);for(let ne=0;ne<R.length;ne++){const $e=R[ne];if(f&&f.indexOf($e)<0)continue;const ii=b[$e];if(!ii)continue;let gt={};q&&I&&(gt=I.getState(ii.sourceLayer||"_geojsonTileLayer",q));const Xt=tn({},k[$e]);Xt.paint=$g(Xt.paint,ii.paint,j,gt,y),Xt.layout=$g(Xt.layout,ii.layout,j,gt,y);const hi=!M||M(j,ii,gt);if(!hi)continue;const vi=new Vg(j,this.z,this.x,this.y,q);vi.layer=Xt;let Di=e[$e];Di===void 0&&(Di=e[$e]=[]),Di.push({featureIndex:l,feature:vi,intersectionZ:hi})}}lookupSymbolFeatures(e,r,o,l,p,f,y,b){const k={};this.loadVTLayers();const I=ha(p);for(const M of e)this.loadMatchingFeature(k,o,l,M,I,f,y,b,r);return k}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function $g(i,e,r,o,l){return Ji(i,(p,f)=>{const y=e instanceof Mh?e.get(f):null;return y&&y.evaluate?y.evaluate(r,o,l):y})}function jg(i){let e=1/0,r=1/0,o=-1/0,l=-1/0;for(const p of i)e=Math.min(e,p.x),r=Math.min(r,p.y),o=Math.max(o,p.x),l=Math.max(l,p.y);return{minX:e,minY:r,maxX:o,maxY:l}}function F_(i,e){return e-i}function Ug(i,e,r,o,l){const p=[];for(let f=0;f<i.length;f++){const y=i[f];let b;for(let k=0;k<y.length-1;k++){let I=y[k],M=y[k+1];I.x<e&&M.x<e||(I.x<e?I=new H(e,I.y+(e-I.x)/(M.x-I.x)*(M.y-I.y))._round():M.x<e&&(M=new H(e,I.y+(e-I.x)/(M.x-I.x)*(M.y-I.y))._round()),I.y<r&&M.y<r||(I.y<r?I=new H(I.x+(r-I.y)/(M.y-I.y)*(M.x-I.x),r)._round():M.y<r&&(M=new H(I.x+(r-I.y)/(M.y-I.y)*(M.x-I.x),r)._round()),I.x>=o&&M.x>=o||(I.x>=o?I=new H(o,I.y+(o-I.x)/(M.x-I.x)*(M.y-I.y))._round():M.x>=o&&(M=new H(o,I.y+(o-I.x)/(M.x-I.x)*(M.y-I.y))._round()),I.y>=l&&M.y>=l||(I.y>=l?I=new H(I.x+(l-I.y)/(M.y-I.y)*(M.x-I.x),l)._round():M.y>=l&&(M=new H(I.x+(l-I.y)/(M.y-I.y)*(M.x-I.x),l)._round()),b&&I.equals(b[b.length-1])||(b=[I],p.push(b)),b.push(M)))))}}return p}Li("FeatureIndex",Ng,{omit:["rawTileData","sourceLayerCoder"]});class _u extends H{constructor(e,r,o,l){super(e,r),this.angle=o,l!==void 0&&(this.segment=l)}clone(){return new _u(this.x,this.y,this.angle,this.segment)}}function qg(i,e,r,o,l){if(e.segment===void 0||r===0)return!0;let p=e,f=e.segment+1,y=0;for(;y>-r/2;){if(f--,f<0)return!1;y-=i[f].dist(p),p=i[f]}y+=i[f].dist(i[f+1]),f++;const b=[];let k=0;for(;y<r/2;){const I=i[f],M=i[f+1];if(!M)return!1;let R=i[f-1].angleTo(I)-I.angleTo(M);for(R=Math.abs((R+3*Math.PI)%(2*Math.PI)-Math.PI),b.push({distance:y,angleDelta:R}),k+=R;y-b[0].distance>o;)k-=b.shift().angleDelta;if(k>l)return!1;f++,y+=I.dist(M)}return!0}function Zg(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Gg(i,e,r){return i?.6*e*r:0}function Hg(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function O_(i,e,r,o,l,p){const f=Gg(r,l,p),y=Hg(r,o)*p;let b=0;const k=Zg(i)/2;for(let I=0;I<i.length-1;I++){const M=i[I],R=i[I+1],V=M.dist(R);if(b+V>k){const j=(k-b)/V,q=Aa.number(M.x,R.x,j),ne=Aa.number(M.y,R.y,j),$e=new _u(q,ne,R.angleTo(M),I);return $e._round(),!f||qg(i,$e,y,f,e)?$e:void 0}b+=V}}function V_(i,e,r,o,l,p,f,y,b){const k=Gg(o,p,f),I=Hg(o,l),M=I*f,R=i[0].x===0||i[0].x===b||i[0].y===0||i[0].y===b;return e-M<e/4&&(e=M+e/4),Wg(i,R?e/2*y%e:(I/2+2*p)*f*y%e,e,k,r,M,R,!1,b)}function Wg(i,e,r,o,l,p,f,y,b){const k=p/2,I=Zg(i);let M=0,R=e-r,V=[];for(let j=0;j<i.length-1;j++){const q=i[j],ne=i[j+1],$e=q.dist(ne),ii=ne.angleTo(q);for(;R+r<M+$e;){R+=r;const gt=(R-M)/$e,Xt=Aa.number(q.x,ne.x,gt),hi=Aa.number(q.y,ne.y,gt);if(Xt>=0&&Xt<b&&hi>=0&&hi<b&&R-k>=0&&R+k<=I){const vi=new _u(Xt,hi,ii,j);vi._round(),o&&!qg(i,vi,p,o,l)||V.push(vi)}}M+=$e}return y||V.length||f||(V=Wg(i,M/2,r,o,l,p,f,!0,b)),V}Li("Anchor",_u);const Gh=Ma;function Kg(i,e,r,o){const l=[],p=i.image,f=p.pixelRatio,y=p.paddedRect.w-2*Gh,b=p.paddedRect.h-2*Gh;let k={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const I=p.stretchX||[[0,y]],M=p.stretchY||[[0,b]],R=(fi,ji)=>fi+ji[1]-ji[0],V=I.reduce(R,0),j=M.reduce(R,0),q=y-V,ne=b-j;let $e=0,ii=V,gt=0,Xt=j,hi=0,vi=q,Di=0,Zi=ne;if(p.content&&o){const fi=p.content,ji=fi[2]-fi[0],Vi=fi[3]-fi[1];(p.textFitWidth||p.textFitHeight)&&(k=wg(i)),$e=hf(I,0,fi[0]),gt=hf(M,0,fi[1]),ii=hf(I,fi[0],fi[2]),Xt=hf(M,fi[1],fi[3]),hi=fi[0]-$e,Di=fi[1]-gt,vi=ji-ii,Zi=Vi-Xt}const Pi=k.x1,Ci=k.y1,Ni=k.x2-Pi,Fi=k.y2-Ci,Ri=(fi,ji,Vi,Ki)=>{const gs=df(fi.stretch-$e,ii,Ni,Pi),ms=pf(fi.fixed-hi,vi,fi.stretch,V),Gs=df(ji.stretch-gt,Xt,Fi,Ci),Wl=pf(ji.fixed-Di,Zi,ji.stretch,j),sa=df(Vi.stretch-$e,ii,Ni,Pi),Ds=pf(Vi.fixed-hi,vi,Vi.stretch,V),xa=df(Ki.stretch-gt,Xt,Fi,Ci),ba=pf(Ki.fixed-Di,Zi,Ki.stretch,j),wa=new H(gs,Gs),Bs=new H(sa,Gs),Hs=new H(sa,xa),pa=new H(gs,xa),aa=new H(ms/f,Wl/f),Sa=new H(Ds/f,ba/f),la=e*Math.PI/180;if(la){const cs=Math.sin(la),xs=Math.cos(la),Ts=[xs,-cs,cs,xs];wa._matMult(Ts),Bs._matMult(Ts),pa._matMult(Ts),Hs._matMult(Ts)}const Ha=fi.stretch+fi.fixed,za=ji.stretch+ji.fixed;return{tl:wa,tr:Bs,bl:pa,br:Hs,tex:{x:p.paddedRect.x+Gh+Ha,y:p.paddedRect.y+Gh+za,w:Vi.stretch+Vi.fixed-Ha,h:Ki.stretch+Ki.fixed-za},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:aa,pixelOffsetBR:Sa,minFontScaleX:vi/f/Ni,minFontScaleY:Zi/f/Fi,isSDF:r}};if(o&&(p.stretchX||p.stretchY)){const fi=Xg(I,q,V),ji=Xg(M,ne,j);for(let Vi=0;Vi<fi.length-1;Vi++){const Ki=fi[Vi],gs=fi[Vi+1];for(let ms=0;ms<ji.length-1;ms++)l.push(Ri(Ki,ji[ms],gs,ji[ms+1]))}}else l.push(Ri({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:y+1},{fixed:0,stretch:b+1}));return l}function hf(i,e,r){let o=0;for(const l of i)o+=Math.max(e,Math.min(r,l[1]))-Math.max(e,Math.min(r,l[0]));return o}function Xg(i,e,r){const o=[{fixed:-Gh,stretch:0}];for(const[l,p]of i){const f=o[o.length-1];o.push({fixed:l-f.stretch,stretch:f.stretch}),o.push({fixed:l-f.stretch,stretch:f.stretch+(p-l)})}return o.push({fixed:e+Gh,stretch:r}),o}function df(i,e,r,o){return i/e*r+o}function pf(i,e,r,o){return i-e*r/o}class ff{constructor(e,r,o,l,p,f,y,b,k,I){var M;if(this.boxStartIndex=e.length,k){let R=f.top,V=f.bottom;const j=f.collisionPadding;j&&(R-=j[1],V+=j[3]);let q=V-R;q>0&&(q=Math.max(10,q),this.circleDiameter=q)}else{const R=!((M=f.image)===null||M===void 0)&&M.content&&(f.image.textFitWidth||f.image.textFitHeight)?wg(f):{x1:f.left,y1:f.top,x2:f.right,y2:f.bottom};R.y1=R.y1*y-b[0],R.y2=R.y2*y+b[2],R.x1=R.x1*y-b[3],R.x2=R.x2*y+b[1];const V=f.collisionPadding;if(V&&(R.x1-=V[0]*y,R.y1-=V[1]*y,R.x2+=V[2]*y,R.y2+=V[3]*y),I){const j=new H(R.x1,R.y1),q=new H(R.x2,R.y1),ne=new H(R.x1,R.y2),$e=new H(R.x2,R.y2),ii=I*Math.PI/180;j._rotate(ii),q._rotate(ii),ne._rotate(ii),$e._rotate(ii),R.x1=Math.min(j.x,q.x,ne.x,$e.x),R.x2=Math.max(j.x,q.x,ne.x,$e.x),R.y1=Math.min(j.y,q.y,ne.y,$e.y),R.y2=Math.max(j.y,q.y,ne.y,$e.y)}e.emplaceBack(r.x,r.y,R.x1,R.y1,R.x2,R.y2,o,l,p)}this.boxEndIndex=e.length}}class N_{constructor(e=[],r=(o,l)=>o<l?-1:o>l?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,l=r[e];for(;e>0;){const p=e-1>>1,f=r[p];if(o(l,f)>=0)break;r[e]=f,e=p}r[e]=l}_down(e){const{data:r,compare:o}=this,l=this.length>>1,p=r[e];for(;e<l;){let f=1+(e<<1);const y=f+1;if(y<this.length&&o(r[y],r[f])<0&&(f=y),o(r[f],p)>=0)break;r[e]=r[f],e=f}r[e]=p}}function $_(i,e=1,r=!1){let o=1/0,l=1/0,p=-1/0,f=-1/0;const y=i[0];for(let V=0;V<y.length;V++){const j=y[V];(!V||j.x<o)&&(o=j.x),(!V||j.y<l)&&(l=j.y),(!V||j.x>p)&&(p=j.x),(!V||j.y>f)&&(f=j.y)}const b=Math.min(p-o,f-l);let k=b/2;const I=new N_([],j_);if(b===0)return new H(o,l);for(let V=o;V<p;V+=b)for(let j=l;j<f;j+=b)I.push(new Hh(V+k,j+k,k,i));let M=function(V){let j=0,q=0,ne=0;const $e=V[0];for(let ii=0,gt=$e.length,Xt=gt-1;ii<gt;Xt=ii++){const hi=$e[ii],vi=$e[Xt],Di=hi.x*vi.y-vi.x*hi.y;q+=(hi.x+vi.x)*Di,ne+=(hi.y+vi.y)*Di,j+=3*Di}return new Hh(q/j,ne/j,0,V)}(i),R=I.length;for(;I.length;){const V=I.pop();(V.d>M.d||!M.d)&&(M=V,r&&console.log("found best %d after %d probes",Math.round(1e4*V.d)/1e4,R)),V.max-M.d<=e||(k=V.h/2,I.push(new Hh(V.p.x-k,V.p.y-k,k,i)),I.push(new Hh(V.p.x+k,V.p.y-k,k,i)),I.push(new Hh(V.p.x-k,V.p.y+k,k,i)),I.push(new Hh(V.p.x+k,V.p.y+k,k,i)),R+=4)}return r&&(console.log(`num probes: ${R}`),console.log(`best distance: ${M.d}`)),M.p}function j_(i,e){return e.max-i.max}function Hh(i,e,r,o){this.p=new H(i,e),this.h=r,this.d=function(l,p){let f=!1,y=1/0;for(let b=0;b<p.length;b++){const k=p[b];for(let I=0,M=k.length,R=M-1;I<M;R=I++){const V=k[I],j=k[R];V.y>l.y!=j.y>l.y&&l.x<(j.x-V.x)*(l.y-V.y)/(j.y-V.y)+V.x&&(f=!f),y=Math.min(y,Dm(l,V,j))}}return(f?1:-1)*Math.sqrt(y)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}var oa;S.ar=void 0,(oa=S.ar||(S.ar={}))[oa.center=1]="center",oa[oa.left=2]="left",oa[oa.right=3]="right",oa[oa.top=4]="top",oa[oa.bottom=5]="bottom",oa[oa["top-left"]=6]="top-left",oa[oa["top-right"]=7]="top-right",oa[oa["bottom-left"]=8]="bottom-left",oa[oa["bottom-right"]=9]="bottom-right";const vu=7,fm=Number.POSITIVE_INFINITY;function Jg(i,e){return e[1]!==fm?function(r,o,l){let p=0,f=0;switch(o=Math.abs(o),l=Math.abs(l),r){case"top-right":case"top-left":case"top":f=l-vu;break;case"bottom-right":case"bottom-left":case"bottom":f=-l+vu}switch(r){case"top-right":case"bottom-right":case"right":p=-o;break;case"top-left":case"bottom-left":case"left":p=o}return[p,f]}(i,e[0],e[1]):function(r,o){let l=0,p=0;o<0&&(o=0);const f=o/Math.SQRT2;switch(r){case"top-right":case"top-left":p=f-vu;break;case"bottom-right":case"bottom-left":p=-f+vu;break;case"bottom":p=-o+vu;break;case"top":p=o-vu}switch(r){case"top-right":case"bottom-right":l=-f;break;case"top-left":case"bottom-left":l=f;break;case"left":l=o;break;case"right":l=-o}return[l,p]}(i,e[0])}function Yg(i,e,r){var o;const l=i.layout,p=(o=l.get("text-variable-anchor-offset"))===null||o===void 0?void 0:o.evaluate(e,{},r);if(p){const y=p.values,b=[];for(let k=0;k<y.length;k+=2){const I=b[k]=y[k],M=y[k+1].map(R=>R*qs);I.startsWith("top")?M[1]-=vu:I.startsWith("bottom")&&(M[1]+=vu),b[k+1]=M}return new Ca(b)}const f=l.get("text-variable-anchor");if(f){let y;y=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(e,{},r)*qs,fm]:l.get("text-offset").evaluate(e,{},r).map(k=>k*qs);const b=[];for(const k of f)b.push(k,Jg(k,y));return new Ca(b)}return null}function mm(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 U_(i,e,r,o,l,p,f,y,b,k,I){let M=p.textMaxSize.evaluate(e,{});M===void 0&&(M=f);const R=i.layers[0].layout,V=R.get("icon-offset").evaluate(e,{},I),j=ey(r.horizontal),q=f/24,ne=i.tilePixelRatio*q,$e=i.tilePixelRatio*M/24,ii=i.tilePixelRatio*y,gt=i.tilePixelRatio*R.get("symbol-spacing"),Xt=R.get("text-padding")*i.tilePixelRatio,hi=function(fi,ji,Vi,Ki=1){const gs=fi.get("icon-padding").evaluate(ji,{},Vi),ms=gs&&gs.values;return[ms[0]*Ki,ms[1]*Ki,ms[2]*Ki,ms[3]*Ki]}(R,e,I,i.tilePixelRatio),vi=R.get("text-max-angle")/180*Math.PI,Di=R.get("text-rotation-alignment")!=="viewport"&&R.get("symbol-placement")!=="point",Zi=R.get("icon-rotation-alignment")==="map"&&R.get("symbol-placement")!=="point",Pi=R.get("symbol-placement"),Ci=gt/2,Ni=R.get("icon-text-fit");let Fi;o&&Ni!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Fi=Sg(o,r.vertical,Ni,R.get("icon-text-fit-padding"),V,q)),j&&(o=Sg(o,j,Ni,R.get("icon-text-fit-padding"),V,q)));const Ri=(fi,ji)=>{ji.x<0||ji.x>=Ns||ji.y<0||ji.y>=Ns||function(Vi,Ki,gs,ms,Gs,Wl,sa,Ds,xa,ba,wa,Bs,Hs,pa,aa,Sa,la,Ha,za,cs,xs,Ts,La,zs,Wh){const Sc=Vi.addToLineVertexArray(Ki,gs);let kc,Kl,Wa,Xs,qc=0,up=0,ny=0,oy=0,Sm=-1,km=-1;const Zc={};let sy=Lh("");if(Vi.allowVerticalPlacement&&ms.vertical){const fa=Ds.layout.get("text-rotate").evaluate(xs,{},zs)+90;Wa=new ff(xa,Ki,ba,wa,Bs,ms.vertical,Hs,pa,aa,fa),sa&&(Xs=new ff(xa,Ki,ba,wa,Bs,sa,la,Ha,aa,fa))}if(Gs){const fa=Ds.layout.get("icon-rotate").evaluate(xs,{}),Ka=Ds.layout.get("icon-text-fit")!=="none",Qu=Kg(Gs,fa,La,Ka),ac=sa?Kg(sa,fa,La,Ka):void 0;Kl=new ff(xa,Ki,ba,wa,Bs,Gs,la,Ha,!1,fa),qc=4*Qu.length;const eh=Vi.iconSizeData;let Ec=null;eh.kind==="source"?(Ec=[wc*Ds.layout.get("icon-size").evaluate(xs,{})],Ec[0]>gu&&Fs(`${Vi.layerIds[0]}: Value for "icon-size" is >= ${sp}. Reduce your "icon-size".`)):eh.kind==="composite"&&(Ec=[wc*Ts.compositeIconSizes[0].evaluate(xs,{},zs),wc*Ts.compositeIconSizes[1].evaluate(xs,{},zs)],(Ec[0]>gu||Ec[1]>gu)&&Fs(`${Vi.layerIds[0]}: Value for "icon-size" is >= ${sp}. Reduce your "icon-size".`)),Vi.addSymbols(Vi.icon,Qu,Ec,cs,za,xs,S.ai.none,Ki,Sc.lineStartIndex,Sc.lineLength,-1,zs),Sm=Vi.icon.placedSymbolArray.length-1,ac&&(up=4*ac.length,Vi.addSymbols(Vi.icon,ac,Ec,cs,za,xs,S.ai.vertical,Ki,Sc.lineStartIndex,Sc.lineLength,-1,zs),km=Vi.icon.placedSymbolArray.length-1)}const ay=Object.keys(ms.horizontal);for(const fa of ay){const Ka=ms.horizontal[fa];if(!kc){sy=Lh(Ka.text);const ac=Ds.layout.get("text-rotate").evaluate(xs,{},zs);kc=new ff(xa,Ki,ba,wa,Bs,Ka,Hs,pa,aa,ac)}const Qu=Ka.positionedLines.length===1;if(ny+=Qg(Vi,Ki,Ka,Wl,Ds,aa,xs,Sa,Sc,ms.vertical?S.ai.horizontal:S.ai.horizontalOnly,Qu?ay:[fa],Zc,Sm,Ts,zs),Qu)break}ms.vertical&&(oy+=Qg(Vi,Ki,ms.vertical,Wl,Ds,aa,xs,Sa,Sc,S.ai.vertical,["vertical"],Zc,km,Ts,zs));const G_=kc?kc.boxStartIndex:Vi.collisionBoxArray.length,H_=kc?kc.boxEndIndex:Vi.collisionBoxArray.length,W_=Wa?Wa.boxStartIndex:Vi.collisionBoxArray.length,K_=Wa?Wa.boxEndIndex:Vi.collisionBoxArray.length,X_=Kl?Kl.boxStartIndex:Vi.collisionBoxArray.length,J_=Kl?Kl.boxEndIndex:Vi.collisionBoxArray.length,Y_=Xs?Xs.boxStartIndex:Vi.collisionBoxArray.length,Q_=Xs?Xs.boxEndIndex:Vi.collisionBoxArray.length;let sc=-1;const gf=(fa,Ka)=>fa&&fa.circleDiameter?Math.max(fa.circleDiameter,Ka):Ka;sc=gf(kc,sc),sc=gf(Wa,sc),sc=gf(Kl,sc),sc=gf(Xs,sc);const ly=sc>-1?1:0;ly&&(sc*=Wh/qs),Vi.glyphOffsetArray.length>=Zh.MAX_GLYPHS&&Fs("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),xs.sortKey!==void 0&&Vi.addToSortKeyRanges(Vi.symbolInstances.length,xs.sortKey);const ev=Yg(Ds,xs,zs),[tv,iv]=function(fa,Ka){const Qu=fa.length,ac=Ka==null?void 0:Ka.values;if((ac==null?void 0:ac.length)>0)for(let eh=0;eh<ac.length;eh+=2){const Ec=ac[eh+1];fa.emplaceBack(S.ar[ac[eh]],Ec[0],Ec[1])}return[Qu,fa.length]}(Vi.textAnchorOffsets,ev);Vi.symbolInstances.emplaceBack(Ki.x,Ki.y,Zc.right>=0?Zc.right:-1,Zc.center>=0?Zc.center:-1,Zc.left>=0?Zc.left:-1,Zc.vertical||-1,Sm,km,sy,G_,H_,W_,K_,X_,J_,Y_,Q_,ba,ny,oy,qc,up,ly,0,Hs,sc,tv,iv)}(i,ji,fi,r,o,l,Fi,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,ne,[Xt,Xt,Xt,Xt],Di,b,ii,hi,Zi,V,e,p,k,I,f)};if(Pi==="line")for(const fi of Ug(e.geometry,0,0,Ns,Ns)){const ji=V_(fi,gt,vi,r.vertical||j,o,24,$e,i.overscaling,Ns);for(const Vi of ji)j&&q_(i,j.text,Ci,Vi)||Ri(fi,Vi)}else if(Pi==="line-center"){for(const fi of e.geometry)if(fi.length>1){const ji=O_(fi,vi,r.vertical||j,o,24,$e);ji&&Ri(fi,ji)}}else if(e.type==="Polygon")for(const fi of ph(e.geometry,0)){const ji=$_(fi,16);Ri(fi[0],new _u(ji.x,ji.y,0))}else if(e.type==="LineString")for(const fi of e.geometry)Ri(fi,new _u(fi[0].x,fi[0].y,0));else if(e.type==="Point")for(const fi of e.geometry)for(const ji of fi)Ri([ji],new _u(ji.x,ji.y,0))}function Qg(i,e,r,o,l,p,f,y,b,k,I,M,R,V,j){const q=function(ii,gt,Xt,hi,vi,Di,Zi,Pi){const Ci=hi.layout.get("text-rotate").evaluate(Di,{})*Math.PI/180,Ni=[];for(const Fi of gt.positionedLines)for(const Ri of Fi.positionedGlyphs){if(!Ri.rect)continue;const fi=Ri.rect||{};let ji=mg+1,Vi=!0,Ki=1,gs=0;const ms=(vi||Pi)&&Ri.vertical,Gs=Ri.metrics.advance*Ri.scale/2;if(Pi&>.verticalizable&&(gs=Fi.lineOffset/2-(Ri.imageName?-(qs-Ri.metrics.width*Ri.scale)/2:(Ri.scale-1)*qs)),Ri.imageName){const cs=Zi[Ri.imageName];Vi=cs.sdf,Ki=cs.pixelRatio,ji=Ma/Ki}const Wl=vi?[Ri.x+Gs,Ri.y]:[0,0];let sa=vi?[0,0]:[Ri.x+Gs+Xt[0],Ri.y+Xt[1]-gs],Ds=[0,0];ms&&(Ds=sa,sa=[0,0]);const xa=Ri.metrics.isDoubleResolution?2:1,ba=(Ri.metrics.left-ji)*Ri.scale-Gs+sa[0],wa=(-Ri.metrics.top-ji)*Ri.scale+sa[1],Bs=ba+fi.w/xa*Ri.scale/Ki,Hs=wa+fi.h/xa*Ri.scale/Ki,pa=new H(ba,wa),aa=new H(Bs,wa),Sa=new H(ba,Hs),la=new H(Bs,Hs);if(ms){const cs=new H(-Gs,Gs-np),xs=-Math.PI/2,Ts=qs/2-Gs,La=new H(5-np-Ts,-(Ri.imageName?Ts:0)),zs=new H(...Ds);pa._rotateAround(xs,cs)._add(La)._add(zs),aa._rotateAround(xs,cs)._add(La)._add(zs),Sa._rotateAround(xs,cs)._add(La)._add(zs),la._rotateAround(xs,cs)._add(La)._add(zs)}if(Ci){const cs=Math.sin(Ci),xs=Math.cos(Ci),Ts=[xs,-cs,cs,xs];pa._matMult(Ts),aa._matMult(Ts),Sa._matMult(Ts),la._matMult(Ts)}const Ha=new H(0,0),za=new H(0,0);Ni.push({tl:pa,tr:aa,bl:Sa,br:la,tex:fi,writingMode:gt.writingMode,glyphOffset:Wl,sectionIndex:Ri.sectionIndex,isSDF:Vi,pixelOffsetTL:Ha,pixelOffsetBR:za,minFontScaleX:0,minFontScaleY:0})}return Ni}(0,r,y,l,p,f,o,i.allowVerticalPlacement),ne=i.textSizeData;let $e=null;ne.kind==="source"?($e=[wc*l.layout.get("text-size").evaluate(f,{})],$e[0]>gu&&Fs(`${i.layerIds[0]}: Value for "text-size" is >= ${sp}. Reduce your "text-size".`)):ne.kind==="composite"&&($e=[wc*V.compositeTextSizes[0].evaluate(f,{},j),wc*V.compositeTextSizes[1].evaluate(f,{},j)],($e[0]>gu||$e[1]>gu)&&Fs(`${i.layerIds[0]}: Value for "text-size" is >= ${sp}. Reduce your "text-size".`)),i.addSymbols(i.text,q,$e,y,p,f,k,e,b.lineStartIndex,b.lineLength,R,j);for(const ii of I)M[ii]=i.text.placedSymbolArray.length-1;return 4*q.length}function ey(i){for(const e in i)return i[e];return null}function q_(i,e,r,o){const l=i.compareText;if(e in l){const p=l[e];for(let f=p.length-1;f>=0;f--)if(o.dist(p[f])<r)return!0}else l[e]=[];return l[e].push(o),!1}const ty=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class gm{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,o]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=o>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const p=ty[15&o];if(!p)throw new Error("Unrecognized array type.");const[f]=new Uint16Array(e,2,1),[y]=new Uint32Array(e,4,1);return new gm(y,f,p,e)}constructor(e,r=64,o=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const p=ty.indexOf(this.ArrayType),f=2*e*this.ArrayType.BYTES_PER_ELEMENT,y=e*this.IndexArrayType.BYTES_PER_ELEMENT,b=(8-y%8)%8;if(p<0)throw new Error(`Unexpected typed array class: ${o}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+y+b,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+f+y+b),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+y+b,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+p]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=r,o}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return ym(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,o,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:p,coords:f,nodeSize:y}=this,b=[0,p.length-1,0],k=[];for(;b.length;){const I=b.pop()||0,M=b.pop()||0,R=b.pop()||0;if(M-R<=y){for(let ne=R;ne<=M;ne++){const $e=f[2*ne],ii=f[2*ne+1];$e>=e&&$e<=o&&ii>=r&&ii<=l&&k.push(p[ne])}continue}const V=R+M>>1,j=f[2*V],q=f[2*V+1];j>=e&&j<=o&&q>=r&&q<=l&&k.push(p[V]),(I===0?e<=j:r<=q)&&(b.push(R),b.push(V-1),b.push(1-I)),(I===0?o>=j:l>=q)&&(b.push(V+1),b.push(M),b.push(1-I))}return k}within(e,r,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:p,nodeSize:f}=this,y=[0,l.length-1,0],b=[],k=o*o;for(;y.length;){const I=y.pop()||0,M=y.pop()||0,R=y.pop()||0;if(M-R<=f){for(let ne=R;ne<=M;ne++)ry(p[2*ne],p[2*ne+1],e,r)<=k&&b.push(l[ne]);continue}const V=R+M>>1,j=p[2*V],q=p[2*V+1];ry(j,q,e,r)<=k&&b.push(l[V]),(I===0?e-o<=j:r-o<=q)&&(y.push(R),y.push(V-1),y.push(1-I)),(I===0?e+o>=j:r+o>=q)&&(y.push(V+1),y.push(M),y.push(1-I))}return b}}function ym(i,e,r,o,l,p){if(l-o<=r)return;const f=o+l>>1;iy(i,e,f,o,l,p),ym(i,e,r,o,f-1,1-p),ym(i,e,r,f+1,l,1-p)}function iy(i,e,r,o,l,p){for(;l>o;){if(l-o>600){const k=l-o+1,I=r-o+1,M=Math.log(k),R=.5*Math.exp(2*M/3),V=.5*Math.sqrt(M*R*(k-R)/k)*(I-k/2<0?-1:1);iy(i,e,r,Math.max(o,Math.floor(r-I*R/k+V)),Math.min(l,Math.floor(r+(k-I)*R/k+V)),p)}const f=e[2*r+p];let y=o,b=l;for(lp(i,e,o,r),e[2*l+p]>f&&lp(i,e,o,l);y<b;){for(lp(i,e,y,b),y++,b--;e[2*y+p]<f;)y++;for(;e[2*b+p]>f;)b--}e[2*o+p]===f?lp(i,e,o,b):(b++,lp(i,e,b,l)),b<=r&&(o=b+1),r<=b&&(l=b-1)}}function lp(i,e,r,o){_m(i,r,o),_m(e,2*r,2*o),_m(e,2*r+1,2*o+1)}function _m(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}function ry(i,e,r,o){const l=i-r,p=e-o;return l*l+p*p}var vm;S.bf=void 0,(vm=S.bf||(S.bf={})).create="create",vm.load="load",vm.fullLoad="fullLoad";let mf=null,cp=[];const xm=1e3/60,bm="loadTime",wm="fullLoadTime",Z_={mark(i){performance.mark(i)},frame(i){const e=i;mf!=null&&cp.push(e-mf),mf=e},clearMetrics(){mf=null,cp=[],performance.clearMeasures(bm),performance.clearMeasures(wm);for(const i in S.bf)performance.clearMarks(S.bf[i])},getPerformanceMetrics(){performance.measure(bm,S.bf.create,S.bf.load),performance.measure(wm,S.bf.create,S.bf.fullLoad);const i=performance.getEntriesByName(bm)[0].duration,e=performance.getEntriesByName(wm)[0].duration,r=cp.length,o=1/(cp.reduce((p,f)=>p+f,0)/r/1e3),l=cp.filter(p=>p>xm).reduce((p,f)=>p+(f-xm)/xm,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};S.$=class extends U{},S.A=Vh,S.B=Ld,S.C=function(i){if(Hc==null){const e=i.navigator?i.navigator.userAgent:null;Hc=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Hc},S.D=$i,S.E=Xc,S.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new L_(()=>this.process()),this.subscription=function(r,o,l,p){return r.addEventListener(o,l,!1),{unsubscribe:()=>{r.removeEventListener(o,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=Xl(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((r,o)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:o},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];const y={id:l,type:"<cancel>",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(y)},{once:!0});const p=[],f=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:Gu(i.data,p)});this.target.postMessage(f,{transfer:p})})}receive(i){const e=i.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[r];const o=this.abortControllers[r];return delete this.abortControllers[r],void(o&&o.abort())}if(Xl(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return u(this,void 0,void 0,function*(){if(e.type==="<response>"){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(e.error?l.reject(Gl(e.error)):l.resolve(Gl(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Gl(e.data),o=new AbortController;this.abortControllers[i]=o;try{const l=yield this.messageHandlers[e.type](e.sourceMapId,r,o);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,e,r){const o=[];delete this.abortControllers[i];const l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Gu(e):null,data:Gu(r,o)};this.target.postMessage(l,{transfer:o})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.G=Kc,S.H=function(){var i=new Vh(16);return Vh!=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},S.I=rm,S.J=function(i,e,r){var o,l,p,f,y,b,k,I,M,R,V,j,q=r[0],ne=r[1],$e=r[2];return e===i?(i[12]=e[0]*q+e[4]*ne+e[8]*$e+e[12],i[13]=e[1]*q+e[5]*ne+e[9]*$e+e[13],i[14]=e[2]*q+e[6]*ne+e[10]*$e+e[14],i[15]=e[3]*q+e[7]*ne+e[11]*$e+e[15]):(l=e[1],p=e[2],f=e[3],y=e[4],b=e[5],k=e[6],I=e[7],M=e[8],R=e[9],V=e[10],j=e[11],i[0]=o=e[0],i[1]=l,i[2]=p,i[3]=f,i[4]=y,i[5]=b,i[6]=k,i[7]=I,i[8]=M,i[9]=R,i[10]=V,i[11]=j,i[12]=o*q+y*ne+M*$e+e[12],i[13]=l*q+b*ne+R*$e+e[13],i[14]=p*q+k*ne+V*$e+e[14],i[15]=f*q+I*ne+j*$e+e[15]),i},S.K=function(i,e,r){var o=r[0],l=r[1],p=r[2];return i[0]=e[0]*o,i[1]=e[1]*o,i[2]=e[2]*o,i[3]=e[3]*o,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*p,i[9]=e[9]*p,i[10]=e[10]*p,i[11]=e[11]*p,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},S.L=Fm,S.M=function(i,e){const r={};for(let o=0;o<e.length;o++){const l=e[o];l in i&&(r[l]=i[l])}return r},S.N=yu,S.O=zg,S.P=H,S.Q=Dg,S.R=Za,S.S=Ga,S.T=lu,S.U=Ii,S.V=pi,S.W=Tc,S.X=Ns,S.Y=C,S.Z=uf,S._=u,S.a=lc,S.a$=function(i,e){var r=i[0],o=i[1],l=i[2],p=i[3],f=i[4],y=i[5],b=i[6],k=i[7],I=i[8],M=i[9],R=i[10],V=i[11],j=i[12],q=i[13],ne=i[14],$e=i[15],ii=e[0],gt=e[1],Xt=e[2],hi=e[3],vi=e[4],Di=e[5],Zi=e[6],Pi=e[7],Ci=e[8],Ni=e[9],Fi=e[10],Ri=e[11],fi=e[12],ji=e[13],Vi=e[14],Ki=e[15];return Math.abs(r-ii)<=va*Math.max(1,Math.abs(r),Math.abs(ii))&&Math.abs(o-gt)<=va*Math.max(1,Math.abs(o),Math.abs(gt))&&Math.abs(l-Xt)<=va*Math.max(1,Math.abs(l),Math.abs(Xt))&&Math.abs(p-hi)<=va*Math.max(1,Math.abs(p),Math.abs(hi))&&Math.abs(f-vi)<=va*Math.max(1,Math.abs(f),Math.abs(vi))&&Math.abs(y-Di)<=va*Math.max(1,Math.abs(y),Math.abs(Di))&&Math.abs(b-Zi)<=va*Math.max(1,Math.abs(b),Math.abs(Zi))&&Math.abs(k-Pi)<=va*Math.max(1,Math.abs(k),Math.abs(Pi))&&Math.abs(I-Ci)<=va*Math.max(1,Math.abs(I),Math.abs(Ci))&&Math.abs(M-Ni)<=va*Math.max(1,Math.abs(M),Math.abs(Ni))&&Math.abs(R-Fi)<=va*Math.max(1,Math.abs(R),Math.abs(Fi))&&Math.abs(V-Ri)<=va*Math.max(1,Math.abs(V),Math.abs(Ri))&&Math.abs(j-fi)<=va*Math.max(1,Math.abs(j),Math.abs(fi))&&Math.abs(q-ji)<=va*Math.max(1,Math.abs(q),Math.abs(ji))&&Math.abs(ne-Vi)<=va*Math.max(1,Math.abs(ne),Math.abs(Vi))&&Math.abs($e-Ki)<=va*Math.max(1,Math.abs($e),Math.abs(Ki))},S.a0=Us,S.a1=pm,S.a2=Si,S.a3=i=>{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const o of i){const l=window.document.createElement("source");Ac(o)||(e.crossOrigin="Anonymous"),l.src=o,e.appendChild(l)}})},S.a4=function(){return Ws++},S.a5=es,S.a6=Zh,S.a7=ha,S.a8=Ju,S.a9=vs,S.aA=function(i){i=i.slice();const e=Object.create(null);for(let r=0;r<i.length;r++)e[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=bu(i[r],e[i[r].ref]));return i},S.aB=function(i){if(i.type==="custom")return new R_(i);switch(i.type){case"background":return new z_(i);case"circle":return new vy(i);case"fill":return new Ly(i);case"fill-extrusion":return new Jy(i);case"heatmap":return new by(i);case"hillshade":return new Sy(i);case"line":return new o_(i);case"raster":return new B_(i);case"symbol":return new cf(i)}},S.aC=os,S.aD=function(i,e){if(!i)return[{command:"setStyle",args:[e]}];let r=[];try{if(!us(i.version,e.version))return[{command:"setStyle",args:[e]}];us(i.center,e.center)||r.push({command:"setCenter",args:[e.center]}),us(i.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),us(i.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),us(i.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),us(i.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),us(i.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),us(i.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),us(i.light,e.light)||r.push({command:"setLight",args:[e.light]}),us(i.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),us(i.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),us(i.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const o={},l=[];(function(f,y,b,k){let I;for(I in y=y||{},f=f||{})Object.prototype.hasOwnProperty.call(f,I)&&(Object.prototype.hasOwnProperty.call(y,I)||hc(I,b,k));for(I in y)Object.prototype.hasOwnProperty.call(y,I)&&(Object.prototype.hasOwnProperty.call(f,I)?us(f[I],y[I])||(f[I].type==="geojson"&&y[I].type==="geojson"&&Jc(f,y,I)?Is(b,{command:"setGeoJSONSourceData",args:[I,y[I].data]}):Ql(I,y,b,k)):wu(I,y,b))})(i.sources,e.sources,l,o);const p=[];i.layers&&i.layers.forEach(f=>{"source"in f&&o[f.source]?r.push({command:"removeLayer",args:[f.id]}):p.push(f)}),r=r.concat(l),function(f,y,b){y=y||[];const k=(f=f||[]).map(Su),I=y.map(Su),M=f.reduce(ku,{}),R=y.reduce(ku,{}),V=k.slice(),j=Object.create(null);let q,ne,$e,ii,gt;for(let Xt=0,hi=0;Xt<k.length;Xt++)q=k[Xt],Object.prototype.hasOwnProperty.call(R,q)?hi++:(Is(b,{command:"removeLayer",args:[q]}),V.splice(V.indexOf(q,hi),1));for(let Xt=0,hi=0;Xt<I.length;Xt++)q=I[I.length-1-Xt],V[V.length-1-Xt]!==q&&(Object.prototype.hasOwnProperty.call(M,q)?(Is(b,{command:"removeLayer",args:[q]}),V.splice(V.lastIndexOf(q,V.length-hi),1)):hi++,ii=V[V.length-Xt],Is(b,{command:"addLayer",args:[R[q],ii]}),V.splice(V.length-Xt,0,q),j[q]=!0);for(let Xt=0;Xt<I.length;Xt++)if(q=I[Xt],ne=M[q],$e=R[q],!j[q]&&!us(ne,$e))if(us(ne.source,$e.source)&&us(ne["source-layer"],$e["source-layer"])&&us(ne.type,$e.type)){for(gt in Da(ne.layout,$e.layout,b,q,null,"setLayoutProperty"),Da(ne.paint,$e.paint,b,q,null,"setPaintProperty"),us(ne.filter,$e.filter)||Is(b,{command:"setFilter",args:[q,$e.filter]}),us(ne.minzoom,$e.minzoom)&&us(ne.maxzoom,$e.maxzoom)||Is(b,{command:"setLayerZoomRange",args:[q,$e.minzoom,$e.maxzoom]}),ne)Object.prototype.hasOwnProperty.call(ne,gt)&>!=="layout"&>!=="paint"&>!=="filter"&>!=="metadata"&>!=="minzoom"&>!=="maxzoom"&&(gt.indexOf("paint.")===0?Da(ne[gt],$e[gt],b,q,gt.slice(6),"setPaintProperty"):us(ne[gt],$e[gt])||Is(b,{command:"setLayerProperty",args:[q,gt,$e[gt]]}));for(gt in $e)Object.prototype.hasOwnProperty.call($e,gt)&&!Object.prototype.hasOwnProperty.call(ne,gt)&>!=="layout"&>!=="paint"&>!=="filter"&>!=="metadata"&>!=="minzoom"&>!=="maxzoom"&&(gt.indexOf("paint.")===0?Da(ne[gt],$e[gt],b,q,gt.slice(6),"setPaintProperty"):us(ne[gt],$e[gt])||Is(b,{command:"setLayerProperty",args:[q,gt,$e[gt]]}))}else Is(b,{command:"removeLayer",args:[q]}),ii=V[V.lastIndexOf(q)+1],Is(b,{command:"addLayer",args:[$e,ii]})}(p,e.layers,r)}catch(o){console.warn("Unable to compute style diff:",o),r=[{command:"setStyle",args:[e]}]}return r},S.aE=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},S.aF=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let o=0;o<e.length;o++)if(!i(e[o],r[o]))return!1;return!0}if(typeof e=="object"&&e!==null&&r!==null){if(typeof r!="object"||Object.keys(e).length!==Object.keys(r).length)return!1;for(const o in e)if(!i(e[o],r[o]))return!1;return!0}return e===r},S.aG=Ji,S.aH=$s,S.aI=class extends Wu{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},S.aJ=Kp,S.aK=class extends Wu{constructor(i,e){super(i,e),this.current=hy}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}}},S.aL=Tm,S.aM=Cm,S.aN=ps,S.aO=class extends Wu{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]))}},S.aP=class extends Wu{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]))}},S.aQ=function(i,e,r,o,l,p,f){var y=1/(e-r),b=1/(o-l),k=1/(p-f);return i[0]=-2*y,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*b,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*k,i[11]=0,i[12]=(e+r)*y,i[13]=(l+o)*b,i[14]=(f+p)*k,i[15]=1,i},S.aR=_y,S.aS=class extends yi{},S.aT=c_,S.aU=class extends zi{},S.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},S.aW=jm,S.aX=Nc,S.aY=Zs,S.aZ=class extends Ai{},S.a_=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]},S.aa=Vg,S.ab=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,l,p)=>{const f=l||p;return e[o]=!f||f.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},S.ac=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},S.ad=ri,S.ae=function(i,e,r){var o=Math.sin(r),l=Math.cos(r),p=e[0],f=e[1],y=e[2],b=e[3],k=e[4],I=e[5],M=e[6],R=e[7];return e!==i&&(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[0]=p*l+k*o,i[1]=f*l+I*o,i[2]=y*l+M*o,i[3]=b*l+R*o,i[4]=k*l-p*o,i[5]=I*l-f*o,i[6]=M*l-y*o,i[7]=R*l-b*o,i},S.af=function(i){var e=new Vh(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},S.ag=Qp,S.ah=function(i,e){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:p,maxZoom:f}=i,y=l?ri(Pa.interpolationFactor(l,e,p,f),0,1):0;i.kind==="camera"?o=Aa.number(i.minSize,i.maxSize,y):r=y}return{uSizeT:r,uSize:o}},S.aj=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:l}){return i.kind==="source"?o/wc:i.kind==="composite"?Aa.number(o/wc,l/wc,r):e},S.ak=am,S.al=function(i,e,r,o){const l=e.y-i.y,p=e.x-i.x,f=o.y-r.y,y=o.x-r.x,b=f*p-y*l;if(b===0)return null;const k=(y*(i.y-r.y)-f*(i.x-r.x))/b;return new H(i.x+k*p,i.y+k*l)},S.am=Ug,S.an=Mm,S.ao=Uf,S.ap=function(i){let e=1/0,r=1/0,o=-1/0,l=-1/0;for(const p of i)e=Math.min(e,p.x),r=Math.min(r,p.y),o=Math.max(o,p.x),l=Math.max(l,p.y);return[e,r,o,l]},S.aq=qs,S.as=sm,S.at=function(i,e){var r=e[0],o=e[1],l=e[2],p=e[3],f=e[4],y=e[5],b=e[6],k=e[7],I=e[8],M=e[9],R=e[10],V=e[11],j=e[12],q=e[13],ne=e[14],$e=e[15],ii=r*y-o*f,gt=r*b-l*f,Xt=r*k-p*f,hi=o*b-l*y,vi=o*k-p*y,Di=l*k-p*b,Zi=I*q-M*j,Pi=I*ne-R*j,Ci=I*$e-V*j,Ni=M*ne-R*q,Fi=M*$e-V*q,Ri=R*$e-V*ne,fi=ii*Ri-gt*Fi+Xt*Ni+hi*Ci-vi*Pi+Di*Zi;return fi?(i[0]=(y*Ri-b*Fi+k*Ni)*(fi=1/fi),i[1]=(l*Fi-o*Ri-p*Ni)*fi,i[2]=(q*Di-ne*vi+$e*hi)*fi,i[3]=(R*vi-M*Di-V*hi)*fi,i[4]=(b*Ci-f*Ri-k*Pi)*fi,i[5]=(r*Ri-l*Ci+p*Pi)*fi,i[6]=(ne*Xt-j*Di-$e*gt)*fi,i[7]=(I*Di-R*Xt+V*gt)*fi,i[8]=(f*Fi-y*Ci+k*Zi)*fi,i[9]=(o*Ci-r*Fi-p*Zi)*fi,i[10]=(j*vi-q*Xt+$e*ii)*fi,i[11]=(M*Xt-I*vi-V*ii)*fi,i[12]=(y*Pi-f*Ni-b*Zi)*fi,i[13]=(r*Ni-o*Pi+l*Zi)*fi,i[14]=(q*gt-j*hi-ne*ii)*fi,i[15]=(I*hi-M*gt+R*ii)*fi,i):null},S.au=mm,S.av=om,S.aw=gm,S.ax=function(){const i={},e=ui.$version;for(const r in ui.$root){const o=ui.$root[r];if(o.required){let l=null;l=r==="version"?e:o.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},S.ay=$p,S.az=Oa,S.b=Xa,S.b0=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},S.b1=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},S.b2=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},S.b3=gi,S.b4=Lg,S.b5=Bg,S.b6=function(i,e,r,o,l){var p,f=1/Math.tan(e/2);return i[0]=f/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=f,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+o)*(p=1/(o-l)),i[14]=2*l*o*p):(i[10]=-1,i[14]=-2*o),i},S.b7=function(i,e,r){var o=Math.sin(r),l=Math.cos(r),p=e[4],f=e[5],y=e[6],b=e[7],k=e[8],I=e[9],M=e[10],R=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=p*l+k*o,i[5]=f*l+I*o,i[6]=y*l+M*o,i[7]=b*l+R*o,i[8]=k*l-p*o,i[9]=I*l-f*o,i[10]=M*l-y*o,i[11]=R*l-b*o,i},S.b8=si,S.b9=ci,S.bA=function(i){return i.message===Fa},S.bB=Fc,S.bC=vc,S.ba=function(i){return i*Math.PI/180},S.bb=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},S.bc=class extends ${},S.bd=hm,S.be=Z_,S.bg=ka,S.bh=function(i,e){lc.REGISTERED_PROTOCOLS[i]=e},S.bi=function(i){delete lc.REGISTERED_PROTOCOLS[i]},S.bj=function(i,e){const r={};for(let l=0;l<i.length;l++){const p=e&&e[i[l].id]||kd(i[l]);e&&(e[i[l].id]=p);let f=r[p];f||(f=r[p]=[]),f.push(i[l])}const o=[];for(const l in r)o.push(r[l]);return o},S.bk=Li,S.bl=Og,S.bm=Ng,S.bn=yg,S.bo=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Ns/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,o=e._unevaluatedLayout._values,l={layoutIconSize:o["icon-size"].possiblyEvaluate(new vs(i.bucket.zoom+1),i.canonical),layoutTextSize:o["text-size"].possiblyEvaluate(new vs(i.bucket.zoom+1),i.canonical),textMaxSize:o["text-size"].possiblyEvaluate(new vs(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:k,maxZoom:I}=i.bucket.textSizeData;l.compositeTextSizes=[o["text-size"].possiblyEvaluate(new vs(k),i.canonical),o["text-size"].possiblyEvaluate(new vs(I),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:k,maxZoom:I}=i.bucket.iconSizeData;l.compositeIconSizes=[o["icon-size"].possiblyEvaluate(new vs(k),i.canonical),o["icon-size"].possiblyEvaluate(new vs(I),i.canonical)]}const p=r.get("text-line-height")*qs,f=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",y=r.get("text-keep-upright"),b=r.get("text-size");for(const k of i.bucket.features){const I=r.get("text-font").evaluate(k,{},i.canonical).join(","),M=b.evaluate(k,{},i.canonical),R=l.layoutTextSize.evaluate(k,{},i.canonical),V=l.layoutIconSize.evaluate(k,{},i.canonical),j={horizontal:{},vertical:void 0},q=k.text;let ne,$e=[0,0];if(q){const Xt=q.toString(),hi=r.get("text-letter-spacing").evaluate(k,{},i.canonical)*qs,vi=Lf(Xt)?hi:0,Di=r.get("text-anchor").evaluate(k,{},i.canonical),Zi=Yg(e,k,i.canonical);if(!Zi){const Fi=r.get("text-radial-offset").evaluate(k,{},i.canonical);$e=Fi?Jg(Di,[Fi*qs,fm]):r.get("text-offset").evaluate(k,{},i.canonical).map(Ri=>Ri*qs)}let Pi=f?"center":r.get("text-justify").evaluate(k,{},i.canonical);const Ci=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(k,{},i.canonical)*qs:1/0,Ni=()=>{i.bucket.allowVerticalPlacement&&Vd(Xt)&&(j.vertical=sf(q,i.glyphMap,i.glyphPositions,i.imagePositions,I,Ci,p,Di,"left",vi,$e,S.ai.vertical,!0,R,M))};if(!f&&Zi){const Fi=new Set;if(Pi==="auto")for(let fi=0;fi<Zi.values.length;fi+=2)Fi.add(mm(Zi.values[fi]));else Fi.add(Pi);let Ri=!1;for(const fi of Fi)if(!j.horizontal[fi])if(Ri)j.horizontal[fi]=j.horizontal[0];else{const ji=sf(q,i.glyphMap,i.glyphPositions,i.imagePositions,I,Ci,p,"center",fi,vi,$e,S.ai.horizontal,!1,R,M);ji&&(j.horizontal[fi]=ji,Ri=ji.positionedLines.length===1)}Ni()}else{Pi==="auto"&&(Pi=mm(Di));const Fi=sf(q,i.glyphMap,i.glyphPositions,i.imagePositions,I,Ci,p,Di,Pi,vi,$e,S.ai.horizontal,!1,R,M);Fi&&(j.horizontal[Pi]=Fi),Ni(),Vd(Xt)&&f&&y&&(j.vertical=sf(q,i.glyphMap,i.glyphPositions,i.imagePositions,I,Ci,p,Di,Pi,vi,$e,S.ai.vertical,!1,R,M))}}let ii=!1;if(k.icon&&k.icon.name){const Xt=i.imageMap[k.icon.name];Xt&&(ne=C_(i.imagePositions[k.icon.name],r.get("icon-offset").evaluate(k,{},i.canonical),r.get("icon-anchor").evaluate(k,{},i.canonical)),ii=!!Xt.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ii:i.bucket.sdfIcons!==ii&&Fs("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Xt.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const gt=ey(j.horizontal)||j.vertical;i.bucket.iconsInText=!!gt&>.iconsInText,(gt||ne)&&U_(i.bucket,k,j,ne,i.imageMap,l,R,V,$e,ii,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},S.bp=Qf,S.bq=Xf,S.br=Yf,S.bs=fu,S.bt=tm,S.bu=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}},S.bv=function(i,e,r,o,l){return u(this,void 0,void 0,function*(){if(pi())try{return yield Tc(i,e,r,o,l)}catch{}return function(p,f,y,b,k){const I=p.width,M=p.height;Jl&&ma||(Jl=new OffscreenCanvas(I,M),ma=Jl.getContext("2d",{willReadFrequently:!0})),Jl.width=I,Jl.height=M,ma.drawImage(p,0,0,I,M);const R=ma.getImageData(f,y,b,k);return ma.clearRect(0,0,I,M),R.data}(i,e,r,o,l)})},S.bw=Fg,S.bx=J,S.by=te,S.bz=lg,S.c=Wc,S.d=i=>u(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),S.e=tn,S.f=i=>new Promise((e,r)=>{const o=new Image;o.onload=()=>{e(o),URL.revokeObjectURL(o.src),o.onload=null,window.requestAnimationFrame(()=>{o.src=th})},o.onerror=()=>r(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 l=new Blob([new Uint8Array(i)],{type:"image/png"});o.src=i.byteLength?URL.createObjectURL(l):th}),S.g=Ja,S.h=(i,e)=>Cc(tn(i,{type:"json"}),e),S.i=Xl,S.j=uc,S.k=cc,S.l=(i,e)=>Cc(tn(i,{type:"arrayBuffer"}),e),S.m=Cc,S.n=function(i){return new tm(i).readFields(x_,[])},S.o=Jd,S.p=gg,S.q=s,S.r=Df,S.s=Ac,S.t=Fd,S.u=Mi,S.v=ui,S.w=Fs,S.x=nc,S.y=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},S.z=Aa}),T("worker",["./shared"],function(S){class u{constructor(O){this.keyCache={},O&&this.replace(O)}replace(O){this._layerConfigs={},this._layers={},this.update(O,[])}update(O,F){for(const he of O){this._layerConfigs[he.id]=he;const vt=this._layers[he.id]=S.aB(he);vt._featureFilter=S.a7(vt.filter),this.keyCache[he.id]&&delete this.keyCache[he.id]}for(const he of F)delete this.keyCache[he],delete this._layerConfigs[he],delete this._layers[he];this.familiesBySource={};const G=S.bj(Object.values(this._layerConfigs),this.keyCache);for(const he of G){const vt=he.map(ai=>this._layers[ai.id]),Ht=vt[0];if(Ht.visibility==="none")continue;const ei=Ht.source||"";let We=this.familiesBySource[ei];We||(We=this.familiesBySource[ei]={});const di=Ht.sourceLayer||"_geojsonTileLayer";let _i=We[di];_i||(_i=We[di]=[]),_i.push(vt)}}}class J{constructor(O){const F={},G=[];for(const ei in O){const We=O[ei],di=F[ei]={};for(const _i in We){const ai=We[+_i];if(!ai||ai.bitmap.width===0||ai.bitmap.height===0)continue;const ki={x:0,y:0,w:ai.bitmap.width+2,h:ai.bitmap.height+2};G.push(ki),di[_i]={rect:ki,metrics:ai.metrics}}}const{w:he,h:vt}=S.p(G),Ht=new S.o({width:he||1,height:vt||1});for(const ei in O){const We=O[ei];for(const di in We){const _i=We[+di];if(!_i||_i.bitmap.width===0||_i.bitmap.height===0)continue;const ai=F[ei][di].rect;S.o.copy(_i.bitmap,Ht,{x:0,y:0},{x:ai.x+1,y:ai.y+1},_i.bitmap)}}this.image=Ht,this.positions=F}}S.bk("GlyphAtlas",J);class te{constructor(O){this.tileID=new S.S(O.tileID.overscaledZ,O.tileID.wrap,O.tileID.canonical.z,O.tileID.canonical.x,O.tileID.canonical.y),this.uid=O.uid,this.zoom=O.zoom,this.pixelRatio=O.pixelRatio,this.tileSize=O.tileSize,this.source=O.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=O.showCollisionBoxes,this.collectResourceTiming=!!O.collectResourceTiming,this.returnDependencies=!!O.returnDependencies,this.promoteId=O.promoteId,this.inFlightDependencies=[]}parse(O,F,G,he){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=O,this.collisionBoxArray=new S.a5;const vt=new S.bl(Object.keys(O.layers).sort()),Ht=new S.bm(this.tileID,this.promoteId);Ht.bucketLayerIDs=[];const ei={},We={featureIndex:Ht,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G},di=F.familiesBySource[this.source];for(const is in di){const ds=O.layers[is];if(!ds)continue;ds.version===1&&S.w(`Vector tile source "${this.source}" layer "${is}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Cs=vt.encode(is),js=[];for(let Js=0;Js<ds.length;Js++){const Ys=ds.feature(Js),Eu=Ht.getId(Ys,is);js.push({feature:Ys,id:Eu,index:Js,sourceLayerIndex:Cs})}for(const Js of di[is]){const Ys=Js[0];Ys.source!==this.source&&S.w(`layer.source = ${Ys.source} does not equal this.source = ${this.source}`),Ys.minzoom&&this.zoom<Math.floor(Ys.minzoom)||Ys.maxzoom&&this.zoom>=Ys.maxzoom||Ys.visibility!=="none"&&(ae(Js,this.zoom,G),(ei[Ys.id]=Ys.createBucket({index:Ht.bucketLayerIDs.length,layers:Js,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Cs,sourceID:this.source})).populate(js,We,this.tileID.canonical),Ht.bucketLayerIDs.push(Js.map(Eu=>Eu.id)))}}const _i=S.aG(We.glyphDependencies,is=>Object.keys(is).map(Number));this.inFlightDependencies.forEach(is=>is==null?void 0:is.abort()),this.inFlightDependencies=[];let ai=Promise.resolve({});if(Object.keys(_i).length){const is=new AbortController;this.inFlightDependencies.push(is),ai=he.sendAsync({type:"GG",data:{stacks:_i,source:this.source,tileID:this.tileID,type:"glyphs"}},is)}const ki=Object.keys(We.iconDependencies);let Ui=Promise.resolve({});if(ki.length){const is=new AbortController;this.inFlightDependencies.push(is),Ui=he.sendAsync({type:"GI",data:{icons:ki,source:this.source,tileID:this.tileID,type:"icons"}},is)}const qi=Object.keys(We.patternDependencies);let en=Promise.resolve({});if(qi.length){const is=new AbortController;this.inFlightDependencies.push(is),en=he.sendAsync({type:"GI",data:{icons:qi,source:this.source,tileID:this.tileID,type:"patterns"}},is)}const[as,Qi,ys]=yield Promise.all([ai,Ui,en]),Ms=new J(as),Os=new S.bn(Qi,ys);for(const is in ei){const ds=ei[is];ds instanceof S.a6?(ae(ds.layers,this.zoom,G),S.bo({bucket:ds,glyphMap:as,glyphPositions:Ms.positions,imageMap:Qi,imagePositions:Os.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ds.hasPattern&&(ds instanceof S.bp||ds instanceof S.bq||ds instanceof S.br)&&(ae(ds.layers,this.zoom,G),ds.addFeatures(We,this.tileID.canonical,Os.patternPositions))}return this.status="done",{buckets:Object.values(ei).filter(is=>!is.isEmpty()),featureIndex:Ht,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ms.image,imageAtlas:Os,glyphMap:this.returnDependencies?as:null,iconMap:this.returnDependencies?Qi:null,glyphPositions:this.returnDependencies?Ms.positions:null}})}}function ae(ze,O,F){const G=new S.a9(O);for(const he of ze)he.recalculate(G,F)}class H{constructor(O,F,G){this.actor=O,this.layerIndex=F,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(O,F){return S._(this,void 0,void 0,function*(){const G=yield S.l(O.request,F);try{return{vectorTile:new S.bs.VectorTile(new S.bt(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(he){const vt=new Uint8Array(G.data);let Ht=`Unable to parse the tile at ${O.request.url}, `;throw Ht+=vt[0]===31&&vt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${he.message}`,new Error(Ht)}})}loadTile(O){return S._(this,void 0,void 0,function*(){const F=O.uid,G=!!(O&&O.request&&O.request.collectResourceTiming)&&new S.bu(O.request),he=new te(O);this.loading[F]=he;const vt=new AbortController;he.abort=vt;try{const Ht=yield this.loadVectorTile(O,vt);if(delete this.loading[F],!Ht)return null;const ei=Ht.rawData,We={};Ht.expires&&(We.expires=Ht.expires),Ht.cacheControl&&(We.cacheControl=Ht.cacheControl);const di={};if(G){const ai=G.finish();ai&&(di.resourceTiming=JSON.parse(JSON.stringify(ai)))}he.vectorTile=Ht.vectorTile;const _i=he.parse(Ht.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[F]=he,this.fetching[F]={rawTileData:ei,cacheControl:We,resourceTiming:di};try{const ai=yield _i;return S.e({rawTileData:ei.slice(0)},ai,We,di)}finally{delete this.fetching[F]}}catch(Ht){throw delete this.loading[F],he.status="done",this.loaded[F]=he,Ht}})}reloadTile(O){return S._(this,void 0,void 0,function*(){const F=O.uid;if(!this.loaded||!this.loaded[F])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[F];if(G.showCollisionBoxes=O.showCollisionBoxes,G.status==="parsing"){const he=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor);let vt;if(this.fetching[F]){const{rawTileData:Ht,cacheControl:ei,resourceTiming:We}=this.fetching[F];delete this.fetching[F],vt=S.e({rawTileData:Ht.slice(0)},he,ei,We)}else vt=he;return vt}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(O){return S._(this,void 0,void 0,function*(){const F=this.loading,G=O.uid;F&&F[G]&&F[G].abort&&(F[G].abort.abort(),delete F[G])})}removeTile(O){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[O.uid]&&delete this.loaded[O.uid]})}}class Y{constructor(){this.loaded={}}loadTile(O){return S._(this,void 0,void 0,function*(){const{uid:F,encoding:G,rawImageData:he,redFactor:vt,greenFactor:Ht,blueFactor:ei,baseShift:We}=O,di=he.width+2,_i=he.height+2,ai=S.b(he)?new S.R({width:di,height:_i},yield S.bv(he,-1,-1,di,_i)):he,ki=new S.bw(F,ai,G,vt,Ht,ei,We);return this.loaded=this.loaded||{},this.loaded[F]=ki,ki})}removeTile(O){const F=this.loaded,G=O.uid;F&&F[G]&&delete F[G]}}function oi(ze,O){if(ze.length!==0){li(ze[0],O);for(var F=1;F<ze.length;F++)li(ze[F],!O)}}function li(ze,O){for(var F=0,G=0,he=0,vt=ze.length,Ht=vt-1;he<vt;Ht=he++){var ei=(ze[he][0]-ze[Ht][0])*(ze[Ht][1]+ze[he][1]),We=F+ei;G+=Math.abs(F)>=Math.abs(ei)?F-We+ei:ei-We+F,F=We}F+G>=0!=!!O&&ze.reverse()}var bt=S.bx(function ze(O,F){var G,he=O&&O.type;if(he==="FeatureCollection")for(G=0;G<O.features.length;G++)ze(O.features[G],F);else if(he==="GeometryCollection")for(G=0;G<O.geometries.length;G++)ze(O.geometries[G],F);else if(he==="Feature")ze(O.geometry,F);else if(he==="Polygon")oi(O.coordinates,F);else if(he==="MultiPolygon")for(G=0;G<O.coordinates.length;G++)oi(O.coordinates[G],F);return O});const mi=S.bs.VectorTileFeature.prototype.toGeoJSON;var Ii={exports:{}},pi=S.by,si=S.bs.VectorTileFeature,ci=ri;function ri(ze,O){this.options=O||{},this.features=ze,this.length=ze.length}function gi(ze,O){this.id=typeof ze.id=="number"?ze.id:void 0,this.type=ze.type,this.rawGeometry=ze.type===1?[ze.geometry]:ze.geometry,this.properties=ze.tags,this.extent=O||4096}ri.prototype.feature=function(ze){return new gi(this.features[ze],this.options.extent)},gi.prototype.loadGeometry=function(){var ze=this.rawGeometry;this.geometry=[];for(var O=0;O<ze.length;O++){for(var F=ze[O],G=[],he=0;he<F.length;he++)G.push(new pi(F[he][0],F[he][1]));this.geometry.push(G)}return this.geometry},gi.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var ze=this.geometry,O=1/0,F=-1/0,G=1/0,he=-1/0,vt=0;vt<ze.length;vt++)for(var Ht=ze[vt],ei=0;ei<Ht.length;ei++){var We=Ht[ei];O=Math.min(O,We.x),F=Math.max(F,We.x),G=Math.min(G,We.y),he=Math.max(he,We.y)}return[O,G,F,he]},gi.prototype.toGeoJSON=si.prototype.toGeoJSON;var tn=S.bz,Ws=ci;function Ji(ze){var O=new tn;return function(F,G){for(var he in F.layers)G.writeMessage(3,$s,F.layers[he])}(ze,O),O.finish()}function $s(ze,O){var F;O.writeVarintField(15,ze.version||1),O.writeStringField(1,ze.name||""),O.writeVarintField(5,ze.extent||4096);var G={keys:[],values:[],keycache:{},valuecache:{}};for(F=0;F<ze.length;F++)G.feature=ze.feature(F),O.writeMessage(2,os,G);var he=G.keys;for(F=0;F<he.length;F++)O.writeStringField(3,he[F]);var vt=G.values;for(F=0;F<vt.length;F++)O.writeMessage(4,Hc,vt[F])}function os(ze,O){var F=ze.feature;F.id!==void 0&&O.writeVarintField(1,F.id),O.writeMessage(2,Gc,ze),O.writeVarintField(3,F.type),O.writeMessage(4,Xl,F)}function Gc(ze,O){var F=ze.feature,G=ze.keys,he=ze.values,vt=ze.keycache,Ht=ze.valuecache;for(var ei in F.properties){var We=F.properties[ei],di=vt[ei];if(We!==null){di===void 0&&(G.push(ei),vt[ei]=di=G.length-1),O.writeVarint(di);var _i=typeof We;_i!=="string"&&_i!=="boolean"&&_i!=="number"&&(We=JSON.stringify(We));var ai=_i+":"+We,ki=Ht[ai];ki===void 0&&(he.push(We),Ht[ai]=ki=he.length-1),O.writeVarint(ki)}}}function Fs(ze,O){return(O<<3)+(7&ze)}function ca(ze){return ze<<1^ze>>31}function Xl(ze,O){for(var F=ze.loadGeometry(),G=ze.type,he=0,vt=0,Ht=F.length,ei=0;ei<Ht;ei++){var We=F[ei],di=1;G===1&&(di=We.length),O.writeVarint(Fs(1,di));for(var _i=G===3?We.length-1:We.length,ai=0;ai<_i;ai++){ai===1&&G!==1&&O.writeVarint(Fs(2,_i-1));var ki=We[ai].x-he,Ui=We[ai].y-vt;O.writeVarint(ca(ki)),O.writeVarint(ca(Ui)),he+=ki,vt+=Ui}G===3&&O.writeVarint(Fs(7,1))}}function Hc(ze,O){var F=typeof ze;F==="string"?O.writeStringField(1,ze):F==="boolean"?O.writeBooleanField(7,ze):F==="number"&&(ze%1!=0?O.writeDoubleField(3,ze):ze<0?O.writeSVarintField(6,ze):O.writeVarintField(5,ze))}Ii.exports=Ji,Ii.exports.fromVectorTileJs=Ji,Ii.exports.fromGeojsonVt=function(ze,O){O=O||{};var F={};for(var G in ze)F[G]=new Ws(ze[G].features,O),F[G].name=G,F[G].version=O.version,F[G].extent=O.extent;return Ji({layers:F})},Ii.exports.GeoJSONWrapper=Ws;var Xa=S.bx(Ii.exports);const th={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ze=>ze},Tc=Math.fround||(Jl=new Float32Array(1),ze=>(Jl[0]=+ze,Jl[0]));var Jl;const ma=3,Fa=5,Wc=6;class lc{constructor(O){this.options=Object.assign(Object.create(th),O),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(O){const{log:F,minZoom:G,maxZoom:he}=this.options;F&&console.time("total time");const vt=`prepare ${O.length} points`;F&&console.time(vt),this.points=O;const Ht=[];for(let We=0;We<O.length;We++){const di=O[We];if(!di.geometry)continue;const[_i,ai]=di.geometry.coordinates,ki=Tc(ka(_i)),Ui=Tc(Oa(ai));Ht.push(ki,Ui,1/0,We,-1,1),this.options.reduce&&Ht.push(0)}let ei=this.trees[he+1]=this._createTree(Ht);F&&console.timeEnd(vt);for(let We=he;We>=G;We--){const di=+Date.now();ei=this.trees[We]=this._createTree(this._cluster(ei,We)),F&&console.log("z%d: %d clusters in %dms",We,ei.numItems,+Date.now()-di)}return F&&console.timeEnd("total time"),this}getClusters(O,F){let G=((O[0]+180)%360+360)%360-180;const he=Math.max(-90,Math.min(90,O[1]));let vt=O[2]===180?180:((O[2]+180)%360+360)%360-180;const Ht=Math.max(-90,Math.min(90,O[3]));if(O[2]-O[0]>=360)G=-180,vt=180;else if(G>vt){const ai=this.getClusters([G,he,180,Ht],F),ki=this.getClusters([-180,he,vt,Ht],F);return ai.concat(ki)}const ei=this.trees[this._limitZoom(F)],We=ei.range(ka(G),Oa(Ht),ka(vt),Oa(he)),di=ei.data,_i=[];for(const ai of We){const ki=this.stride*ai;_i.push(di[ki+Fa]>1?Ja(di,ki,this.clusterProps):this.points[di[ki+ma]])}return _i}getChildren(O){const F=this._getOriginId(O),G=this._getOriginZoom(O),he="No cluster with the specified id.",vt=this.trees[G];if(!vt)throw new Error(he);const Ht=vt.data;if(F*this.stride>=Ht.length)throw new Error(he);const ei=this.options.radius/(this.options.extent*Math.pow(2,G-1)),We=vt.within(Ht[F*this.stride],Ht[F*this.stride+1],ei),di=[];for(const _i of We){const ai=_i*this.stride;Ht[ai+4]===O&&di.push(Ht[ai+Fa]>1?Ja(Ht,ai,this.clusterProps):this.points[Ht[ai+ma]])}if(di.length===0)throw new Error(he);return di}getLeaves(O,F,G){const he=[];return this._appendLeaves(he,O,F=F||10,G=G||0,0),he}getTile(O,F,G){const he=this.trees[this._limitZoom(O)],vt=Math.pow(2,O),{extent:Ht,radius:ei}=this.options,We=ei/Ht,di=(G-We)/vt,_i=(G+1+We)/vt,ai={features:[]};return this._addTileFeatures(he.range((F-We)/vt,di,(F+1+We)/vt,_i),he.data,F,G,vt,ai),F===0&&this._addTileFeatures(he.range(1-We/vt,di,1,_i),he.data,vt,G,vt,ai),F===vt-1&&this._addTileFeatures(he.range(0,di,We/vt,_i),he.data,-1,G,vt,ai),ai.features.length?ai:null}getClusterExpansionZoom(O){let F=this._getOriginZoom(O)-1;for(;F<=this.options.maxZoom;){const G=this.getChildren(O);if(F++,G.length!==1)break;O=G[0].properties.cluster_id}return F}_appendLeaves(O,F,G,he,vt){const Ht=this.getChildren(F);for(const ei of Ht){const We=ei.properties;if(We&&We.cluster?vt+We.point_count<=he?vt+=We.point_count:vt=this._appendLeaves(O,We.cluster_id,G,he,vt):vt<he?vt++:O.push(ei),O.length===G)break}return vt}_createTree(O){const F=new S.aw(O.length/this.stride|0,this.options.nodeSize,Float32Array);for(let G=0;G<O.length;G+=this.stride)F.add(O[G],O[G+1]);return F.finish(),F.data=O,F}_addTileFeatures(O,F,G,he,vt,Ht){for(const ei of O){const We=ei*this.stride,di=F[We+Fa]>1;let _i,ai,ki;if(di)_i=Kc(F,We,this.clusterProps),ai=F[We],ki=F[We+1];else{const en=this.points[F[We+ma]];_i=en.properties;const[as,Qi]=en.geometry.coordinates;ai=ka(as),ki=Oa(Qi)}const Ui={type:1,geometry:[[Math.round(this.options.extent*(ai*vt-G)),Math.round(this.options.extent*(ki*vt-he))]],tags:_i};let qi;qi=di||this.options.generateId?F[We+ma]:this.points[F[We+ma]].id,qi!==void 0&&(Ui.id=qi),Ht.features.push(Ui)}}_limitZoom(O){return Math.max(this.options.minZoom,Math.min(Math.floor(+O),this.options.maxZoom+1))}_cluster(O,F){const{radius:G,extent:he,reduce:vt,minPoints:Ht}=this.options,ei=G/(he*Math.pow(2,F)),We=O.data,di=[],_i=this.stride;for(let ai=0;ai<We.length;ai+=_i){if(We[ai+2]<=F)continue;We[ai+2]=F;const ki=We[ai],Ui=We[ai+1],qi=O.within(We[ai],We[ai+1],ei),en=We[ai+Fa];let as=en;for(const Qi of qi){const ys=Qi*_i;We[ys+2]>F&&(as+=We[ys+Fa])}if(as>en&&as>=Ht){let Qi,ys=ki*en,Ms=Ui*en,Os=-1;const is=((ai/_i|0)<<5)+(F+1)+this.points.length;for(const ds of qi){const Cs=ds*_i;if(We[Cs+2]<=F)continue;We[Cs+2]=F;const js=We[Cs+Fa];ys+=We[Cs]*js,Ms+=We[Cs+1]*js,We[Cs+4]=is,vt&&(Qi||(Qi=this._map(We,ai,!0),Os=this.clusterProps.length,this.clusterProps.push(Qi)),vt(Qi,this._map(We,Cs)))}We[ai+4]=is,di.push(ys/as,Ms/as,1/0,is,-1,as),vt&&di.push(Os)}else{for(let Qi=0;Qi<_i;Qi++)di.push(We[ai+Qi]);if(as>1)for(const Qi of qi){const ys=Qi*_i;if(!(We[ys+2]<=F)){We[ys+2]=F;for(let Ms=0;Ms<_i;Ms++)di.push(We[ys+Ms])}}}}return di}_getOriginId(O){return O-this.points.length>>5}_getOriginZoom(O){return(O-this.points.length)%32}_map(O,F,G){if(O[F+Fa]>1){const Ht=this.clusterProps[O[F+Wc]];return G?Object.assign({},Ht):Ht}const he=this.points[O[F+ma]].properties,vt=this.options.map(he);return G&&vt===he?Object.assign({},vt):vt}}function Ja(ze,O,F){return{type:"Feature",id:ze[O+ma],properties:Kc(ze,O,F),geometry:{type:"Point",coordinates:[(G=ze[O],360*(G-.5)),Cc(ze[O+1])]}};var G}function Kc(ze,O,F){const G=ze[O+Fa],he=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,vt=ze[O+Wc],Ht=vt===-1?{}:Object.assign({},F[vt]);return Object.assign(Ht,{cluster:!0,cluster_id:ze[O+ma],point_count:G,point_count_abbreviated:he})}function ka(ze){return ze/360+.5}function Oa(ze){const O=Math.sin(ze*Math.PI/180),F=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return F<0?0:F>1?1:F}function Cc(ze){const O=(180-360*ze)*Math.PI/180;return 360*Math.atan(Math.exp(O))/Math.PI-90}function Ac(ze,O,F,G){let he=G;const vt=O+(F-O>>1);let Ht,ei=F-O;const We=ze[O],di=ze[O+1],_i=ze[F],ai=ze[F+1];for(let ki=O+3;ki<F;ki+=3){const Ui=xu(ze[ki],ze[ki+1],We,di,_i,ai);if(Ui>he)Ht=ki,he=Ui;else if(Ui===he){const qi=Math.abs(ki-vt);qi<ei&&(Ht=ki,ei=qi)}}he>G&&(Ht-O>3&&Ac(ze,O,Ht,G),ze[Ht+2]=he,F-Ht>3&&Ac(ze,Ht,F,G))}function xu(ze,O,F,G,he,vt){let Ht=he-F,ei=vt-G;if(Ht!==0||ei!==0){const We=((ze-F)*Ht+(O-G)*ei)/(Ht*Ht+ei*ei);We>1?(F=he,G=vt):We>0&&(F+=Ht*We,G+=ei*We)}return Ht=ze-F,ei=O-G,Ht*Ht+ei*ei}function Yl(ze,O,F,G){const he={id:ze??null,type:O,geometry:F,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(O==="Point"||O==="MultiPoint"||O==="LineString")cc(he,F);else if(O==="Polygon")cc(he,F[0]);else if(O==="MultiLineString")for(const vt of F)cc(he,vt);else if(O==="MultiPolygon")for(const vt of F)cc(he,vt[0]);return he}function cc(ze,O){for(let F=0;F<O.length;F+=3)ze.minX=Math.min(ze.minX,O[F]),ze.minY=Math.min(ze.minY,O[F+1]),ze.maxX=Math.max(ze.maxX,O[F]),ze.maxY=Math.max(ze.maxY,O[F+1])}function uc(ze,O,F,G){if(!O.geometry)return;const he=O.geometry.coordinates;if(he&&he.length===0)return;const vt=O.geometry.type,Ht=Math.pow(F.tolerance/((1<<F.maxZoom)*F.extent),2);let ei=[],We=O.id;if(F.promoteId?We=O.properties[F.promoteId]:F.generateId&&(We=G||0),vt==="Point")Xc(he,ei);else if(vt==="MultiPoint")for(const di of he)Xc(di,ei);else if(vt==="LineString")ui(he,ei,Ht,!1);else if(vt==="MultiLineString"){if(F.lineMetrics){for(const di of he)ei=[],ui(di,ei,Ht,!1),ze.push(Yl(We,"LineString",ei,O.properties));return}Pc(he,ei,Ht,!1)}else if(vt==="Polygon")Pc(he,ei,Ht,!0);else{if(vt!=="MultiPolygon"){if(vt==="GeometryCollection"){for(const di of O.geometry.geometries)uc(ze,{id:We,geometry:di,properties:O.properties},F,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const di of he){const _i=[];Pc(di,_i,Ht,!0),ei.push(_i)}}ze.push(Yl(We,vt,ei,O.properties))}function Xc(ze,O){O.push(bu(ze[0]),us(ze[1]),0)}function ui(ze,O,F,G){let he,vt,Ht=0;for(let We=0;We<ze.length;We++){const di=bu(ze[We][0]),_i=us(ze[We][1]);O.push(di,_i,0),We>0&&(Ht+=G?(he*_i-di*vt)/2:Math.sqrt(Math.pow(di-he,2)+Math.pow(_i-vt,2))),he=di,vt=_i}const ei=O.length-3;O[2]=1,Ac(O,0,ei,F),O[ei+2]=1,O.size=Math.abs(Ht),O.start=0,O.end=O.size}function Pc(ze,O,F,G){for(let he=0;he<ze.length;he++){const vt=[];ui(ze[he],vt,F,G),O.push(vt)}}function bu(ze){return ze/360+.5}function us(ze){const O=Math.sin(ze*Math.PI/180),F=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return F<0?0:F>1?1:F}function Is(ze,O,F,G,he,vt,Ht,ei){if(G/=O,vt>=(F/=O)&&Ht<G)return ze;if(Ht<F||vt>=G)return null;const We=[];for(const di of ze){const _i=di.geometry;let ai=di.type;const ki=he===0?di.minX:di.minY,Ui=he===0?di.maxX:di.maxY;if(ki>=F&&Ui<G){We.push(di);continue}if(Ui<F||ki>=G)continue;let qi=[];if(ai==="Point"||ai==="MultiPoint")wu(_i,qi,F,G,he);else if(ai==="LineString")hc(_i,qi,F,G,he,!1,ei.lineMetrics);else if(ai==="MultiLineString")Jc(_i,qi,F,G,he,!1);else if(ai==="Polygon")Jc(_i,qi,F,G,he,!0);else if(ai==="MultiPolygon")for(const en of _i){const as=[];Jc(en,as,F,G,he,!0),as.length&&qi.push(as)}if(qi.length){if(ei.lineMetrics&&ai==="LineString"){for(const en of qi)We.push(Yl(di.id,ai,en,di.tags));continue}ai!=="LineString"&&ai!=="MultiLineString"||(qi.length===1?(ai="LineString",qi=qi[0]):ai="MultiLineString"),ai!=="Point"&&ai!=="MultiPoint"||(ai=qi.length===3?"Point":"MultiPoint"),We.push(Yl(di.id,ai,qi,di.tags))}}return We.length?We:null}function wu(ze,O,F,G,he){for(let vt=0;vt<ze.length;vt+=3){const Ht=ze[vt+he];Ht>=F&&Ht<=G&&Da(O,ze[vt],ze[vt+1],ze[vt+2])}}function hc(ze,O,F,G,he,vt,Ht){let ei=Ql(ze);const We=he===0?Su:ku;let di,_i,ai=ze.start;for(let as=0;as<ze.length-3;as+=3){const Qi=ze[as],ys=ze[as+1],Ms=ze[as+2],Os=ze[as+3],is=ze[as+4],ds=he===0?Qi:ys,Cs=he===0?Os:is;let js=!1;Ht&&(di=Math.sqrt(Math.pow(Qi-Os,2)+Math.pow(ys-is,2))),ds<F?Cs>F&&(_i=We(ei,Qi,ys,Os,is,F),Ht&&(ei.start=ai+di*_i)):ds>G?Cs<G&&(_i=We(ei,Qi,ys,Os,is,G),Ht&&(ei.start=ai+di*_i)):Da(ei,Qi,ys,Ms),Cs<F&&ds>=F&&(_i=We(ei,Qi,ys,Os,is,F),js=!0),Cs>G&&ds<=G&&(_i=We(ei,Qi,ys,Os,is,G),js=!0),!vt&&js&&(Ht&&(ei.end=ai+di*_i),O.push(ei),ei=Ql(ze)),Ht&&(ai+=di)}let ki=ze.length-3;const Ui=ze[ki],qi=ze[ki+1],en=he===0?Ui:qi;en>=F&&en<=G&&Da(ei,Ui,qi,ze[ki+2]),ki=ei.length-3,vt&&ki>=3&&(ei[ki]!==ei[0]||ei[ki+1]!==ei[1])&&Da(ei,ei[0],ei[1],ei[2]),ei.length&&O.push(ei)}function Ql(ze){const O=[];return O.size=ze.size,O.start=ze.start,O.end=ze.end,O}function Jc(ze,O,F,G,he,vt){for(const Ht of ze)hc(Ht,O,F,G,he,vt,!1)}function Da(ze,O,F,G){ze.push(O,F,G)}function Su(ze,O,F,G,he,vt){const Ht=(vt-O)/(G-O);return Da(ze,vt,F+(he-F)*Ht,1),Ht}function ku(ze,O,F,G,he,vt){const Ht=(vt-F)/(he-F);return Da(ze,O+(G-O)*Ht,vt,1),Ht}function Si(ze,O){const F=[];for(let G=0;G<ze.length;G++){const he=ze[G],vt=he.type;let Ht;if(vt==="Point"||vt==="MultiPoint"||vt==="LineString")Ht=Ya(he.geometry,O);else if(vt==="MultiLineString"||vt==="Polygon"){Ht=[];for(const ei of he.geometry)Ht.push(Ya(ei,O))}else if(vt==="MultiPolygon"){Ht=[];for(const ei of he.geometry){const We=[];for(const di of ei)We.push(Ya(di,O));Ht.push(We)}}F.push(Yl(he.id,vt,Ht,he.tags))}return F}function Ya(ze,O){const F=[];F.size=ze.size,ze.start!==void 0&&(F.start=ze.start,F.end=ze.end);for(let G=0;G<ze.length;G+=3)F.push(ze[G]+O,ze[G+1],ze[G+2]);return F}function ua(ze,O){if(ze.transformed)return ze;const F=1<<ze.z,G=ze.x,he=ze.y;for(const vt of ze.features){const Ht=vt.geometry,ei=vt.type;if(vt.geometry=[],ei===1)for(let We=0;We<Ht.length;We+=2)vt.geometry.push(Qa(Ht[We],Ht[We+1],O,F,G,he));else for(let We=0;We<Ht.length;We++){const di=[];for(let _i=0;_i<Ht[We].length;_i+=2)di.push(Qa(Ht[We][_i],Ht[We][_i+1],O,F,G,he));vt.geometry.push(di)}}return ze.transformed=!0,ze}function Qa(ze,O,F,G,he,vt){return[Math.round(F*(ze*G-he)),Math.round(F*(O*G-vt))]}function dc(ze,O,F,G,he){const vt=O===he.maxZoom?0:he.tolerance/((1<<O)*he.extent),Ht={features:[],numPoints:0,numSimplified:0,numFeatures:ze.length,source:null,x:F,y:G,z:O,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ei of ze)Ti(Ht,ei,vt,he);return Ht}function Ti(ze,O,F,G){const he=O.geometry,vt=O.type,Ht=[];if(ze.minX=Math.min(ze.minX,O.minX),ze.minY=Math.min(ze.minY,O.minY),ze.maxX=Math.max(ze.maxX,O.maxX),ze.maxY=Math.max(ze.maxY,O.maxY),vt==="Point"||vt==="MultiPoint")for(let ei=0;ei<he.length;ei+=3)Ht.push(he[ei],he[ei+1]),ze.numPoints++,ze.numSimplified++;else if(vt==="LineString")ts(Ht,he,ze,F,!1,!1);else if(vt==="MultiLineString"||vt==="Polygon")for(let ei=0;ei<he.length;ei++)ts(Ht,he[ei],ze,F,vt==="Polygon",ei===0);else if(vt==="MultiPolygon")for(let ei=0;ei<he.length;ei++){const We=he[ei];for(let di=0;di<We.length;di++)ts(Ht,We[di],ze,F,!0,di===0)}if(Ht.length){let ei=O.tags||null;if(vt==="LineString"&&G.lineMetrics){ei={};for(const di in O.tags)ei[di]=O.tags[di];ei.mapbox_clip_start=he.start/he.size,ei.mapbox_clip_end=he.end/he.size}const We={geometry:Ht,type:vt==="Polygon"||vt==="MultiPolygon"?3:vt==="LineString"||vt==="MultiLineString"?2:1,tags:ei};O.id!==null&&(We.id=O.id),ze.features.push(We)}}function ts(ze,O,F,G,he,vt){const Ht=G*G;if(G>0&&O.size<(he?Ht:G))return void(F.numPoints+=O.length/3);const ei=[];for(let We=0;We<O.length;We+=3)(G===0||O[We+2]>Ht)&&(F.numSimplified++,ei.push(O[We],O[We+1])),F.numPoints++;he&&function(We,di){let _i=0;for(let ai=0,ki=We.length,Ui=ki-2;ai<ki;Ui=ai,ai+=2)_i+=(We[ai]-We[Ui])*(We[ai+1]+We[Ui+1]);if(_i>0===di)for(let ai=0,ki=We.length;ai<ki/2;ai+=2){const Ui=We[ai],qi=We[ai+1];We[ai]=We[ki-2-ai],We[ai+1]=We[ki-1-ai],We[ki-2-ai]=Ui,We[ki-1-ai]=qi}}(ei,vt),ze.push(ei)}const Hi={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ga{constructor(O,F){const G=(F=this.options=function(vt,Ht){for(const ei in Ht)vt[ei]=Ht[ei];return vt}(Object.create(Hi),F)).debug;if(G&&console.time("preprocess data"),F.maxZoom<0||F.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(F.promoteId&&F.generateId)throw new Error("promoteId and generateId cannot be used together.");let he=function(vt,Ht){const ei=[];if(vt.type==="FeatureCollection")for(let We=0;We<vt.features.length;We++)uc(ei,vt.features[We],Ht,We);else uc(ei,vt.type==="Feature"?vt:{geometry:vt},Ht);return ei}(O,F);this.tiles={},this.tileCoords=[],G&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",F.indexMaxZoom,F.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),he=function(vt,Ht){const ei=Ht.buffer/Ht.extent;let We=vt;const di=Is(vt,1,-1-ei,ei,0,-1,2,Ht),_i=Is(vt,1,1-ei,2+ei,0,-1,2,Ht);return(di||_i)&&(We=Is(vt,1,-ei,1+ei,0,-1,2,Ht)||[],di&&(We=Si(di,1).concat(We)),_i&&(We=We.concat(Si(_i,-1)))),We}(he,F),he.length&&this.splitTile(he,0,0,0),G&&(he.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(O,F,G,he,vt,Ht,ei){const We=[O,F,G,he],di=this.options,_i=di.debug;for(;We.length;){he=We.pop(),G=We.pop(),F=We.pop(),O=We.pop();const ai=1<<F,ki=Va(F,G,he);let Ui=this.tiles[ki];if(!Ui&&(_i>1&&console.time("creation"),Ui=this.tiles[ki]=dc(O,F,G,he,di),this.tileCoords.push({z:F,x:G,y:he}),_i)){_i>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",F,G,he,Ui.numFeatures,Ui.numPoints,Ui.numSimplified),console.timeEnd("creation"));const js=`z${F}`;this.stats[js]=(this.stats[js]||0)+1,this.total++}if(Ui.source=O,vt==null){if(F===di.indexMaxZoom||Ui.numPoints<=di.indexMaxPoints)continue}else{if(F===di.maxZoom||F===vt)continue;if(vt!=null){const js=vt-F;if(G!==Ht>>js||he!==ei>>js)continue}}if(Ui.source=null,O.length===0)continue;_i>1&&console.time("clipping");const qi=.5*di.buffer/di.extent,en=.5-qi,as=.5+qi,Qi=1+qi;let ys=null,Ms=null,Os=null,is=null,ds=Is(O,ai,G-qi,G+as,0,Ui.minX,Ui.maxX,di),Cs=Is(O,ai,G+en,G+Qi,0,Ui.minX,Ui.maxX,di);O=null,ds&&(ys=Is(ds,ai,he-qi,he+as,1,Ui.minY,Ui.maxY,di),Ms=Is(ds,ai,he+en,he+Qi,1,Ui.minY,Ui.maxY,di),ds=null),Cs&&(Os=Is(Cs,ai,he-qi,he+as,1,Ui.minY,Ui.maxY,di),is=Is(Cs,ai,he+en,he+Qi,1,Ui.minY,Ui.maxY,di),Cs=null),_i>1&&console.timeEnd("clipping"),We.push(ys||[],F+1,2*G,2*he),We.push(Ms||[],F+1,2*G,2*he+1),We.push(Os||[],F+1,2*G+1,2*he),We.push(is||[],F+1,2*G+1,2*he+1)}}getTile(O,F,G){O=+O,F=+F,G=+G;const he=this.options,{extent:vt,debug:Ht}=he;if(O<0||O>24)return null;const ei=1<<O,We=Va(O,F=F+ei&ei-1,G);if(this.tiles[We])return ua(this.tiles[We],vt);Ht>1&&console.log("drilling down to z%d-%d-%d",O,F,G);let di,_i=O,ai=F,ki=G;for(;!di&&_i>0;)_i--,ai>>=1,ki>>=1,di=this.tiles[Va(_i,ai,ki)];return di&&di.source?(Ht>1&&(console.log("found parent tile z%d-%d-%d",_i,ai,ki),console.time("drilling down")),this.splitTile(di.source,_i,ai,ki,O,F,G),Ht>1&&console.timeEnd("drilling down"),this.tiles[We]?ua(this.tiles[We],vt):null):null}}function Va(ze,O,F){return 32*((1<<ze)*F+O)+ze}function Yi(ze,O){return O?ze.properties[O]:ze.id}function Il(ze,O){if(ze==null)return!0;if(ze.type==="Feature")return Yi(ze,O)!=null;if(ze.type==="FeatureCollection"){const F=new Set;for(const G of ze.features){const he=Yi(G,O);if(he==null||F.has(he))return!1;F.add(he)}return!0}return!1}function ec(ze,O){const F=new Map;if(ze!=null)if(ze.type==="Feature")F.set(Yi(ze,O),ze);else for(const G of ze.features)F.set(Yi(G,O),G);return F}class pc extends H{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(O,F){return S._(this,void 0,void 0,function*(){const G=O.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const he=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!he)return null;const vt=new class{constructor(ei){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.X,this.length=ei.length,this._features=ei}feature(ei){return new class{constructor(We){this._feature=We,this.extent=S.X,this.type=We.type,this.properties=We.tags,"id"in We&&!isNaN(We.id)&&(this.id=parseInt(We.id,10))}loadGeometry(){if(this._feature.type===1){const We=[];for(const di of this._feature.geometry)We.push([new S.P(di[0],di[1])]);return We}{const We=[];for(const di of this._feature.geometry){const _i=[];for(const ai of di)_i.push(new S.P(ai[0],ai[1]));We.push(_i)}return We}}toGeoJSON(We,di,_i){return mi.call(this,We,di,_i)}}(this._features[ei])}}(he.features);let Ht=Xa(vt);return Ht.byteOffset===0&&Ht.byteLength===Ht.buffer.byteLength||(Ht=new Uint8Array(Ht)),{vectorTile:vt,rawData:Ht.buffer}})}loadData(O){return S._(this,void 0,void 0,function*(){var F;(F=this._pendingRequest)===null||F===void 0||F.abort();const G=!!(O&&O.request&&O.request.collectResourceTiming)&&new S.bu(O.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(O,this._pendingRequest),this._geoJSONIndex=O.cluster?new lc(function({superclusterOptions:Ht,clusterProperties:ei}){if(!ei||!Ht)return Ht;const We={},di={},_i={accumulated:null,zoom:0},ai={properties:null},ki=Object.keys(ei);for(const Ui of ki){const[qi,en]=ei[Ui],as=S.bB(en),Qi=S.bB(typeof qi=="string"?[qi,["accumulated"],["get",Ui]]:qi);We[Ui]=as.value,di[Ui]=Qi.value}return Ht.map=Ui=>{ai.properties=Ui;const qi={};for(const en of ki)qi[en]=We[en].evaluate(_i,ai);return qi},Ht.reduce=(Ui,qi)=>{ai.properties=qi;for(const en of ki)_i.accumulated=Ui[en],Ui[en]=di[en].evaluate(_i,ai)},Ht}(O)).load((yield this._pendingData).features):(he=yield this._pendingData,new ga(he,O.geojsonVtOptions)),this.loaded={};const vt={};if(G){const Ht=G.finish();Ht&&(vt.resourceTiming={},vt.resourceTiming[O.source]=JSON.parse(JSON.stringify(Ht)))}return vt}catch(vt){if(delete this._pendingRequest,S.bA(vt))return{abandoned:!0};throw vt}var he})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(O){const F=this.loaded;return F&&F[O.uid]?super.reloadTile(O):this.loadTile(O)}loadAndProcessGeoJSON(O,F){return S._(this,void 0,void 0,function*(){let G=yield this.loadGeoJSON(O,F);if(delete this._pendingRequest,typeof G!="object")throw new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`);if(bt(G,!0),O.filter){const he=S.bB(O.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(he.result==="error")throw new Error(he.value.map(Ht=>`${Ht.key}: ${Ht.message}`).join(", "));G={type:"FeatureCollection",features:G.features.filter(Ht=>he.value.evaluate({zoom:0},Ht))}}return G})}loadGeoJSON(O,F){return S._(this,void 0,void 0,function*(){const{promoteId:G}=O;if(O.request){const he=yield S.h(O.request,F);return this._dataUpdateable=Il(he.data,G)?ec(he.data,G):void 0,he.data}if(typeof O.data=="string")try{const he=JSON.parse(O.data);return this._dataUpdateable=Il(he,G)?ec(he,G):void 0,he}catch{throw new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`)}if(!O.dataDiff)throw new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${O.source}`);return function(he,vt,Ht){var ei,We,di,_i;if(vt.removeAll&&he.clear(),vt.remove)for(const ai of vt.remove)he.delete(ai);if(vt.add)for(const ai of vt.add){const ki=Yi(ai,Ht);ki!=null&&he.set(ki,ai)}if(vt.update)for(const ai of vt.update){let ki=he.get(ai.id);if(ki==null)continue;const Ui=!ai.removeAllProperties&&(((ei=ai.removeProperties)===null||ei===void 0?void 0:ei.length)>0||((We=ai.addOrUpdateProperties)===null||We===void 0?void 0:We.length)>0);if((ai.newGeometry||ai.removeAllProperties||Ui)&&(ki=Object.assign({},ki),he.set(ai.id,ki),Ui&&(ki.properties=Object.assign({},ki.properties))),ai.newGeometry&&(ki.geometry=ai.newGeometry),ai.removeAllProperties)ki.properties={};else if(((di=ai.removeProperties)===null||di===void 0?void 0:di.length)>0)for(const qi of ai.removeProperties)Object.prototype.hasOwnProperty.call(ki.properties,qi)&&delete ki.properties[qi];if(((_i=ai.addOrUpdateProperties)===null||_i===void 0?void 0:_i.length)>0)for(const{key:qi,value:en}of ai.addOrUpdateProperties)ki.properties[qi]=en}}(this._dataUpdateable,O.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(O){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(O){return this._geoJSONIndex.getClusterExpansionZoom(O.clusterId)}getClusterChildren(O){return this._geoJSONIndex.getChildren(O.clusterId)}getClusterLeaves(O){return this._geoJSONIndex.getLeaves(O.clusterId,O.limit,O.offset)}}class zl{constructor(O){this.self=O,this.actor=new S.F(O),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(F,G)=>{if(this.externalWorkerSourceTypes[F])throw new Error(`Worker source with name "${F}" already registered.`);this.externalWorkerSourceTypes[F]=G},this.self.addProtocol=S.bh,this.self.removeProtocol=S.bi,this.self.registerRTLTextPlugin=F=>{if(S.bC.isParsed())throw new Error("RTL text plugin already registered.");S.bC.setMethods(F)},this.actor.registerMessageHandler("LDT",(F,G)=>this._getDEMWorkerSource(F,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(F,G)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(F,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(F,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(F,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(F,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(F,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(F,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(F,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(F,G)=>this._getWorkerSource(F,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("GD",(F,G)=>this._getWorkerSource(F,G.type,G.source).getData()),this.actor.registerMessageHandler("LT",(F,G)=>this._getWorkerSource(F,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(F,G)=>this._getWorkerSource(F,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(F,G)=>this._getWorkerSource(F,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(F,G)=>this._getWorkerSource(F,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(F,G)=>S._(this,void 0,void 0,function*(){if(!this.workerSources[F]||!this.workerSources[F][G.type]||!this.workerSources[F][G.type][G.source])return;const he=this.workerSources[F][G.type][G.source];delete this.workerSources[F][G.type][G.source],he.removeSource!==void 0&&he.removeSource(G)})),this.actor.registerMessageHandler("RM",F=>S._(this,void 0,void 0,function*(){delete this.layerIndexes[F],delete this.availableImages[F],delete this.workerSources[F],delete this.demWorkerSources[F]})),this.actor.registerMessageHandler("SR",(F,G)=>S._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(F,G)=>this._syncRTLPluginState(F,G)),this.actor.registerMessageHandler("IS",(F,G)=>S._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(F,G)=>this._setImages(F,G)),this.actor.registerMessageHandler("UL",(F,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(F).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(F,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(F).replace(G)}))}_setImages(O,F){return S._(this,void 0,void 0,function*(){this.availableImages[O]=F;for(const G in this.workerSources[O]){const he=this.workerSources[O][G];for(const vt in he)he[vt].availableImages=F}})}_syncRTLPluginState(O,F){return S._(this,void 0,void 0,function*(){if(S.bC.isParsed())return S.bC.getState();if(F.pluginStatus!=="loading")return S.bC.setState(F),F;const G=F.pluginURL;if(this.self.importScripts(G),S.bC.isParsed()){const he={pluginStatus:"loaded",pluginURL:G};return S.bC.setState(he),he}throw S.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${G}`)})}_getAvailableImages(O){let F=this.availableImages[O];return F||(F=[]),F}_getLayerIndex(O){let F=this.layerIndexes[O];return F||(F=this.layerIndexes[O]=new u),F}_getWorkerSource(O,F,G){if(this.workerSources[O]||(this.workerSources[O]={}),this.workerSources[O][F]||(this.workerSources[O][F]={}),!this.workerSources[O][F][G]){const he={sendAsync:(vt,Ht)=>(vt.targetMapId=O,this.actor.sendAsync(vt,Ht))};switch(F){case"vector":this.workerSources[O][F][G]=new H(he,this._getLayerIndex(O),this._getAvailableImages(O));break;case"geojson":this.workerSources[O][F][G]=new pc(he,this._getLayerIndex(O),this._getAvailableImages(O));break;default:this.workerSources[O][F][G]=new this.externalWorkerSourceTypes[F](he,this._getLayerIndex(O),this._getAvailableImages(O))}}return this.workerSources[O][F][G]}_getDEMWorkerSource(O,F){return this.demWorkerSources[O]||(this.demWorkerSources[O]={}),this.demWorkerSources[O][F]||(this.demWorkerSources[O][F]=new Y),this.demWorkerSources[O][F]}}return S.i(self)&&(self.worker=new zl(self)),zl}),T("index",["exports","./shared"],function(S,u){var J="4.5.2";let te,ae;const H={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:d=>new Promise((t,n)=>{const s=requestAnimationFrame(t);d.signal.addEventListener("abort",()=>{cancelAnimationFrame(s),n(u.c())})}),getImageData(d,t=0){return this.getImageCanvasContext(d).getImageData(-t,-t,d.width+2*t,d.height+2*t)},getImageCanvasContext(d){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=d.width,t.height=d.height,n.drawImage(d,0,0,d.width,d.height),n},resolveURL:d=>(te||(te=document.createElement("a")),te.href=d,te.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ae==null&&(ae=matchMedia("(prefers-reduced-motion: reduce)")),ae.matches)}};class Y{static testProp(t){if(!Y.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in Y.docStyle)return t[n];return t[0]}static create(t,n,s){const a=window.document.createElement(t);return n!==void 0&&(a.className=n),s&&s.appendChild(a),a}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){Y.docStyle&&Y.selectProp&&(Y.userSelect=Y.docStyle[Y.selectProp],Y.docStyle[Y.selectProp]="none")}static enableDrag(){Y.docStyle&&Y.selectProp&&(Y.docStyle[Y.selectProp]=Y.userSelect)}static setTransform(t,n){t.style[Y.transformProp]=n}static addEventListener(t,n,s,a={}){t.addEventListener(n,s,"passive"in a?a:a.capture)}static removeEventListener(t,n,s,a={}){t.removeEventListener(n,s,"passive"in a?a:a.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",Y.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Y.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Y.suppressClickInternal,!0)},0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,s){const a=n.boundingClientRect;return new u.P((s.clientX-a.left)/n.x-t.clientLeft,(s.clientY-a.top)/n.y-t.clientTop)}static mousePos(t,n){const s=Y.getScale(t);return Y.getPoint(t,s,n)}static touchPos(t,n){const s=[],a=Y.getScale(t);for(let h=0;h<n.length;h++)s.push(Y.getPoint(t,a,n[h]));return s}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}Y.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Y.selectProp=Y.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Y.transformProp=Y.testProp(["transform","WebkitTransform"]);const oi={supported:!1,testSupport:function(d){!mi&&bt&&(Ii?pi(d):li=d)}};let li,bt,mi=!1,Ii=!1;function pi(d){const t=d.createTexture();d.bindTexture(d.TEXTURE_2D,t);try{if(d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,bt),d.isContextLost())return;oi.supported=!0}catch{}d.deleteTexture(t),mi=!0}var si;typeof document<"u"&&(bt=document.createElement("img"),bt.onload=()=>{li&&pi(li),li=null,Ii=!0},bt.onerror=()=>{mi=!0,li=null},bt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(d){let t,n,s,a;d.resetRequestQueue=()=>{t=[],n=0,s=0,a={}},d.addThrottleControl=E=>{const C=s++;return a[C]=E,C},d.removeThrottleControl=E=>{delete a[E],_()},d.getImage=(E,C,z=!0)=>new Promise((D,$)=>{oi.supported&&(E.headers||(E.headers={}),E.headers.accept="image/webp,*/*"),u.e(E,{type:"image"}),t.push({abortController:C,requestParameters:E,supportImageRefresh:z,state:"queued",onError:U=>{$(U)},onSuccess:U=>{D(U)}}),_()});const h=E=>u._(this,void 0,void 0,function*(){E.state="running";const{requestParameters:C,supportImageRefresh:z,onError:D,onSuccess:$,abortController:U}=E,ee=z===!1&&!u.i(self)&&!u.g(C.url)&&(!C.headers||Object.keys(C.headers).reduce((Re,Ke)=>Re&&Ke==="accept",!0));n++;const de=ee?w(C,U):u.m(C,U);try{const Re=yield de;delete E.abortController,E.state="completed",Re.data instanceof HTMLImageElement||u.b(Re.data)?$(Re):Re.data&&$({data:yield(re=Re.data,typeof createImageBitmap=="function"?u.d(re):u.f(re)),cacheControl:Re.cacheControl,expires:Re.expires})}catch(Re){delete E.abortController,D(Re)}finally{n--,_()}var re}),_=()=>{const E=(()=>{for(const C of Object.keys(a))if(a[C]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let C=n;C<E&&t.length>0;C++){const z=t.shift();z.abortController.signal.aborted?C--:h(z)}},w=(E,C)=>new Promise((z,D)=>{const $=new Image,U=E.url,ee=E.credentials;ee&&ee==="include"?$.crossOrigin="use-credentials":(ee&&ee==="same-origin"||!u.s(U))&&($.crossOrigin="anonymous"),C.signal.addEventListener("abort",()=>{$.src="",D(u.c())}),$.fetchPriority="high",$.onload=()=>{$.onerror=$.onload=null,z({data:$})},$.onerror=()=>{$.onerror=$.onload=null,C.signal.aborted||D(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."))},$.src=U})}(si||(si={})),si.resetRequestQueue();class ci{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function ri(d){var t=new u.A(3);return t[0]=d[0],t[1]=d[1],t[2]=d[2],t}var gi,tn=function(d,t,n){return d[0]=t[0]-n[0],d[1]=t[1]-n[1],d[2]=t[2]-n[2],d};gi=new u.A(3),u.A!=Float32Array&&(gi[0]=0,gi[1]=0,gi[2]=0);var Ws=function(d){var t=d[0],n=d[1];return t*t+n*n};function Ji(d){const t=[];if(typeof d=="string")t.push({id:"default",url:d});else if(d&&d.length>0){const n=[];for(const{id:s,url:a}of d){const h=`${s}${a}`;n.indexOf(h)===-1&&(n.push(h),t.push({id:s,url:a}))}}return t}function $s(d,t,n){const s=d.split("?");return s[0]+=`${t}${n}`,s.join("?")}(function(){var d=new u.A(2);u.A!=Float32Array&&(d[0]=0,d[1]=0)})();class os{constructor(t,n,s,a){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,a)}update(t,n,s){const{width:a,height:h}=t,_=!(this.size&&this.size[0]===a&&this.size[1]===h||s),{context:w}=this,{gl:E}=w;if(this.useMipmap=!!(n&&n.useMipmap),E.bindTexture(E.TEXTURE_2D,this.texture),w.pixelStoreUnpackFlipY.set(!1),w.pixelStoreUnpack.set(1),w.pixelStoreUnpackPremultiplyAlpha.set(this.format===E.RGBA&&(!n||n.premultiply!==!1)),_)this.size=[a,h],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||u.b(t)?E.texImage2D(E.TEXTURE_2D,0,this.format,this.format,E.UNSIGNED_BYTE,t):E.texImage2D(E.TEXTURE_2D,0,this.format,a,h,0,this.format,E.UNSIGNED_BYTE,t.data);else{const{x:C,y:z}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||u.b(t)?E.texSubImage2D(E.TEXTURE_2D,0,C,z,E.RGBA,E.UNSIGNED_BYTE,t):E.texSubImage2D(E.TEXTURE_2D,0,C,z,a,h,E.RGBA,E.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&E.generateMipmap(E.TEXTURE_2D)}bind(t,n,s){const{context:a}=this,{gl:h}=a;h.bindTexture(h.TEXTURE_2D,this.texture),s!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=h.LINEAR),t!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,t),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,n),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Gc(d){const{userImage:t}=d;return!!(t&&t.render&&t.render())&&(d.data.replace(new Uint8Array(t.data.buffer)),!0)}class Fs extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:s}of this.requestors)s(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const s=n.spriteData;n.data=new u.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;const a=n.data||n.spriteData;return this._validateStretch(n.stretchX,a&&a.width)||(this.fire(new u.j(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,a&&a.height)||(this.fire(new u.j(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new u.j(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const a of t){if(a[0]<s||a[1]<a[0]||n<a[1])return!1;s=a[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const s=n.spriteData,a=s&&s.width||n.data.width,h=s&&s.height||n.data.height;return!(t[0]<0||a<t[0]||t[1]<0||h<t[1]||t[2]<0||a<t[2]||t[3]<0||h<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,s=!0){const a=this.getImage(t);if(s&&(a.data.width!==n.data.width||a.data.height!==n.data.height))throw new Error(`size mismatch between old image (${a.data.width}x${a.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=a.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise((n,s)=>{let a=!0;if(!this.isLoaded())for(const h of t)this.images[h]||(a=!1);this.isLoaded()||a?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})})}_getImagesForIds(t){const n={};for(const s of t){let a=this.getImage(s);a||(this.fire(new u.k("styleimagemissing",{id:s})),a=this.getImage(s)),a?n[s]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf,version:a.version,stretchX:a.stretchX,stretchY:a.stretchY,content:a.content,textFitWidth:a.textFitWidth,textFitHeight:a.textFitHeight,hasRenderCallback:!!(a.userImage&&a.userImage.render)}:u.w(`Image "${s}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const a={w:s.data.width+2,h:s.data.height+2,x:0,y:0},h=new u.I(a,s);this.patterns[t]={bin:a,position:h}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new os(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const h in this.patterns)t.push(this.patterns[h].bin);const{w:n,h:s}=u.p(t),a=this.atlasImage;a.resize({width:n||1,height:s||1});for(const h in this.patterns){const{bin:_}=this.patterns[h],w=_.x+1,E=_.y+1,C=this.getImage(h).data,z=C.width,D=C.height;u.R.copy(C,a,{x:0,y:0},{x:w,y:E},{width:z,height:D}),u.R.copy(C,a,{x:0,y:D-1},{x:w,y:E-1},{width:z,height:1}),u.R.copy(C,a,{x:0,y:0},{x:w,y:E+D},{width:z,height:1}),u.R.copy(C,a,{x:z-1,y:0},{x:w-1,y:E},{width:1,height:D}),u.R.copy(C,a,{x:0,y:0},{x:w+z,y:E},{width:1,height:D})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.getImage(n);s||u.w(`Image with ID: "${n}" was not found`),Gc(s)&&this.updateImage(n,s)}}}const ca=1e20;function Xl(d,t,n,s,a,h,_,w,E){for(let C=t;C<t+s;C++)Hc(d,n*h+C,h,a,_,w,E);for(let C=n;C<n+a;C++)Hc(d,C*h+t,1,s,_,w,E)}function Hc(d,t,n,s,a,h,_){h[0]=0,_[0]=-ca,_[1]=ca,a[0]=d[t];for(let w=1,E=0,C=0;w<s;w++){a[w]=d[t+w*n];const z=w*w;do{const D=h[E];C=(a[w]-a[D]+z-D*D)/(w-D)/2}while(C<=_[E]&&--E>-1);E++,h[E]=w,_[E]=C,_[E+1]=ca}for(let w=0,E=0;w<s;w++){for(;_[E+1]<w;)E++;const C=h[E],z=w-C;d[t+w*n]=a[C]+z*z}}class Xa{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return u._(this,void 0,void 0,function*(){const n=[];for(const h in t)for(const _ of t[h])n.push(this._getAndCacheGlyphsPromise(h,_));const s=yield Promise.all(n),a={};for(const{stack:h,id:_,glyph:w}of s)a[h]||(a[h]={}),a[h][_]=w&&{id:w.id,bitmap:w.bitmap.clone(),metrics:w.metrics};return a})}_getAndCacheGlyphsPromise(t,n){return u._(this,void 0,void 0,function*(){let s=this.entries[t];s||(s=this.entries[t]={glyphs:{},requests:{},ranges:{}});let a=s.glyphs[n];if(a!==void 0)return{stack:t,id:n,glyph:a};if(a=this._tinySDF(s,t,n),a)return s.glyphs[n]=a,{stack:t,id:n,glyph:a};const h=Math.floor(n/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[h])return{stack:t,id:n,glyph:a};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[h]){const w=Xa.loadGlyphRange(t,h,this.url,this.requestManager);s.requests[h]=w}const _=yield s.requests[h];for(const w in _)this._doesCharSupportLocalGlyph(+w)||(s.glyphs[+w]=_[+w]);return s.ranges[h]=!0,{stack:t,id:n,glyph:_[n]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](t)||u.u["Hangul Syllables"](t)||u.u.Hiragana(t)||u.u.Katakana(t))}_tinySDF(t,n,s){const a=this.localIdeographFontFamily;if(!a||!this._doesCharSupportLocalGlyph(s))return;let h=t.tinySDF;if(!h){let w="400";/bold/i.test(n)?w="900":/medium/i.test(n)?w="500":/light/i.test(n)&&(w="200"),h=t.tinySDF=new Xa.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:w})}const _=h.draw(String.fromCharCode(s));return{id:s,bitmap:new u.o({width:_.width||60,height:_.height||60},_.data),metrics:{width:_.glyphWidth/2||24,height:_.glyphHeight/2||24,left:_.glyphLeft/2+.5||0,top:_.glyphTop/2-27.5||-8,advance:_.glyphAdvance/2||24,isDoubleResolution:!0}}}}Xa.loadGlyphRange=function(d,t,n,s){return u._(this,void 0,void 0,function*(){const a=256*t,h=a+255,_=s.transformRequest(n.replace("{fontstack}",d).replace("{range}",`${a}-${h}`),"Glyphs"),w=yield u.l(_,new AbortController);if(!w||!w.data)throw new Error(`Could not load glyph range. range: ${t}, ${a}-${h}`);const E={};for(const C of u.n(w.data))E[C.id]=C;return E})},Xa.TinySDF=class{constructor({fontSize:d=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:a="sans-serif",fontWeight:h="normal",fontStyle:_="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const w=this.size=d+4*t,E=this._createCanvas(w),C=this.ctx=E.getContext("2d",{willReadFrequently:!0});C.font=`${_} ${h} ${d}px ${a}`,C.textBaseline="alphabetic",C.textAlign="left",C.fillStyle="black",this.gridOuter=new Float64Array(w*w),this.gridInner=new Float64Array(w*w),this.f=new Float64Array(w),this.z=new Float64Array(w+1),this.v=new Uint16Array(w)}_createCanvas(d){const t=document.createElement("canvas");return t.width=t.height=d,t}draw(d){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:a,actualBoundingBoxRight:h}=this.ctx.measureText(d),_=Math.ceil(n),w=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-a))),E=Math.min(this.size-this.buffer,_+Math.ceil(s)),C=w+2*this.buffer,z=E+2*this.buffer,D=Math.max(C*z,0),$=new Uint8ClampedArray(D),U={data:$,width:C,height:z,glyphWidth:w,glyphHeight:E,glyphTop:_,glyphLeft:0,glyphAdvance:t};if(w===0||E===0)return U;const{ctx:ee,buffer:de,gridInner:re,gridOuter:Re}=this;ee.clearRect(de,de,w,E),ee.fillText(d,de,de+_);const Ke=ee.getImageData(de,de,w,E);Re.fill(ca,0,D),re.fill(0,0,D);for(let ie=0;ie<E;ie++)for(let Zt=0;Zt<w;Zt++){const ti=Ke.data[4*(ie*w+Zt)+3]/255;if(ti===0)continue;const ni=(ie+de)*C+Zt+de;if(ti===1)Re[ni]=0,re[ni]=ca;else{const yi=.5-ti;Re[ni]=yi>0?yi*yi:0,re[ni]=yi<0?yi*yi:0}}Xl(Re,0,0,C,z,C,this.f,this.v,this.z),Xl(re,de,de,w,E,C,this.f,this.v,this.z);for(let ie=0;ie<D;ie++){const Zt=Math.sqrt(Re[ie])-Math.sqrt(re[ie]);$[ie]=Math.round(255-255*(Zt/this.radius+this.cutoff))}return U}};class th{constructor(){this.specification=u.v.light.position}possiblyEvaluate(t,n){return u.y(t.expression.evaluate(n))}interpolate(t,n,s){return{x:u.z.number(t.x,n.x,s),y:u.z.number(t.y,n.y,s),z:u.z.number(t.z,n.z,s)}}}let Tc;class Jl extends u.E{constructor(t){super(),Tc=Tc||new u.q({anchor:new u.D(u.v.light.anchor),position:new th,color:new u.D(u.v.light.color),intensity:new u.D(u.v.light.intensity)}),this._transitionable=new u.T(Tc),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(u.r,t,n))for(const s in t){const a=t[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),a):this._transitionable.setValue(s,a)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s){return(!s||s.validate!==!1)&&u.t(this,t.call(u.x,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:u.v}))}}const ma=new u.q({"sky-color":new u.D(u.v.sky["sky-color"]),"horizon-color":new u.D(u.v.sky["horizon-color"]),"fog-color":new u.D(u.v.sky["fog-color"]),"fog-ground-blend":new u.D(u.v.sky["fog-ground-blend"]),"horizon-fog-blend":new u.D(u.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new u.D(u.v.sky["sky-horizon-blend"]),"atmosphere-blend":new u.D(u.v.sky["atmosphere-blend"])});class Fa extends u.E{constructor(t){super(),this._transitionable=new u.T(ma),this.setSky(t),this._transitioning=this._transitionable.untransitioned()}setSky(t,n={}){if(!this._validate(u.B,t,n))for(const s in t){const a=t[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),a):this._transitionable.setValue(s,a)}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s={}){return(s==null?void 0:s.validate)!==!1&&u.t(this,t.call(u.x,u.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:u.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Wc{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const a=[];let h=t.length%2==1?-t[t.length-1]*s:0,_=t[0]*s,w=!0;a.push({left:h,right:_,isDash:w,zeroLength:t[0]===0});let E=t[0];for(let C=1;C<t.length;C++){w=!w;const z=t[C];h=E*s,E+=z,_=E*s,a.push({left:h,right:_,isDash:w,zeroLength:z===0})}return a}addRoundDash(t,n,s){const a=n/2;for(let h=-s;h<=s;h++){const _=this.width*(this.nextRow+s+h);let w=0,E=t[w];for(let C=0;C<this.width;C++){C/E.right>1&&(E=t[++w]);const z=Math.abs(C-E.left),D=Math.abs(C-E.right),$=Math.min(z,D);let U;const ee=h/s*(a+1);if(E.isDash){const de=a-Math.abs(ee);U=Math.sqrt($*$+de*de)}else U=a-Math.sqrt($*$+ee*ee);this.data[_+C]=Math.max(0,Math.min(255,U+128))}}}addRegularDash(t){for(let w=t.length-1;w>=0;--w){const E=t[w],C=t[w+1];E.zeroLength?t.splice(w,1):C&&C.isDash===E.isDash&&(C.left=E.left,t.splice(w,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const a=this.width*this.nextRow;let h=0,_=t[h];for(let w=0;w<this.width;w++){w/_.right>1&&(_=t[++h]);const E=Math.abs(w-_.left),C=Math.abs(w-_.right),z=Math.min(E,C);this.data[a+w]=Math.max(0,Math.min(255,(_.isDash?z:-z)+128))}}addDash(t,n){const s=n?7:0,a=2*s+1;if(this.nextRow+a>this.height)return u.w("LineAtlas out of space"),null;let h=0;for(let w=0;w<t.length;w++)h+=t[w];if(h!==0){const w=this.width/h,E=this.getDashRanges(t,this.width,w);n?this.addRoundDash(E,w,s):this.addRegularDash(E)}const _={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:h};return this.nextRow+=a,this.dirty=!0,_}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const lc="maplibre_preloaded_worker_pool";class Ja{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Ja.workerCount;)this.workers.push(new Worker(u.a.WORKER_URL));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[lc]}numActive(){return Object.keys(this.active).length}}const Kc=Math.floor(H.hardwareConcurrency/2);let ka,Oa;function Cc(){return ka||(ka=new Ja),ka}Ja.workerCount=u.C(globalThis)?Math.max(Math.min(Kc,3),1):1;class Ac{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const s=this.workerPool.acquire(n);for(let a=0;a<s.length;a++){const h=new u.F(s[a],n);h.name=`Worker ${a}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const s=[];for(const a of this.actors)s.push(a.sendAsync({type:t,data:n}));return Promise.all(s)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,n){for(const s of this.actors)s.registerMessageHandler(t,n)}}function xu(){return Oa||(Oa=new Ac(Cc(),u.G),Oa.registerMessageHandler("GR",(d,t,n)=>u.m(t,n))),Oa}function Yl(d,t){const n=u.H();return u.J(n,n,[1,1,0]),u.K(n,n,[.5*d.width,.5*d.height,1]),u.L(n,n,d.calculatePosMatrix(t.toUnwrapped()))}function cc(d,t,n,s,a,h){const _=function(D,$,U){if(D)for(const ee of D){const de=$[ee];if(de&&de.source===U&&de.type==="fill-extrusion")return!0}else for(const ee in $){const de=$[ee];if(de.source===U&&de.type==="fill-extrusion")return!0}return!1}(a&&a.layers,t,d.id),w=h.maxPitchScaleFactor(),E=d.tilesIn(s,w,_);E.sort(uc);const C=[];for(const D of E)C.push({wrappedTileID:D.tileID.wrapped().key,queryResults:D.tile.queryRenderedFeatures(t,n,d._state,D.queryGeometry,D.cameraQueryGeometry,D.scale,a,h,w,Yl(d.transform,D.tileID))});const z=function(D){const $={},U={};for(const ee of D){const de=ee.queryResults,re=ee.wrappedTileID,Re=U[re]=U[re]||{};for(const Ke in de){const ie=de[Ke],Zt=Re[Ke]=Re[Ke]||{},ti=$[Ke]=$[Ke]||[];for(const ni of ie)Zt[ni.featureIndex]||(Zt[ni.featureIndex]=!0,ti.push(ni))}}return $}(C);for(const D in z)z[D].forEach($=>{const U=$.feature,ee=d.getFeatureState(U.layer["source-layer"],U.id);U.source=U.layer.source,U.layer["source-layer"]&&(U.sourceLayer=U.layer["source-layer"]),U.state=ee});return z}function uc(d,t){const n=d.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}function Xc(d,t,n){return u._(this,void 0,void 0,function*(){let s=d;if(d.url?s=(yield u.h(t.transformRequest(d.url,"Source"),n)).data:yield H.frameAsync(n),!s)return null;const a=u.M(u.e(s,d),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(a.vectorLayerIds=s.vector_layers.map(h=>h.id)),a})}class ui{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof u.N?new u.N(t.lng,t.lat):u.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof u.N?new u.N(t.lng,t.lat):u.N.convert(t),this}extend(t){const n=this._sw,s=this._ne;let a,h;if(t instanceof u.N)a=t,h=t;else{if(!(t instanceof ui))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ui.convert(t)):this.extend(u.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(u.N.convert(t)):this;if(a=t._sw,h=t._ne,!a||!h)return this}return n||s?(n.lng=Math.min(a.lng,n.lng),n.lat=Math.min(a.lat,n.lat),s.lng=Math.max(h.lng,s.lng),s.lat=Math.max(h.lat,s.lat)):(this._sw=new u.N(a.lng,a.lat),this._ne=new u.N(h.lng,h.lat)),this}getCenter(){return new u.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new u.N(this.getWest(),this.getNorth())}getSouthEast(){return new u.N(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(t){const{lng:n,lat:s}=u.N.convert(t);let a=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&a}static convert(t){return t instanceof ui?t:t&&new ui(t)}static fromLngLat(t,n=0){const s=360*n/40075017,a=s/Math.cos(Math.PI/180*t.lat);return new ui(new u.N(t.lng-a,t.lat-s),new u.N(t.lng+a,t.lat+s))}}class Pc{constructor(t,n,s){this.bounds=ui.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||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),s=Math.floor(u.O(this.bounds.getWest())*n),a=Math.floor(u.Q(this.bounds.getNorth())*n),h=Math.ceil(u.O(this.bounds.getEast())*n),_=Math.ceil(u.Q(this.bounds.getSouth())*n);return t.x>=s&&t.x<h&&t.y>=a&&t.y<_}}class bu extends u.E{constructor(t,n,s,a){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,u.e(this,u.M(n,["url","scheme","tileSize","promoteId"])),this._options=u.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(a)}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Xc(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(u.e(this,t),t.bounds&&(this.tileBounds=new Pc(t.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new u.j(t))}})}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.abort(),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.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(t){return u._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(n,"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};s.request.collectResourceTiming=this._collectResourceTiming;let a="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((h,_)=>{t.reloadPromise={resolve:h,reject:_}})}else t.actor=this.dispatcher.getActor(),a="LT";t.abortController=new AbortController;try{const h=yield t.actor.sendAsync({type:a,data:s},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,h)}catch(h){if(delete t.abortController,t.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,n){if(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),t.reloadPromise){const s=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(s.resolve).catch(s.reject)}}abortTile(t){return u._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return u._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class us extends u.E{constructor(t,n,s,a){super(),this.id=t,this.dispatcher=s,this.setEventedParent(a),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},n),u.e(this,u.M(n,["url","scheme","tileSize"]))}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Xc(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(u.e(this,t),t.bounds&&(this.tileBounds=new Pc(t.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new u.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),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}serialize(){return u.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return u._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const s=yield si.getImage(this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&s.cacheControl&&s.expires&&t.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});const a=this.map.painter.context,h=a.gl,_=s.data;t.texture=this.map.painter.getTileTexture(_.width),t.texture?t.texture.update(_,{useMipmap:!0}):(t.texture=new os(a,_,h.RGBA,{useMipmap:!0}),t.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(s){if(delete t.abortController,t.aborted)t.state="unloaded";else if(s)throw t.state="errored",s}})}abortTile(t){return u._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return u._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class Is extends us{constructor(t,n,s,a){super(t,n,s,a),this.type="raster-dem",this.maxzoom=22,this._options=u.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t){return u._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const a=yield si.getImage(s,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a&&a.data){const h=a.data;this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const _=u.b(h)&&u.U()?h:yield this.readImageNow(h),w={type:this.type,uid:t.uid,source:this.id,rawImageData:_,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const E=yield t.actor.sendAsync({type:"LDT",data:w});t.dem=E,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}})}readImageNow(t){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.V()){const n=t.width+2,s=t.height+2;try{return new u.R({width:n,height:s},yield u.W(t,-1,-1,n,s))}catch{}}return H.getImageData(t,1)})}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),a=(n.x-1+s)%s,h=n.x===0?t.wrap-1:t.wrap,_=(n.x+1+s)%s,w=n.x+1===s?t.wrap+1:t.wrap,E={};return E[new u.S(t.overscaledZ,h,n.z,a,n.y).key]={backfilled:!1},E[new u.S(t.overscaledZ,w,n.z,_,n.y).key]={backfilled:!1},n.y>0&&(E[new u.S(t.overscaledZ,h,n.z,a,n.y-1).key]={backfilled:!1},E[new u.S(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},E[new u.S(t.overscaledZ,w,n.z,_,n.y-1).key]={backfilled:!1}),n.y+1<s&&(E[new u.S(t.overscaledZ,h,n.z,a,n.y+1).key]={backfilled:!1},E[new u.S(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},E[new u.S(t.overscaledZ,w,n.z,_,n.y+1).key]={backfilled:!1}),E}unloadTile(t){return u._(this,void 0,void 0,function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}class wu extends u.E{constructor(t,n,s,a){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(a),this._data=n.data,this._options=u.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const h=u.X/this.tileSize;this.workerOptions=u.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*h,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*h,extent:u.X,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:u.X,radius:(n.clusterRadius||50)*h,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return u._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getData(){return u._(this,void 0,void 0,function*(){const t=u.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})})}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:s}})}_updateWorkerData(t){return u._(this,void 0,void 0,function*(){const n=u.e({type:this.type},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(H.resolveURL(this._data),"Source"),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new u.k("dataloading",{dataType:"source"}));try{const s=yield this.actor.sendAsync({type:"LD",data:n});if(this._pendingLoads--,this._removed||s.abandoned)return void this.fire(new u.k("dataabort",{dataType:"source"}));let a=null;s.resourceTiming&&s.resourceTiming[this.id]&&(a=s.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&u.e(h,{resourceTiming:a}),this.fire(new u.k("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new u.k("dataabort",{dataType:"source"}));this.fire(new u.j(s))}})}loaded(){return this._pendingLoads===0}loadTile(t){return u._(this,void 0,void 0,function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const s={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.abortController=new AbortController;const a=yield this.actor.sendAsync({type:n,data:s},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,n==="RT")})}abortTile(t){return u._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return u._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var hc=u.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ql extends u.E{constructor(t,n,s,a){super(),this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=n}load(t){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield si.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new u.j(n))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(u.Z.fromLngLat);this.tileID=function(a){let h=1/0,_=1/0,w=-1/0,E=-1/0;for(const $ of a)h=Math.min(h,$.x),_=Math.min(_,$.y),w=Math.max(w,$.x),E=Math.max(E,$.y);const C=Math.max(w-h,E-_),z=Math.max(0,Math.floor(-Math.log(C)/Math.LN2)),D=Math.pow(2,z);return new u.a1(z,Math.floor((h+w)/2*D),Math.floor((_+E)/2*D))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(a=>this.tileID.getTilePoint(a)._round());return this._boundsArray=new u.$,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,u.X,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,u.X),this._boundsArray.emplaceBack(s[2].x,s[2].y,u.X,u.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,hc.members)),this.boundsSegments||(this.boundsSegments=u.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new os(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Jc extends Ql{constructor(t,n,s,a){super(t,n,s,a),this.roundZoom=!0,this.type="video",this.options=n}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield u.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new u.j(n))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new u.j(new u.a2(`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,hc.members)),this.boundsSegments||(this.boundsSegments=u.a0.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 os(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Da extends Ql{constructor(t,n,s,a){super(t,n,s,a),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(_=>typeof _!="number"))||this.fire(new u.j(new u.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a2(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new u.j(new u.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a2(`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 u.j(new u.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return u._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new u.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(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,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,hc.members)),this.boundsSegments||(this.boundsSegments=u.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new os(n,this.canvas,s.RGBA,{premultiply:!0});let a=!1;for(const h in this.tiles){const _=this.tiles[h];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,a=!0)}a&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Su={},ku=d=>{switch(d){case"geojson":return wu;case"image":return Ql;case"raster":return us;case"raster-dem":return Is;case"vector":return bu;case"video":return Jc;case"canvas":return Da}return Su[d]},Si="RTLPluginLoaded";class Ya extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=xu()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return u._(this,arguments,void 0,function*(n,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=H.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return u._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.k(Si))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ua=null;function Qa(){return ua||(ua=new Ya),ua}class dc{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=u.a4(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,s){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(a,h){const _={};if(!h)return _;for(const w of a){const E=w.layerIds.map(C=>h.getLayer(C)).filter(Boolean);if(E.length!==0){w.layers=E,w.stateDependentLayerIds&&(w.stateDependentLayers=w.stateDependentLayerIds.map(C=>E.filter(z=>z.id===C)[0]));for(const C of E)_[C.id]=w}}return _}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const a in this.buckets){const h=this.buckets[a];if(h instanceof u.a6){if(this.hasSymbolBuckets=!0,!s)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const a in this.buckets){const h=this.buckets[a];if(h instanceof u.a6&&h.hasRTLText){this.hasRTLText=!0,Qa().lazyLoad();break}}this.queryPadding=0;for(const a in this.buckets){const h=this.buckets[a];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(a).queryRadius(h))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new u.a5}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 s in this.buckets){const a=this.buckets[s];a.uploadPending()&&a.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new os(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new os(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,a,h,_,w,E,C,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:h,scale:_,tileSize:this.tileSize,pixelPosMatrix:z,transform:E,params:w,queryPadding:this.queryPadding*C},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const a=s.loadVTLayers(),h=n&&n.sourceLayer?n.sourceLayer:"",_=a._geojsonTileLayer||a[h];if(!_)return;const w=u.a7(n&&n.filter),{z:E,x:C,y:z}=this.tileID.canonical,D={z:E,x:C,y:z};for(let $=0;$<_.length;$++){const U=_.feature($);if(w.needGeometry){const re=u.a8(U,!0);if(!w.filter(new u.a9(this.tileID.overscaledZ),re,this.tileID.canonical))continue}else if(!w.filter(new u.a9(this.tileID.overscaledZ),U))continue;const ee=s.getId(U,h),de=new u.aa(U,E,C,z,ee);de.tile=D,t.push(de)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=u.ab(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let a=!1;if(this.expirationTime>s)a=!1;else if(n)if(this.expirationTime<n)a=!0;else{const h=this.expirationTime-n;h?this.expirationTime=s+Math.max(h,3e4):a=!0}else a=!0;a?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const a in this.buckets){if(!n.style.hasLayer(a))continue;const h=this.buckets[a],_=h.layers[0].sourceLayer||"_geojsonTileLayer",w=s[_],E=t[_];if(!w||!E||Object.keys(E).length===0)continue;h.update(E,w,this.imageAtlas&&this.imageAtlas.patternPositions||{});const C=n&&n.style&&n.style.getLayer(a);C&&(this.queryPadding=Math.max(this.queryPadding,C.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<H.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=H.now()+t}setDependencies(t,n){const s={};for(const a of n)s[a]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const a=this.dependencies[s];if(a){for(const h of n)if(a[h])return!0}}return!1}}class Ti{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const a=t.wrapped().key;this.data[a]===void 0&&(this.data[a]=[]);const h={value:n,timeout:void 0};if(s!==void 0&&(h.timeout=setTimeout(()=>{this.remove(t,h)},s)),this.data[a].push(h),this.order.push(a),this.order.length>this.max){const _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}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 s=t.wrapped().key,a=n===void 0?0:this.data[s].indexOf(n),h=this.data[s][a];return this.data[s].splice(a,1),h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(h.value),this.order.splice(this.order.indexOf(s),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 s in this.data)for(const a of this.data[s])t(a.value)||n.push(a);for(const s of n)this.remove(s.value.tileID,s)}}class ts{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const a=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][a]=this.stateChanges[t][a]||{},u.e(this.stateChanges[t][a],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const h in this.state[t])h!==a&&(this.deletedStates[t][h]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][a]===null){this.deletedStates[t][a]={};for(const h in this.state[t][a])s[h]||(this.deletedStates[t][a][h]=null)}else for(const h in s)this.deletedStates[t]&&this.deletedStates[t][a]&&this.deletedStates[t][a][h]===null&&delete this.deletedStates[t][a][h]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const a=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][a]!==null&&(this.deletedStates[t][a]=this.deletedStates[t][a]||{},this.deletedStates[t][a][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][a])for(s in this.deletedStates[t][a]={},this.stateChanges[t][a])this.deletedStates[t][a][s]=null;else this.deletedStates[t][a]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),a=u.e({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const h=this.deletedStates[t][n];if(h===null)return{};for(const _ in h)delete a[_]}return a}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const a in this.stateChanges){this.state[a]=this.state[a]||{};const h={};for(const _ in this.stateChanges[a])this.state[a][_]||(this.state[a][_]={}),u.e(this.state[a][_],this.stateChanges[a][_]),h[_]=this.state[a][_];s[a]=h}for(const a in this.deletedStates){this.state[a]=this.state[a]||{};const h={};if(this.deletedStates[a]===null)for(const _ in this.state[a])h[_]={},this.state[a][_]={};else for(const _ in this.deletedStates[a]){if(this.deletedStates[a][_]===null)this.state[a][_]={};else for(const w of Object.keys(this.deletedStates[a][_]))delete this.state[a][_][w];h[_]=this.state[a][_]}s[a]=s[a]||{},u.e(s[a],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const a in t)t[a].setFeatureState(s,n)}}class Hi extends u.E{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",a=>this._dataHandler(a)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((a,h,_,w)=>{const E=new(ku(h.type))(a,h,_,w);if(E.id!==a)throw new Error(`Expected Source id to be ${a} instead of ${E.id}`);return E})(t,n,s,this),this._tiles={},this._cache=new Ti(0,a=>this._unloadTile(a)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ts,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels: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;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)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,s){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,n,s)}catch(a){t.state="errored",a.status!==404?this._source.fire(new u.j(a,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new u.k("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 s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(ga).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,a)=>{const h=s.tileID,_=a.tileID,w=new u.P(h.canonical.x,h.canonical.y)._rotate(this.transform.angle),E=new u.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle);return h.overscaledZ-_.overscaledZ||E.y-w.y||E.x-w.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(ga).map(s=>s.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){return u._(this,void 0,void 0,function*(){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),yield this._loadTile(s,t,n))})}_tileLoaded(t,n,s){t.timeAdded=H.now(),s==="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 u.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let a=0;a<n.length;a++){const h=n[a];if(t.neighboringTiles&&t.neighboringTiles[h]){const _=this.getTileByID(h);s(t,_),s(_,t)}}function s(a,h){a.needsHillshadePrepare=!0,a.needsTerrainPrepare=!0;let _=h.tileID.canonical.x-a.tileID.canonical.x;const w=h.tileID.canonical.y-a.tileID.canonical.y,E=Math.pow(2,a.tileID.canonical.z),C=h.tileID.key;_===0&&w===0||Math.abs(w)>1||(Math.abs(_)>1&&(Math.abs(_+E)===1?_+=E:Math.abs(_-E)===1&&(_-=E)),h.dem&&a.dem&&(a.dem.backfillBorder(h.dem,_,w),a.neighboringTiles&&a.neighboringTiles[C]&&(a.neighboringTiles[C].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,a){for(const h in this._tiles){let _=this._tiles[h];if(a[h]||!_.hasData()||_.tileID.overscaledZ<=n||_.tileID.overscaledZ>s)continue;let w=_.tileID;for(;_&&_.tileID.overscaledZ>n+1;){const C=_.tileID.scaledTo(_.tileID.overscaledZ-1);_=this._tiles[C.key],_&&_.hasData()&&(w=C)}let E=w;for(;E.overscaledZ>n;)if(E=E.scaledTo(E.overscaledZ-1),t[E.key]){a[w.key]=w;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const a=t.scaledTo(s),h=this._getLoadedTile(a);if(h)return h}}findLoadedSibling(t){return this._getLoadedTile(t)}_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,s=Math.ceil(t.height/this._source.tileSize)+1,a=Math.floor(n*s*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(h)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const a in this._tiles){const h=this._tiles[a];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+n),s[h.tileID.key]=h}this._tiles=s;for(const a in this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(const a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}}_updateCoveredAndRetainedTiles(t,n,s,a,h,_){const w={},E={},C=Object.keys(t),z=H.now();for(const D of C){const $=t[D],U=this._tiles[D];if(!U||U.fadeEndTime!==0&&U.fadeEndTime<=z)continue;const ee=this.findLoadedParent($,n),de=this.findLoadedSibling($),re=ee||de||null;re&&(this._addTile(re.tileID),w[re.tileID.key]=re.tileID),E[D]=$}this._retainLoadedChildren(E,a,s,t);for(const D in w)t[D]||(this._coveredTiles[D]=!0,t[D]=w[D]);if(_){const D={},$={};for(const U of h)this._tiles[U.key].hasData()?D[U.key]=U:$[U.key]=U;for(const U in $){const ee=$[U].children(this._source.maxzoom);this._tiles[ee[0].key]&&this._tiles[ee[1].key]&&this._tiles[ee[2].key]&&this._tiles[ee[3].key]&&(D[ee[0].key]=t[ee[0].key]=ee[0],D[ee[1].key]=t[ee[1].key]=ee[1],D[ee[2].key]=t[ee[2].key]=ee[2],D[ee[3].key]=t[ee[3].key]=ee[3],delete $[U])}for(const U in $){const ee=$[U],de=this.findLoadedParent(ee,this._source.minzoom),re=this.findLoadedSibling(ee),Re=de||re||null;if(Re){D[Re.tileID.key]=t[Re.tileID.key]=Re.tileID;for(const Ke in D)D[Ke].isChildOf(Re.tileID)&&delete D[Ke]}}for(const U in this._tiles)D[U]||(this._coveredTiles[U]=!0)}}update(t,n){if(!this._sourceLoaded||this._paused)return;let s;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(z=>new u.S(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.canonical.y)):(s=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&&(s=s.filter(z=>this._source.hasTile(z)))):s=[];const a=t.coveringZoomLevel(this._source),h=Math.max(a-Hi.maxOverzooming,this._source.minzoom),_=Math.max(a+Hi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const D of s)if(D.canonical.z>this._source.minzoom){const $=D.scaledTo(D.canonical.z-1);z[$.key]=$;const U=D.scaledTo(Math.max(this._source.minzoom,Math.min(D.canonical.z,5)));z[U.key]=U}s=s.concat(Object.values(z))}const w=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,w&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const E=this._updateRetainedTiles(s,a);Va(this._source.type)&&this._updateCoveredAndRetainedTiles(E,h,_,a,s,n);for(const z in E)this._tiles[z].clearFadeHold();const C=u.ac(this._tiles,E);for(const z of C){const D=this._tiles[z];D.hasSymbolBuckets&&!D.holdingForFade()?D.setHoldDuration(this.map._fadeDuration):D.hasSymbolBuckets&&!D.symbolFadeFinished()||this._removeTile(z)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var s;const a={},h={},_=Math.max(n-Hi.maxOverzooming,this._source.minzoom),w=Math.max(n+Hi.maxUnderzooming,this._source.minzoom),E={};for(const C of t){const z=this._addTile(C);a[C.key]=C,z.hasData()||n<this._source.maxzoom&&(E[C.key]=C)}this._retainLoadedChildren(E,n,w,a);for(const C of t){let z=this._tiles[C.key];if(z.hasData())continue;if(n+1>this._source.maxzoom){const $=C.children(this._source.maxzoom)[0],U=this.getTile($);if(U&&U.hasData()){a[$.key]=$;continue}}else{const $=C.children(this._source.maxzoom);if(a[$[0].key]&&a[$[1].key]&&a[$[2].key]&&a[$[3].key])continue}let D=z.wasRequested();for(let $=C.overscaledZ-1;$>=_;--$){const U=C.scaledTo($);if(h[U.key])break;if(h[U.key]=!0,z=this.getTile(U),!z&&D&&(z=this._addTile(U)),z){const ee=z.hasData();if((ee||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||D)&&(a[U.key]=U),D=z.wasRequested(),ee)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,a=this._tiles[t].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){s=this._loadedParentTiles[a.key];break}n.push(a.key);const h=a.scaledTo(a.overscaledZ-1);if(s=this._getLoadedTile(h),s)break;a=h}for(const h of n)this._loadedParentTiles[h]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const n=this._tiles[t].tileID,s=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=s}}_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 s=n;return n||(n=new dc(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new u.k("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 s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_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))))}_dataHandler(t){const n=t.sourceDataType;t.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const a=[],h=this.transform;if(!h)return a;const _=s?h.getCameraQueryGeometry(t):t,w=t.map(ee=>h.pointCoordinate(ee,this.terrain)),E=_.map(ee=>h.pointCoordinate(ee,this.terrain)),C=this.getIds();let z=1/0,D=1/0,$=-1/0,U=-1/0;for(const ee of E)z=Math.min(z,ee.x),D=Math.min(D,ee.y),$=Math.max($,ee.x),U=Math.max(U,ee.y);for(let ee=0;ee<C.length;ee++){const de=this._tiles[C[ee]];if(de.holdingForFade())continue;const re=de.tileID,Re=Math.pow(2,h.zoom-de.tileID.overscaledZ),Ke=n*de.queryPadding*u.X/de.tileSize/Re,ie=[re.getTilePoint(new u.Z(z,D)),re.getTilePoint(new u.Z($,U))];if(ie[0].x-Ke<u.X&&ie[0].y-Ke<u.X&&ie[1].x+Ke>=0&&ie[1].y+Ke>=0){const Zt=w.map(ni=>re.getTilePoint(ni)),ti=E.map(ni=>re.getTilePoint(ni));a.push({tile:de,tileID:re,queryGeometry:Zt,cameraQueryGeometry:ti,scale:Re})}}return a}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Va(this._source.type)){const t=H.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const a=this._tiles[t];a&&a.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function ga(d,t){const n=Math.abs(2*d.wrap)-+(d.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return d.overscaledZ-t.overscaledZ||s-n||t.canonical.y-d.canonical.y||t.canonical.x-d.canonical.x}function Va(d){return d==="raster"||d==="image"||d==="video"}Hi.maxOverzooming=10,Hi.maxUnderzooming=3;class Yi{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=u.ad(t,0,1);let n=1,s=this._distances[n];const a=t*this.paddedLength+this.padding;for(;s<a&&n<this._distances.length;)s=this._distances[++n];const h=n-1,_=this._distances[h],w=s-_,E=w>0?(a-_)/w:0;return this.points[h].mult(1-E).add(this.points[n].mult(E))}}function Il(d,t){let n=!0;return d==="always"||d!=="never"&&t!=="never"||(n=!1),n}class ec{constructor(t,n,s){const a=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let _=0;_<this.xCellCount*this.yCellCount;_++)a.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,s,a,h){this._forEachCell(n,s,a,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(a),this.bboxes.push(h)}insertCircle(t,n,s,a){this._forEachCell(n-a,s-a,n+a,s+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(a)}_insertBoxCell(t,n,s,a,h,_){this.boxCells[h].push(_)}_insertCircleCell(t,n,s,a,h,_){this.circleCells[h].push(_)}_query(t,n,s,a,h,_,w){if(s<0||t>this.width||a<0||n>this.height)return[];const E=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=a){if(h)return[{key:null,x1:t,y1:n,x2:s,y2:a}];for(let C=0;C<this.boxKeys.length;C++)E.push({key:this.boxKeys[C],x1:this.bboxes[4*C],y1:this.bboxes[4*C+1],x2:this.bboxes[4*C+2],y2:this.bboxes[4*C+3]});for(let C=0;C<this.circleKeys.length;C++){const z=this.circles[3*C],D=this.circles[3*C+1],$=this.circles[3*C+2];E.push({key:this.circleKeys[C],x1:z-$,y1:D-$,x2:z+$,y2:D+$})}}else this._forEachCell(t,n,s,a,this._queryCell,E,{hitTest:h,overlapMode:_,seenUids:{box:{},circle:{}}},w);return E}query(t,n,s,a){return this._query(t,n,s,a,!1,null)}hitTest(t,n,s,a,h,_){return this._query(t,n,s,a,!0,h,_).length>0}hitTestCircle(t,n,s,a,h){const _=t-s,w=t+s,E=n-s,C=n+s;if(w<0||_>this.width||C<0||E>this.height)return!1;const z=[];return this._forEachCell(_,E,w,C,this._queryCellCircle,z,{hitTest:!0,overlapMode:a,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},h),z.length>0}_queryCell(t,n,s,a,h,_,w,E){const{seenUids:C,hitTest:z,overlapMode:D}=w,$=this.boxCells[h];if($!==null){const ee=this.bboxes;for(const de of $)if(!C.box[de]){C.box[de]=!0;const re=4*de,Re=this.boxKeys[de];if(t<=ee[re+2]&&n<=ee[re+3]&&s>=ee[re+0]&&a>=ee[re+1]&&(!E||E(Re))&&(!z||!Il(D,Re.overlapMode))&&(_.push({key:Re,x1:ee[re],y1:ee[re+1],x2:ee[re+2],y2:ee[re+3]}),z))return!0}}const U=this.circleCells[h];if(U!==null){const ee=this.circles;for(const de of U)if(!C.circle[de]){C.circle[de]=!0;const re=3*de,Re=this.circleKeys[de];if(this._circleAndRectCollide(ee[re],ee[re+1],ee[re+2],t,n,s,a)&&(!E||E(Re))&&(!z||!Il(D,Re.overlapMode))){const Ke=ee[re],ie=ee[re+1],Zt=ee[re+2];if(_.push({key:Re,x1:Ke-Zt,y1:ie-Zt,x2:Ke+Zt,y2:ie+Zt}),z)return!0}}}return!1}_queryCellCircle(t,n,s,a,h,_,w,E){const{circle:C,seenUids:z,overlapMode:D}=w,$=this.boxCells[h];if($!==null){const ee=this.bboxes;for(const de of $)if(!z.box[de]){z.box[de]=!0;const re=4*de,Re=this.boxKeys[de];if(this._circleAndRectCollide(C.x,C.y,C.radius,ee[re+0],ee[re+1],ee[re+2],ee[re+3])&&(!E||E(Re))&&!Il(D,Re.overlapMode))return _.push(!0),!0}}const U=this.circleCells[h];if(U!==null){const ee=this.circles;for(const de of U)if(!z.circle[de]){z.circle[de]=!0;const re=3*de,Re=this.circleKeys[de];if(this._circlesCollide(ee[re],ee[re+1],ee[re+2],C.x,C.y,C.radius)&&(!E||E(Re))&&!Il(D,Re.overlapMode))return _.push(!0),!0}}}_forEachCell(t,n,s,a,h,_,w,E){const C=this._convertToXCellCoord(t),z=this._convertToYCellCoord(n),D=this._convertToXCellCoord(s),$=this._convertToYCellCoord(a);for(let U=C;U<=D;U++)for(let ee=z;ee<=$;ee++)if(h.call(this,t,n,s,a,this.xCellCount*ee+U,_,w,E))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,s,a,h,_){const w=a-t,E=h-n,C=s+_;return C*C>w*w+E*E}_circleAndRectCollide(t,n,s,a,h,_,w){const E=(_-a)/2,C=Math.abs(t-(a+E));if(C>E+s)return!1;const z=(w-h)/2,D=Math.abs(n-(h+z));if(D>z+s)return!1;if(C<=E||D<=z)return!0;const $=C-E,U=D-z;return $*$+U*U<=s*s}}function pc(d,t,n,s,a){const h=u.H();return t?(u.K(h,h,[1/a,1/a,1]),n||u.ae(h,h,s.angle)):u.L(h,s.labelPlaneMatrix,d),h}function zl(d,t,n,s,a){if(t){const h=u.af(d);return u.K(h,h,[a,a,1]),n||u.ae(h,h,-s.angle),h}return s.glCoordMatrix}function ze(d,t,n){let s;n?(s=[d.x,d.y,n(d.x,d.y),1],u.ag(s,s,t)):(s=[d.x,d.y,0,1],function(h,_,w){const E=_[0],C=_[1];h[0]=w[0]*E+w[4]*C+w[12],h[1]=w[1]*E+w[5]*C+w[13],h[3]=w[3]*E+w[7]*C+w[15]}(s,s,t));const a=s[3];return{point:new u.P(s[0]/a,s[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function O(d,t){return .5+d/t*.5}function F(d,t){return d.x>=-t[0]&&d.x<=t[0]&&d.y>=-t[1]&&d.y<=t[1]}function G(d,t,n,s,a,h,_,w,E,C,z,D,$,U,ee){const de=s?d.textSizeData:d.iconSizeData,re=u.ah(de,n.transform.zoom),Re=[256/n.width*2+1,256/n.height*2+1],Ke=s?d.text.dynamicLayoutVertexArray:d.icon.dynamicLayoutVertexArray;Ke.clear();const ie=d.lineVertexArray,Zt=s?d.text.placedSymbolArray:d.icon.placedSymbolArray,ti=n.transform.width/n.transform.height;let ni=!1;for(let yi=0;yi<Zt.length;yi++){const xi=Zt.get(yi);if(xi.hidden||xi.writingMode===u.ai.vertical&&!ni){qi(xi.numGlyphs,Ke);continue}ni=!1;const zi=ze(new u.P(xi.anchorX,xi.anchorY),t,ee);if(!F(zi.point,Re)){qi(xi.numGlyphs,Ke);continue}const Bi=O(n.transform.cameraToCenterDistance,zi.signedDistanceFromCamera),bi=u.aj(de,re,xi),wi=_?bi/Bi:bi*Bi,Oi={getElevation:ee,labelPlaneMatrix:a,lineVertexArray:ie,pitchWithMap:_,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:C,tileAnchorPoint:new u.P(xi.anchorX,xi.anchorY),unwrappedTileID:z,width:D,height:$,translation:U},Xi=Ht(Oi,xi,wi,!1,w,t,h,d.glyphOffsetArray,Ke,ti,E);ni=Xi.useVertical,(Xi.notEnoughRoom||ni||Xi.needsFlipping&&Ht(Oi,xi,wi,!0,w,t,h,d.glyphOffsetArray,Ke,ti,E).notEnoughRoom)&&qi(xi.numGlyphs,Ke)}s?d.text.dynamicLayoutVertexBuffer.updateData(Ke):d.icon.dynamicLayoutVertexBuffer.updateData(Ke)}function he(d,t,n,s,a,h,_,w){const E=h.glyphStartIndex+h.numGlyphs,C=h.lineStartIndex,z=h.lineStartIndex+h.lineLength,D=t.getoffsetX(h.glyphStartIndex),$=t.getoffsetX(E-1),U=ki(d*D,n,s,a,h.segment,C,z,w,_);if(!U)return null;const ee=ki(d*$,n,s,a,h.segment,C,z,w,_);return ee?w.projectionCache.anyProjectionOccluded?null:{first:U,last:ee}:null}function vt(d,t,n,s){return d===u.ai.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(d===u.ai.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function Ht(d,t,n,s,a,h,_,w,E,C,z){const D=n/24,$=t.lineOffsetX*D,U=t.lineOffsetY*D;let ee;if(t.numGlyphs>1){const de=t.glyphStartIndex+t.numGlyphs,re=t.lineStartIndex,Re=t.lineStartIndex+t.lineLength,Ke=he(D,w,$,U,s,t,z,d);if(!Ke)return{notEnoughRoom:!0};const ie=ze(Ke.first.point,_,d.getElevation).point,Zt=ze(Ke.last.point,_,d.getElevation).point;if(a&&!s){const ti=vt(t.writingMode,ie,Zt,C);if(ti)return ti}ee=[Ke.first];for(let ti=t.glyphStartIndex+1;ti<de-1;ti++)ee.push(ki(D*w.getoffsetX(ti),$,U,s,t.segment,re,Re,d,z));ee.push(Ke.last)}else{if(a&&!s){const re=ze(d.tileAnchorPoint,h,d.getElevation).point,Re=t.lineStartIndex+t.segment+1,Ke=new u.P(d.lineVertexArray.getx(Re),d.lineVertexArray.gety(Re)),ie=ze(Ke,h,d.getElevation),Zt=ie.signedDistanceFromCamera>0?ie.point:function(ni,yi,xi,zi,Bi,bi){return ei(ni,yi,xi,1,Bi,bi)}(d.tileAnchorPoint,Ke,re,0,h,d),ti=vt(t.writingMode,re,Zt,C);if(ti)return ti}const de=ki(D*w.getoffsetX(t.glyphStartIndex),$,U,s,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,d,z);if(!de||d.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};ee=[de]}for(const de of ee)u.ak(E,de.point,de.angle);return{}}function ei(d,t,n,s,a,h){const _=d.add(d.sub(t)._unit()),w=a!==void 0?ze(_,a,h.getElevation).point:di(_.x,_.y,h).point,E=n.sub(w);return n.add(E._mult(s/E.mag()))}function We(d,t,n){const s=t.projectionCache;if(s.projections[d])return s.projections[d];const a=new u.P(t.lineVertexArray.getx(d),t.lineVertexArray.gety(d)),h=di(a.x,a.y,t);if(h.signedDistanceFromCamera>0)return s.projections[d]=h.point,s.anyProjectionOccluded=s.anyProjectionOccluded||h.isOccluded,h.point;const _=d-n.direction;return function(w,E,C,z,D){return ei(w,E,C,z,void 0,D)}(n.distanceFromAnchor===0?t.tileAnchorPoint:new u.P(t.lineVertexArray.getx(_),t.lineVertexArray.gety(_)),a,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function di(d,t,n){const s=d+n.translation[0],a=t+n.translation[1];let h;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(h=n.projection.projectTileCoordinates(s,a,n.unwrappedTileID,n.getElevation),h.point.x=(.5*h.point.x+.5)*n.width,h.point.y=(.5*-h.point.y+.5)*n.height):(h=ze(new u.P(s,a),n.labelPlaneMatrix,n.getElevation),h.isOccluded=!1),h}function _i(d,t,n){return d._unit()._perp()._mult(t*n)}function ai(d,t,n,s,a,h,_,w,E){if(w.projectionCache.offsets[d])return w.projectionCache.offsets[d];const C=n.add(t);if(d+E.direction<s||d+E.direction>=a)return w.projectionCache.offsets[d]=C,C;const z=We(d+E.direction,w,E),D=_i(z.sub(n),_,E.direction),$=n.add(D),U=z.add(D);return w.projectionCache.offsets[d]=u.al(h,C,$,U)||C,w.projectionCache.offsets[d]}function ki(d,t,n,s,a,h,_,w,E){const C=s?d-t:d+t;let z=C>0?1:-1,D=0;s&&(z*=-1,D=Math.PI),z<0&&(D+=Math.PI);let $,U=z>0?h+a:h+a+1;w.projectionCache.cachedAnchorPoint?$=w.projectionCache.cachedAnchorPoint:($=di(w.tileAnchorPoint.x,w.tileAnchorPoint.y,w).point,w.projectionCache.cachedAnchorPoint=$);let ee,de,re=$,Re=$,Ke=0,ie=0;const Zt=Math.abs(C),ti=[];let ni;for(;Ke+ie<=Zt;){if(U+=z,U<h||U>=_)return null;Ke+=ie,Re=re,de=ee;const zi={absOffsetX:Zt,direction:z,distanceFromAnchor:Ke,previousVertex:Re};if(re=We(U,w,zi),n===0)ti.push(Re),ni=re.sub(Re);else{let Bi;const bi=re.sub(Re);Bi=bi.mag()===0?_i(We(U+z,w,zi).sub(re),n,z):_i(bi,n,z),de||(de=Re.add(Bi)),ee=ai(U,Bi,re,h,_,de,n,w,zi),ti.push(de),ni=ee.sub(de)}ie=ni.mag()}const yi=ni._mult((Zt-Ke)/ie)._add(de||Re),xi=D+Math.atan2(re.y-Re.y,re.x-Re.x);return ti.push(yi),{point:yi,angle:E?xi:0,path:ti}}const Ui=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function qi(d,t){for(let n=0;n<d;n++){const s=t.length;t.resize(s+4),t.float32.set(Ui,3*s)}}const en=100;class as{constructor(t,n,s=new ec(t.width+200,t.height+200,25),a=new ec(t.width+200,t.height+200,25)){this.transform=t,this.mapProjection=n,this.grid=s,this.ignoredGrid=a,this.pitchFactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+en,this.screenBottomBoundary=t.height+en,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,a,h,_,w,E,C,z,D){const $=t.anchorPointX+E[0],U=t.anchorPointY+E[1],ee=this.projectAndGetPerspectiveRatio(a,$,U,h,z),de=this._projectCollisionBox(t,s,a,h,_,w,E,ee,z,D),[re,Re,Ke,ie]=de.box;return this.mapProjection.useSpecialProjectionForSymbols&&(_?de.allPointsOccluded:this.mapProjection.isOccluded($,U,h))||ee.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(re,Re,Ke,ie)||n!=="always"&&this.grid.hitTest(re,Re,Ke,ie,n,C)?{box:[re,Re,Ke,ie],placeable:!1,offscreen:!1}:{box:[re,Re,Ke,ie],placeable:!0,offscreen:this.isOffscreen(re,Re,Ke,ie)}}placeCollisionCircles(t,n,s,a,h,_,w,E,C,z,D,$,U,ee,de,re){const Re=[],Ke=new u.P(n.anchorX,n.anchorY),ie=this.getPerspectiveRatio(_,Ke.x,Ke.y,w,re),Zt=(D?h/ie:h*ie)/u.aq,ti={getElevation:re,labelPlaneMatrix:E,lineVertexArray:s,pitchWithMap:D,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Ke,unwrappedTileID:w,width:this.transform.width,height:this.transform.height,translation:de},ni=he(Zt,a,n.lineOffsetX*Zt,n.lineOffsetY*Zt,!1,n,!1,ti);let yi=!1,xi=!1,zi=!0;if(ni){const Bi=.5*U*ie+ee,bi=new u.P(-100,-100),wi=new u.P(this.screenRightBoundary,this.screenBottomBoundary),Oi=new Yi,Xi=ni.first,Ei=ni.last;let Ai=[];for(let es=Xi.path.length-1;es>=1;es--)Ai.push(Xi.path[es]);for(let es=1;es<Ei.path.length;es++)Ai.push(Ei.path[es]);const Wi=2.5*Bi;if(C){const es=this.projectPathToScreenSpace(Ai,ti,C);Ai=es.some(ns=>ns.signedDistanceFromCamera<=0)?[]:es.map(ns=>ns.point)}let Ss=[];if(Ai.length>0){const es=Ai[0].clone(),ns=Ai[0].clone();for(let ks=1;ks<Ai.length;ks++)es.x=Math.min(es.x,Ai[ks].x),es.y=Math.min(es.y,Ai[ks].y),ns.x=Math.max(ns.x,Ai[ks].x),ns.y=Math.max(ns.y,Ai[ks].y);Ss=es.x>=bi.x&&ns.x<=wi.x&&es.y>=bi.y&&ns.y<=wi.y?[Ai]:ns.x<bi.x||es.x>wi.x||ns.y<bi.y||es.y>wi.y?[]:u.am([Ai],bi.x,bi.y,wi.x,wi.y)}for(const es of Ss){Oi.reset(es,.25*Bi);let ns=0;ns=Oi.length<=.5*Bi?1:Math.ceil(Oi.paddedLength/Wi)+1;for(let ks=0;ks<ns;ks++){const ea=ks/Math.max(ns-1,1),ja=Oi.lerp(ea),Es=ja.x+en,_a=ja.y+en;Re.push(Es,_a,Bi,0);const da=Es-Bi,ta=_a-Bi,ia=Es+Bi,Ua=_a+Bi;if(zi=zi&&this.isOffscreen(da,ta,ia,Ua),xi=xi||this.isInsideGrid(da,ta,ia,Ua),t!=="always"&&this.grid.hitTestCircle(Es,_a,Bi,t,$)&&(yi=!0,!z))return{circles:[],offscreen:!1,collisionDetected:yi}}}}return{circles:!z&&yi||!xi||ie<this.perspectiveRatioCutoff?[]:Re,offscreen:zi,collisionDetected:yi}}projectPathToScreenSpace(t,n,s){return t.map(a=>ze(a,s,n.getElevation))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,a=1/0,h=-1/0,_=-1/0;for(const z of t){const D=new u.P(z.x+en,z.y+en);s=Math.min(s,D.x),a=Math.min(a,D.y),h=Math.max(h,D.x),_=Math.max(_,D.y),n.push(D)}const w=this.grid.query(s,a,h,_).concat(this.ignoredGrid.query(s,a,h,_)),E={},C={};for(const z of w){const D=z.key;if(E[D.bucketInstanceId]===void 0&&(E[D.bucketInstanceId]={}),E[D.bucketInstanceId][D.featureIndex])continue;const $=[new u.P(z.x1,z.y1),new u.P(z.x2,z.y1),new u.P(z.x2,z.y2),new u.P(z.x1,z.y2)];u.an(n,$)&&(E[D.bucketInstanceId][D.featureIndex]=!0,C[D.bucketInstanceId]===void 0&&(C[D.bucketInstanceId]=[]),C[D.bucketInstanceId].push(D.featureIndex))}return C}insertCollisionBox(t,n,s,a,h,_){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:h,collisionGroupID:_,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,a,h,_){const w=s?this.ignoredGrid:this.grid,E={bucketInstanceId:a,featureIndex:h,collisionGroupID:_,overlapMode:n};for(let C=0;C<t.length;C+=4)w.insertCircle(E,t[C],t[C+1],t[C+2])}projectAndGetPerspectiveRatio(t,n,s,a,h){const _=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,s,a,h):ze(new u.P(n,s),t,h);return{point:new u.P((_.point.x+1)/2*this.transform.width+en,(1-_.point.y)/2*this.transform.height+en),perspectiveRatio:.5+this.transform.cameraToCenterDistance/_.signedDistanceFromCamera*.5,isOccluded:_.isOccluded,signedDistanceFromCamera:_.signedDistanceFromCamera}}getPerspectiveRatio(t,n,s,a,h){const _=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,s,a,h):ze(new u.P(n,s),t,h);return .5+this.transform.cameraToCenterDistance/_.signedDistanceFromCamera*.5}isOffscreen(t,n,s,a){return s<en||t>=this.screenRightBoundary||a<en||n>this.screenBottomBoundary}isInsideGrid(t,n,s,a){return s>=0&&t<this.gridRightBoundary&&a>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=u.ao([]);return u.J(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,s,a,h,_,w,E,C,z){const D=n*E.perspectiveRatio;let $=new u.P(1,0),U=new u.P(0,1);const ee=new u.P(t.anchorPointX+w[0],t.anchorPointY+w[1]);if(_&&!h){const Bi=this.projectAndGetPerspectiveRatio(s,ee.x+1,ee.y,a,C).point.sub(E.point).unit(),bi=Math.atan(Bi.y/Bi.x)+(Bi.x<0?Math.PI:0),wi=Math.sin(bi),Oi=Math.cos(bi);$=new u.P(Oi,wi),U=new u.P(-wi,Oi)}else if(!_&&h){const Bi=-this.transform.angle,bi=Math.sin(Bi),wi=Math.cos(Bi);$=new u.P(wi,bi),U=new u.P(-bi,wi)}let de=E.point,re=D;if(h){de=ee;const Bi=this.transform.zoom-Math.floor(this.transform.zoom);re=Math.pow(2,-Bi),re*=this.mapProjection.getPitchedTextCorrection(this.transform,ee,a),z||(re*=u.ad(.5+E.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}z&&(de=de.add($.mult(z.x*re)).add(U.mult(z.y*re)));const Re=t.x1*re,Ke=t.x2*re,ie=(Re+Ke)/2,Zt=t.y1*re,ti=t.y2*re,ni=(Zt+ti)/2,yi=[{offsetX:Re,offsetY:Zt},{offsetX:ie,offsetY:Zt},{offsetX:Ke,offsetY:Zt},{offsetX:Ke,offsetY:ni},{offsetX:Ke,offsetY:ti},{offsetX:ie,offsetY:ti},{offsetX:Re,offsetY:ti},{offsetX:Re,offsetY:ni}];let xi=[];for(const{offsetX:Bi,offsetY:bi}of yi)xi.push(new u.P(de.x+$.x*Bi+U.x*bi,de.y+$.y*Bi+U.y*bi));let zi=!1;if(h){const Bi=xi.map(bi=>this.projectAndGetPerspectiveRatio(s,bi.x,bi.y,a,C));zi=Bi.some(bi=>!bi.isOccluded),xi=Bi.map(bi=>bi.point)}else zi=!0;return{box:u.ap(xi),allPointsOccluded:!zi}}}function Qi(d,t,n){return t*(u.X/(d.tileSize*Math.pow(2,n-d.tileID.overscaledZ)))}class ys{constructor(t,n,s,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):a&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Ms{constructor(t,n,s,a,h){this.text=new ys(t?t.text:null,n,s,h),this.icon=new ys(t?t.icon:null,n,a,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Os{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class is{constructor(){this.invProjMatrix=u.H(),this.viewportMatrix=u.H(),this.circles=[]}}class ds{constructor(t,n,s,a,h){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=a,this.tileID=h}}class Cs{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function js(d,t,n,s,a){const{horizontalAlign:h,verticalAlign:_}=u.av(d);return new u.P(-(h-.5)*t+s[0]*a,-(_-.5)*n+s[1]*a)}class Js{constructor(t,n,s,a,h,_){this.transform=t.clone(),this.terrain=s,this.collisionIndex=new as(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Cs(h),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=_,_&&(_.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(s,a)=>n.getElevation(t,s,a):null}getBucketParts(t,n,s,a){const h=s.getBucket(n),_=s.latestFeatureIndex;if(!h||!_||n.id!==h.layerIds[0])return;const w=s.collisionBoxArray,E=h.layers[0].layout,C=h.layers[0].paint,z=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),D=s.tileSize/u.X,$=s.tileID.toUnwrapped(),U=this.transform.calculatePosMatrix($),ee=E.get("text-pitch-alignment")==="map",de=E.get("text-rotation-alignment")==="map",re=Qi(s,1,this.transform.zoom),Re=this.collisionIndex.mapProjection.translatePosition(this.transform,s,C.get("text-translate"),C.get("text-translate-anchor")),Ke=this.collisionIndex.mapProjection.translatePosition(this.transform,s,C.get("icon-translate"),C.get("icon-translate-anchor")),ie=pc(U,ee,de,this.transform,re);let Zt=null;if(ee){const ni=zl(U,ee,de,this.transform,re);Zt=u.L([],this.transform.labelPlaneMatrix,ni)}this.retainedQueryData[h.bucketInstanceId]=new ds(h.bucketInstanceId,_,h.sourceLayerIndex,h.index,s.tileID);const ti={bucket:h,layout:E,translationText:Re,translationIcon:Ke,posMatrix:U,unwrappedTileID:$,textLabelPlaneMatrix:ie,labelToScreenMatrix:Zt,scale:z,textPixelRatio:D,holdingForFade:s.holdingForFade(),collisionBoxArray:w,partiallyEvaluatedTextSize:u.ah(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(a)for(const ni of h.sortKeyRanges){const{sortKey:yi,symbolInstanceStart:xi,symbolInstanceEnd:zi}=ni;t.push({sortKey:yi,symbolInstanceStart:xi,symbolInstanceEnd:zi,parameters:ti})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:ti})}attemptAnchorPlacement(t,n,s,a,h,_,w,E,C,z,D,$,U,ee,de,re,Re,Ke,ie){const Zt=u.ar[t.textAnchor],ti=[t.textOffset0,t.textOffset1],ni=js(Zt,s,a,ti,h),yi=this.collisionIndex.placeCollisionBox(n,$,E,C,z,w,_,re,D.predicate,ie,ni);if((!Ke||this.collisionIndex.placeCollisionBox(Ke,$,E,C,z,w,_,Re,D.predicate,ie,ni).placeable)&&yi.placeable){let xi;if(this.prevPlacement&&this.prevPlacement.variableOffsets[U.crossTileID]&&this.prevPlacement.placements[U.crossTileID]&&this.prevPlacement.placements[U.crossTileID].text&&(xi=this.prevPlacement.variableOffsets[U.crossTileID].anchor),U.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[U.crossTileID]={textOffset:ti,width:s,height:a,anchor:Zt,textBoxScale:h,prevAnchor:xi},this.markUsedJustification(ee,Zt,U,de),ee.allowVerticalPlacement&&(this.markUsedOrientation(ee,de,U),this.placedOrientations[U.crossTileID]=de),{shift:ni,placedGlyphBoxes:yi}}}placeLayerBucketPart(t,n,s){const{bucket:a,layout:h,translationText:_,translationIcon:w,posMatrix:E,unwrappedTileID:C,textLabelPlaneMatrix:z,labelToScreenMatrix:D,textPixelRatio:$,holdingForFade:U,collisionBoxArray:ee,partiallyEvaluatedTextSize:de,collisionGroup:re}=t.parameters,Re=h.get("text-optional"),Ke=h.get("icon-optional"),ie=u.as(h,"text-overlap","text-allow-overlap"),Zt=ie==="always",ti=u.as(h,"icon-overlap","icon-allow-overlap"),ni=ti==="always",yi=h.get("text-rotation-alignment")==="map",xi=h.get("text-pitch-alignment")==="map",zi=h.get("icon-text-fit")!=="none",Bi=h.get("symbol-z-order")==="viewport-y",bi=Zt&&(ni||!a.hasIconData()||Ke),wi=ni&&(Zt||!a.hasTextData()||Re);!a.collisionArrays&&ee&&a.deserializeCollisionBoxes(ee);const Oi=this._getTerrainElevationFunc(this.retainedQueryData[a.bucketInstanceId].tileID),Xi=(Ei,Ai,Wi)=>{var Ss,es;if(n[Ei.crossTileID])return;if(U)return void(this.placements[Ei.crossTileID]=new Os(!1,!1,!1));let ns=!1,ks=!1,ea=!0,ja=null,Es={box:null,placeable:!1,offscreen:null},_a={box:null,placeable:!1,offscreen:null},da=null,ta=null,ia=null,Ua=0,Nc=0,zh=0;Ai.textFeatureIndex?Ua=Ai.textFeatureIndex:Ei.useRuntimeCollisionCircles&&(Ua=Ei.featureIndex),Ai.verticalTextFeatureIndex&&(Nc=Ai.verticalTextFeatureIndex);const cu=Ai.textBox;if(cu){const Ks=ra=>{let na=u.ai.horizontal;if(a.allowVerticalPlacement&&!ra&&this.prevPlacement){const Zs=this.prevPlacement.placedOrientations[Ei.crossTileID];Zs&&(this.placedOrientations[Ei.crossTileID]=Zs,na=Zs,this.markUsedOrientation(a,na,Ei))}return na},qa=(ra,na)=>{if(a.allowVerticalPlacement&&Ei.numVerticalGlyphVertices>0&&Ai.verticalTextBox){for(const Zs of a.writingModes)if(Zs===u.ai.vertical?(Es=na(),_a=Es):Es=ra(),Es&&Es.placeable)break}else Es=ra()},xc=Ei.textAnchorOffsetStartIndex,uu=Ei.textAnchorOffsetEndIndex;if(uu===xc){const ra=(na,Zs)=>{const Ps=this.collisionIndex.placeCollisionBox(na,ie,$,E,C,xi,yi,_,re.predicate,Oi);return Ps&&Ps.placeable&&(this.markUsedOrientation(a,Zs,Ei),this.placedOrientations[Ei.crossTileID]=Zs),Ps};qa(()=>ra(cu,u.ai.horizontal),()=>{const na=Ai.verticalTextBox;return a.allowVerticalPlacement&&Ei.numVerticalGlyphVertices>0&&na?ra(na,u.ai.vertical):{box:null,offscreen:null}}),Ks(Es&&Es.placeable)}else{let ra=u.ar[(es=(Ss=this.prevPlacement)===null||Ss===void 0?void 0:Ss.variableOffsets[Ei.crossTileID])===null||es===void 0?void 0:es.anchor];const na=(Ps,hu,qd)=>{const Us=Ps.x2-Ps.x1,Gp=Ps.y2-Ps.y1,Bh=Ei.textBoxScale,Rh=zi&&ti==="never"?hu:null;let bc=null,Hp=ie==="never"?1:2,Zd="never";ra&&Hp++;for(let Gd=0;Gd<Hp;Gd++){for(let Hd=xc;Hd<uu;Hd++){const Lh=a.textAnchorOffsets.get(Hd);if(ra&&Lh.textAnchor!==ra)continue;const du=this.attemptAnchorPlacement(Lh,Ps,Us,Gp,Bh,yi,xi,$,E,C,re,Zd,Ei,a,qd,_,w,Rh,Oi);if(du&&(bc=du.placedGlyphBoxes,bc&&bc.placeable))return ns=!0,ja=du.shift,bc}ra?ra=null:Zd=ie}return s&&!bc&&(bc={box:this.collisionIndex.placeCollisionBox(cu,"always",$,E,C,xi,yi,_,re.predicate,Oi,new u.P(0,0)).box,offscreen:!1,placeable:!1}),bc};qa(()=>na(cu,Ai.iconBox,u.ai.horizontal),()=>{const Ps=Ai.verticalTextBox;return a.allowVerticalPlacement&&(!Es||!Es.placeable)&&Ei.numVerticalGlyphVertices>0&&Ps?na(Ps,Ai.verticalIconBox,u.ai.vertical):{box:null,occluded:!0,offscreen:null}}),Es&&(ns=Es.placeable,ea=Es.offscreen);const Zs=Ks(Es&&Es.placeable);if(!ns&&this.prevPlacement){const Ps=this.prevPlacement.variableOffsets[Ei.crossTileID];Ps&&(this.variableOffsets[Ei.crossTileID]=Ps,this.markUsedJustification(a,Ps.anchor,Ei,Zs))}}}if(da=Es,ns=da&&da.placeable,ea=da&&da.offscreen,Ei.useRuntimeCollisionCircles){const Ks=a.text.placedSymbolArray.get(Ei.centerJustifiedTextSymbolIndex),qa=u.aj(a.textSizeData,de,Ks),xc=h.get("text-padding");ta=this.collisionIndex.placeCollisionCircles(ie,Ks,a.lineVertexArray,a.glyphOffsetArray,qa,E,C,z,D,s,xi,re.predicate,Ei.collisionCircleDiameter,xc,_,Oi),ta.circles.length&&ta.collisionDetected&&!s&&u.w("Collisions detected, but collision boxes are not shown"),ns=Zt||ta.circles.length>0&&!ta.collisionDetected,ea=ea&&ta.offscreen}if(Ai.iconFeatureIndex&&(zh=Ai.iconFeatureIndex),Ai.iconBox){const Ks=qa=>this.collisionIndex.placeCollisionBox(qa,ti,$,E,C,xi,yi,w,re.predicate,Oi,zi&&ja?ja:void 0);_a&&_a.placeable&&Ai.verticalIconBox?(ia=Ks(Ai.verticalIconBox),ks=ia.placeable):(ia=Ks(Ai.iconBox),ks=ia.placeable),ea=ea&&ia.offscreen}const $c=Re||Ei.numHorizontalGlyphVertices===0&&Ei.numVerticalGlyphVertices===0,Dh=Ke||Ei.numIconVertices===0;$c||Dh?Dh?$c||(ks=ks&&ns):ns=ks&&ns:ks=ns=ks&&ns;const Ud=ks&&ia.placeable;if(ns&&da.placeable&&this.collisionIndex.insertCollisionBox(da.box,ie,h.get("text-ignore-placement"),a.bucketInstanceId,_a&&_a.placeable&&Nc?Nc:Ua,re.ID),Ud&&this.collisionIndex.insertCollisionBox(ia.box,ti,h.get("icon-ignore-placement"),a.bucketInstanceId,zh,re.ID),ta&&ns&&this.collisionIndex.insertCollisionCircles(ta.circles,ie,h.get("text-ignore-placement"),a.bucketInstanceId,Ua,re.ID),s&&this.storeCollisionData(a.bucketInstanceId,Wi,Ai,da,ia,ta),Ei.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(a.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ei.crossTileID]=new Os(ns||bi,ks||wi,ea||a.justReloaded),n[Ei.crossTileID]=!0};if(Bi){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ei=a.getSortedSymbolIndexes(this.transform.angle);for(let Ai=Ei.length-1;Ai>=0;--Ai){const Wi=Ei[Ai];Xi(a.symbolInstances.get(Wi),a.collisionArrays[Wi],Wi)}}else for(let Ei=t.symbolInstanceStart;Ei<t.symbolInstanceEnd;Ei++)Xi(a.symbolInstances.get(Ei),a.collisionArrays[Ei],Ei);if(s&&a.bucketInstanceId in this.collisionCircleArrays){const Ei=this.collisionCircleArrays[a.bucketInstanceId];u.at(Ei.invProjMatrix,E),Ei.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1}storeCollisionData(t,n,s,a,h,_){if(s.textBox||s.iconBox){let w,E;this.collisionBoxArrays.has(t)?w=this.collisionBoxArrays.get(t):(w=new Map,this.collisionBoxArrays.set(t,w)),w.has(n)?E=w.get(n):(E={text:null,icon:null},w.set(n,E)),s.textBox&&(E.text=a.box),s.iconBox&&(E.icon=h.box)}if(_){let w=this.collisionCircleArrays[t];w===void 0&&(w=this.collisionCircleArrays[t]=new is);for(let E=0;E<_.circles.length;E+=4)w.circles.push(_.circles[E+0]),w.circles.push(_.circles[E+1]),w.circles.push(_.circles[E+2]),w.circles.push(_.collisionDetected?1:0)}}markUsedJustification(t,n,s,a){let h;h=a===u.ai.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[u.au(n)];const _=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const w of _)w>=0&&(t.text.placedSymbolArray.get(w).crossTileID=h>=0&&w!==h?0:s.crossTileID)}markUsedOrientation(t,n,s){const a=n===u.ai.horizontal||n===u.ai.horizontalOnly?n:0,h=n===u.ai.vertical?n:0,_=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const w of _)t.text.placedSymbolArray.get(w).placedOrientation=a;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const a=n?n.symbolFadeChange(t):1,h=n?n.opacities:{},_=n?n.variableOffsets:{},w=n?n.placedOrientations:{};for(const E in this.placements){const C=this.placements[E],z=h[E];z?(this.opacities[E]=new Ms(z,a,C.text,C.icon),s=s||C.text!==z.text.placed||C.icon!==z.icon.placed):(this.opacities[E]=new Ms(null,a,C.text,C.icon,C.skipFade),s=s||C.text||C.icon)}for(const E in h){const C=h[E];if(!this.opacities[E]){const z=new Ms(C,a,!1,!1);z.isHidden()||(this.opacities[E]=z,s=s||C.text.placed||C.icon.placed)}}for(const E in _)this.variableOffsets[E]||!this.opacities[E]||this.opacities[E].isHidden()||(this.variableOffsets[E]=_[E]);for(const E in w)this.placedOrientations[E]||!this.opacities[E]||this.opacities[E].isHidden()||(this.placedOrientations[E]=w[E]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const a of n){const h=a.getBucket(t);h&&a.latestFeatureIndex&&t.id===h.layerIds[0]&&this.updateBucketOpacities(h,a.tileID,s,a.collisionBoxArray)}}updateBucketOpacities(t,n,s,a){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const h=t.layers[0],_=h.layout,w=new Ms(null,0,!1,!1,!0),E=_.get("text-allow-overlap"),C=_.get("icon-allow-overlap"),z=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),D=_.get("text-rotation-alignment")==="map",$=_.get("text-pitch-alignment")==="map",U=_.get("icon-text-fit")!=="none",ee=new Ms(null,0,E&&(C||!t.hasIconData()||_.get("icon-optional")),C&&(E||!t.hasTextData()||_.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const de=(Re,Ke,ie)=>{for(let Zt=0;Zt<Ke/4;Zt++)Re.opacityVertexArray.emplaceBack(ie);Re.hasVisibleVertices=Re.hasVisibleVertices||ie!==Qs},re=this.collisionBoxArrays.get(t.bucketInstanceId);for(let Re=0;Re<t.symbolInstances.length;Re++){const Ke=t.symbolInstances.get(Re),{numHorizontalGlyphVertices:ie,numVerticalGlyphVertices:Zt,crossTileID:ti}=Ke;let ni=this.opacities[ti];s[ti]?ni=w:ni||(ni=ee,this.opacities[ti]=ni),s[ti]=!0;const yi=Ke.numIconVertices>0,xi=this.placedOrientations[Ke.crossTileID],zi=xi===u.ai.vertical,Bi=xi===u.ai.horizontal||xi===u.ai.horizontalOnly;if(ie>0||Zt>0){const wi=Ca(ni.text);de(t.text,ie,zi?Qs:wi),de(t.text,Zt,Bi?Qs:wi);const Oi=ni.text.isHidden();[Ke.rightJustifiedTextSymbolIndex,Ke.centerJustifiedTextSymbolIndex,Ke.leftJustifiedTextSymbolIndex].forEach(Ai=>{Ai>=0&&(t.text.placedSymbolArray.get(Ai).hidden=Oi||zi?1:0)}),Ke.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(Ke.verticalPlacedTextSymbolIndex).hidden=Oi||Bi?1:0);const Xi=this.variableOffsets[Ke.crossTileID];Xi&&this.markUsedJustification(t,Xi.anchor,Ke,xi);const Ei=this.placedOrientations[Ke.crossTileID];Ei&&(this.markUsedJustification(t,"left",Ke,Ei),this.markUsedOrientation(t,Ei,Ke))}if(yi){const wi=Ca(ni.icon),Oi=!(U&&Ke.verticalPlacedIconSymbolIndex&&zi);Ke.placedIconSymbolIndex>=0&&(de(t.icon,Ke.numIconVertices,Oi?wi:Qs),t.icon.placedSymbolArray.get(Ke.placedIconSymbolIndex).hidden=ni.icon.isHidden()),Ke.verticalPlacedIconSymbolIndex>=0&&(de(t.icon,Ke.numVerticalIconVertices,Oi?Qs:wi),t.icon.placedSymbolArray.get(Ke.verticalPlacedIconSymbolIndex).hidden=ni.icon.isHidden())}const bi=re&&re.has(Re)?re.get(Re):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const wi=t.collisionArrays[Re];if(wi){let Oi=new u.P(0,0);if(wi.textBox||wi.verticalTextBox){let Xi=!0;if(z){const Ei=this.variableOffsets[ti];Ei?(Oi=js(Ei.anchor,Ei.width,Ei.height,Ei.textOffset,Ei.textBoxScale),D&&Oi._rotate($?this.transform.angle:-this.transform.angle)):Xi=!1}if(wi.textBox||wi.verticalTextBox){let Ei;wi.textBox&&(Ei=zi),wi.verticalTextBox&&(Ei=Bi),Ys(t.textCollisionBox.collisionVertexArray,ni.text.placed,!Xi||Ei,bi.text,Oi.x,Oi.y)}}if(wi.iconBox||wi.verticalIconBox){const Xi=!!(!Bi&&wi.verticalIconBox);let Ei;wi.iconBox&&(Ei=Xi),wi.verticalIconBox&&(Ei=!Xi),Ys(t.iconCollisionBox.collisionVertexArray,ni.icon.placed,Ei,bi.icon,U?Oi.x:0,U?Oi.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 Re=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=Re.invProjMatrix,t.placementViewportMatrix=Re.viewportMatrix,t.collisionCircleArray=Re.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.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function Ys(d,t,n,s,a,h){s&&s.length!==0||(s=[0,0,0,0]);const _=s[0]-en,w=s[1]-en,E=s[2]-en,C=s[3]-en;d.emplaceBack(t?1:0,n?1:0,a||0,h||0,_,w),d.emplaceBack(t?1:0,n?1:0,a||0,h||0,E,w),d.emplaceBack(t?1:0,n?1:0,a||0,h||0,E,C),d.emplaceBack(t?1:0,n?1:0,a||0,h||0,_,C)}const Eu=Math.pow(2,25),ps=Math.pow(2,24),Kh=Math.pow(2,17),Xh=Math.pow(2,16),Ea=Math.pow(2,9),Ta=Math.pow(2,8),yf=Math.pow(2,1);function Ca(d){if(d.opacity===0&&!d.placed)return 0;if(d.opacity===1&&d.placed)return 4294967295;const t=d.placed?1:0,n=Math.floor(127*d.opacity);return n*Eu+t*ps+n*Kh+t*Xh+n*Ea+t*Ta+n*yf+t}const Qs=0;function ih(){return{isOccluded:(d,t,n)=>!1,getPitchedTextCorrection:(d,t,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(d,t,n,s){throw new Error("Not implemented.")},translatePosition:(d,t,n,s)=>function(a,h,_,w,E=!1){if(!_[0]&&!_[1])return[0,0];const C=E?w==="map"?a.angle:0:w==="viewport"?-a.angle:0;if(C){const z=Math.sin(C),D=Math.cos(C);_=[_[0]*D-_[1]*z,_[0]*z+_[1]*D]}return[E?_[0]:Qi(h,_[0],a.zoom),E?_[1]:Qi(h,_[1],a.zoom)]}(d,t,n,s),getCircleRadiusCorrection:d=>1}}class Tu{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,s,a,h){const _=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(_,a,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,_.sort((w,E)=>w.sortKey-E.sortKey));this._currentPartIndex<_.length;)if(n.placeLayerBucketPart(_[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class Vs{constructor(t,n,s,a,h,_,w,E){this.placement=new Js(t,ih(),n,_,w,E),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const a=H.now(),h=()=>!this._forceFullPlacement&&H.now()-a>2;for(;this._currentPlacementIndex>=0;){const _=n[t[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(_.type==="symbol"&&(!_.minzoom||_.minzoom<=w)&&(!_.maxzoom||_.maxzoom>w)){if(this._inProgressLayer||(this._inProgressLayer=new Tu(_)),this._inProgressLayer.continuePlacement(s[_.source],this.placement,this._showCollisionBoxes,_,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const tc=512/u.X/2;class Ic{constructor(t,n,s){this.tileID=t,this.bucketInstanceId=s,this._symbolsByKey={};const a=new Map;for(let h=0;h<n.length;h++){const _=n.get(h),w=_.key,E=a.get(w);E?E.push(_):a.set(w,[_])}for(const[h,_]of a){const w={positions:_.map(E=>({x:Math.floor(E.anchorX*tc),y:Math.floor(E.anchorY*tc)})),crossTileIDs:_.map(E=>E.crossTileID)};if(w.positions.length>128){const E=new u.aw(w.positions.length,16,Uint16Array);for(const{x:C,y:z}of w.positions)E.add(C,z);E.finish(),delete w.positions,w.index=E}this._symbolsByKey[h]=w}}getScaledCoordinates(t,n){const{x:s,y:a,z:h}=this.tileID.canonical,{x:_,y:w,z:E}=n.canonical,C=tc/Math.pow(2,E-h),z=(w*u.X+t.anchorY)*C,D=a*u.X*tc;return{x:Math.floor((_*u.X+t.anchorX)*C-s*u.X*tc),y:Math.floor(z-D)}}findMatches(t,n,s){const a=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let h=0;h<t.length;h++){const _=t.get(h);if(_.crossTileID)continue;const w=this._symbolsByKey[_.key];if(!w)continue;const E=this.getScaledCoordinates(_,n);if(w.index){const C=w.index.range(E.x-a,E.y-a,E.x+a,E.y+a).sort();for(const z of C){const D=w.crossTileIDs[z];if(!s[D]){s[D]=!0,_.crossTileID=D;break}}}else if(w.positions)for(let C=0;C<w.positions.length;C++){const z=w.positions[C],D=w.crossTileIDs[C];if(Math.abs(z.x-E.x)<=a&&Math.abs(z.y-E.y)<=a&&!s[D]){s[D]=!0,_.crossTileID=D;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Rs{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class rh{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const a=this.indexes[s],h={};for(const _ in a){const w=a[_];w.tileID=w.tileID.unwrapTo(w.tileID.wrap+n),h[w.tileID.key]=w}this.indexes[s]=h}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let h=0;h<n.symbolInstances.length;h++)n.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const a=this.usedCrossTileIDs[t.overscaledZ];for(const h in this.indexes){const _=this.indexes[h];if(Number(h)>t.overscaledZ)for(const w in _){const E=_[w];E.tileID.isChildOf(t)&&E.findMatches(n.symbolInstances,t,a)}else{const w=_[t.scaledTo(Number(h)).key];w&&w.findMatches(n.symbolInstances,t,a)}}for(let h=0;h<n.symbolInstances.length;h++){const _=n.symbolInstances.get(h);_.crossTileID||(_.crossTileID=s.generate(),a[_.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ic(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s of n.getCrossTileIDsLists())for(const a of s)delete this.usedCrossTileIDs[t][a]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const a=this.indexes[s];for(const h in a)t[a[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,a[h]),delete a[h],n=!0)}return n}}class Ba{constructor(){this.layerIndexes={},this.crossTileIDs=new Rs,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let a=this.layerIndexes[t.id];a===void 0&&(a=this.layerIndexes[t.id]=new rh);let h=!1;const _={};a.handleWrapJump(s);for(const w of n){const E=w.getBucket(t);E&&t.id===E.layerIds[0]&&(E.bucketInstanceId||(E.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(w.tileID,E,this.crossTileIDs)&&(h=!0),_[E.bucketInstanceId]=!0)}return a.removeStaleBuckets(_)&&(h=!0),h}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}const Cu=(d,t)=>u.t(d,t&&t.filter(n=>n.identifier!=="source.canvas")),fc=u.ax();class Jh extends u.E{constructor(t,n={}){super(),this._rtlPluginLoaded=()=>{for(const s in this.sourceCaches){const a=this.sourceCaches[s].getSource().type;a!=="vector"&&a!=="geojson"||this.sourceCaches[s].reload()}},this.map=t,this.dispatcher=new Ac(Cc(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(s,a)=>this.getGlyphs(s,a)),this.dispatcher.registerMessageHandler("GI",(s,a)=>this.getImages(s,a)),this.imageManager=new Fs,this.imageManager.setEventedParent(this),this.glyphManager=new Xa(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Wc(256,512),this.crossTileSymbolIndex=new Ba,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",u.az()),Qa().on(Si,this._rtlPluginLoaded),this.on("data",s=>{if(s.dataType!=="source"||s.sourceDataType!=="metadata")return;const a=this.sourceCaches[s.sourceId];if(!a)return;const h=a.getSource();if(h&&h.vectorLayerIds)for(const _ in this._layers){const w=this._layers[_];w.source===h.id&&this._validateLayer(w)}})}loadURL(t,n={},s){this.fire(new u.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const a=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const h=this._loadStyleRequest;u.h(a,this._loadStyleRequest).then(_=>{this._loadStyleRequest=null,this._load(_.data,n,s)}).catch(_=>{this._loadStyleRequest=null,_&&!h.signal.aborted&&this.fire(new u.j(_))})}loadJSON(t,n={},s){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,H.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,s)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(fc,{validate:!1})}_load(t,n,s){var a;const h=n.transformStyle?n.transformStyle(s,t):t;if(!n.validate||!Cu(this,u.x(h))){this._loaded=!0,this.stylesheet=h;for(const _ in h.sources)this.addSource(_,h.sources[_],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs),this._createLayers(),this.light=new Jl(this.stylesheet.light),this.sky=new Fa(this.stylesheet.sky),this.map.setTerrain((a=this.stylesheet.terrain)!==null&&a!==void 0?a:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const t=u.aA(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const s=u.aB(n);s.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=s}}_loadSprite(t,n=!1,s=void 0){let a;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,_,w,E){return u._(this,void 0,void 0,function*(){const C=Ji(h),z=w>1?"@2x":"",D={},$={};for(const{id:U,url:ee}of C){const de=_.transformRequest($s(ee,z,".json"),"SpriteJSON");D[U]=u.h(de,E);const re=_.transformRequest($s(ee,z,".png"),"SpriteImage");$[U]=si.getImage(re,E)}return yield Promise.all([...Object.values(D),...Object.values($)]),function(U,ee){return u._(this,void 0,void 0,function*(){const de={};for(const re in U){de[re]={};const Re=H.getImageCanvasContext((yield ee[re]).data),Ke=(yield U[re]).data;for(const ie in Ke){const{width:Zt,height:ti,x:ni,y:yi,sdf:xi,pixelRatio:zi,stretchX:Bi,stretchY:bi,content:wi,textFitWidth:Oi,textFitHeight:Xi}=Ke[ie];de[re][ie]={data:null,pixelRatio:zi,sdf:xi,stretchX:Bi,stretchY:bi,content:wi,textFitWidth:Oi,textFitHeight:Xi,spriteData:{width:Zt,height:ti,x:ni,y:yi,context:Re}}}}return de})}(D,$)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const _ in h){this._spritesImagesIds[_]=[];const w=this._spritesImagesIds[_]?this._spritesImagesIds[_].filter(E=>!(E in h)):[];for(const E of w)this.imageManager.removeImage(E),this._changedImages[E]=!0;for(const E in h[_]){const C=_==="default"?E:`${_}:${E}`;this._spritesImagesIds[_].push(C),C in this.imageManager.images?this.imageManager.updateImage(C,h[_][E],!1):this.imageManager.addImage(C,h[_][E]),n&&(this._changedImages[C]=!0)}}}).catch(h=>{this._spriteRequest=null,a=h,this.fire(new u.j(a))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),s&&s(a)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const a=n.getSource();(a.type==="geojson"||a.vectorLayerIds&&a.vectorLayerIds.indexOf(s)===-1)&&this.fire(new u.j(new Error(`Source layer "${s}" does not exist on source "${a.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()}_serializeByIds(t){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const s=[];for(const a of t)n[a]&&s.push(n[a]);return s}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const s of n){const a=this._layers[s];a.type!=="custom"&&(t[s]=a.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.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(n){const a=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(a.length||h.length)&&this._updateWorkerLayers(a,h);for(const _ in this._updatedSources){const w=this._updatedSources[_];if(w==="reload")this._reloadSource(_);else{if(w!=="clear")throw new Error(`Invalid action ${w}`);this._clearSource(_)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const _ in this._updatedPaintProps)this._layers[_].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const s={};for(const a in this.sourceCaches){const h=this.sourceCaches[a];s[a]=h.used,h.used=!1}for(const a of this._order){const h=this._layers[a];h.recalculate(t,this._availableImages),!h.isHidden(t.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const a in s){const h=this.sourceCaches[a];!!s[a]!=!!h.used&&h.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:a}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,n&&this.fire(new u.k("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={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){var s;this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,((s=n.validate)===null||s===void 0||s)&&Cu(this,u.x(t)))return!1;(t=u.aC(t)).layers=u.aA(t.layers);const h=u.aD(a,t),_=this._getOperationsToPerform(h);if(_.unimplemented.length>0)throw new Error(`Unimplemented: ${_.unimplemented.join(", ")}.`);if(_.operations.length===0)return!1;for(const w of _.operations)w();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const n=[],s=[];for(const a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,a.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,a.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,a.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,a.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,a.args));break;case"addSource":n.push(()=>this.addSource.apply(this,a.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,a.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,a.args));break;case"setLight":n.push(()=>this.setLight.apply(this,a.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,a.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,a.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,a.args));break;case"setSky":n.push(()=>this.setSky.apply(this,a.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,a.args));break;case"setTransition":n.push(()=>{});break;default:s.push(a.command)}return{operations:n,unimplemented:s}}addImage(t,n){if(this.getImage(t))return this.fire(new u.j(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 u.j(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("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){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(u.x.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const a=this.sourceCaches[t]=new Hi(t,n,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:t})),a.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 s in this._layers)if(this._layers[s].source===t)return this.fire(new u.j(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new u.k("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 s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const a=t.id;if(this.getLayer(a))return void this.fire(new u.j(new Error(`Layer "${a}" already exists on this map.`)));let h;if(t.type==="custom"){if(Cu(this,u.aE(t)))return;h=u.aB(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(a,t.source),t=u.aC(t),t=u.e(t,{source:a})),this._validate(u.x.layer,`layers.${a}`,t,{arrayIndex:-1},s))return;h=u.aB(t),this._validateLayer(h),h.setEventedParent(this,{layer:{id:a}})}const _=n?this._order.indexOf(n):this._order.length;if(n&&_===-1)this.fire(new u.j(new Error(`Cannot add layer "${a}" before non-existing layer "${n}".`)));else{if(this._order.splice(_,0,a),this._layerOrderChanged=!0,this._layers[a]=h,this._removedLayers[a]&&h.source&&h.type!=="custom"){const w=this._removedLayers[a];delete this._removedLayers[a],w.type!==h.type?this._updatedSources[h.source]="clear":(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause())}this._updateLayer(h),h.onAdd&&h.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new u.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const a=n?this._order.indexOf(n):this._order.length;n&&a===-1?this.fire(new u.j(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(a,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const a=this.getLayer(t);a?a.minzoom===n&&a.maxzoom===s||(n!=null&&(a.minzoom=n),s!=null&&(a.maxzoom=s),this._updateLayer(a)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const a=this.getLayer(t);if(a){if(!u.aF(a.filter,n))return n==null?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(u.x.filter,`layers.${a.id}.filter`,n,null,s)||(a.filter=u.aC(n),this._updateLayer(a)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return u.aC(this.getLayer(t).filter)}setLayoutProperty(t,n,s,a={}){this._checkLoaded();const h=this.getLayer(t);h?u.aF(h.getLayoutProperty(n),s)||(h.setLayoutProperty(n,s,a),this._updateLayer(h)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,a={}){this._checkLoaded();const h=this.getLayer(t);h?u.aF(h.getPaintProperty(n),s)||(h.setPaintProperty(n,s,a)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new u.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,a=t.sourceLayer,h=this.sourceCaches[s];if(h===void 0)return void this.fire(new u.j(new Error(`The source '${s}' does not exist in the map's style.`)));const _=h.getSource().type;_==="geojson"&&a?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):_!=="vector"||a?(t.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),h.setFeatureState(a,t.id,n)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,a=this.sourceCaches[s];if(a===void 0)return void this.fire(new u.j(new Error(`The source '${s}' does not exist in the map's style.`)));const h=a.getSource().type,_=h==="vector"?t.sourceLayer:void 0;h!=="vector"||_?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(_,t.id,n):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,a=this.sourceCaches[n];if(a!==void 0)return a.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),a.getFeatureState(s,t.id)):void this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=u.aG(this.sourceCaches,h=>h.serialize()),n=this._serializeByIds(this._order),s=this.map.getTerrain()||void 0,a=this.stylesheet;return u.aH({version:a.version,name:a.name,metadata:a.metadata,light:a.light,sky:a.sky,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n,terrain:s},h=>h!==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._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=_=>this._layers[_].type==="fill-extrusion",s={},a=[];for(let _=this._order.length-1;_>=0;_--){const w=this._order[_];if(n(w)){s[w]=_;for(const E of t){const C=E[w];if(C)for(const z of C)a.push(z)}}}a.sort((_,w)=>w.intersectionZ-_.intersectionZ);const h=[];for(let _=this._order.length-1;_>=0;_--){const w=this._order[_];if(n(w))for(let E=a.length-1;E>=0;E--){const C=a[E].feature;if(s[C.layer.id]<_)break;h.push(C),a.pop()}else for(const E of t){const C=E[w];if(C)for(const z of C)h.push(z.feature)}}return h}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(u.x.filter,"queryRenderedFeatures.filter",n.filter,null,n);const a={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new u.j(new Error("parameters.layers must be an Array."))),[];for(const w of n.layers){const E=this._layers[w];if(!E)return this.fire(new u.j(new Error(`The layer '${w}' does not exist in the map's style and cannot be queried for features.`))),[];a[E.source]=!0}}const h=[];n.availableImages=this._availableImages;const _=this._serializedAllLayers();for(const w in this.sourceCaches)n.layers&&!a[w]||h.push(cc(this.sourceCaches[w],this._layers,_,t,n,s));return this.placement&&h.push(function(w,E,C,z,D,$,U){const ee={},de=$.queryRenderedSymbols(z),re=[];for(const Re of Object.keys(de).map(Number))re.push(U[Re]);re.sort(uc);for(const Re of re){const Ke=Re.featureIndex.lookupSymbolFeatures(de[Re.bucketInstanceId],E,Re.bucketIndex,Re.sourceLayerIndex,D.filter,D.layers,D.availableImages,w);for(const ie in Ke){const Zt=ee[ie]=ee[ie]||[],ti=Ke[ie];ti.sort((ni,yi)=>{const xi=Re.featureSortOrder;if(xi){const zi=xi.indexOf(ni.featureIndex);return xi.indexOf(yi.featureIndex)-zi}return yi.featureIndex-ni.featureIndex});for(const ni of ti)Zt.push(ni)}}for(const Re in ee)ee[Re].forEach(Ke=>{const ie=Ke.feature,Zt=C[w[Re].source].getFeatureState(ie.layer["source-layer"],ie.id);ie.source=ie.layer.source,ie.layer["source-layer"]&&(ie.sourceLayer=ie.layer["source-layer"]),ie.state=Zt});return ee}(this._layers,_,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(t,n){n&&n.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(a,h){const _=a.getRenderableIds().map(C=>a.getTileByID(C)),w=[],E={};for(let C=0;C<_.length;C++){const z=_[C],D=z.tileID.canonical.key;E[D]||(E[D]=!0,z.querySourceFeatures(w,h))}return w}(s,n):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let a=!1;for(const _ in t)if(!u.aF(t[_],s[_])){a=!0;break}if(!a)return;const h={now:H.now(),transition:u.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(h)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){const s=this.sky.getSky();let a=!1;t||s&&(a=!0);for(const _ in t)if(!u.aF(t[_],s[_])){a=!0;break}if(!a)return;const h={now:H.now(),transition:u.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(h)}_validate(t,n,s,a,h={}){return(!h||h.validate!==!1)&&Cu(this,t.call(u.x,u.e({key:n,style:this.serialize(),value:s,styleSpec:u.v},a)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Qa().off(Si,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const s=this.sourceCaches[n];s.setEventedParent(null),s.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,a,h=!1){let _=!1,w=!1;const E={};for(const C of this._order){const z=this._layers[C];if(z.type!=="symbol")continue;if(!E[z.source]){const $=this.sourceCaches[z.source];E[z.source]=$.getRenderableIds(!0).map(U=>$.getTileByID(U)).sort((U,ee)=>ee.tileID.overscaledZ-U.tileID.overscaledZ||(U.tileID.isLessThan(ee.tileID)?-1:1))}const D=this.crossTileSymbolIndex.addLayer(z,E[z.source],t.center.lng);_=_||D}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(H.now(),t.zoom))&&(this.pauseablePlacement=new Vs(t,this.map.terrain,this._order,h,n,s,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,E),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(H.now()),w=!0),_&&this.pauseablePlacement.placement.setStale()),w||_)for(const C of this._order){const z=this._layers[C];z.type==="symbol"&&this.placement.updateLayerOpacities(z,E[z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(H.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n){return u._(this,void 0,void 0,function*(){const s=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,n.icons),s})}getGlyphs(t,n){return u._(this,void 0,void 0,function*(){const s=yield this.glyphManager.getGlyphs(n.stacks),a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,[""]),s})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(u.x.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,s={},a){this._checkLoaded();const h=[{id:t,url:n}],_=[...Ji(this.stylesheet.sprite),...h];this._validate(u.x.sprite,"sprite",_,null,s)||(this.stylesheet.sprite=_,this._loadSprite(h,!0,a))}removeSprite(t){this._checkLoaded();const n=Ji(this.stylesheet.sprite);if(n.find(s=>s.id===t)){if(this._spritesImagesIds[t])for(const s of this._spritesImagesIds[t])this.imageManager.removeImage(s),this._changedImages[s]=!0;n.splice(n.findIndex(s=>s.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Ji(this.stylesheet.sprite)}setSprite(t,n={},s){this._checkLoaded(),t&&this._validate(u.x.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,s):(this._unloadSprite(),s&&s(null)))}}var Au=u.Y([{name:"a_pos",type:"Int16",components:2}]);const mc={prelude:hs(`#ifdef GL_ES
|
11
|
-
precision mediump float;
|
12
|
-
#else
|
13
|
-
#if !defined(lowp)
|
14
|
-
#define lowp
|
15
|
-
#endif
|
16
|
-
#if !defined(mediump)
|
17
|
-
#define mediump
|
18
|
-
#endif
|
19
|
-
#if !defined(highp)
|
20
|
-
#define highp
|
21
|
-
#endif
|
22
|
-
#endif
|
23
|
-
`,`#ifdef GL_ES
|
24
|
-
precision highp float;
|
25
|
-
#else
|
26
|
-
#if !defined(lowp)
|
27
|
-
#define lowp
|
28
|
-
#endif
|
29
|
-
#if !defined(mediump)
|
30
|
-
#define mediump
|
31
|
-
#endif
|
32
|
-
#if !defined(highp)
|
33
|
-
#define highp
|
34
|
-
#endif
|
35
|
-
#endif
|
36
|
-
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
37
|
-
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
|
38
|
-
#ifdef TERRAIN3D
|
39
|
-
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
40
|
-
#endif
|
41
|
-
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
|
42
|
-
#ifdef TERRAIN3D
|
43
|
-
highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
44
|
-
#else
|
45
|
-
return 1.0;
|
46
|
-
#endif
|
47
|
-
}float calculate_visibility(vec4 pos) {
|
48
|
-
#ifdef TERRAIN3D
|
49
|
-
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
|
50
|
-
#else
|
51
|
-
return 1.0;
|
52
|
-
#endif
|
53
|
-
}float ele(vec2 pos) {
|
54
|
-
#ifdef TERRAIN3D
|
55
|
-
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
56
|
-
#else
|
57
|
-
return 0.0;
|
58
|
-
#endif
|
59
|
-
}float get_elevation(vec2 pos) {
|
60
|
-
#ifdef TERRAIN3D
|
61
|
-
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
|
62
|
-
#else
|
63
|
-
return 0.0;
|
64
|
-
#endif
|
65
|
-
}`),background:hs(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
66
|
-
#ifdef OVERDRAW_INSPECTOR
|
67
|
-
gl_FragColor=vec4(1.0);
|
68
|
-
#endif
|
69
|
-
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:hs(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
70
|
-
#ifdef OVERDRAW_INSPECTOR
|
71
|
-
gl_FragColor=vec4(1.0);
|
72
|
-
#endif
|
73
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:hs(`varying vec3 v_data;varying float v_visibility;
|
74
|
-
#pragma mapbox: define highp vec4 color
|
75
|
-
#pragma mapbox: define mediump float radius
|
76
|
-
#pragma mapbox: define lowp float blur
|
77
|
-
#pragma mapbox: define lowp float opacity
|
78
|
-
#pragma mapbox: define highp vec4 stroke_color
|
79
|
-
#pragma mapbox: define mediump float stroke_width
|
80
|
-
#pragma mapbox: define lowp float stroke_opacity
|
81
|
-
void main() {
|
82
|
-
#pragma mapbox: initialize highp vec4 color
|
83
|
-
#pragma mapbox: initialize mediump float radius
|
84
|
-
#pragma mapbox: initialize lowp float blur
|
85
|
-
#pragma mapbox: initialize lowp float opacity
|
86
|
-
#pragma mapbox: initialize highp vec4 stroke_color
|
87
|
-
#pragma mapbox: initialize mediump float stroke_width
|
88
|
-
#pragma mapbox: initialize lowp float stroke_opacity
|
89
|
-
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
90
|
-
#ifdef OVERDRAW_INSPECTOR
|
91
|
-
gl_FragColor=vec4(1.0);
|
92
|
-
#endif
|
93
|
-
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
|
94
|
-
#pragma mapbox: define highp vec4 color
|
95
|
-
#pragma mapbox: define mediump float radius
|
96
|
-
#pragma mapbox: define lowp float blur
|
97
|
-
#pragma mapbox: define lowp float opacity
|
98
|
-
#pragma mapbox: define highp vec4 stroke_color
|
99
|
-
#pragma mapbox: define mediump float stroke_width
|
100
|
-
#pragma mapbox: define lowp float stroke_opacity
|
101
|
-
void main(void) {
|
102
|
-
#pragma mapbox: initialize highp vec4 color
|
103
|
-
#pragma mapbox: initialize mediump float radius
|
104
|
-
#pragma mapbox: initialize lowp float blur
|
105
|
-
#pragma mapbox: initialize lowp float opacity
|
106
|
-
#pragma mapbox: initialize highp vec4 stroke_color
|
107
|
-
#pragma mapbox: initialize mediump float stroke_width
|
108
|
-
#pragma mapbox: initialize lowp float stroke_opacity
|
109
|
-
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:hs("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:hs(`uniform highp float u_intensity;varying vec2 v_extrude;
|
110
|
-
#pragma mapbox: define highp float weight
|
111
|
-
#define GAUSS_COEF 0.3989422804014327
|
112
|
-
void main() {
|
113
|
-
#pragma mapbox: initialize highp float weight
|
114
|
-
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
115
|
-
#ifdef OVERDRAW_INSPECTOR
|
116
|
-
gl_FragColor=vec4(1.0);
|
117
|
-
#endif
|
118
|
-
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
119
|
-
#pragma mapbox: define highp float weight
|
120
|
-
#pragma mapbox: define mediump float radius
|
121
|
-
const highp float ZERO=1.0/255.0/16.0;
|
122
|
-
#define GAUSS_COEF 0.3989422804014327
|
123
|
-
void main(void) {
|
124
|
-
#pragma mapbox: initialize highp float weight
|
125
|
-
#pragma mapbox: initialize mediump float radius
|
126
|
-
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:hs(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
127
|
-
#ifdef OVERDRAW_INSPECTOR
|
128
|
-
gl_FragColor=vec4(0.0);
|
129
|
-
#endif
|
130
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:hs("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:hs("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:hs("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:hs(`#pragma mapbox: define highp vec4 color
|
131
|
-
#pragma mapbox: define lowp float opacity
|
132
|
-
void main() {
|
133
|
-
#pragma mapbox: initialize highp vec4 color
|
134
|
-
#pragma mapbox: initialize lowp float opacity
|
135
|
-
gl_FragColor=color*opacity;
|
136
|
-
#ifdef OVERDRAW_INSPECTOR
|
137
|
-
gl_FragColor=vec4(1.0);
|
138
|
-
#endif
|
139
|
-
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
140
|
-
#pragma mapbox: define highp vec4 color
|
141
|
-
#pragma mapbox: define lowp float opacity
|
142
|
-
void main() {
|
143
|
-
#pragma mapbox: initialize highp vec4 color
|
144
|
-
#pragma mapbox: initialize lowp float opacity
|
145
|
-
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:hs(`varying vec2 v_pos;
|
146
|
-
#pragma mapbox: define highp vec4 outline_color
|
147
|
-
#pragma mapbox: define lowp float opacity
|
148
|
-
void main() {
|
149
|
-
#pragma mapbox: initialize highp vec4 outline_color
|
150
|
-
#pragma mapbox: initialize lowp float opacity
|
151
|
-
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
152
|
-
#ifdef OVERDRAW_INSPECTOR
|
153
|
-
gl_FragColor=vec4(1.0);
|
154
|
-
#endif
|
155
|
-
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
156
|
-
#pragma mapbox: define highp vec4 outline_color
|
157
|
-
#pragma mapbox: define lowp float opacity
|
158
|
-
void main() {
|
159
|
-
#pragma mapbox: initialize highp vec4 outline_color
|
160
|
-
#pragma mapbox: initialize lowp float opacity
|
161
|
-
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:hs(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
162
|
-
#pragma mapbox: define lowp float opacity
|
163
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
164
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
165
|
-
void main() {
|
166
|
-
#pragma mapbox: initialize lowp float opacity
|
167
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
168
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
169
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
170
|
-
#ifdef OVERDRAW_INSPECTOR
|
171
|
-
gl_FragColor=vec4(1.0);
|
172
|
-
#endif
|
173
|
-
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
174
|
-
#pragma mapbox: define lowp float opacity
|
175
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
176
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
177
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
178
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
179
|
-
void main() {
|
180
|
-
#pragma mapbox: initialize lowp float opacity
|
181
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
182
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
183
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
184
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
185
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:hs(`#ifdef GL_ES
|
186
|
-
precision highp float;
|
187
|
-
#endif
|
188
|
-
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
189
|
-
#pragma mapbox: define lowp float opacity
|
190
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
191
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
192
|
-
void main() {
|
193
|
-
#pragma mapbox: initialize lowp float opacity
|
194
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
195
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
196
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
197
|
-
#ifdef OVERDRAW_INSPECTOR
|
198
|
-
gl_FragColor=vec4(1.0);
|
199
|
-
#endif
|
200
|
-
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
201
|
-
#pragma mapbox: define lowp float opacity
|
202
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
203
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
204
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
205
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
206
|
-
void main() {
|
207
|
-
#pragma mapbox: initialize lowp float opacity
|
208
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
209
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
210
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
211
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
212
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:hs(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
213
|
-
#ifdef OVERDRAW_INSPECTOR
|
214
|
-
gl_FragColor=vec4(1.0);
|
215
|
-
#endif
|
216
|
-
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
217
|
-
#ifdef TERRAIN3D
|
218
|
-
attribute vec2 a_centroid;
|
219
|
-
#endif
|
220
|
-
varying vec4 v_color;
|
221
|
-
#pragma mapbox: define highp float base
|
222
|
-
#pragma mapbox: define highp float height
|
223
|
-
#pragma mapbox: define highp vec4 color
|
224
|
-
void main() {
|
225
|
-
#pragma mapbox: initialize highp float base
|
226
|
-
#pragma mapbox: initialize highp float height
|
227
|
-
#pragma mapbox: initialize highp vec4 color
|
228
|
-
vec3 normal=a_normal_ed.xyz;
|
229
|
-
#ifdef TERRAIN3D
|
230
|
-
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
231
|
-
#else
|
232
|
-
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
233
|
-
#endif
|
234
|
-
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:hs(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
235
|
-
#pragma mapbox: define lowp float base
|
236
|
-
#pragma mapbox: define lowp float height
|
237
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
238
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
239
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
240
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
241
|
-
void main() {
|
242
|
-
#pragma mapbox: initialize lowp float base
|
243
|
-
#pragma mapbox: initialize lowp float height
|
244
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
245
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
246
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
247
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
248
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
249
|
-
#ifdef OVERDRAW_INSPECTOR
|
250
|
-
gl_FragColor=vec4(1.0);
|
251
|
-
#endif
|
252
|
-
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
253
|
-
#ifdef TERRAIN3D
|
254
|
-
attribute vec2 a_centroid;
|
255
|
-
#endif
|
256
|
-
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
257
|
-
#pragma mapbox: define lowp float base
|
258
|
-
#pragma mapbox: define lowp float height
|
259
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
260
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
261
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
262
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
263
|
-
void main() {
|
264
|
-
#pragma mapbox: initialize lowp float base
|
265
|
-
#pragma mapbox: initialize lowp float height
|
266
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
267
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
268
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
269
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
270
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
|
271
|
-
#ifdef TERRAIN3D
|
272
|
-
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
273
|
-
#else
|
274
|
-
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
275
|
-
#endif
|
276
|
-
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
277
|
-
? a_pos
|
278
|
-
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:hs(`#ifdef GL_ES
|
279
|
-
precision highp float;
|
280
|
-
#endif
|
281
|
-
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
282
|
-
#ifdef OVERDRAW_INSPECTOR
|
283
|
-
gl_FragColor=vec4(1.0);
|
284
|
-
#endif
|
285
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:hs(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
286
|
-
#define PI 3.141592653589793
|
287
|
-
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
288
|
-
#ifdef OVERDRAW_INSPECTOR
|
289
|
-
gl_FragColor=vec4(1.0);
|
290
|
-
#endif
|
291
|
-
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:hs(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
292
|
-
#pragma mapbox: define highp vec4 color
|
293
|
-
#pragma mapbox: define lowp float blur
|
294
|
-
#pragma mapbox: define lowp float opacity
|
295
|
-
void main() {
|
296
|
-
#pragma mapbox: initialize highp vec4 color
|
297
|
-
#pragma mapbox: initialize lowp float blur
|
298
|
-
#pragma mapbox: initialize lowp float opacity
|
299
|
-
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
|
300
|
-
#ifdef OVERDRAW_INSPECTOR
|
301
|
-
gl_FragColor=vec4(1.0);
|
302
|
-
#endif
|
303
|
-
}`,`
|
304
|
-
#define scale 0.015873016
|
305
|
-
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
306
|
-
#pragma mapbox: define highp vec4 color
|
307
|
-
#pragma mapbox: define lowp float blur
|
308
|
-
#pragma mapbox: define lowp float opacity
|
309
|
-
#pragma mapbox: define mediump float gapwidth
|
310
|
-
#pragma mapbox: define lowp float offset
|
311
|
-
#pragma mapbox: define mediump float width
|
312
|
-
void main() {
|
313
|
-
#pragma mapbox: initialize highp vec4 color
|
314
|
-
#pragma mapbox: initialize lowp float blur
|
315
|
-
#pragma mapbox: initialize lowp float opacity
|
316
|
-
#pragma mapbox: initialize mediump float gapwidth
|
317
|
-
#pragma mapbox: initialize lowp float offset
|
318
|
-
#pragma mapbox: initialize mediump float width
|
319
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
320
|
-
#ifdef TERRAIN3D
|
321
|
-
v_gamma_scale=1.0;
|
322
|
-
#else
|
323
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
324
|
-
#endif
|
325
|
-
v_width2=vec2(outset,inset);}`),lineGradient:hs(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
326
|
-
#pragma mapbox: define lowp float blur
|
327
|
-
#pragma mapbox: define lowp float opacity
|
328
|
-
void main() {
|
329
|
-
#pragma mapbox: initialize lowp float blur
|
330
|
-
#pragma mapbox: initialize lowp float opacity
|
331
|
-
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
332
|
-
#ifdef OVERDRAW_INSPECTOR
|
333
|
-
gl_FragColor=vec4(1.0);
|
334
|
-
#endif
|
335
|
-
}`,`
|
336
|
-
#define scale 0.015873016
|
337
|
-
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
338
|
-
#pragma mapbox: define lowp float blur
|
339
|
-
#pragma mapbox: define lowp float opacity
|
340
|
-
#pragma mapbox: define mediump float gapwidth
|
341
|
-
#pragma mapbox: define lowp float offset
|
342
|
-
#pragma mapbox: define mediump float width
|
343
|
-
void main() {
|
344
|
-
#pragma mapbox: initialize lowp float blur
|
345
|
-
#pragma mapbox: initialize lowp float opacity
|
346
|
-
#pragma mapbox: initialize mediump float gapwidth
|
347
|
-
#pragma mapbox: initialize lowp float offset
|
348
|
-
#pragma mapbox: initialize mediump float width
|
349
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
350
|
-
#ifdef TERRAIN3D
|
351
|
-
v_gamma_scale=1.0;
|
352
|
-
#else
|
353
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
354
|
-
#endif
|
355
|
-
v_width2=vec2(outset,inset);}`),linePattern:hs(`#ifdef GL_ES
|
356
|
-
precision highp float;
|
357
|
-
#endif
|
358
|
-
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
359
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
360
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
361
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
362
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
363
|
-
#pragma mapbox: define lowp float blur
|
364
|
-
#pragma mapbox: define lowp float opacity
|
365
|
-
void main() {
|
366
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
367
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
368
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
369
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
370
|
-
#pragma mapbox: initialize lowp float blur
|
371
|
-
#pragma mapbox: initialize lowp float opacity
|
372
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
373
|
-
#ifdef OVERDRAW_INSPECTOR
|
374
|
-
gl_FragColor=vec4(1.0);
|
375
|
-
#endif
|
376
|
-
}`,`
|
377
|
-
#define scale 0.015873016
|
378
|
-
#define LINE_DISTANCE_SCALE 2.0
|
379
|
-
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
380
|
-
#pragma mapbox: define lowp float blur
|
381
|
-
#pragma mapbox: define lowp float opacity
|
382
|
-
#pragma mapbox: define lowp float offset
|
383
|
-
#pragma mapbox: define mediump float gapwidth
|
384
|
-
#pragma mapbox: define mediump float width
|
385
|
-
#pragma mapbox: define lowp float floorwidth
|
386
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
387
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
388
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
389
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
390
|
-
void main() {
|
391
|
-
#pragma mapbox: initialize lowp float blur
|
392
|
-
#pragma mapbox: initialize lowp float opacity
|
393
|
-
#pragma mapbox: initialize lowp float offset
|
394
|
-
#pragma mapbox: initialize mediump float gapwidth
|
395
|
-
#pragma mapbox: initialize mediump float width
|
396
|
-
#pragma mapbox: initialize lowp float floorwidth
|
397
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
398
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
399
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
400
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
401
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
402
|
-
#ifdef TERRAIN3D
|
403
|
-
v_gamma_scale=1.0;
|
404
|
-
#else
|
405
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
406
|
-
#endif
|
407
|
-
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:hs(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
408
|
-
#pragma mapbox: define highp vec4 color
|
409
|
-
#pragma mapbox: define lowp float blur
|
410
|
-
#pragma mapbox: define lowp float opacity
|
411
|
-
#pragma mapbox: define mediump float width
|
412
|
-
#pragma mapbox: define lowp float floorwidth
|
413
|
-
void main() {
|
414
|
-
#pragma mapbox: initialize highp vec4 color
|
415
|
-
#pragma mapbox: initialize lowp float blur
|
416
|
-
#pragma mapbox: initialize lowp float opacity
|
417
|
-
#pragma mapbox: initialize mediump float width
|
418
|
-
#pragma mapbox: initialize lowp float floorwidth
|
419
|
-
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
420
|
-
#ifdef OVERDRAW_INSPECTOR
|
421
|
-
gl_FragColor=vec4(1.0);
|
422
|
-
#endif
|
423
|
-
}`,`
|
424
|
-
#define scale 0.015873016
|
425
|
-
#define LINE_DISTANCE_SCALE 2.0
|
426
|
-
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
427
|
-
#pragma mapbox: define highp vec4 color
|
428
|
-
#pragma mapbox: define lowp float blur
|
429
|
-
#pragma mapbox: define lowp float opacity
|
430
|
-
#pragma mapbox: define mediump float gapwidth
|
431
|
-
#pragma mapbox: define lowp float offset
|
432
|
-
#pragma mapbox: define mediump float width
|
433
|
-
#pragma mapbox: define lowp float floorwidth
|
434
|
-
void main() {
|
435
|
-
#pragma mapbox: initialize highp vec4 color
|
436
|
-
#pragma mapbox: initialize lowp float blur
|
437
|
-
#pragma mapbox: initialize lowp float opacity
|
438
|
-
#pragma mapbox: initialize mediump float gapwidth
|
439
|
-
#pragma mapbox: initialize lowp float offset
|
440
|
-
#pragma mapbox: initialize mediump float width
|
441
|
-
#pragma mapbox: initialize lowp float floorwidth
|
442
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
443
|
-
#ifdef TERRAIN3D
|
444
|
-
v_gamma_scale=1.0;
|
445
|
-
#else
|
446
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
447
|
-
#endif
|
448
|
-
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:hs(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
449
|
-
#ifdef OVERDRAW_INSPECTOR
|
450
|
-
gl_FragColor=vec4(1.0);
|
451
|
-
#endif
|
452
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:hs(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
453
|
-
#pragma mapbox: define lowp float opacity
|
454
|
-
void main() {
|
455
|
-
#pragma mapbox: initialize lowp float opacity
|
456
|
-
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
457
|
-
#ifdef OVERDRAW_INSPECTOR
|
458
|
-
gl_FragColor=vec4(1.0);
|
459
|
-
#endif
|
460
|
-
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
461
|
-
#pragma mapbox: define lowp float opacity
|
462
|
-
void main() {
|
463
|
-
#pragma mapbox: initialize lowp float opacity
|
464
|
-
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
465
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
466
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:hs(`#define SDF_PX 8.0
|
467
|
-
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
468
|
-
#pragma mapbox: define highp vec4 fill_color
|
469
|
-
#pragma mapbox: define highp vec4 halo_color
|
470
|
-
#pragma mapbox: define lowp float opacity
|
471
|
-
#pragma mapbox: define lowp float halo_width
|
472
|
-
#pragma mapbox: define lowp float halo_blur
|
473
|
-
void main() {
|
474
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
475
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
476
|
-
#pragma mapbox: initialize lowp float opacity
|
477
|
-
#pragma mapbox: initialize lowp float halo_width
|
478
|
-
#pragma mapbox: initialize lowp float halo_blur
|
479
|
-
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
|
480
|
-
#ifdef OVERDRAW_INSPECTOR
|
481
|
-
gl_FragColor=vec4(1.0);
|
482
|
-
#endif
|
483
|
-
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
484
|
-
#pragma mapbox: define highp vec4 fill_color
|
485
|
-
#pragma mapbox: define highp vec4 halo_color
|
486
|
-
#pragma mapbox: define lowp float opacity
|
487
|
-
#pragma mapbox: define lowp float halo_width
|
488
|
-
#pragma mapbox: define lowp float halo_blur
|
489
|
-
void main() {
|
490
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
491
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
492
|
-
#pragma mapbox: initialize lowp float opacity
|
493
|
-
#pragma mapbox: initialize lowp float halo_width
|
494
|
-
#pragma mapbox: initialize lowp float halo_blur
|
495
|
-
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
496
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
497
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:hs(`#define SDF_PX 8.0
|
498
|
-
#define SDF 1.0
|
499
|
-
#define ICON 0.0
|
500
|
-
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
501
|
-
#pragma mapbox: define highp vec4 fill_color
|
502
|
-
#pragma mapbox: define highp vec4 halo_color
|
503
|
-
#pragma mapbox: define lowp float opacity
|
504
|
-
#pragma mapbox: define lowp float halo_width
|
505
|
-
#pragma mapbox: define lowp float halo_blur
|
506
|
-
void main() {
|
507
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
508
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
509
|
-
#pragma mapbox: initialize lowp float opacity
|
510
|
-
#pragma mapbox: initialize lowp float halo_width
|
511
|
-
#pragma mapbox: initialize lowp float halo_blur
|
512
|
-
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
513
|
-
#ifdef OVERDRAW_INSPECTOR
|
514
|
-
gl_FragColor=vec4(1.0);
|
515
|
-
#endif
|
516
|
-
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
517
|
-
#ifdef OVERDRAW_INSPECTOR
|
518
|
-
gl_FragColor=vec4(1.0);
|
519
|
-
#endif
|
520
|
-
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
521
|
-
#pragma mapbox: define highp vec4 fill_color
|
522
|
-
#pragma mapbox: define highp vec4 halo_color
|
523
|
-
#pragma mapbox: define lowp float opacity
|
524
|
-
#pragma mapbox: define lowp float halo_width
|
525
|
-
#pragma mapbox: define lowp float halo_blur
|
526
|
-
void main() {
|
527
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
528
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
529
|
-
#pragma mapbox: initialize lowp float opacity
|
530
|
-
#pragma mapbox: initialize lowp float halo_width
|
531
|
-
#pragma mapbox: initialize lowp float halo_blur
|
532
|
-
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
533
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
534
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:hs("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:hs("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:hs("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:hs("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function hs(d,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),a=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),h=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),_=h?h.concat(a):a,w={};return{fragmentSource:d=d.replace(n,(E,C,z,D,$)=>(w[$]=!0,C==="define"?`
|
535
|
-
#ifndef HAS_UNIFORM_u_${$}
|
536
|
-
varying ${z} ${D} ${$};
|
537
|
-
#else
|
538
|
-
uniform ${z} ${D} u_${$};
|
539
|
-
#endif
|
540
|
-
`:`
|
541
|
-
#ifdef HAS_UNIFORM_u_${$}
|
542
|
-
${z} ${D} ${$} = u_${$};
|
543
|
-
#endif
|
544
|
-
`)),vertexSource:t=t.replace(n,(E,C,z,D,$)=>{const U=D==="float"?"vec2":"vec4",ee=$.match(/color/)?"color":U;return w[$]?C==="define"?`
|
545
|
-
#ifndef HAS_UNIFORM_u_${$}
|
546
|
-
uniform lowp float u_${$}_t;
|
547
|
-
attribute ${z} ${U} a_${$};
|
548
|
-
varying ${z} ${D} ${$};
|
549
|
-
#else
|
550
|
-
uniform ${z} ${D} u_${$};
|
551
|
-
#endif
|
552
|
-
`:ee==="vec4"?`
|
553
|
-
#ifndef HAS_UNIFORM_u_${$}
|
554
|
-
${$} = a_${$};
|
555
|
-
#else
|
556
|
-
${z} ${D} ${$} = u_${$};
|
557
|
-
#endif
|
558
|
-
`:`
|
559
|
-
#ifndef HAS_UNIFORM_u_${$}
|
560
|
-
${$} = unpack_mix_${ee}(a_${$}, u_${$}_t);
|
561
|
-
#else
|
562
|
-
${z} ${D} ${$} = u_${$};
|
563
|
-
#endif
|
564
|
-
`:C==="define"?`
|
565
|
-
#ifndef HAS_UNIFORM_u_${$}
|
566
|
-
uniform lowp float u_${$}_t;
|
567
|
-
attribute ${z} ${U} a_${$};
|
568
|
-
#else
|
569
|
-
uniform ${z} ${D} u_${$};
|
570
|
-
#endif
|
571
|
-
`:ee==="vec4"?`
|
572
|
-
#ifndef HAS_UNIFORM_u_${$}
|
573
|
-
${z} ${D} ${$} = a_${$};
|
574
|
-
#else
|
575
|
-
${z} ${D} ${$} = u_${$};
|
576
|
-
#endif
|
577
|
-
`:`
|
578
|
-
#ifndef HAS_UNIFORM_u_${$}
|
579
|
-
${z} ${D} ${$} = unpack_mix_${ee}(a_${$}, u_${$}_t);
|
580
|
-
#else
|
581
|
-
${z} ${D} ${$} = u_${$};
|
582
|
-
#endif
|
583
|
-
`}),staticAttributes:s,staticUniforms:_}}class nh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,a,h,_,w,E,C){this.context=t;let z=this.boundPaintVertexBuffers.length!==a.length;for(let D=0;!z&&D<a.length;D++)this.boundPaintVertexBuffers[D]!==a[D]&&(z=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==s||z||this.boundIndexBuffer!==h||this.boundVertexOffset!==_||this.boundDynamicVertexBuffer!==w||this.boundDynamicVertexBuffer2!==E||this.boundDynamicVertexBuffer3!==C?this.freshBind(n,s,a,h,_,w,E,C):(t.bindVertexArray.set(this.vao),w&&w.bind(),h&&h.dynamicDraw&&h.bind(),E&&E.bind(),C&&C.bind())}freshBind(t,n,s,a,h,_,w,E){const C=t.numAttributes,z=this.context,D=z.gl;this.vao&&this.destroy(),this.vao=z.createVertexArray(),z.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=a,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=_,this.boundDynamicVertexBuffer2=w,this.boundDynamicVertexBuffer3=E,n.enableAttributes(D,t);for(const $ of s)$.enableAttributes(D,t);_&&_.enableAttributes(D,t),w&&w.enableAttributes(D,t),E&&E.enableAttributes(D,t),n.bind(),n.setVertexAttribPointers(D,t,h);for(const $ of s)$.bind(),$.setVertexAttribPointers(D,t,h);_&&(_.bind(),_.setVertexAttribPointers(D,t,h)),a&&a.bind(),w&&(w.bind(),w.setVertexAttribPointers(D,t,h)),E&&(E.bind(),E.setVertexAttribPointers(D,t,h)),z.currentNumAttributes=C}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Yh=(d,t,n,s,a)=>({u_matrix:d,u_texture:0,u_ele_delta:t,u_fog_matrix:n,u_fog_color:s?s.properties.get("fog-color"):u.aN.white,u_fog_ground_blend:s?s.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:s?s.calculateFogBlendOpacity(a):0,u_horizon_color:s?s.properties.get("horizon-color"):u.aN.white,u_horizon_fog_blend:s?s.properties.get("horizon-fog-blend"):1});function Pu(d){const t=[];for(let n=0;n<d.length;n++){if(d[n]===null)continue;const s=d[n].split(" ");t.push(s.pop())}return t}class oh{constructor(t,n,s,a,h,_){const w=t.gl;this.program=w.createProgram();const E=Pu(n.staticAttributes),C=s?s.getBinderAttributes():[],z=E.concat(C),D=mc.prelude.staticUniforms?Pu(mc.prelude.staticUniforms):[],$=n.staticUniforms?Pu(n.staticUniforms):[],U=s?s.getBinderUniforms():[],ee=D.concat($).concat(U),de=[];for(const ni of ee)de.indexOf(ni)<0&&de.push(ni);const re=s?s.defines():[];h&&re.push("#define OVERDRAW_INSPECTOR;"),_&&re.push("#define TERRAIN3D;");const Re=re.concat(mc.prelude.fragmentSource,n.fragmentSource).join(`
|
584
|
-
`),Ke=re.concat(mc.prelude.vertexSource,n.vertexSource).join(`
|
585
|
-
`),ie=w.createShader(w.FRAGMENT_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);if(w.shaderSource(ie,Re),w.compileShader(ie),!w.getShaderParameter(ie,w.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${w.getShaderInfoLog(ie)}`);w.attachShader(this.program,ie);const Zt=w.createShader(w.VERTEX_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);if(w.shaderSource(Zt,Ke),w.compileShader(Zt),!w.getShaderParameter(Zt,w.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${w.getShaderInfoLog(Zt)}`);w.attachShader(this.program,Zt),this.attributes={};const ti={};this.numAttributes=z.length;for(let ni=0;ni<this.numAttributes;ni++)z[ni]&&(w.bindAttribLocation(this.program,ni,z[ni]),this.attributes[z[ni]]=ni);if(w.linkProgram(this.program),!w.getProgramParameter(this.program,w.LINK_STATUS))throw new Error(`Program failed to link: ${w.getProgramInfoLog(this.program)}`);w.deleteShader(Zt),w.deleteShader(ie);for(let ni=0;ni<de.length;ni++){const yi=de[ni];if(yi&&!ti[yi]){const xi=w.getUniformLocation(this.program,yi);xi&&(ti[yi]=xi)}}this.fixedUniforms=a(t,ti),this.terrainUniforms=((ni,yi)=>({u_depth:new u.aI(ni,yi.u_depth),u_terrain:new u.aI(ni,yi.u_terrain),u_terrain_dim:new u.aJ(ni,yi.u_terrain_dim),u_terrain_matrix:new u.aK(ni,yi.u_terrain_matrix),u_terrain_unpack:new u.aL(ni,yi.u_terrain_unpack),u_terrain_exaggeration:new u.aJ(ni,yi.u_terrain_exaggeration)}))(t,ti),this.binderUniforms=s?s.getUniforms(t,ti):[]}draw(t,n,s,a,h,_,w,E,C,z,D,$,U,ee,de,re,Re,Ke){const ie=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(a),t.setColorMode(h),t.setCullFace(_),E){t.activeTexture.set(ie.TEXTURE2),ie.bindTexture(ie.TEXTURE_2D,E.depthTexture),t.activeTexture.set(ie.TEXTURE3),ie.bindTexture(ie.TEXTURE_2D,E.texture);for(const ti in this.terrainUniforms)this.terrainUniforms[ti].set(E[ti])}for(const ti in this.fixedUniforms)this.fixedUniforms[ti].set(w[ti]);de&&de.setUniforms(t,this.binderUniforms,U,{zoom:ee});let Zt=0;switch(n){case ie.LINES:Zt=2;break;case ie.TRIANGLES:Zt=3;break;case ie.LINE_STRIP:Zt=1}for(const ti of $.get()){const ni=ti.vaos||(ti.vaos={});(ni[C]||(ni[C]=new nh)).bind(t,this,z,de?de.getPaintVertexBuffers():[],D,ti.vertexOffset,re,Re,Ke),ie.drawElements(n,ti.primitiveLength*Zt,ie.UNSIGNED_SHORT,ti.primitiveOffset*Zt*2)}}}function sh(d,t,n){const s=1/Qi(n,1,t.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,_=h*(n.tileID.canonical.x+n.tileID.wrap*a),w=h*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,d.fromScale,d.toScale],u_fade:d.t,u_pixel_coord_upper:[_>>16,w>>16],u_pixel_coord_lower:[65535&_,65535&w]}}const ah=(d,t,n,s)=>{const a=t.style.light,h=a.properties.get("position"),_=[h.x,h.y,h.z],w=function(){var C=new u.A(9);return u.A!=Float32Array&&(C[1]=0,C[2]=0,C[3]=0,C[5]=0,C[6]=0,C[7]=0),C[0]=1,C[4]=1,C[8]=1,C}();a.properties.get("anchor")==="viewport"&&function(C,z){var D=Math.sin(z),$=Math.cos(z);C[0]=$,C[1]=D,C[2]=0,C[3]=-D,C[4]=$,C[5]=0,C[6]=0,C[7]=0,C[8]=1}(w,-t.transform.angle),function(C,z,D){var $=z[0],U=z[1],ee=z[2];C[0]=$*D[0]+U*D[3]+ee*D[6],C[1]=$*D[1]+U*D[4]+ee*D[7],C[2]=$*D[2]+U*D[5]+ee*D[8]}(_,_,w);const E=a.properties.get("color");return{u_matrix:d,u_lightpos:_,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[E.r,E.g,E.b],u_vertical_gradient:+n,u_opacity:s}},lh=(d,t,n,s,a,h,_)=>u.e(ah(d,t,n,s),sh(h,t,_),{u_height_factor:-Math.pow(2,a.overscaledZ)/_.tileSize/8}),Iu=d=>({u_matrix:d}),Yc=(d,t,n,s)=>u.e(Iu(d),sh(n,t,s)),_f=(d,t)=>({u_matrix:d,u_world:t}),vf=(d,t,n,s,a)=>u.e(Yc(d,t,n,s),{u_world:a}),hp=(d,t,n,s)=>{const a=d.transform;let h,_;if(s.paint.get("circle-pitch-alignment")==="map"){const w=Qi(n,1,a.zoom);h=!0,_=[w,w]}else h=!1,_=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:d.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+h,u_device_pixel_ratio:d.pixelRatio,u_extrude_scale:_}},xf=(d,t,n)=>({u_matrix:d,u_inv_matrix:t,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),gc=(d,t,n=1)=>({u_matrix:d,u_color:t,u_overlay:0,u_overlay_scale:n}),Mu=d=>({u_matrix:d}),Aa=(d,t,n,s)=>({u_matrix:d,u_extrude_scale:Qi(t,1,n),u_intensity:s});function Pa(d,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new u.Z(0,s/n).toLngLat().lat,new u.Z(0,(s+1)/n).toLngLat().lat]}const zu=(d,t,n,s)=>{const a=d.transform;return{u_matrix:fp(d,t,n,s),u_ratio:1/Qi(t,1,a.zoom),u_device_pixel_ratio:d.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},ch=(d,t,n,s,a)=>u.e(zu(d,t,n,a),{u_image:0,u_image_height:s}),dp=(d,t,n,s,a)=>{const h=d.transform,_=Mc(t,h);return{u_matrix:fp(d,t,n,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Qi(t,1,h.zoom),u_device_pixel_ratio:d.pixelRatio,u_image:0,u_scale:[_,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},pp=(d,t,n,s,a,h)=>{const _=d.lineAtlas,w=Mc(t,d.transform),E=n.layout.get("line-cap")==="round",C=_.getDash(s.from,E),z=_.getDash(s.to,E),D=C.width*a.fromScale,$=z.width*a.toScale;return u.e(zu(d,t,n,h),{u_patternscale_a:[w/D,-C.height/2],u_patternscale_b:[w/$,-z.height/2],u_sdfgamma:_.width/(256*Math.min(D,$)*d.pixelRatio)/2,u_image:0,u_tex_y_a:C.y,u_tex_y_b:z.y,u_mix:a.t})};function Mc(d,t){return 1/Qi(d,1,t.tileZoom)}function fp(d,t,n,s){return d.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const bf=(d,t,n,s,a)=>{return{u_matrix:d,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(_=a.paint.get("raster-saturation"),_>0?1-1/(1.001-_):-_),u_contrast_factor:(h=a.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:wf(a.paint.get("raster-hue-rotate"))};var h,_};function wf(d){d*=Math.PI/180;const t=Math.sin(d),n=Math.cos(d);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const mp=(d,t,n,s,a,h,_,w,E,C,z,D,$,U)=>{const ee=_.transform;return{u_is_size_zoom_constant:+(d==="constant"||d==="source"),u_is_size_feature_constant:+(d==="constant"||d==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:ee.cameraToCenterDistance,u_pitch:ee.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:ee.width/ee.height,u_fade_change:_.options.fadeDuration?_.symbolFadeChange:1,u_matrix:w,u_label_plane_matrix:E,u_coord_matrix:C,u_is_text:+D,u_pitch_with_map:+s,u_is_along_line:a,u_is_variable_anchor:h,u_texsize:$,u_texture:0,u_translation:z,u_pitched_scale:U}},gp=(d,t,n,s,a,h,_,w,E,C,z,D,$,U,ee)=>{const de=_.transform;return u.e(mp(d,t,n,s,a,h,_,w,E,C,z,D,$,ee),{u_gamma_scale:s?Math.cos(de._pitch)*de.cameraToCenterDistance:1,u_device_pixel_ratio:_.pixelRatio,u_is_halo:+U})},Sf=(d,t,n,s,a,h,_,w,E,C,z,D,$,U)=>u.e(gp(d,t,n,s,a,h,_,w,E,C,z,!0,D,!0,U),{u_texsize_icon:$,u_texture_icon:1}),uh=(d,t,n)=>({u_matrix:d,u_opacity:t,u_color:n}),Qh=(d,t,n,s,a,h)=>u.e(function(_,w,E,C){const z=E.imageManager.getPattern(_.from.toString()),D=E.imageManager.getPattern(_.to.toString()),{width:$,height:U}=E.imageManager.getPixelSize(),ee=Math.pow(2,C.tileID.overscaledZ),de=C.tileSize*Math.pow(2,E.transform.tileZoom)/ee,re=de*(C.tileID.canonical.x+C.tileID.wrap*ee),Re=de*C.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:D.tl,u_pattern_br_b:D.br,u_texsize:[$,U],u_mix:w.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:D.displaySize,u_scale_a:w.fromScale,u_scale_b:w.toScale,u_tile_units_to_pixels:1/Qi(C,1,E.transform.tileZoom),u_pixel_coord_upper:[re>>16,Re>>16],u_pixel_coord_lower:[65535&re,65535&Re]}}(s,h,n,a),{u_matrix:d,u_opacity:t}),hh={fillExtrusion:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_lightpos:new u.aO(d,t.u_lightpos),u_lightintensity:new u.aJ(d,t.u_lightintensity),u_lightcolor:new u.aO(d,t.u_lightcolor),u_vertical_gradient:new u.aJ(d,t.u_vertical_gradient),u_opacity:new u.aJ(d,t.u_opacity)}),fillExtrusionPattern:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_lightpos:new u.aO(d,t.u_lightpos),u_lightintensity:new u.aJ(d,t.u_lightintensity),u_lightcolor:new u.aO(d,t.u_lightcolor),u_vertical_gradient:new u.aJ(d,t.u_vertical_gradient),u_height_factor:new u.aJ(d,t.u_height_factor),u_image:new u.aI(d,t.u_image),u_texsize:new u.aP(d,t.u_texsize),u_pixel_coord_upper:new u.aP(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aP(d,t.u_pixel_coord_lower),u_scale:new u.aO(d,t.u_scale),u_fade:new u.aJ(d,t.u_fade),u_opacity:new u.aJ(d,t.u_opacity)}),fill:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix)}),fillPattern:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_image:new u.aI(d,t.u_image),u_texsize:new u.aP(d,t.u_texsize),u_pixel_coord_upper:new u.aP(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aP(d,t.u_pixel_coord_lower),u_scale:new u.aO(d,t.u_scale),u_fade:new u.aJ(d,t.u_fade)}),fillOutline:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_world:new u.aP(d,t.u_world)}),fillOutlinePattern:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_world:new u.aP(d,t.u_world),u_image:new u.aI(d,t.u_image),u_texsize:new u.aP(d,t.u_texsize),u_pixel_coord_upper:new u.aP(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aP(d,t.u_pixel_coord_lower),u_scale:new u.aO(d,t.u_scale),u_fade:new u.aJ(d,t.u_fade)}),circle:(d,t)=>({u_camera_to_center_distance:new u.aJ(d,t.u_camera_to_center_distance),u_scale_with_map:new u.aI(d,t.u_scale_with_map),u_pitch_with_map:new u.aI(d,t.u_pitch_with_map),u_extrude_scale:new u.aP(d,t.u_extrude_scale),u_device_pixel_ratio:new u.aJ(d,t.u_device_pixel_ratio),u_matrix:new u.aK(d,t.u_matrix)}),collisionBox:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_pixel_extrude_scale:new u.aP(d,t.u_pixel_extrude_scale)}),collisionCircle:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_inv_matrix:new u.aK(d,t.u_inv_matrix),u_camera_to_center_distance:new u.aJ(d,t.u_camera_to_center_distance),u_viewport_size:new u.aP(d,t.u_viewport_size)}),debug:(d,t)=>({u_color:new u.aM(d,t.u_color),u_matrix:new u.aK(d,t.u_matrix),u_overlay:new u.aI(d,t.u_overlay),u_overlay_scale:new u.aJ(d,t.u_overlay_scale)}),clippingMask:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix)}),heatmap:(d,t)=>({u_extrude_scale:new u.aJ(d,t.u_extrude_scale),u_intensity:new u.aJ(d,t.u_intensity),u_matrix:new u.aK(d,t.u_matrix)}),heatmapTexture:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_world:new u.aP(d,t.u_world),u_image:new u.aI(d,t.u_image),u_color_ramp:new u.aI(d,t.u_color_ramp),u_opacity:new u.aJ(d,t.u_opacity)}),hillshade:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_image:new u.aI(d,t.u_image),u_latrange:new u.aP(d,t.u_latrange),u_light:new u.aP(d,t.u_light),u_shadow:new u.aM(d,t.u_shadow),u_highlight:new u.aM(d,t.u_highlight),u_accent:new u.aM(d,t.u_accent)}),hillshadePrepare:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_image:new u.aI(d,t.u_image),u_dimension:new u.aP(d,t.u_dimension),u_zoom:new u.aJ(d,t.u_zoom),u_unpack:new u.aL(d,t.u_unpack)}),line:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_ratio:new u.aJ(d,t.u_ratio),u_device_pixel_ratio:new u.aJ(d,t.u_device_pixel_ratio),u_units_to_pixels:new u.aP(d,t.u_units_to_pixels)}),lineGradient:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_ratio:new u.aJ(d,t.u_ratio),u_device_pixel_ratio:new u.aJ(d,t.u_device_pixel_ratio),u_units_to_pixels:new u.aP(d,t.u_units_to_pixels),u_image:new u.aI(d,t.u_image),u_image_height:new u.aJ(d,t.u_image_height)}),linePattern:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_texsize:new u.aP(d,t.u_texsize),u_ratio:new u.aJ(d,t.u_ratio),u_device_pixel_ratio:new u.aJ(d,t.u_device_pixel_ratio),u_image:new u.aI(d,t.u_image),u_units_to_pixels:new u.aP(d,t.u_units_to_pixels),u_scale:new u.aO(d,t.u_scale),u_fade:new u.aJ(d,t.u_fade)}),lineSDF:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_ratio:new u.aJ(d,t.u_ratio),u_device_pixel_ratio:new u.aJ(d,t.u_device_pixel_ratio),u_units_to_pixels:new u.aP(d,t.u_units_to_pixels),u_patternscale_a:new u.aP(d,t.u_patternscale_a),u_patternscale_b:new u.aP(d,t.u_patternscale_b),u_sdfgamma:new u.aJ(d,t.u_sdfgamma),u_image:new u.aI(d,t.u_image),u_tex_y_a:new u.aJ(d,t.u_tex_y_a),u_tex_y_b:new u.aJ(d,t.u_tex_y_b),u_mix:new u.aJ(d,t.u_mix)}),raster:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_tl_parent:new u.aP(d,t.u_tl_parent),u_scale_parent:new u.aJ(d,t.u_scale_parent),u_buffer_scale:new u.aJ(d,t.u_buffer_scale),u_fade_t:new u.aJ(d,t.u_fade_t),u_opacity:new u.aJ(d,t.u_opacity),u_image0:new u.aI(d,t.u_image0),u_image1:new u.aI(d,t.u_image1),u_brightness_low:new u.aJ(d,t.u_brightness_low),u_brightness_high:new u.aJ(d,t.u_brightness_high),u_saturation_factor:new u.aJ(d,t.u_saturation_factor),u_contrast_factor:new u.aJ(d,t.u_contrast_factor),u_spin_weights:new u.aO(d,t.u_spin_weights)}),symbolIcon:(d,t)=>({u_is_size_zoom_constant:new u.aI(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aI(d,t.u_is_size_feature_constant),u_size_t:new u.aJ(d,t.u_size_t),u_size:new u.aJ(d,t.u_size),u_camera_to_center_distance:new u.aJ(d,t.u_camera_to_center_distance),u_pitch:new u.aJ(d,t.u_pitch),u_rotate_symbol:new u.aI(d,t.u_rotate_symbol),u_aspect_ratio:new u.aJ(d,t.u_aspect_ratio),u_fade_change:new u.aJ(d,t.u_fade_change),u_matrix:new u.aK(d,t.u_matrix),u_label_plane_matrix:new u.aK(d,t.u_label_plane_matrix),u_coord_matrix:new u.aK(d,t.u_coord_matrix),u_is_text:new u.aI(d,t.u_is_text),u_pitch_with_map:new u.aI(d,t.u_pitch_with_map),u_is_along_line:new u.aI(d,t.u_is_along_line),u_is_variable_anchor:new u.aI(d,t.u_is_variable_anchor),u_texsize:new u.aP(d,t.u_texsize),u_texture:new u.aI(d,t.u_texture),u_translation:new u.aP(d,t.u_translation),u_pitched_scale:new u.aJ(d,t.u_pitched_scale)}),symbolSDF:(d,t)=>({u_is_size_zoom_constant:new u.aI(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aI(d,t.u_is_size_feature_constant),u_size_t:new u.aJ(d,t.u_size_t),u_size:new u.aJ(d,t.u_size),u_camera_to_center_distance:new u.aJ(d,t.u_camera_to_center_distance),u_pitch:new u.aJ(d,t.u_pitch),u_rotate_symbol:new u.aI(d,t.u_rotate_symbol),u_aspect_ratio:new u.aJ(d,t.u_aspect_ratio),u_fade_change:new u.aJ(d,t.u_fade_change),u_matrix:new u.aK(d,t.u_matrix),u_label_plane_matrix:new u.aK(d,t.u_label_plane_matrix),u_coord_matrix:new u.aK(d,t.u_coord_matrix),u_is_text:new u.aI(d,t.u_is_text),u_pitch_with_map:new u.aI(d,t.u_pitch_with_map),u_is_along_line:new u.aI(d,t.u_is_along_line),u_is_variable_anchor:new u.aI(d,t.u_is_variable_anchor),u_texsize:new u.aP(d,t.u_texsize),u_texture:new u.aI(d,t.u_texture),u_gamma_scale:new u.aJ(d,t.u_gamma_scale),u_device_pixel_ratio:new u.aJ(d,t.u_device_pixel_ratio),u_is_halo:new u.aI(d,t.u_is_halo),u_translation:new u.aP(d,t.u_translation),u_pitched_scale:new u.aJ(d,t.u_pitched_scale)}),symbolTextAndIcon:(d,t)=>({u_is_size_zoom_constant:new u.aI(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aI(d,t.u_is_size_feature_constant),u_size_t:new u.aJ(d,t.u_size_t),u_size:new u.aJ(d,t.u_size),u_camera_to_center_distance:new u.aJ(d,t.u_camera_to_center_distance),u_pitch:new u.aJ(d,t.u_pitch),u_rotate_symbol:new u.aI(d,t.u_rotate_symbol),u_aspect_ratio:new u.aJ(d,t.u_aspect_ratio),u_fade_change:new u.aJ(d,t.u_fade_change),u_matrix:new u.aK(d,t.u_matrix),u_label_plane_matrix:new u.aK(d,t.u_label_plane_matrix),u_coord_matrix:new u.aK(d,t.u_coord_matrix),u_is_text:new u.aI(d,t.u_is_text),u_pitch_with_map:new u.aI(d,t.u_pitch_with_map),u_is_along_line:new u.aI(d,t.u_is_along_line),u_is_variable_anchor:new u.aI(d,t.u_is_variable_anchor),u_texsize:new u.aP(d,t.u_texsize),u_texsize_icon:new u.aP(d,t.u_texsize_icon),u_texture:new u.aI(d,t.u_texture),u_texture_icon:new u.aI(d,t.u_texture_icon),u_gamma_scale:new u.aJ(d,t.u_gamma_scale),u_device_pixel_ratio:new u.aJ(d,t.u_device_pixel_ratio),u_is_halo:new u.aI(d,t.u_is_halo),u_translation:new u.aP(d,t.u_translation),u_pitched_scale:new u.aJ(d,t.u_pitched_scale)}),background:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_opacity:new u.aJ(d,t.u_opacity),u_color:new u.aM(d,t.u_color)}),backgroundPattern:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_opacity:new u.aJ(d,t.u_opacity),u_image:new u.aI(d,t.u_image),u_pattern_tl_a:new u.aP(d,t.u_pattern_tl_a),u_pattern_br_a:new u.aP(d,t.u_pattern_br_a),u_pattern_tl_b:new u.aP(d,t.u_pattern_tl_b),u_pattern_br_b:new u.aP(d,t.u_pattern_br_b),u_texsize:new u.aP(d,t.u_texsize),u_mix:new u.aJ(d,t.u_mix),u_pattern_size_a:new u.aP(d,t.u_pattern_size_a),u_pattern_size_b:new u.aP(d,t.u_pattern_size_b),u_scale_a:new u.aJ(d,t.u_scale_a),u_scale_b:new u.aJ(d,t.u_scale_b),u_pixel_coord_upper:new u.aP(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aP(d,t.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aJ(d,t.u_tile_units_to_pixels)}),terrain:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_texture:new u.aI(d,t.u_texture),u_ele_delta:new u.aJ(d,t.u_ele_delta),u_fog_matrix:new u.aK(d,t.u_fog_matrix),u_fog_color:new u.aM(d,t.u_fog_color),u_fog_ground_blend:new u.aJ(d,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new u.aJ(d,t.u_fog_ground_blend_opacity),u_horizon_color:new u.aM(d,t.u_horizon_color),u_horizon_fog_blend:new u.aJ(d,t.u_horizon_fog_blend)}),terrainDepth:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_ele_delta:new u.aJ(d,t.u_ele_delta)}),terrainCoords:(d,t)=>({u_matrix:new u.aK(d,t.u_matrix),u_texture:new u.aI(d,t.u_texture),u_terrain_coords_id:new u.aJ(d,t.u_terrain_coords_id),u_ele_delta:new u.aJ(d,t.u_ele_delta)}),sky:(d,t)=>({u_sky_color:new u.aM(d,t.u_sky_color),u_horizon_color:new u.aM(d,t.u_horizon_color),u_horizon:new u.aJ(d,t.u_horizon),u_sky_horizon_blend:new u.aJ(d,t.u_sky_horizon_blend)})};class ed{constructor(t,n,s){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const td={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ql{constructor(t,n,s,a){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=a,this.context=t;const h=t.gl;this.buffer=h.createBuffer(),t.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const a=n.attributes[this.attributes[s].name];a!==void 0&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,n,s){for(let a=0;a<this.attributes.length;a++){const h=this.attributes[a],_=n.attributes[h.name];_!==void 0&&t.vertexAttribPointer(_,h.components,t[td[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const rd=new WeakMap;function Qc(d){var t;if(rd.has(d))return rd.get(d);{const n=(t=d.getParameter(d.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return rd.set(d,n),n}}class ss{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Du extends ss{getDefault(){return u.aN.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class kf extends ss{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class dh extends ss{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Ef extends ss{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class eu extends ss{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Tf extends ss{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class yp extends ss{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Cf extends ss{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class _p extends ss{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class nd extends ss{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class vp extends ss{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class xp extends ss{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class bp extends ss{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class wp extends ss{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class zc extends ss{getDefault(){return u.aN.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Sp extends ss{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Af extends ss{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Pf extends ss{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class kp extends ss{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Bu extends ss{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class If extends ss{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ph extends ss{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Mf extends ss{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class zf extends ss{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ep extends ss{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Tp extends ss{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Cp extends ss{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class od extends ss{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const s=this.gl;Qc(s)?s.bindVertexArray(t):(n=s.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Ap extends ss{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class fh extends ss{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class ic extends ss{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Ru extends ss{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class sd extends Ru{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class ad extends Ru{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Pp extends Ru{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ld{constructor(t,n,s,a,h){this.context=t,this.width=n,this.height=s;const _=t.gl,w=this.framebuffer=_.createFramebuffer();if(this.colorAttachment=new sd(t,w),a)this.depthAttachment=h?new Pp(t,w):new ad(t,w);else if(h)throw new Error("Stencil cannot be set without depth");if(_.checkFramebufferStatus(_.FRAMEBUFFER)!==_.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class _s{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}_s.Replace=[1,0],_s.disabled=new _s(_s.Replace,u.aN.transparent,[!1,!1,!1,!1]),_s.unblended=new _s(_s.Replace,u.aN.transparent,[!0,!0,!0,!0]),_s.alphaBlended=new _s([1,771],u.aN.transparent,[!0,!0,!0,!0]);class cd{constructor(t){var n,s;if(this.gl=t,this.clearColor=new Du(this),this.clearDepth=new kf(this),this.clearStencil=new dh(this),this.colorMask=new Ef(this),this.depthMask=new eu(this),this.stencilMask=new Tf(this),this.stencilFunc=new yp(this),this.stencilOp=new Cf(this),this.stencilTest=new _p(this),this.depthRange=new nd(this),this.depthTest=new vp(this),this.depthFunc=new xp(this),this.blend=new bp(this),this.blendFunc=new wp(this),this.blendColor=new zc(this),this.blendEquation=new Sp(this),this.cullFace=new Af(this),this.cullFaceSide=new Pf(this),this.frontFace=new kp(this),this.program=new Bu(this),this.activeTexture=new If(this),this.viewport=new ph(this),this.bindFramebuffer=new Mf(this),this.bindRenderbuffer=new zf(this),this.bindTexture=new Ep(this),this.bindVertexBuffer=new Tp(this),this.bindElementBuffer=new Cp(this),this.bindVertexArray=new od(this),this.pixelStoreUnpack=new Ap(this),this.pixelStoreUnpackPremultiplyAlpha=new fh(this),this.pixelStoreUnpackFlipY=new ic(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Qc(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:a==null?void 0:a.RGBA16F_EXT,this.RGB16F=(s=t.RGB16F)!==null&&s!==void 0?s:a==null?void 0:a.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const a=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=a==null?void 0:a.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new ed(this,t,n)}createVertexBuffer(t,n,s){return new ql(this,t,n,s)}createRenderbuffer(t,n,s){const a=this.gl,h=a.createRenderbuffer();return this.bindRenderbuffer.set(h),a.renderbufferStorage(a.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),h}createFramebuffer(t,n,s,a){return new ld(this,t,n,s,a)}clear({color:t,depth:n,stencil:s}){const a=this.gl;let h=0;t&&(h|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s!==void 0&&(h|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),a.clear(h)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){u.aF(t.blendFunction,_s.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Qc(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return Qc(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class rs{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}rs.ReadOnly=!1,rs.ReadWrite=!0,rs.disabled=new rs(519,rs.ReadOnly,[0,1]);const ud=7680;class As{constructor(t,n,s,a,h,_){this.test=t,this.ref=n,this.mask=s,this.fail=a,this.depthFail=h,this.pass=_}}As.disabled=new As({func:519,mask:0},0,0,ud,ud,ud);class bs{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let Lu;function Ip(d,t,n,s,a){const h=d.context,_=h.gl,w=d.useProgram("collisionBox"),E=[];let C=0,z=0;for(let Re=0;Re<s.length;Re++){const Ke=s[Re],ie=t.getTile(Ke).getBucket(n);if(!ie)continue;const Zt=a?ie.textCollisionBox:ie.iconCollisionBox,ti=ie.collisionCircleArray;if(ti.length>0){const ni=u.H();u.aR(ni,ie.placementInvProjMatrix,d.transform.glCoordMatrix),u.aR(ni,ni,ie.placementViewportMatrix),E.push({circleArray:ti,circleOffset:z,transform:Ke.posMatrix,invTransform:ni,coord:Ke}),C+=ti.length/4,z=C}Zt&&w.draw(h,_.LINES,rs.disabled,As.disabled,d.colorModeForRenderPass(),bs.disabled,{u_matrix:Ke.posMatrix,u_pixel_extrude_scale:[1/(D=d.transform).width,1/D.height]},d.style.map.terrain&&d.style.map.terrain.getTerrainData(Ke),n.id,Zt.layoutVertexBuffer,Zt.indexBuffer,Zt.segments,null,d.transform.zoom,null,null,Zt.collisionVertexBuffer)}var D;if(!a||!E.length)return;const $=d.useProgram("collisionCircle"),U=new u.aS;U.resize(4*C),U._trim();let ee=0;for(const Re of E)for(let Ke=0;Ke<Re.circleArray.length/4;Ke++){const ie=4*Ke,Zt=Re.circleArray[ie+0],ti=Re.circleArray[ie+1],ni=Re.circleArray[ie+2],yi=Re.circleArray[ie+3];U.emplace(ee++,Zt,ti,ni,yi,0),U.emplace(ee++,Zt,ti,ni,yi,1),U.emplace(ee++,Zt,ti,ni,yi,2),U.emplace(ee++,Zt,ti,ni,yi,3)}(!Lu||Lu.length<2*C)&&(Lu=function(Re){const Ke=2*Re,ie=new u.aU;ie.resize(Ke),ie._trim();for(let Zt=0;Zt<Ke;Zt++){const ti=6*Zt;ie.uint16[ti+0]=4*Zt+0,ie.uint16[ti+1]=4*Zt+1,ie.uint16[ti+2]=4*Zt+2,ie.uint16[ti+3]=4*Zt+2,ie.uint16[ti+4]=4*Zt+3,ie.uint16[ti+5]=4*Zt+0}return ie}(C));const de=h.createIndexBuffer(Lu,!0),re=h.createVertexBuffer(U,u.aT.members,!0);for(const Re of E){const Ke=xf(Re.transform,Re.invTransform,d.transform);$.draw(h,_.TRIANGLES,rs.disabled,As.disabled,d.colorModeForRenderPass(),bs.disabled,Ke,d.style.map.terrain&&d.style.map.terrain.getTerrainData(Re.coord),n.id,re,de,u.a0.simpleSegment(0,2*Re.circleOffset,Re.circleArray.length,Re.circleArray.length/2),null,d.transform.zoom,null,null,null)}re.destroy(),de.destroy()}bs.disabled=new bs(!1,1029,2305),bs.backCCW=new bs(!0,1029,2305);const hd=u.ao(new Float32Array(16));function mh(d,t,n,s,a,h){const{horizontalAlign:_,verticalAlign:w}=u.av(d);return new u.P((-(_-.5)*t/a+s[0])*h,(-(w-.5)*n/a+s[1])*h)}function gh(d,t,n,s,a,h){const _=t.tileAnchorPoint.add(new u.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let w=s.mult(h);return n||(w=w.rotate(-a)),ze(_.add(w),t.labelPlaneMatrix,t.getElevation).point}if(n){const w=di(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(d),E=Math.atan(w.y/w.x)+(w.x<0?Math.PI:0);return d.add(s.rotate(E))}return d.add(s)}function yh(d,t,n,s,a,h,_,w,E,C,z,D,$,U){const ee=d.text.placedSymbolArray,de=d.text.dynamicLayoutVertexArray,re=d.icon.dynamicLayoutVertexArray,Re={};de.clear();for(let Ke=0;Ke<ee.length;Ke++){const ie=ee.get(Ke),Zt=ie.hidden||!ie.crossTileID||d.allowVerticalPlacement&&!ie.placedOrientation?null:s[ie.crossTileID];if(Zt){const ti=new u.P(ie.anchorX,ie.anchorY),ni={getElevation:U,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:n,projection:z,projectionCache:null,tileAnchorPoint:ti,translation:D,unwrappedTileID:$},yi=n?ze(ti,_,U):di(ti.x,ti.y,ni),xi=O(a.cameraToCenterDistance,yi.signedDistanceFromCamera);let zi=u.aj(d.textSizeData,E,ie)*xi/u.aq;n&&(zi*=d.tilePixelRatio/w);const{width:Bi,height:bi,anchor:wi,textOffset:Oi,textBoxScale:Xi}=Zt,Ei=mh(wi,Bi,bi,Oi,Xi,zi),Ai=z.getPitchedTextCorrection(a,ti.add(new u.P(D[0],D[1])),$),Wi=gh(yi.point,ni,t,Ei,a.angle,Ai),Ss=d.allowVerticalPlacement&&ie.placedOrientation===u.ai.vertical?Math.PI/2:0;for(let es=0;es<ie.numGlyphs;es++)u.ak(de,Wi,Ss);C&&ie.associatedIconIndex>=0&&(Re[ie.associatedIconIndex]={shiftedAnchor:Wi,angle:Ss})}else qi(ie.numGlyphs,de)}if(C){re.clear();const Ke=d.icon.placedSymbolArray;for(let ie=0;ie<Ke.length;ie++){const Zt=Ke.get(ie);if(Zt.hidden)qi(Zt.numGlyphs,re);else{const ti=Re[ie];if(ti)for(let ni=0;ni<Zt.numGlyphs;ni++)u.ak(re,ti.shiftedAnchor,ti.angle);else qi(Zt.numGlyphs,re)}}d.icon.dynamicLayoutVertexBuffer.updateData(re)}d.text.dynamicLayoutVertexBuffer.updateData(de)}function dd(d,t,n){return n.iconsInText&&t?"symbolTextAndIcon":d?"symbolSDF":"symbolIcon"}function yc(d,t,n,s,a,h,_,w,E,C,z,D){const $=d.context,U=$.gl,ee=d.transform,de=ih(),re=w==="map",Re=E==="map",Ke=w!=="viewport"&&n.layout.get("symbol-placement")!=="point",ie=re&&!Re&&!Ke,Zt=!Re&&Ke,ti=!n.layout.get("symbol-sort-key").isConstant();let ni=!1;const yi=d.depthModeForSublayer(0,rs.ReadOnly),xi=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),zi=[],Bi=de.getCircleRadiusCorrection(ee);for(const bi of s){const wi=t.getTile(bi),Oi=wi.getBucket(n);if(!Oi)continue;const Xi=a?Oi.text:Oi.icon;if(!Xi||!Xi.segments.get().length||!Xi.hasVisibleVertices)continue;const Ei=Xi.programConfigurations.get(n.id),Ai=a||Oi.sdfIcons,Wi=a?Oi.textSizeData:Oi.iconSizeData,Ss=Re||ee.pitch!==0,es=d.useProgram(dd(Ai,a,Oi),Ei),ns=u.ah(Wi,ee.zoom),ks=d.style.map.terrain&&d.style.map.terrain.getTerrainData(bi);let ea,ja,Es,_a,da=[0,0],ta=null;if(a)ja=wi.glyphAtlasTexture,Es=U.LINEAR,ea=wi.glyphAtlasTexture.size,Oi.iconsInText&&(da=wi.imageAtlasTexture.size,ta=wi.imageAtlasTexture,_a=Ss||d.options.rotating||d.options.zooming||Wi.kind==="composite"||Wi.kind==="camera"?U.LINEAR:U.NEAREST);else{const Ps=n.layout.get("icon-size").constantOr(0)!==1||Oi.iconsNeedLinear;ja=wi.imageAtlasTexture,Es=Ai||d.options.rotating||d.options.zooming||Ps||Ss?U.LINEAR:U.NEAREST,ea=wi.imageAtlasTexture.size}const ia=Qi(wi,1,d.transform.zoom),Ua=Zt?bi.posMatrix:hd,Nc=pc(Ua,Re,re,d.transform,ia),zh=zl(Ua,Re,re,d.transform,ia),cu=zl(bi.posMatrix,Re,re,d.transform,ia),$c=de.translatePosition(d.transform,wi,h,_),Dh=xi&&Oi.hasTextData(),Ud=n.layout.get("icon-text-fit")!=="none"&&Dh&&Oi.hasIconData();if(Ke){const Ps=d.style.map.terrain?(qd,Us)=>d.style.map.terrain.getElevation(bi,qd,Us):null,hu=n.layout.get("text-rotation-alignment")==="map";G(Oi,bi.posMatrix,d,a,Nc,cu,Re,C,hu,de,bi.toUnwrapped(),ee.width,ee.height,$c,Ps)}const Ks=bi.posMatrix,qa=a&&xi||Ud,xc=Ke||qa?hd:Nc,uu=zh,ra=Ai&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let na;na=Ai?Oi.iconsInText?Sf(Wi.kind,ns,ie,Re,Ke,qa,d,Ks,xc,uu,$c,ea,da,Bi):gp(Wi.kind,ns,ie,Re,Ke,qa,d,Ks,xc,uu,$c,a,ea,!0,Bi):mp(Wi.kind,ns,ie,Re,Ke,qa,d,Ks,xc,uu,$c,a,ea,Bi);const Zs={program:es,buffers:Xi,uniformValues:na,atlasTexture:ja,atlasTextureIcon:ta,atlasInterpolation:Es,atlasInterpolationIcon:_a,isSDF:Ai,hasHalo:ra};if(ti&&Oi.canOverlap){ni=!0;const Ps=Xi.segments.get();for(const hu of Ps)zi.push({segments:new u.a0([hu]),sortKey:hu.sortKey,state:Zs,terrainData:ks})}else zi.push({segments:Xi.segments,sortKey:0,state:Zs,terrainData:ks})}ni&&zi.sort((bi,wi)=>bi.sortKey-wi.sortKey);for(const bi of zi){const wi=bi.state;if($.activeTexture.set(U.TEXTURE0),wi.atlasTexture.bind(wi.atlasInterpolation,U.CLAMP_TO_EDGE),wi.atlasTextureIcon&&($.activeTexture.set(U.TEXTURE1),wi.atlasTextureIcon&&wi.atlasTextureIcon.bind(wi.atlasInterpolationIcon,U.CLAMP_TO_EDGE)),wi.isSDF){const Oi=wi.uniformValues;wi.hasHalo&&(Oi.u_is_halo=1,Dc(wi.buffers,bi.segments,n,d,wi.program,yi,z,D,Oi,bi.terrainData)),Oi.u_is_halo=0}Dc(wi.buffers,bi.segments,n,d,wi.program,yi,z,D,wi.uniformValues,bi.terrainData)}}function Dc(d,t,n,s,a,h,_,w,E,C){const z=s.context;a.draw(z,z.gl.TRIANGLES,h,_,w,bs.disabled,E,C,n.id,d.layoutVertexBuffer,d.indexBuffer,t,n.paint,s.transform.zoom,d.programConfigurations.get(n.id),d.dynamicLayoutVertexBuffer,d.opacityVertexBuffer)}function Ia(d,t,n,s,a){if(!n||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let _=h[n.to.toString()],w=h[n.from.toString()];if(!_&&w&&(_=w),!w&&_&&(w=_),!_||!w){const E=a.getPaintProperty(t);_=h[E],w=h[E]}_&&w&&d.setConstantPatternPositions(_,w)}function pd(d,t,n,s,a,h,_){const w=d.context.gl,E="fill-pattern",C=n.paint.get(E),z=C&&C.constantOr(1),D=n.getCrossfadeParameters();let $,U,ee,de,re;_?(U=z&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",$=w.LINES):(U=z?"fillPattern":"fill",$=w.TRIANGLES);const Re=C.constantOr(null);for(const Ke of s){const ie=t.getTile(Ke);if(z&&!ie.patternsLoaded())continue;const Zt=ie.getBucket(n);if(!Zt)continue;const ti=Zt.programConfigurations.get(n.id),ni=d.useProgram(U,ti),yi=d.style.map.terrain&&d.style.map.terrain.getTerrainData(Ke);z&&(d.context.activeTexture.set(w.TEXTURE0),ie.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),ti.updatePaintBuffers(D)),Ia(ti,E,Re,ie,n);const xi=yi?Ke:null,zi=d.translatePosMatrix(xi?xi.posMatrix:Ke.posMatrix,ie,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(_){de=Zt.indexBuffer2,re=Zt.segments2;const Bi=[w.drawingBufferWidth,w.drawingBufferHeight];ee=U==="fillOutlinePattern"&&z?vf(zi,d,D,ie,Bi):_f(zi,Bi)}else de=Zt.indexBuffer,re=Zt.segments,ee=z?Yc(zi,d,D,ie):Iu(zi);ni.draw(d.context,$,a,d.stencilModeForClipping(Ke),h,bs.disabled,ee,yi,n.id,Zt.layoutVertexBuffer,de,re,n.paint,d.transform.zoom,ti)}}function _h(d,t,n,s,a,h,_){const w=d.context,E=w.gl,C="fill-extrusion-pattern",z=n.paint.get(C),D=z.constantOr(1),$=n.getCrossfadeParameters(),U=n.paint.get("fill-extrusion-opacity"),ee=z.constantOr(null);for(const de of s){const re=t.getTile(de),Re=re.getBucket(n);if(!Re)continue;const Ke=d.style.map.terrain&&d.style.map.terrain.getTerrainData(de),ie=Re.programConfigurations.get(n.id),Zt=d.useProgram(D?"fillExtrusionPattern":"fillExtrusion",ie);D&&(d.context.activeTexture.set(E.TEXTURE0),re.imageAtlasTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),ie.updatePaintBuffers($)),Ia(ie,C,ee,re,n);const ti=d.translatePosMatrix(de.posMatrix,re,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ni=n.paint.get("fill-extrusion-vertical-gradient"),yi=D?lh(ti,d,ni,U,de,$,re):ah(ti,d,ni,U);Zt.draw(w,w.gl.TRIANGLES,a,h,_,bs.backCCW,yi,Ke,n.id,Re.layoutVertexBuffer,Re.indexBuffer,Re.segments,n.paint,d.transform.zoom,ie,d.style.map.terrain&&Re.centroidVertexBuffer)}}function fd(d,t,n,s,a,h,_){const w=d.context,E=w.gl,C=n.fbo;if(!C)return;const z=d.useProgram("hillshade"),D=d.style.map.terrain&&d.style.map.terrain.getTerrainData(t);w.activeTexture.set(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,C.colorAttachment.get()),z.draw(w,E.TRIANGLES,a,h,_,bs.disabled,(($,U,ee,de)=>{const re=ee.paint.get("hillshade-shadow-color"),Re=ee.paint.get("hillshade-highlight-color"),Ke=ee.paint.get("hillshade-accent-color");let ie=ee.paint.get("hillshade-illumination-direction")*(Math.PI/180);ee.paint.get("hillshade-illumination-anchor")==="viewport"&&(ie-=$.transform.angle);const Zt=!$.options.moving;return{u_matrix:de?de.posMatrix:$.transform.calculatePosMatrix(U.tileID.toUnwrapped(),Zt),u_image:0,u_latrange:Pa(0,U.tileID),u_light:[ee.paint.get("hillshade-exaggeration"),ie],u_shadow:re,u_highlight:Re,u_accent:Ke}})(d,n,s,D?t:null),D,s.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments)}function Bc(d,t,n,s,a,h){const _=d.context,w=_.gl,E=t.dem;if(E&&E.data){const C=E.dim,z=E.stride,D=E.getPixels();if(_.activeTexture.set(w.TEXTURE1),_.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||d.getTileTexture(z),t.demTexture){const U=t.demTexture;U.update(D,{premultiply:!1}),U.bind(w.NEAREST,w.CLAMP_TO_EDGE)}else t.demTexture=new os(_,D,w.RGBA,{premultiply:!1}),t.demTexture.bind(w.NEAREST,w.CLAMP_TO_EDGE);_.activeTexture.set(w.TEXTURE0);let $=t.fbo;if(!$){const U=new os(_,{width:C,height:C,data:null},w.RGBA);U.bind(w.LINEAR,w.CLAMP_TO_EDGE),$=t.fbo=_.createFramebuffer(C,C,!0,!1),$.colorAttachment.set(U.texture)}_.bindFramebuffer.set($.framebuffer),_.viewport.set([0,0,C,C]),d.useProgram("hillshadePrepare").draw(_,w.TRIANGLES,s,a,h,bs.disabled,((U,ee)=>{const de=ee.stride,re=u.H();return u.aQ(re,0,u.X,-u.X,0,0,1),u.J(re,re,[0,-u.X,0]),{u_matrix:re,u_image:1,u_dimension:[de,de],u_zoom:U.overscaledZ,u_unpack:ee.getUnpackVector()}})(t.tileID,E),null,n.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function vh(d,t,n,s,a,h){const _=s.paint.get("raster-fade-duration");if(!h&&_>0){const w=H.now(),E=(w-d.timeAdded)/_,C=t?(w-t.timeAdded)/_:-1,z=n.getSource(),D=a.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),$=!t||Math.abs(t.tileID.overscaledZ-D)>Math.abs(d.tileID.overscaledZ-D),U=$&&d.refreshedUponExpiration?1:u.ad($?E:1-C,0,1);return d.refreshedUponExpiration&&E>=1&&(d.refreshedUponExpiration=!1),t?{opacity:1,mix:1-U}:{opacity:U,mix:0}}return{opacity:1,mix:0}}const xh=new u.aN(1,0,0,1),Fu=new u.aN(0,1,0,1),bh=new u.aN(0,0,1,1),Mp=new u.aN(1,0,1,1),tu=new u.aN(0,1,1,1);function Rc(d,t,n,s){iu(d,0,t+n/2,d.transform.width,n,s)}function md(d,t,n,s){iu(d,t-n/2,0,n,d.transform.height,s)}function iu(d,t,n,s,a,h){const _=d.context,w=_.gl;w.enable(w.SCISSOR_TEST),w.scissor(t*d.pixelRatio,n*d.pixelRatio,s*d.pixelRatio,a*d.pixelRatio),_.clear({color:h}),w.disable(w.SCISSOR_TEST)}function ls(d,t,n){const s=d.context,a=s.gl,h=n.posMatrix,_=d.useProgram("debug"),w=rs.disabled,E=As.disabled,C=d.colorModeForRenderPass(),z="$debug",D=d.style.map.terrain&&d.style.map.terrain.getTerrainData(n);s.activeTexture.set(a.TEXTURE0);const $=t.getTileByID(n.key).latestRawTileData,U=Math.floor(($&&$.byteLength||0)/1024),ee=t.getTile(n).tileSize,de=512/Math.min(ee,512)*(n.overscaledZ/d.transform.zoom)*.5;let re=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(re+=` => ${n.overscaledZ}`),function(Re,Ke){Re.initDebugOverlayCanvas();const ie=Re.debugOverlayCanvas,Zt=Re.context.gl,ti=Re.debugOverlayCanvas.getContext("2d");ti.clearRect(0,0,ie.width,ie.height),ti.shadowColor="white",ti.shadowBlur=2,ti.lineWidth=1.5,ti.strokeStyle="white",ti.textBaseline="top",ti.font="bold 36px Open Sans, sans-serif",ti.fillText(Ke,5,5),ti.strokeText(Ke,5,5),Re.debugOverlayTexture.update(ie),Re.debugOverlayTexture.bind(Zt.LINEAR,Zt.CLAMP_TO_EDGE)}(d,`${re} ${U}kB`),_.draw(s,a.TRIANGLES,w,E,_s.alphaBlended,bs.disabled,gc(h,u.aN.transparent,de),null,z,d.debugBuffer,d.quadTriangleIndexBuffer,d.debugSegments),_.draw(s,a.LINE_STRIP,w,E,C,bs.disabled,gc(h,u.aN.red),D,z,d.debugBuffer,d.tileBorderIndexBuffer,d.debugSegments)}function Ou(d,t,n){const s=d.context,a=s.gl,h=d.colorModeForRenderPass(),_=new rs(a.LEQUAL,rs.ReadWrite,d.depthRangeFor3D),w=d.useProgram("terrain"),E=t.getTerrainMesh();s.bindFramebuffer.set(null),s.viewport.set([0,0,d.width,d.height]);for(const C of n){const z=d.renderToTexture.getTexture(C),D=t.getTerrainData(C.tileID);s.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,z.texture);const $=d.transform.calculatePosMatrix(C.tileID.toUnwrapped()),U=t.getMeshFrameDelta(d.transform.zoom),ee=d.transform.calculateFogMatrix(C.tileID.toUnwrapped()),de=Yh($,U,ee,d.style.sky,d.transform.pitch);w.draw(s,a.TRIANGLES,_,As.disabled,h,bs.backCCW,de,D,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}}class zp{constructor(t,n,s){this.vertexBuffer=t,this.indexBuffer=n,this.segments=s}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Dp{constructor(t,n){this.context=new cd(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Hi.maxUnderzooming+Hi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ba}resize(t,n,s){if(this.width=Math.floor(t*s),this.height=Math.floor(n*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const a of this.style._order)this.style._layers[a].resize()}setup(){const t=this.context,n=new u.aX;n.emplaceBack(0,0),n.emplaceBack(u.X,0),n.emplaceBack(0,u.X),n.emplaceBack(u.X,u.X),this.tileExtentBuffer=t.createVertexBuffer(n,Au.members),this.tileExtentSegments=u.a0.simpleSegment(0,0,4,2);const s=new u.aX;s.emplaceBack(0,0),s.emplaceBack(u.X,0),s.emplaceBack(0,u.X),s.emplaceBack(u.X,u.X),this.debugBuffer=t.createVertexBuffer(s,Au.members),this.debugSegments=u.a0.simpleSegment(0,0,4,5);const a=new u.$;a.emplaceBack(0,0,0,0),a.emplaceBack(u.X,0,u.X,0),a.emplaceBack(0,u.X,0,u.X),a.emplaceBack(u.X,u.X,u.X,u.X),this.rasterBoundsBuffer=t.createVertexBuffer(a,hc.members),this.rasterBoundsSegments=u.a0.simpleSegment(0,0,4,2);const h=new u.aX;h.emplaceBack(0,0),h.emplaceBack(1,0),h.emplaceBack(0,1),h.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(h,Au.members),this.viewportSegments=u.a0.simpleSegment(0,0,4,2);const _=new u.aZ;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(_);const w=new u.aY;w.emplaceBack(0,1,2),w.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(w);const E=this.context.gl;this.stencilClearMode=new As({func:E.ALWAYS,mask:0},0,255,E.ZERO,E.ZERO,E.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=u.H();u.aQ(s,0,this.width,this.height,0,0,1),u.K(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,rs.disabled,this.stencilClearMode,_s.disabled,bs.disabled,Mu(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,a=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(_s.disabled),s.setDepthMode(rs.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const _ of n){const w=this._tileClippingMaskIDs[_.key]=this.nextStencilID++,E=this.style.map.terrain&&this.style.map.terrain.getTerrainData(_);h.draw(s,a.TRIANGLES,rs.disabled,new As({func:a.ALWAYS,mask:0},w,255,a.KEEP,a.KEEP,a.REPLACE),_s.disabled,bs.disabled,Mu(_.posMatrix),E,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new As({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new As({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((_,w)=>w.overscaledZ-_.overscaledZ),a=s[s.length-1].overscaledZ,h=s[0].overscaledZ-a+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const _={};for(let w=0;w<h;w++)_[w+a]=new As({func:n.GEQUAL,mask:255},w+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=h,[_,s]}return[{[a]:As.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new _s([t.CONSTANT_COLOR,t.ONE],new u.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?_s.unblended:_s.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return rs.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new rs(s||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var s;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(H.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,_={},w={},E={};for(const C in h){const z=h[C];z.used&&z.prepare(this.context),_[C]=z.getVisibleCoordinates(),w[C]=_[C].slice().reverse(),E[C]=z.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let C=0;C<a.length;C++)if(this.style._layers[a[C]].is3D()){this.opaquePassCutoff=C;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const C of a){const z=this.style._layers[C];if(!z.hasOffscreenPass()||z.isHidden(this.transform.zoom))continue;const D=w[z.source];(z.type==="custom"||D.length)&&this.renderLayer(this,h[z.source],z,D)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?u.aN.black:u.aN.transparent,depth:1}),this.clearStencil(),!((s=this.style.stylesheet)===null||s===void 0)&&s.sky&&function(C,z){const D=C.context,$=D.gl,U=((Ke,ie,Zt)=>({u_sky_color:Ke.properties.get("sky-color"),u_horizon_color:Ke.properties.get("horizon-color"),u_horizon:(ie.height/2+ie.getHorizon())*Zt,u_sky_horizon_blend:Ke.properties.get("sky-horizon-blend")*ie.height/2*Zt}))(z,C.style.map.transform,C.pixelRatio),ee=new rs($.LEQUAL,rs.ReadWrite,[0,1]),de=As.disabled,re=C.colorModeForRenderPass(),Re=C.useProgram("sky");if(!z.mesh){const Ke=new u.aX;Ke.emplaceBack(-1,-1),Ke.emplaceBack(1,-1),Ke.emplaceBack(1,1),Ke.emplaceBack(-1,1);const ie=new u.aY;ie.emplaceBack(0,1,2),ie.emplaceBack(0,2,3),z.mesh=new zp(D.createVertexBuffer(Ke,Au.members),D.createIndexBuffer(ie),u.a0.simpleSegment(0,0,Ke.length,ie.length))}Re.draw(D,$.TRIANGLES,ee,de,re,bs.disabled,U,void 0,"sky",z.mesh.vertexBuffer,z.mesh.indexBuffer,z.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const C=this.style._layers[a[this.currentLayer]],z=h[C.source],D=_[C.source];this._renderTileClippingMasks(C,D),this.renderLayer(this,z,C,D)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const C=this.style._layers[a[this.currentLayer]],z=h[C.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(C))continue;const D=(C.type==="symbol"?E:w)[C.source];this._renderTileClippingMasks(C,_[C.source]),this.renderLayer(this,z,C,D)}if(this.options.showTileBoundaries){const C=function(z,D){let $=null;const U=Object.values(z._layers).flatMap(Re=>Re.source&&!Re.isHidden(D)?[z.sourceCaches[Re.source]]:[]),ee=U.filter(Re=>Re.getSource().type==="vector"),de=U.filter(Re=>Re.getSource().type!=="vector"),re=Re=>{(!$||$.getSource().maxzoom<Re.getSource().maxzoom)&&($=Re)};return ee.forEach(Re=>re(Re)),$||de.forEach(Re=>re(Re)),$}(this.style,this.transform.zoom);C&&function(z,D,$){for(let U=0;U<$.length;U++)ls(z,D,$[U])}(this,C,C.getVisibleCoordinates())}this.options.showPadding&&function(C){const z=C.transform.padding;Rc(C,C.transform.height-(z.top||0),3,xh),Rc(C,z.bottom||0,3,Fu),md(C,z.left||0,3,bh),md(C,C.transform.width-(z.right||0),3,Mp);const D=C.transform.centerPoint;(function($,U,ee,de){iu($,U-1,ee-10,2,20,de),iu($,U-10,ee-1,20,2,de)})(C,D.x,C.transform.height-D.y,tu)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,s=this.transform.modelViewProjectionMatrix;let a=this.terrainFacilitator.dirty;a||(a=t?!u.a_(n,s):!u.a$(n,s)),a||(a=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),a&&(u.b0(n,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,_){const w=h.context,E=w.gl,C=_s.unblended,z=new rs(E.LEQUAL,rs.ReadWrite,[0,1]),D=_.getTerrainMesh(),$=_.sourceCache.getRenderableTiles(),U=h.useProgram("terrainDepth");w.bindFramebuffer.set(_.getFramebuffer("depth").framebuffer),w.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),w.clear({color:u.aN.transparent,depth:1});for(const ee of $){const de=_.getTerrainData(ee.tileID),re={u_matrix:h.transform.calculatePosMatrix(ee.tileID.toUnwrapped()),u_ele_delta:_.getMeshFrameDelta(h.transform.zoom)};U.draw(w,E.TRIANGLES,z,As.disabled,C,bs.backCCW,re,de,"terrain",D.vertexBuffer,D.indexBuffer,D.segments)}w.bindFramebuffer.set(null),w.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,_){const w=h.context,E=w.gl,C=_s.unblended,z=new rs(E.LEQUAL,rs.ReadWrite,[0,1]),D=_.getTerrainMesh(),$=_.getCoordsTexture(),U=_.sourceCache.getRenderableTiles(),ee=h.useProgram("terrainCoords");w.bindFramebuffer.set(_.getFramebuffer("coords").framebuffer),w.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),w.clear({color:u.aN.transparent,depth:1}),_.coordsIndex=[];for(const de of U){const re=_.getTerrainData(de.tileID);w.activeTexture.set(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,$.texture);const Re={u_matrix:h.transform.calculatePosMatrix(de.tileID.toUnwrapped()),u_terrain_coords_id:(255-_.coordsIndex.length)/255,u_texture:0,u_ele_delta:_.getMeshFrameDelta(h.transform.zoom)};ee.draw(w,E.TRIANGLES,z,As.disabled,C,bs.backCCW,Re,re,"terrain",D.vertexBuffer,D.indexBuffer,D.segments),_.coordsIndex.push(de.tileID.key)}w.bindFramebuffer.set(null),w.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,n,s,a){if(!s.isHidden(this.transform.zoom)&&(s.type==="background"||s.type==="custom"||(a||[]).length))switch(this.id=s.id,s.type){case"symbol":(function(h,_,w,E,C){if(h.renderPass!=="translucent")return;const z=As.disabled,D=h.colorModeForRenderPass();(w._unevaluatedLayout.hasValue("text-variable-anchor")||w._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function($,U,ee,de,re,Re,Ke,ie,Zt){const ti=U.transform,ni=ih(),yi=re==="map",xi=Re==="map";for(const zi of $){const Bi=de.getTile(zi),bi=Bi.getBucket(ee);if(!bi||!bi.text||!bi.text.segments.get().length)continue;const wi=u.ah(bi.textSizeData,ti.zoom),Oi=Qi(Bi,1,U.transform.zoom),Xi=pc(zi.posMatrix,xi,yi,U.transform,Oi),Ei=ee.layout.get("icon-text-fit")!=="none"&&bi.hasIconData();if(wi){const Ai=Math.pow(2,ti.zoom-Bi.tileID.overscaledZ),Wi=U.style.map.terrain?(es,ns)=>U.style.map.terrain.getElevation(zi,es,ns):null,Ss=ni.translatePosition(ti,Bi,Ke,ie);yh(bi,yi,xi,Zt,ti,Xi,zi.posMatrix,Ai,wi,Ei,ni,Ss,zi.toUnwrapped(),Wi)}}}(E,h,w,_,w.layout.get("text-rotation-alignment"),w.layout.get("text-pitch-alignment"),w.paint.get("text-translate"),w.paint.get("text-translate-anchor"),C),w.paint.get("icon-opacity").constantOr(1)!==0&&yc(h,_,w,E,!1,w.paint.get("icon-translate"),w.paint.get("icon-translate-anchor"),w.layout.get("icon-rotation-alignment"),w.layout.get("icon-pitch-alignment"),w.layout.get("icon-keep-upright"),z,D),w.paint.get("text-opacity").constantOr(1)!==0&&yc(h,_,w,E,!0,w.paint.get("text-translate"),w.paint.get("text-translate-anchor"),w.layout.get("text-rotation-alignment"),w.layout.get("text-pitch-alignment"),w.layout.get("text-keep-upright"),z,D),_.map.showCollisionBoxes&&(Ip(h,_,w,E,!0),Ip(h,_,w,E,!1))})(t,n,s,a,this.style.placement.variableOffsets);break;case"circle":(function(h,_,w,E){if(h.renderPass!=="translucent")return;const C=w.paint.get("circle-opacity"),z=w.paint.get("circle-stroke-width"),D=w.paint.get("circle-stroke-opacity"),$=!w.layout.get("circle-sort-key").isConstant();if(C.constantOr(1)===0&&(z.constantOr(1)===0||D.constantOr(1)===0))return;const U=h.context,ee=U.gl,de=h.depthModeForSublayer(0,rs.ReadOnly),re=As.disabled,Re=h.colorModeForRenderPass(),Ke=[];for(let ie=0;ie<E.length;ie++){const Zt=E[ie],ti=_.getTile(Zt),ni=ti.getBucket(w);if(!ni)continue;const yi=ni.programConfigurations.get(w.id),xi=h.useProgram("circle",yi),zi=ni.layoutVertexBuffer,Bi=ni.indexBuffer,bi=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Zt),wi={programConfiguration:yi,program:xi,layoutVertexBuffer:zi,indexBuffer:Bi,uniformValues:hp(h,Zt,ti,w),terrainData:bi};if($){const Oi=ni.segments.get();for(const Xi of Oi)Ke.push({segments:new u.a0([Xi]),sortKey:Xi.sortKey,state:wi})}else Ke.push({segments:ni.segments,sortKey:0,state:wi})}$&&Ke.sort((ie,Zt)=>ie.sortKey-Zt.sortKey);for(const ie of Ke){const{programConfiguration:Zt,program:ti,layoutVertexBuffer:ni,indexBuffer:yi,uniformValues:xi,terrainData:zi}=ie.state;ti.draw(U,ee.TRIANGLES,de,re,Re,bs.disabled,xi,zi,w.id,ni,yi,ie.segments,w.paint,h.transform.zoom,Zt)}})(t,n,s,a);break;case"heatmap":(function(h,_,w,E){if(w.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const C=h.context,z=C.gl,D=As.disabled,$=new _s([z.ONE,z.ONE],u.aN.transparent,[!0,!0,!0,!0]);(function(U,ee,de){const re=U.gl;U.activeTexture.set(re.TEXTURE1),U.viewport.set([0,0,ee.width/4,ee.height/4]);let Re=de.heatmapFbo;if(Re)re.bindTexture(re.TEXTURE_2D,Re.colorAttachment.get()),U.bindFramebuffer.set(Re.framebuffer);else{const Ke=re.createTexture();re.bindTexture(re.TEXTURE_2D,Ke),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_WRAP_S,re.CLAMP_TO_EDGE),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_WRAP_T,re.CLAMP_TO_EDGE),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_MIN_FILTER,re.LINEAR),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_MAG_FILTER,re.LINEAR),Re=de.heatmapFbo=U.createFramebuffer(ee.width/4,ee.height/4,!1,!1),function(ie,Zt,ti,ni){var yi,xi;const zi=ie.gl,Bi=(yi=ie.HALF_FLOAT)!==null&&yi!==void 0?yi:zi.UNSIGNED_BYTE,bi=(xi=ie.RGBA16F)!==null&&xi!==void 0?xi:zi.RGBA;zi.texImage2D(zi.TEXTURE_2D,0,bi,Zt.width/4,Zt.height/4,0,zi.RGBA,Bi,null),ni.colorAttachment.set(ti)}(U,ee,Ke,Re)}})(C,h,w),C.clear({color:u.aN.transparent});for(let U=0;U<E.length;U++){const ee=E[U];if(_.hasRenderableParent(ee))continue;const de=_.getTile(ee),re=de.getBucket(w);if(!re)continue;const Re=re.programConfigurations.get(w.id),Ke=h.useProgram("heatmap",Re),{zoom:ie}=h.transform;Ke.draw(C,z.TRIANGLES,rs.disabled,D,$,bs.disabled,Aa(ee.posMatrix,de,ie,w.paint.get("heatmap-intensity")),null,w.id,re.layoutVertexBuffer,re.indexBuffer,re.segments,w.paint,h.transform.zoom,Re)}C.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(C,z){const D=C.context,$=D.gl,U=z.heatmapFbo;if(!U)return;D.activeTexture.set($.TEXTURE0),$.bindTexture($.TEXTURE_2D,U.colorAttachment.get()),D.activeTexture.set($.TEXTURE1);let ee=z.colorRampTexture;ee||(ee=z.colorRampTexture=new os(D,z.colorRamp,$.RGBA)),ee.bind($.LINEAR,$.CLAMP_TO_EDGE),C.useProgram("heatmapTexture").draw(D,$.TRIANGLES,rs.disabled,As.disabled,C.colorModeForRenderPass(),bs.disabled,((de,re,Re,Ke)=>{const ie=u.H();u.aQ(ie,0,de.width,de.height,0,0,1);const Zt=de.context.gl;return{u_matrix:ie,u_world:[Zt.drawingBufferWidth,Zt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:re.paint.get("heatmap-opacity")}})(C,z),null,z.id,C.viewportBuffer,C.quadTriangleIndexBuffer,C.viewportSegments,z.paint,C.transform.zoom)}(h,w))})(t,n,s,a);break;case"line":(function(h,_,w,E){if(h.renderPass!=="translucent")return;const C=w.paint.get("line-opacity"),z=w.paint.get("line-width");if(C.constantOr(1)===0||z.constantOr(1)===0)return;const D=h.depthModeForSublayer(0,rs.ReadOnly),$=h.colorModeForRenderPass(),U=w.paint.get("line-dasharray"),ee=w.paint.get("line-pattern"),de=ee.constantOr(1),re=w.paint.get("line-gradient"),Re=w.getCrossfadeParameters(),Ke=de?"linePattern":U?"lineSDF":re?"lineGradient":"line",ie=h.context,Zt=ie.gl;let ti=!0;for(const ni of E){const yi=_.getTile(ni);if(de&&!yi.patternsLoaded())continue;const xi=yi.getBucket(w);if(!xi)continue;const zi=xi.programConfigurations.get(w.id),Bi=h.context.program.get(),bi=h.useProgram(Ke,zi),wi=ti||bi.program!==Bi,Oi=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ni),Xi=ee.constantOr(null);if(Xi&&yi.imageAtlas){const Wi=yi.imageAtlas,Ss=Wi.patternPositions[Xi.to.toString()],es=Wi.patternPositions[Xi.from.toString()];Ss&&es&&zi.setConstantPatternPositions(Ss,es)}const Ei=Oi?ni:null,Ai=de?dp(h,yi,w,Re,Ei):U?pp(h,yi,w,U,Re,Ei):re?ch(h,yi,w,xi.lineClipsArray.length,Ei):zu(h,yi,w,Ei);if(de)ie.activeTexture.set(Zt.TEXTURE0),yi.imageAtlasTexture.bind(Zt.LINEAR,Zt.CLAMP_TO_EDGE),zi.updatePaintBuffers(Re);else if(U&&(wi||h.lineAtlas.dirty))ie.activeTexture.set(Zt.TEXTURE0),h.lineAtlas.bind(ie);else if(re){const Wi=xi.gradients[w.id];let Ss=Wi.texture;if(w.gradientVersion!==Wi.version){let es=256;if(w.stepInterpolant){const ns=_.getSource().maxzoom,ks=ni.canonical.z===ns?Math.ceil(1<<h.transform.maxZoom-ni.canonical.z):1;es=u.ad(u.aV(xi.maxLineLength/u.X*1024*ks),256,ie.maxTextureSize)}Wi.gradient=u.aW({expression:w.gradientExpression(),evaluationKey:"lineProgress",resolution:es,image:Wi.gradient||void 0,clips:xi.lineClipsArray}),Wi.texture?Wi.texture.update(Wi.gradient):Wi.texture=new os(ie,Wi.gradient,Zt.RGBA),Wi.version=w.gradientVersion,Ss=Wi.texture}ie.activeTexture.set(Zt.TEXTURE0),Ss.bind(w.stepInterpolant?Zt.NEAREST:Zt.LINEAR,Zt.CLAMP_TO_EDGE)}bi.draw(ie,Zt.TRIANGLES,D,h.stencilModeForClipping(ni),$,bs.disabled,Ai,Oi,w.id,xi.layoutVertexBuffer,xi.indexBuffer,xi.segments,w.paint,h.transform.zoom,zi,xi.layoutVertexBuffer2),ti=!1}})(t,n,s,a);break;case"fill":(function(h,_,w,E){const C=w.paint.get("fill-color"),z=w.paint.get("fill-opacity");if(z.constantOr(1)===0)return;const D=h.colorModeForRenderPass(),$=w.paint.get("fill-pattern"),U=h.opaquePassEnabledForLayer()&&!$.constantOr(1)&&C.constantOr(u.aN.transparent).a===1&&z.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===U){const ee=h.depthModeForSublayer(1,h.renderPass==="opaque"?rs.ReadWrite:rs.ReadOnly);pd(h,_,w,E,ee,D,!1)}if(h.renderPass==="translucent"&&w.paint.get("fill-antialias")){const ee=h.depthModeForSublayer(w.getPaintProperty("fill-outline-color")?2:0,rs.ReadOnly);pd(h,_,w,E,ee,D,!0)}})(t,n,s,a);break;case"fill-extrusion":(function(h,_,w,E){const C=w.paint.get("fill-extrusion-opacity");if(C!==0&&h.renderPass==="translucent"){const z=new rs(h.context.gl.LEQUAL,rs.ReadWrite,h.depthRangeFor3D);if(C!==1||w.paint.get("fill-extrusion-pattern").constantOr(1))_h(h,_,w,E,z,As.disabled,_s.disabled),_h(h,_,w,E,z,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const D=h.colorModeForRenderPass();_h(h,_,w,E,z,As.disabled,D)}}})(t,n,s,a);break;case"hillshade":(function(h,_,w,E){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const C=h.context,z=h.depthModeForSublayer(0,rs.ReadOnly),D=h.colorModeForRenderPass(),[$,U]=h.renderPass==="translucent"?h.stencilConfigForOverlap(E):[{},E];for(const ee of U){const de=_.getTile(ee);de.needsHillshadePrepare!==void 0&&de.needsHillshadePrepare&&h.renderPass==="offscreen"?Bc(h,de,w,z,As.disabled,D):h.renderPass==="translucent"&&fd(h,ee,de,w,z,$[ee.overscaledZ],D)}C.viewport.set([0,0,h.width,h.height])})(t,n,s,a);break;case"raster":(function(h,_,w,E){if(h.renderPass!=="translucent"||w.paint.get("raster-opacity")===0||!E.length)return;const C=h.context,z=C.gl,D=_.getSource(),$=h.useProgram("raster"),U=h.colorModeForRenderPass(),[ee,de]=D instanceof Ql?[{},E]:h.stencilConfigForOverlap(E),re=de[de.length-1].overscaledZ,Re=!h.options.moving;for(const Ke of de){const ie=h.depthModeForSublayer(Ke.overscaledZ-re,w.paint.get("raster-opacity")===1?rs.ReadWrite:rs.ReadOnly,z.LESS),Zt=_.getTile(Ke);Zt.registerFadeDuration(w.paint.get("raster-fade-duration"));const ti=_.findLoadedParent(Ke,0),ni=_.findLoadedSibling(Ke),yi=vh(Zt,ti||ni||null,_,w,h.transform,h.style.map.terrain);let xi,zi;const Bi=w.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR;C.activeTexture.set(z.TEXTURE0),Zt.texture.bind(Bi,z.CLAMP_TO_EDGE,z.LINEAR_MIPMAP_NEAREST),C.activeTexture.set(z.TEXTURE1),ti?(ti.texture.bind(Bi,z.CLAMP_TO_EDGE,z.LINEAR_MIPMAP_NEAREST),xi=Math.pow(2,ti.tileID.overscaledZ-Zt.tileID.overscaledZ),zi=[Zt.tileID.canonical.x*xi%1,Zt.tileID.canonical.y*xi%1]):Zt.texture.bind(Bi,z.CLAMP_TO_EDGE,z.LINEAR_MIPMAP_NEAREST),Zt.texture.useMipmap&&C.extTextureFilterAnisotropic&&h.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax);const bi=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Ke),wi=bi?Ke:null,Oi=wi?wi.posMatrix:h.transform.calculatePosMatrix(Ke.toUnwrapped(),Re),Xi=bf(Oi,zi||[0,0],xi||1,yi,w);D instanceof Ql?$.draw(C,z.TRIANGLES,ie,As.disabled,U,bs.disabled,Xi,bi,w.id,D.boundsBuffer,h.quadTriangleIndexBuffer,D.boundsSegments):$.draw(C,z.TRIANGLES,ie,ee[Ke.overscaledZ],U,bs.disabled,Xi,bi,w.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,s,a);break;case"background":(function(h,_,w,E){const C=w.paint.get("background-color"),z=w.paint.get("background-opacity");if(z===0)return;const D=h.context,$=D.gl,U=h.transform,ee=U.tileSize,de=w.paint.get("background-pattern");if(h.isPatternMissing(de))return;const re=!de&&C.a===1&&z===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==re)return;const Re=As.disabled,Ke=h.depthModeForSublayer(0,re==="opaque"?rs.ReadWrite:rs.ReadOnly),ie=h.colorModeForRenderPass(),Zt=h.useProgram(de?"backgroundPattern":"background"),ti=E||U.coveringTiles({tileSize:ee,terrain:h.style.map.terrain});de&&(D.activeTexture.set($.TEXTURE0),h.imageManager.bind(h.context));const ni=w.getCrossfadeParameters();for(const yi of ti){const xi=E?yi.posMatrix:h.transform.calculatePosMatrix(yi.toUnwrapped()),zi=de?Qh(xi,z,h,de,{tileID:yi,tileSize:ee},ni):uh(xi,z,C),Bi=h.style.map.terrain&&h.style.map.terrain.getTerrainData(yi);Zt.draw(D,$.TRIANGLES,Ke,Re,ie,bs.disabled,zi,Bi,w.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,s,a);break;case"custom":(function(h,_,w){const E=h.context,C=w.implementation;if(h.renderPass==="offscreen"){const z=C.prerender;z&&(h.setCustomLayerDefaults(),E.setColorMode(h.colorModeForRenderPass()),z.call(C,E.gl,h.transform.customLayerMatrix()),E.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),E.setColorMode(h.colorModeForRenderPass()),E.setStencilMode(As.disabled);const z=C.renderingMode==="3d"?new rs(h.context.gl.LEQUAL,rs.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,rs.ReadOnly);E.setDepthMode(z),C.render(E.gl,h.transform.customLayerMatrix(),{farZ:h.transform.farZ,nearZ:h.transform.nearZ,fov:h.transform._fov,modelViewProjectionMatrix:h.transform.modelViewProjectionMatrix,projectionMatrix:h.transform.projectionMatrix}),E.setDirty(),h.setBaseState(),E.bindFramebuffer.set(null)}})(t,0,s)}}translatePosMatrix(t,n,s,a,h){if(!s[0]&&!s[1])return t;const _=h?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(_){const C=Math.sin(_),z=Math.cos(_);s=[s[0]*z-s[1]*C,s[0]*C+s[1]*z]}const w=[h?s[0]:Qi(n,s[0],this.transform.zoom),h?s[1]:Qi(n,s[1],this.transform.zoom),0],E=new Float32Array(16);return u.J(E,t,w),E}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new oh(this.context,mc[t],n,hh[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new os(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class Lc{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const a=Math.pow(2,s),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(w=>{const E=1/(w=u.ag([],w,t))[3]/n*a;return u.b1(w,w,[E,E,1/w[3],E])}),_=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(w=>{const E=function($,U){var ee=U[0],de=U[1],re=U[2],Re=ee*ee+de*de+re*re;return Re>0&&(Re=1/Math.sqrt(Re)),$[0]=U[0]*Re,$[1]=U[1]*Re,$[2]=U[2]*Re,$}([],function($,U,ee){var de=U[0],re=U[1],Re=U[2],Ke=ee[0],ie=ee[1],Zt=ee[2];return $[0]=re*Zt-Re*ie,$[1]=Re*Ke-de*Zt,$[2]=de*ie-re*Ke,$}([],tn([],h[w[0]],h[w[1]]),tn([],h[w[2]],h[w[1]]))),C=-((z=E)[0]*(D=h[w[1]])[0]+z[1]*D[1]+z[2]*D[2]);var z,D;return E.concat(C)});return new Lc(h,_)}}class wh{constructor(t,n){this.min=t,this.max=n,this.center=function(s,a,h){return s[0]=.5*a[0],s[1]=.5*a[1],s[2]=.5*a[2],s}([],function(s,a,h){return s[0]=a[0]+h[0],s[1]=a[1]+h[1],s[2]=a[2]+h[2],s}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],s=ri(this.min),a=ri(this.max);for(let h=0;h<n.length;h++)s[h]=n[h]?this.min[h]:this.center[h],a[h]=n[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new wh(s,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let a=0;a<t.planes.length;a++){const h=t.planes[a];let _=0;for(let w=0;w<n.length;w++)u.b2(h,n[w])>=0&&_++;if(_===0)return 0;_!==n.length&&(s=!1)}if(s)return 2;for(let a=0;a<3;a++){let h=Number.MAX_VALUE,_=-Number.MAX_VALUE;for(let w=0;w<t.points.length;w++){const E=t.points[w][a]-this.min[a];h=Math.min(h,E),_=Math.max(_,E)}if(_<0||h>this.max[a]-this.min[a])return 0}return 1}}class Sh{constructor(t=0,n=0,s=0,a=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(a)||a<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=s,this.right=a}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=u.z.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=u.z.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=u.z.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=u.z.number(t.right,n.right,s)),this}getCenter(t,n){const s=u.ad((this.left+t-this.right)/2,0,t),a=u.ad((this.top+n-this.bottom)/2,0,n);return new u.P(s,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Sh(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const gd=85.051129;class yd{constructor(t,n,s,a,h){this.tileSize=512,this._renderWorldCopies=h===void 0||!!h,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s??0,this._maxPitch=a??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new u.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Sh,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new yd(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-u.b3(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var s=new u.A(4);return u.A!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s}(),function(s,a,h){var _=a[0],w=a[1],E=a[2],C=a[3],z=Math.sin(h),D=Math.cos(h);s[0]=_*D+E*z,s[1]=w*D+C*z,s[2]=_*-z+E*D,s[3]=w*-z+C*D}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=u.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new u.b4(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new u.P(0,0)),a=this.pointCoordinate(new u.P(this.width,0)),h=this.pointCoordinate(new u.P(this.width,this.height)),_=this.pointCoordinate(new u.P(0,this.height)),w=Math.floor(Math.min(s.x,a.x,h.x,_.x)),E=Math.floor(Math.max(s.x,a.x,h.x,_.x)),C=1;for(let z=w-C;z<=E+C;z++)z!==0&&n.push(new u.b4(z,t))}return n}coveringTiles(t){var n,s;let a=this.coveringZoomLevel(t);const h=a;if(t.minzoom!==void 0&&a<t.minzoom)return[];t.maxzoom!==void 0&&a>t.maxzoom&&(a=t.maxzoom);const _=this.pointCoordinate(this.getCameraPoint()),w=u.Z.fromLngLat(this.center),E=Math.pow(2,a),C=[E*_.x,E*_.y,0],z=[E*w.x,E*w.y,0],D=Lc.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let $=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&($=a);const U=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,ee=ie=>({aabb:new wh([ie*E,0,0],[(ie+1)*E,E,0]),zoom:0,x:0,y:0,wrap:ie,fullyVisible:!1}),de=[],re=[],Re=a,Ke=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let ie=1;ie<=3;ie++)de.push(ee(-ie)),de.push(ee(ie));for(de.push(ee(0));de.length>0;){const ie=de.pop(),Zt=ie.x,ti=ie.y;let ni=ie.fullyVisible;if(!ni){const bi=ie.aabb.intersects(D);if(bi===0)continue;ni=bi===2}const yi=t.terrain?C:z,xi=ie.aabb.distanceX(yi),zi=ie.aabb.distanceY(yi),Bi=Math.max(Math.abs(xi),Math.abs(zi));if(ie.zoom===Re||Bi>U+(1<<Re-ie.zoom)-2&&ie.zoom>=$){const bi=Re-ie.zoom,wi=C[0]-.5-(Zt<<bi),Oi=C[1]-.5-(ti<<bi);re.push({tileID:new u.S(ie.zoom===Re?Ke:ie.zoom,ie.wrap,ie.zoom,Zt,ti),distanceSq:Ws([z[0]-.5-Zt,z[1]-.5-ti]),tileDistanceToCamera:Math.sqrt(wi*wi+Oi*Oi)})}else for(let bi=0;bi<4;bi++){const wi=(Zt<<1)+bi%2,Oi=(ti<<1)+(bi>>1),Xi=ie.zoom+1;let Ei=ie.aabb.quadrant(bi);if(t.terrain){const Ai=new u.S(Xi,ie.wrap,Xi,wi,Oi),Wi=t.terrain.getMinMaxElevation(Ai),Ss=(n=Wi.minElevation)!==null&&n!==void 0?n:this.elevation,es=(s=Wi.maxElevation)!==null&&s!==void 0?s:this.elevation;Ei=new wh([Ei.min[0],Ei.min[1],Ss],[Ei.max[0],Ei.max[1],es])}de.push({aabb:Ei,zoom:Xi,x:wi,y:Oi,wrap:ie.wrap,fullyVisible:ni})}}return re.sort((ie,Zt)=>ie.distanceSq-Zt.distanceSq).map(ie=>ie.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=u.ad(t.lat,-85.051129,gd);return new u.P(u.O(t.lng)*this.worldSize,u.Q(n)*this.worldSize)}unproject(t){return new u.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.elevation,s=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,a=this.pointLocation(this.centerPoint,t),h=t.getElevationForLngLatZoom(a,this.tileZoom);if(!(this.elevation-h))return;const _=s+n-h,w=Math.cos(this._pitch)*this.cameraToCenterDistance/_/u.b5(1,a.lat),E=this.scaleZoom(w/this.tileSize);this._elevation=h,this._center=a,this.zoom=E}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),_=new u.Z(h.x-(s.x-a.x),h.y-(s.y-a.y));this.center=this.coordinateLocation(_),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return u.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const $=n.pointCoordinate(t);if($!=null)return $}const s=[t.x,t.y,0,1],a=[t.x,t.y,1,1];u.ag(s,s,this.pixelMatrixInverse),u.ag(a,a,this.pixelMatrixInverse);const h=s[3],_=a[3],w=s[1]/h,E=a[1]/_,C=s[2]/h,z=a[2]/_,D=C===z?0:(0-C)/(z-C);return new u.Z(u.z.number(s[0]/h,a[0]/_,D)/this.worldSize,u.z.number(w,E,D)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,n,1];return u.ag(a,a,s),new u.P(a[0]/a[3],a[1]/a[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new ui().extend(this.pointLocation(new u.P(0,t))).extend(this.pointLocation(new u.P(this.width,t))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ui([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,gd])}calculateTileMatrix(t){const n=t.canonical,s=this.worldSize/this.zoomScale(n.z),a=n.x+Math.pow(2,n.z)*t.wrap,h=u.ao(new Float64Array(16));return u.J(h,h,[a*s,n.y*s,0]),u.K(h,h,[s/u.X,s/u.X,1]),h}calculatePosMatrix(t,n=!1){const s=t.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[s])return a[s];const h=this.calculateTileMatrix(t);return u.L(h,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,h),a[s]=new Float32Array(h),a[s]}calculateFogMatrix(t){const n=t.key,s=this._fogMatrixCache;if(s[n])return s[n];const a=this.calculateTileMatrix(t);return u.L(a,this.fogMatrix,a),s[n]=new Float32Array(a),s[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,n){n=u.ad(+n,this.minZoom,this.maxZoom);const s={center:new u.N(t.lng,t.lat),zoom:n};let a=this.lngRange;if(!this._renderWorldCopies&&a===null){const ie=179.9999999999;a=[-ie,ie]}const h=this.tileSize*this.zoomScale(s.zoom);let _=0,w=h,E=0,C=h,z=0,D=0;const{x:$,y:U}=this.size;if(this.latRange){const ie=this.latRange;_=u.Q(ie[1])*h,w=u.Q(ie[0])*h,w-_<U&&(z=U/(w-_))}a&&(E=u.b3(u.O(a[0])*h,0,h),C=u.b3(u.O(a[1])*h,0,h),C<E&&(C+=h),C-E<$&&(D=$/(C-E)));const{x:ee,y:de}=this.project.call({worldSize:h},t);let re,Re;const Ke=Math.max(D||0,z||0);if(Ke){const ie=new u.P(D?(C+E)/2:ee,z?(w+_)/2:de);return s.center=this.unproject.call({worldSize:h},ie).wrap(),s.zoom+=this.scaleZoom(Ke),s}if(this.latRange){const ie=U/2;de-ie<_&&(Re=_+ie),de+ie>w&&(Re=w-ie)}if(a){const ie=(E+C)/2;let Zt=ee;this._renderWorldCopies&&(Zt=u.b3(ee,ie-h/2,ie+h/2));const ti=$/2;Zt-ti<E&&(re=E+ti),Zt+ti>C&&(re=C-ti)}if(re!==void 0||Re!==void 0){const ie=new u.P(re??ee,Re??de);s.center=this.unproject.call({worldSize:h},ie).wrap()}return s}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:s}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=s,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b5(1,this.center.lat)*this.worldSize;let a=u.ao(new Float64Array(16));u.K(a,a,[this.width/2,-this.height/2,1]),u.J(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=u.ao(new Float64Array(16)),u.K(a,a,[1,-1,1]),u.J(a,a,[-1,-1,0]),u.K(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a;const h=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),_=Math.min(this.elevation,this.minElevationForCurrentTile),w=h-_*this._pixelPerMeter/Math.cos(this._pitch),E=_<0?w:h,C=Math.PI/2+this._pitch,z=this._fov*(.5+t.y/this.height),D=Math.sin(z)*E/Math.sin(u.ad(Math.PI-C-z,.01,Math.PI-.01)),$=this.getHorizon(),U=2*Math.atan($/this.cameraToCenterDistance)*(.5+t.y/(2*$)),ee=Math.sin(U)*E/Math.sin(u.ad(Math.PI-C-U,.01,Math.PI-.01)),de=Math.min(D,ee);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*de+E),this.nearZ=this.height/50,a=new Float64Array(16),u.b6(a,this._fov,this.width/this.height,this.nearZ,this.farZ),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,this.projectionMatrix=u.af(a),u.K(a,a,[1,-1,1]),u.J(a,a,[0,0,-this.cameraToCenterDistance]),u.b7(a,a,this._pitch),u.ae(a,a,this.angle),u.J(a,a,[-n,-s,0]),this.mercatorMatrix=u.K([],a,[this.worldSize,this.worldSize,this.worldSize]),u.K(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.L(new Float64Array(16),this.labelPlaneMatrix,a),u.J(a,a,[0,0,-this.elevation]),this.modelViewProjectionMatrix=a,this.invModelViewProjectionMatrix=u.at([],a),this.fogMatrix=new Float64Array(16),u.b6(this.fogMatrix,this._fov,this.width/this.height,h,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,u.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),u.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),u.b7(this.fogMatrix,this.fogMatrix,this._pitch),u.ae(this.fogMatrix,this.fogMatrix,this.angle),u.J(this.fogMatrix,this.fogMatrix,[-n,-s,0]),u.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),u.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=u.L(new Float64Array(16),this.labelPlaneMatrix,a);const re=this.width%2/2,Re=this.height%2/2,Ke=Math.cos(this.angle),ie=Math.sin(this.angle),Zt=n-Math.round(n)+Ke*re+ie*Re,ti=s-Math.round(s)+Ke*Re+ie*re,ni=new Float64Array(a);if(u.J(ni,ni,[Zt>.5?Zt-1:Zt,ti>.5?ti-1:ti,0]),this.alignedModelViewProjectionMatrix=ni,a=u.at(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new u.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return u.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,a=n.y,h=n.x,_=n.y;for(const w of t)s=Math.min(s,w.x),a=Math.min(a,w.y),h=Math.max(h,w.x),_=Math.max(_,w.y);return[new u.P(s,a),new u.P(h,a),new u.P(h,_),new u.P(s,_),new u.P(s,a)]}}lngLatToCameraDepth(t,n){const s=this.locationCoordinate(t),a=[s.x*this.worldSize,s.y*this.worldSize,n,1];return u.ag(a,a,this.modelViewProjectionMatrix),a[2]/a[3]}}function kh(d,t){let n,s=!1,a=null,h=null;const _=()=>{a=null,s&&(d.apply(h,n),a=setTimeout(_,t),s=!1)};return(...w)=>(s=!0,h=this,n=w,a||_(),a)}class Vu{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let s;return n.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(s=a)}),(s&&s[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(s=>isNaN(s))){const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:s,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const s=n.join("/");let a=s;a.split("&").length>0&&(a=a.split("&")[0]),this._hashName&&(a=`${this._hashName}=${s}`);let h=window.location.hash.replace(a,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let _=window.location.href.replace(/(#.+)?$/,h);_=_.replace("&&","&"),window.history.replaceState(window.history.state,null,_)},this._updateHash=kh(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,a=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,a),_=Math.round(n.lng*h)/h,w=Math.round(n.lat*h)/h,E=this._map.getBearing(),C=this._map.getPitch();let z="";if(z+=t?`/${_}/${w}/${s}`:`${s}/${w}/${_}`,(E||C)&&(z+="/"+Math.round(10*E)/10),C&&(z+=`/${Math.round(C)}`),this._hashName){const D=this._hashName;let $=!1;const U=window.location.hash.slice(1).split("&").map(ee=>{const de=ee.split("=")[0];return de===D?($=!0,`${de}=${z}`):ee}).filter(ee=>ee);return $||U.push(`${D}=${z}`),`#${U.join("&")}`}return`#${z}`}}const Fc={linearity:.3,easing:u.b8(0,0,.3,1)},_d=u.e({deceleration:2500,maxSpeed:1400},Fc),vd=u.e({deceleration:20,maxSpeed:1400},Fc),Bp=u.e({deceleration:1e3,maxSpeed:360},Fc),Eh=u.e({deceleration:1e3,maxSpeed:90},Fc);class Th{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:H.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=H.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)n.zoom+=h.zoomDelta||0,n.bearing+=h.bearingDelta||0,n.pitch+=h.pitchDelta||0,h.panDelta&&n.pan._add(h.panDelta),h.around&&(n.around=h.around),h.pinchAround&&(n.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const h=Ch(n.pan.mag(),s,u.e({},_d,t||{}));a.offset=n.pan.mult(h.amount/n.pan.mag()),a.center=this._map.transform.center,ru(a,h)}if(n.zoom){const h=Ch(n.zoom,s,vd);a.zoom=this._map.transform.zoom+h.amount,ru(a,h)}if(n.bearing){const h=Ch(n.bearing,s,Bp);a.bearing=this._map.transform.bearing+u.ad(h.amount,-179,179),ru(a,h)}if(n.pitch){const h=Ch(n.pitch,s,Eh);a.pitch=this._map.transform.pitch+h.amount,ru(a,h)}if(a.zoom||a.bearing){const h=n.pinchAround===void 0?n.around:n.pinchAround;a.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),u.e(a,{noMoveStart:!0})}}function ru(d,t){(!d.duration||d.duration<t.duration)&&(d.duration=t.duration,d.easing=t.easing)}function Ch(d,t,n){const{maxSpeed:s,linearity:a,deceleration:h}=n,_=u.ad(d*a/(t/1e3),-s,s),w=Math.abs(_)/(h*a);return{easing:n.easing,duration:1e3*w,amount:_*(w/2)}}class ha extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s,a={}){const h=Y.mousePos(n.getCanvas(),s),_=n.unproject(h);super(t,u.e({point:h,lngLat:_,originalEvent:s},a)),this._defaultPrevented=!1,this.target=n}}class Nu extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s){const a=t==="touchend"?s.changedTouches:s.touches,h=Y.touchPos(n.getCanvasContainer(),a),_=h.map(E=>n.unproject(E)),w=h.reduce((E,C,z,D)=>E.add(C.div(D.length)),new u.P(0,0));super(t,{points:h,point:w,lngLats:_,lngLat:n.unproject(w),originalEvent:s}),this._defaultPrevented=!1}}class xd extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}}class Ah{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new xd(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new ha(t.type,this._map,t))}mouseup(t){this._map.fire(new ha(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new ha(t.type,this._map,t))}dblclick(t){return this._firePreventable(new ha(t.type,this._map,t))}mouseover(t){this._map.fire(new ha(t.type,this._map,t))}mouseout(t){this._map.fire(new ha(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Nu(t.type,this._map,t))}touchmove(t){this._map.fire(new Nu(t.type,this._map,t))}touchend(t){this._map.fire(new Nu(t.type,this._map,t))}touchcancel(t){this._map.fire(new Nu(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bd{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new ha(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ha("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new ha(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nu{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(u.P.convert(t),this._map.terrain)}}class wd{constructor(t,n){this._map=t,this._tr=new nu(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(Y.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=s,this._box||(this._box=Y.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const h=Math.min(a.x,s.x),_=Math.max(a.x,s.x),w=Math.min(a.y,s.y),E=Math.max(a.y,s.y);Y.setTransform(this._box,`translate(${h}px,${w}px)`),this._box.style.width=_-h+"px",this._box.style.height=E-w+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,a=n;if(this.reset(),Y.suppressClick(),s.x!==a.x||s.y!==a.y)return this._map.fire(new u.k("boxzoomend",{originalEvent:t})),{cameraAnimation:h=>h.fitScreenCoordinates(s,a,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(Y.remove(this._box),this._box=null),Y.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new u.k(t,{originalEvent:n}))}}function ou(d,t){if(d.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${d.length}, points ${t.length}`);const n={};for(let s=0;s<d.length;s++)n[d[s].identifier]=t[s];return n}class Sd{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(a){const h=new u.P(0,0);for(const _ of a)h._add(_);return h.div(a.length)}(n),this.touches=ou(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const a=ou(s,n);for(const h in this.touches){const _=a[h];(!_||_.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}class kd{constructor(t){this.singleTap=new Sd(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const a=this.singleTap.touchend(t,n,s);if(a){const h=t.timeStamp-this.lastTime<500,_=!this.lastTap||this.lastTap.dist(a)<30;if(h&&_||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class Rp{constructor(t){this._tr=new nu(t),this._zoomIn=new kd({numTouches:1,numTaps:2}),this._zoomOut=new kd({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const a=this._zoomIn.touchend(t,n,s),h=this._zoomOut.touchend(t,n,s),_=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:w=>w.easeTo({duration:300,zoom:_.zoom+1,around:_.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:w=>w.easeTo({duration:300,zoom:_.zoom-1,around:_.unproject(h)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ws{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const a=n.length?n[0]:n;return!this._moved&&a.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(s,a))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&Y.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Oc={0:1,2:2};class ya{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=Y.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,s){const a=Oc[s];return n.buttons===void 0||(n.buttons&a)!==a}(t,this._eventButton)}isValidEndEvent(t){return Y.mouseButton(t)===this._eventButton}}class Ph{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const $u=d=>{d.mousedown=d.dragStart,d.mousemoveWindow=d.dragMove,d.mouseup=d.dragEnd,d.contextmenu=t=>{t.preventDefault()}},Ed=({enable:d,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const s=new ya({checkCorrectEvent:a=>Y.mouseButton(a)===0&&a.ctrlKey||Y.mouseButton(a)===2});return new ws({clickTolerance:t,move:(a,h)=>({bearingDelta:(h.x-a.x)*n}),moveStateManager:s,enable:d,assignEvents:$u})},Vc=({enable:d,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const s=new ya({checkCorrectEvent:a=>Y.mouseButton(a)===0&&a.ctrlKey||Y.mouseButton(a)===2});return new ws({clickTolerance:t,move:(a,h)=>({pitchDelta:(h.y-a.y)*n}),moveStateManager:s,enable:d,assignEvents:$u})};class ju{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._active){if(!this._shouldBePrevented(s.length))return t.preventDefault(),this._calculateTransform(t,n,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const a=ou(s,n),h=new u.P(0,0),_=new u.P(0,0);let w=0;for(const C in a){const z=a[C],D=this._touches[C];D&&(h._add(z),_._add(z.sub(D)),w++,a[C]=z)}if(this._touches=a,this._shouldBePrevented(w)||!_.mag())return;const E=_.div(w);return this._sum._add(E),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(w),panDelta:E}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Uu{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[a,h]=this._firstTwoTouches,_=qu(s,n,a),w=qu(s,n,h);if(!_||!w)return;const E=this._aroundCenter?null:_.add(w).div(2);return this._move([_,w],E,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,_=qu(s,n,a),w=qu(s,n,h);_&&w||(this._active&&Y.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function qu(d,t,n){for(let s=0;s<d.length;s++)if(d[s].identifier===n)return t[s]}function Td(d,t){return Math.log(d/t)/Math.LN2}class Cd extends Uu{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Td(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Td(this._distance,s),pinchAround:n}}}function Ad(d,t){return 180*d.angleWith(t)/Math.PI}class Pd extends Uu{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n,s){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Ad(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=Ad(t,this._startVector);return Math.abs(s)<n}}function rc(d){return Math.abs(d.y)>Math.abs(d.x)}class Id extends Uu{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,rc(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const a=t[0].sub(this._lastPoints[0]),h=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,h,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(a.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const a=t.mag()>=2,h=n.mag()>=2;if(!a&&!h)return;if(!a||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const _=t.y>0==n.y>0;return rc(t)&&rc(n)&&_}}const Lp={panStep:100,bearingStep:15,pitchStep:10};class Md{constructor(t){this._tr=new nu(t);const n=Lp;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,a=0,h=0,_=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?s=-1:(t.preventDefault(),h=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),h=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),_=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),_=1);break;default:return}return this._rotationDisabled&&(s=0,a=0),{cameraAnimation:w=>{const E=this._tr;w.easeTo({duration:300,easeId:"keyboardHandler",easing:Fp,zoom:n?Math.round(E.zoom)+n*(t.shiftKey?2:1):E.zoom,bearing:E.bearing+s*this._bearingStep,pitch:E.pitch+a*this._pitchStep,offset:[-h*this._panStep,-_*this._panStep],center:E.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Fp(d){return d*(2-d)}const zd=4.000244140625;class Dd{constructor(t,n){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=t,this._tr=new nu(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=H.now(),a=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%zd==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=Y.mousePos(this._map.getCanvas(),t),s=this._tr;this._around=n.y>s.transform.height/2-s.transform.getHorizon()?u.N.convert(this._aroundCenter?s.center:s.unproject(n)):u.N.convert(s.center),this._aroundPoint=s.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const E=this._type==="wheel"&&Math.abs(this._delta)>zd?this._wheelZoomRate:this._defaultZoomRate;let C=2/(1+Math.exp(-Math.abs(this._delta*E)));this._delta<0&&C!==0&&(C=1/C);const z=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(z*C))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,a=this._easing;let h,_=!1;const w=H.now()-this._lastWheelEventTime;if(this._type==="wheel"&&s&&a&&w){const E=Math.min(w/200,1),C=a(E);h=u.z.number(s,n,C),E<1?this._frameId||(this._frameId=!0):_=!0}else h=n,_=!0;return this._active=!0,_&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!_,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=u.b9;if(this._prevEase){const s=this._prevEase,a=(H.now()-s.start)/s.duration,h=s.easing(a+.01)-s.easing(a),_=.27/Math.sqrt(h*h+1e-4)*.01,w=Math.sqrt(.0729-_*_);n=u.b8(_,w,.25,1)}return this._prevEase={start:H.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Bd{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Zu{constructor(t){this._tr=new nu(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Op{constructor(){this._tap=new kd({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,s){if(!this._swipePoint)if(this._tapTime){const a=n[0],h=t.timeStamp-this._tapTime<500,_=this._tapPoint.dist(a)<30;h&&_?s.length>0&&(this._swipePoint=a,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(t,n,s)}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const a=n[0],h=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const a=this._tap.touchend(t,n,s);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ra{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Na{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Rd{constructor(t,n,s,a){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class $a{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=Y.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=n,this._container.appendChild(a);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(Y.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new u.k("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const nc=d=>d.zoom||d.drag||d.pitch||d.rotate;class Df extends u.k{}function Ld(d){return d.panDelta&&d.panDelta.mag()||d.zoomDelta||d.bearingDelta||d.pitchDelta}class Bf{constructor(t,n){this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,h)=>{if(a.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const _=a.type==="renderFrame"?void 0:a,w={needsRenderFrame:!1},E={},C={},z=a.touches,D=z?this._getMapTouches(z):void 0,$=D?Y.touchPos(this._map.getCanvas(),D):Y.mousePos(this._map.getCanvas(),a);for(const{handlerName:de,handler:re,allowed:Re}of this._handlers){if(!re.isEnabled())continue;let Ke;this._blockedByActive(C,Re,de)?re.reset():re[h||a.type]&&(Ke=re[h||a.type](a,$,D),this.mergeHandlerResult(w,E,Ke,de,_),Ke&&Ke.needsRenderFrame&&this._triggerRenderFrame()),(Ke||re.isActive())&&(C[de]=re)}const U={};for(const de in this._previousActiveHandlers)C[de]||(U[de]=_);this._previousActiveHandlers=C,(Object.keys(U).length||Ld(w))&&(this._changes.push([w,E,U]),this._triggerRenderFrame()),(Object.keys(C).length||Ld(w))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ee}=w;ee&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ee(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Th(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[a,h,_]of this._listeners)Y.addEventListener(a,h,a===document?this.handleWindowEvent:this.handleEvent,_)}destroy(){for(const[t,n,s]of this._listeners)Y.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new Ah(n,t));const a=n.boxZoom=new wd(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=n.cooperativeGestures=new $a(n,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const _=new Rp(n),w=new Zu(n);n.doubleClickZoom=new Bd(w,_),this._add("tapZoom",_),this._add("clickZoom",w),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const E=new Op;this._add("tapDragZoom",E);const C=n.touchPitch=new Id(n);this._add("touchPitch",C),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const z=Ed(t),D=Vc(t);n.dragRotate=new Na(t,z,D),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",D,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const $=(({enable:Ke,clickTolerance:ie})=>{const Zt=new ya({checkCorrectEvent:ti=>Y.mouseButton(ti)===0&&!ti.ctrlKey});return new ws({clickTolerance:ie,move:(ti,ni)=>({around:ni,panDelta:ni.sub(ti)}),activateOnStart:!0,moveStateManager:Zt,enable:Ke,assignEvents:$u})})(t),U=new ju(t,n);n.dragPan=new Ra(s,$,U),this._add("mousePan",$),this._add("touchPan",U,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const ee=new Pd,de=new Cd;n.touchZoomRotate=new Rd(s,de,ee,E),this._add("touchRotate",ee,["touchPan","touchZoom"]),this._add("touchZoom",de,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const re=n.scrollZoom=new Dd(n,()=>this._triggerRenderFrame());this._add("scrollZoom",re,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const Re=n.keyboard=new Md(n);this._add("keyboard",Re),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new bd(n))}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!nc(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,s){for(const a in t)if(a!==s&&(!n||n.indexOf(a)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}mergeHandlerResult(t,n,s,a,h){if(!s)return;u.e(t,s);const _={handlerName:a,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(n.zoom=_),s.panDelta!==void 0&&(n.drag=_),s.pitchDelta!==void 0&&(n.pitch=_),s.bearingDelta!==void 0&&(n.rotate=_)}_applyChanges(){const t={},n={},s={};for(const[a,h,_]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new u.P(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),a.around!==void 0&&(t.around=a.around),a.pinchAround!==void 0&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),u.e(n,h),u.e(s,_);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const a=this._map,h=a._getTransformForUpdate(),_=a.terrain;if(!(Ld(t)||_&&this._terrainMovement))return this._fireEvents(n,s,!0);let{panDelta:w,zoomDelta:E,bearingDelta:C,pitchDelta:z,around:D,pinchAround:$}=t;$!==void 0&&(D=$),a._stop(!0),D=D||a.transform.centerPoint;const U=h.pointLocation(w?D.sub(w):D);C&&(h.bearing+=C),z&&(h.pitch+=z),E&&(h.zoom+=E),_?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(w)):h.setLocationAtPoint(U,D):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(U,D)):h.setLocationAtPoint(U,D),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const a=nc(this._eventsInProgress),h=nc(t),_={};for(const D in t){const{originalEvent:$}=t[D];this._eventsInProgress[D]||(_[`${D}start`]=$),this._eventsInProgress[D]=t[D]}!a&&h&&this._fireEvent("movestart",h.originalEvent);for(const D in _)this._fireEvent(D,_[D]);h&&this._fireEvent("move",h.originalEvent);for(const D in t){const{originalEvent:$}=t[D];this._fireEvent(D,$)}const w={};let E;for(const D in this._eventsInProgress){const{handlerName:$,originalEvent:U}=this._eventsInProgress[D];this._handlersById[$].isActive()||(delete this._eventsInProgress[D],E=n[$]||U,w[`${D}end`]=E)}for(const D in w)this._fireEvent(D,w[D]);const C=nc(this._eventsInProgress),z=(a||h)&&!C;if(z&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const D=this._map._getTransformForUpdate();D.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(D)}if(s&&z){this._updatingCamera=!0;const D=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),$=U=>U!==0&&-this._bearingSnap<U&&U<this._bearingSnap;!D||!D.essential&&H.prefersReducedMotion?(this._map.fire(new u.k("moveend",{originalEvent:E})),$(this._map.getBearing())&&this._map.resetNorth()):($(D.bearing||this._map.getBearing())&&(D.bearing=0),D.freezeElevation=!0,this._map.easeTo(D,{originalEvent:E})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new u.k(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Df("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Rf extends u.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const s=Math.min((H.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(s)),s<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=u.P.convert(t).mult(-1),this.panTo(this.transform.center,u.e({offset:t},n),s)}panTo(t,n,s){return this.easeTo(u.e({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(u.e({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,s){return this.easeTo(u.e({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,u.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=ui.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,a){const h={top:0,bottom:0,right:0,left:0};if(typeof(a=u.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const bi=a.padding;a.padding={top:bi,bottom:bi,right:bi,left:bi}}a.padding=u.e(h,a.padding);const _=this.transform,w=_.padding,E=new ui(t,n),C=_.project(E.getNorthWest()),z=_.project(E.getNorthEast()),D=_.project(E.getSouthEast()),$=_.project(E.getSouthWest()),U=u.ba(-s),ee=C.rotate(U),de=z.rotate(U),re=D.rotate(U),Re=$.rotate(U),Ke=new u.P(Math.max(ee.x,de.x,Re.x,re.x),Math.max(ee.y,de.y,Re.y,re.y)),ie=new u.P(Math.min(ee.x,de.x,Re.x,re.x),Math.min(ee.y,de.y,Re.y,re.y)),Zt=Ke.sub(ie),ti=(_.width-(w.left+w.right+a.padding.left+a.padding.right))/Zt.x,ni=(_.height-(w.top+w.bottom+a.padding.top+a.padding.bottom))/Zt.y;if(ni<0||ti<0)return void u.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const yi=Math.min(_.scaleZoom(_.scale*Math.min(ti,ni)),a.maxZoom),xi=u.P.convert(a.offset),zi=new u.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(u.ba(s)),Bi=xi.add(zi).mult(_.scale/_.zoomScale(yi));return{center:_.unproject(C.add(D).div(2).sub(Bi)),zoom:yi,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,a,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(u.P.convert(t)),this.transform.pointLocation(u.P.convert(n)),s,a),a,h)}_fitInternal(t,n,s){return t?(delete(n=u.e(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this._getTransformForUpdate();let a=!1,h=!1,_=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(a=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=u.N.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(h=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(_=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this._applyUpdatedTransform(s),this.fire(new u.k("movestart",n)).fire(new u.k("move",n)),a&&this.fire(new u.k("zoomstart",n)).fire(new u.k("zoom",n)).fire(new u.k("zoomend",n)),h&&this.fire(new u.k("rotatestart",n)).fire(new u.k("rotate",n)).fire(new u.k("rotateend",n)),_&&this.fire(new u.k("pitchstart",n)).fire(new u.k("pitch",n)).fire(new u.k("pitchend",n)),this.fire(new u.k("moveend",n))}calculateCameraOptionsFromTo(t,n,s,a=0){const h=u.Z.fromLngLat(t,n),_=u.Z.fromLngLat(s,a),w=_.x-h.x,E=_.y-h.y,C=_.z-h.z,z=Math.hypot(w,E,C);if(z===0)throw new Error("Can't calculate camera options with same From and To");const D=Math.hypot(w,E),$=this.transform.scaleZoom(this.transform.cameraToCenterDistance/z/this.transform.tileSize),U=180*Math.atan2(w,-E)/Math.PI;let ee=180*Math.acos(D/z)/Math.PI;return ee=C<0?90-ee:90+ee,{center:_.toLngLat(),zoom:$,pitch:ee,bearing:U}}easeTo(t,n){var s;this._stop(!1,t.easeId),((t=u.e({offset:[0,0],duration:500,easing:u.b9},t)).animate===!1||!t.essential&&H.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,_=a.bearing,w=a.pitch,E=a.padding,C="bearing"in t?this._normalizeBearing(t.bearing,_):_,z="pitch"in t?+t.pitch:w,D="padding"in t?t.padding:a.padding,$=u.P.convert(t.offset);let U=a.centerPoint.add($);const ee=a.pointLocation(U),{center:de,zoom:re}=a.getConstrained(u.N.convert(t.center||ee),(s=t.zoom)!==null&&s!==void 0?s:h);this._normalizeCenter(de,a);const Re=a.project(ee),Ke=a.project(de).sub(Re),ie=a.zoomScale(re-h);let Zt,ti;t.around&&(Zt=u.N.convert(t.around),ti=a.locationPoint(Zt));const ni={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||re!==h,this._rotating=this._rotating||_!==C,this._pitching=this._pitching||z!==w,this._padding=!a.isPaddingEqual(D),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ni),this.terrain&&this._prepareElevation(de),this._ease(yi=>{if(this._zooming&&(a.zoom=u.z.number(h,re,yi)),this._rotating&&(a.bearing=u.z.number(_,C,yi)),this._pitching&&(a.pitch=u.z.number(w,z,yi)),this._padding&&(a.interpolatePadding(E,D,yi),U=a.centerPoint.add($)),this.terrain&&!t.freezeElevation&&this._updateElevation(yi),Zt)a.setLocationAtPoint(Zt,ti);else{const xi=a.zoomScale(a.zoom-h),zi=re>h?Math.min(2,ie):Math.max(.5,ie),Bi=Math.pow(zi,1-yi),bi=a.unproject(Re.add(Ke.mult(yi*Bi)).mult(xi));a.setLocationAtPoint(a.renderWorldCopies?bi.wrap():bi,U)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},yi=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,yi)},t),this}_prepareEase(t,n,s={}){this._moving=!0,n||s.moving||this.fire(new u.k("movestart",t)),this._zooming&&!s.zooming&&this.fire(new u.k("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new u.k("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new u.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(s-(n-(s*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=u.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const n=t.getCameraPosition(),s=this.terrain.getElevationForLngLatZoom(n.lngLat,t.zoom);if(n.altitude<s){const a=this.calculateCameraOptionsFromTo(n.lngLat,s,t.center,t.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(this.terrain&&n.push(a=>this._elevateCameraIfInsideTerrain(a)),this.transformCameraUpdate&&n.push(a=>this.transformCameraUpdate(a)),!n.length)return;const s=t.clone();for(const a of n){const h=s.clone(),{center:_,zoom:w,pitch:E,bearing:C,elevation:z}=a(h);_&&(h.center=_),w!==void 0&&(h.zoom=w),E!==void 0&&(h.pitch=E),C!==void 0&&(h.bearing=C),z!==void 0&&(h.elevation=z),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(t){this.fire(new u.k("move",t)),this._zooming&&this.fire(new u.k("zoom",t)),this._rotating&&this.fire(new u.k("rotate",t)),this._pitching&&this.fire(new u.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const s=this._zooming,a=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new u.k("zoomend",t)),a&&this.fire(new u.k("rotateend",t)),h&&this.fire(new u.k("pitchend",t)),this.fire(new u.k("moveend",t))}flyTo(t,n){var s;if(!t.essential&&H.prefersReducedMotion){const Ai=u.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ai,n)}this.stop(),t=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b9},t);const a=this._getTransformForUpdate(),h=a.zoom,_=a.bearing,w=a.pitch,E=a.padding,C="bearing"in t?this._normalizeBearing(t.bearing,_):_,z="pitch"in t?+t.pitch:w,D="padding"in t?t.padding:a.padding,$=u.P.convert(t.offset);let U=a.centerPoint.add($);const ee=a.pointLocation(U),{center:de,zoom:re}=a.getConstrained(u.N.convert(t.center||ee),(s=t.zoom)!==null&&s!==void 0?s:h);this._normalizeCenter(de,a);const Re=a.zoomScale(re-h),Ke=a.project(ee),ie=a.project(de).sub(Ke);let Zt=t.curve;const ti=Math.max(a.width,a.height),ni=ti/Re,yi=ie.mag();if("minZoom"in t){const Ai=u.ad(Math.min(t.minZoom,h,re),a.minZoom,a.maxZoom),Wi=ti/a.zoomScale(Ai-h);Zt=Math.sqrt(Wi/yi*2)}const xi=Zt*Zt;function zi(Ai){const Wi=(ni*ni-ti*ti+(Ai?-1:1)*xi*xi*yi*yi)/(2*(Ai?ni:ti)*xi*yi);return Math.log(Math.sqrt(Wi*Wi+1)-Wi)}function Bi(Ai){return(Math.exp(Ai)-Math.exp(-Ai))/2}function bi(Ai){return(Math.exp(Ai)+Math.exp(-Ai))/2}const wi=zi(!1);let Oi=function(Ai){return bi(wi)/bi(wi+Zt*Ai)},Xi=function(Ai){return ti*((bi(wi)*(Bi(Wi=wi+Zt*Ai)/bi(Wi))-Bi(wi))/xi)/yi;var Wi},Ei=(zi(!0)-wi)/Zt;if(Math.abs(yi)<1e-6||!isFinite(Ei)){if(Math.abs(ti-ni)<1e-6)return this.easeTo(t,n);const Ai=ni<ti?-1:1;Ei=Math.abs(Math.log(ni/ti))/Zt,Xi=()=>0,Oi=Wi=>Math.exp(Ai*Zt*Wi)}return t.duration="duration"in t?+t.duration:1e3*Ei/("screenSpeed"in t?+t.screenSpeed/Zt:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=_!==C,this._pitching=z!==w,this._padding=!a.isPaddingEqual(D),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(de),this._ease(Ai=>{const Wi=Ai*Ei,Ss=1/Oi(Wi);a.zoom=Ai===1?re:h+a.scaleZoom(Ss),this._rotating&&(a.bearing=u.z.number(_,C,Ai)),this._pitching&&(a.pitch=u.z.number(w,z,Ai)),this._padding&&(a.interpolatePadding(E,D,Ai),U=a.centerPoint.add($)),this.terrain&&!t.freezeElevation&&this._updateElevation(Ai);const es=Ai===1?de:a.unproject(Ke.add(ie.mult(Xi(Wi))).mult(Ss));a.setLocationAtPoint(a.renderWorldCopies?es.wrap():es,U),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return t||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=H.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=u.b3(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t,n){if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(u.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Fd={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class su{constructor(t=Fd){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=Y.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=Y.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Y.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){Y.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(a=>typeof a!="string"?"":a)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const a=this._map.style.stylesheet;this.styleOwner=a.owner,this.styleId=a.id}const n=this._map.style.sourceCaches;for(const a in n){const h=n[a];if(h.used||h.usedForTerrain){const _=h.getSource();_.attribution&&t.indexOf(_.attribution)<0&&t.push(_.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,h)=>a.length-h.length),t=t.filter((a,h)=>{for(let _=h+1;_<t.length;_++)if(t[_].indexOf(a)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Zl{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const s=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=Y.create("div","maplibregl-ctrl");const n=Y.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){Y.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Li{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(const a of s)if(a.id===t)return void(a.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Vp=u.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Od extends u.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const s={};for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))s[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),u.aQ(a.posMatrix,0,u.X,0,u.X,0,1),this._tiles[a.key]=new dc(a,this.tileSize));for(const a in this._tiles)s[a]||delete this._tiles[a]}freeRtt(t){for(const n in this._tiles){const s=this._tiles[n];(!t||s.tileID.equals(t)||s.tileID.isChildOf(t)||t.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const a=this._tiles[s].tileID;if(a.canonical.equals(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16),u.aQ(h.posMatrix,0,u.X,0,u.X,0,1),n[s]=h}else if(a.canonical.isChildOf(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const _=a.canonical.z-t.canonical.z,w=a.canonical.x-(a.canonical.x>>_<<_),E=a.canonical.y-(a.canonical.y>>_<<_),C=u.X>>_;u.aQ(h.posMatrix,0,C,0,C,0,1),u.J(h.posMatrix,h.posMatrix,[-w*C,-E*C,0]),n[s]=h}else if(t.canonical.isChildOf(a.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const _=t.canonical.z-a.canonical.z,w=t.canonical.x-(t.canonical.x>>_<<_),E=t.canonical.y-(t.canonical.y>>_<<_),C=u.X>>_;u.aQ(h.posMatrix,0,u.X,0,u.X,0,1),u.J(h.posMatrix,h.posMatrix,[w*C,E*C,0]),u.K(h.posMatrix,h.posMatrix,[1/2**_,1/2**_,0]),n[s]=h}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let a=t.overscaledZ-this.deltaZoom;if(a>s.maxzoom&&(a=s.maxzoom),a<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(a).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!h||!h.dem)&&n)for(;a>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(t.scaledTo(a--).key);return h}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class Np{constructor(t,n,s){this.painter=t,this.sourceCache=new Od(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,s,a=u.X){var h;if(!(n>=0&&n<a&&s>=0&&s<a))return 0;const _=this.getTerrainData(t),w=(h=_.tile)===null||h===void 0?void 0:h.dem;if(!w)return 0;const E=function(ee,de,re){var Re=de[0],Ke=de[1];return ee[0]=re[0]*Re+re[4]*Ke+re[12],ee[1]=re[1]*Re+re[5]*Ke+re[13],ee}([],[n/a*u.X,s/a*u.X],_.u_terrain_matrix),C=[E[0]*w.dim,E[1]*w.dim],z=Math.floor(C[0]),D=Math.floor(C[1]),$=C[0]-z,U=C[1]-D;return w.get(z,D)*(1-$)*(1-U)+w.get(z+1,D)*$*(1-U)+w.get(z,D+1)*(1-$)*U+w.get(z+1,D+1)*$*U}getElevationForLngLatZoom(t,n){const{tileID:s,mercatorX:a,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(s,a%u.X,h%u.X,u.X)}getElevation(t,n,s,a=u.X){return this.getDEMElevation(t,n,s,a)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const a=this.painter.context,h=new u.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new os(a,h,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new os(a,new u.R({width:1,height:1}),a.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=u.ao([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const a=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new os(a,n.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),n.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const a=this.sourceCache.sourceCache._source.maxzoom;let h=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?h=t.canonical.z-a:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const _=t.canonical.x-(t.canonical.x>>h<<h),w=t.canonical.y-(t.canonical.y>>h<<h),E=u.bb(new Float64Array(16),[1/(u.X<<h),1/(u.X<<h),0]);u.J(E,E,[_*u.X,w*u.X,0]),this._demMatrixCache[t.key]={matrix:E,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,s=n.width/devicePixelRatio,a=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new os(n.context,{width:s,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new os(n.context,{width:s,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(s,a,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,a))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,_=0;h<this._coordsTextureSize;h++)for(let w=0;w<this._coordsTextureSize;w++,_+=4)n[_+0]=255&w,n[_+1]=255&h,n[_+2]=w>>8<<4|h>>8,n[_+3]=0;const s=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new os(t,s,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),s=this.painter.context,a=s.gl,h=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),_=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),w=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,w-_-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null);const E=n[0]+(n[2]>>4<<8),C=n[1]+((15&n[2])<<8),z=this.coordsIndex[255-n[3]],D=z&&this.sourceCache.getTileByID(z);if(!D)return null;const $=this._coordsTextureSize,U=(1<<D.tileID.canonical.z)*$;return new u.Z((D.tileID.canonical.x*$+E)/U+D.tileID.wrap,(D.tileID.canonical.y*$+C)/U,this.getElevation(D.tileID,E,C,$))}depthAtPoint(t){const n=new Uint8Array(4),s=this.painter.context,a=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new u.bc,s=new u.aY,a=this.meshSize,h=u.X/a,_=a*a;for(let D=0;D<=a;D++)for(let $=0;$<=a;$++)n.emplaceBack($*h,D*h,0);for(let D=0;D<_;D+=a+1)for(let $=0;$<a;$++)s.emplaceBack($+D,a+$+D+1,a+$+D+2),s.emplaceBack($+D,a+$+D+2,$+D+1);const w=n.length,E=w+2*(a+1);for(const D of[0,1])for(let $=0;$<=a;$++)for(const U of[0,1])n.emplaceBack($*h,D*u.X,U);for(let D=0;D<2*a;D+=2)s.emplaceBack(E+D,E+D+1,E+D+3),s.emplaceBack(E+D,E+D+3,E+D+2),s.emplaceBack(w+D,w+D+3,w+D+1),s.emplaceBack(w+D,w+D+2,w+D+3);const C=n.length,z=C+2*(a+1);for(const D of[0,1])for(let $=0;$<=a;$++)for(const U of[0,1])n.emplaceBack(D*u.X,$*h,U);for(let D=0;D<2*a;D+=2)s.emplaceBack(C+D,C+D+1,C+D+3),s.emplaceBack(C+D,C+D+3,C+D+2),s.emplaceBack(z+D,z+D+3,z+D+1),s.emplaceBack(z+D,z+D+2,z+D+3);return this._mesh=new zp(t.createVertexBuffer(n,Vp.members),t.createIndexBuffer(s),u.a0.simpleSegment(0,0,n.length,s.length)),this._mesh}getMeshFrameDelta(t){return 2*Math.PI*u.bd/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,n){var s;const{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(s=this.getMinMaxElevation(a).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=n.dem.min*this.exaggeration,s.maxElevation=n.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(t,n){const s=u.Z.fromLngLat(t.wrap()),a=(1<<n)*u.X,h=s.x*a,_=s.y*a,w=Math.floor(h/u.X),E=Math.floor(_/u.X);return{tileID:new u.S(n,0,n,w,E),mercatorX:h,mercatorY:_}}}class Gu{constructor(t,n,s){this._context=t,this._size=n,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new os(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(s.texture),{id:t,fbo:n,texture:s,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const Gl={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class $p{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Gu(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(s=>!t._layers[s].isHidden(n)),this._coordsDescendingInv={};for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const a=t.sourceCaches[s].getVisibleCoordinates();for(const h of a){const _=this.terrain.sourceCache.getTerrainCoords(h);for(const w in _)this._coordsDescendingInv[s][w]||(this._coordsDescendingInv[s][w]=[]),this._coordsDescendingInv[s][w].push(_[w])}}this._coordsDescendingInvStr={};for(const s of t._order){const a=t._layers[s],h=a.source;if(Gl[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const _ in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][_]=this._coordsDescendingInv[h][_].map(w=>w.key).sort().join()}}for(const s of this._renderableTiles)for(const a in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[a][s.tileID.key];h&&h!==s.rttCoords[a]&&(s.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,s=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Gl[n]&&(this._prevType&&Gl[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(Gl[this._prevType]||Gl[n]&&a){this._prevType=n;const h=this._stacks.length-1,_=this._stacks[h]||[];for(const w of this._renderableTiles){if(this.pool.isFull()&&(Ou(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(w),w.rtt[h]){const C=this.pool.getObjectForId(w.rtt[h].id);if(C.stamp===w.rtt[h].stamp){this.pool.useObject(C);continue}}const E=this.pool.getOrCreateFreeObject();this.pool.useObject(E),this.pool.stampObject(E),w.rtt[h]={id:E.id,stamp:E.stamp},s.context.bindFramebuffer.set(E.fbo.framebuffer),s.context.clear({color:u.aN.transparent,stencil:0}),s.currentStencilSource=void 0;for(let C=0;C<_.length;C++){const z=s.style._layers[_[C]],D=z.source?this._coordsDescendingInv[z.source][w.tileID.key]:[w.tileID];s.context.viewport.set([0,0,E.fbo.width,E.fbo.height]),s._renderTileClippingMasks(z,D),s.renderLayer(s,s.style.sourceCaches[z.source],z,D),z.source&&(w.rttCoords[z.source]=this._coordsDescendingInvStr[z.source][w.tileID.key])}}return Ou(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Gl[n]}return!1}}const Mi={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Vd=J,Lf={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Fd,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:u.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},jp=d=>{d.touchstart=d.dragStart,d.touchmoveWindow=d.dragMove,d.touchend=d.dragEnd},Nd={showCompass:!0,showZoom:!0,visualizePitch:!1};class Up{constructor(t,n,s=!1){this.mousedown=_=>{this.startMouse(u.e({},_,{ctrlKey:!0,preventDefault:()=>_.preventDefault()}),Y.mousePos(this.element,_)),Y.addEventListener(window,"mousemove",this.mousemove),Y.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=_=>{this.moveMouse(_,Y.mousePos(this.element,_))},this.mouseup=_=>{this.mouseRotate.dragEnd(_),this.mousePitch&&this.mousePitch.dragEnd(_),this.offTemp()},this.touchstart=_=>{_.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Y.touchPos(this.element,_.targetTouches)[0],this.startTouch(_,this._startPos),Y.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),Y.addEventListener(window,"touchend",this.touchend))},this.touchmove=_=>{_.targetTouches.length!==1?this.reset():(this._lastPos=Y.touchPos(this.element,_.targetTouches)[0],this.moveTouch(_,this._lastPos))},this.touchend=_=>{_.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const a=t.dragRotate._mouseRotate.getClickTolerance(),h=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Ed({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:_,clickTolerance:w,bearingDegreesPerPixelMoved:E=.8})=>{const C=new Ph;return new ws({clickTolerance:w,move:(z,D)=>({bearingDelta:(D.x-z.x)*E}),moveStateManager:C,enable:_,assignEvents:jp})})({clickTolerance:a,enable:!0}),this.map=t,s&&(this.mousePitch=Vc({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:_,clickTolerance:w,pitchDegreesPerPixelMoved:E=-.5})=>{const C=new Ph;return new ws({clickTolerance:w,move:(z,D)=>({pitchDelta:(D.y-z.y)*E}),moveStateManager:C,enable:_,assignEvents:jp})})({clickTolerance:h,enable:!0})),Y.addEventListener(n,"mousedown",this.mousedown),Y.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),Y.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),Y.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),Y.disableDrag()}moveMouse(t,n){const s=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(t,n)||{};if(a&&s.setBearing(s.getBearing()+a),this.mousePitch){const{pitchDelta:h}=this.mousePitch.dragMove(t,n)||{};h&&s.setPitch(s.getPitch()+h)}}moveTouch(t,n){const s=this.map,{bearingDelta:a}=this.touchRotate.dragMove(t,n)||{};if(a&&s.setBearing(s.getBearing()+a),this.touchPitch){const{pitchDelta:h}=this.touchPitch.dragMove(t,n)||{};h&&s.setPitch(s.getPitch()+h)}}off(){const t=this.element;Y.removeEventListener(t,"mousedown",this.mousedown),Y.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),Y.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),Y.removeEventListener(window,"touchend",this.touchend),Y.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){Y.enableDrag(),Y.removeEventListener(window,"mousemove",this.mousemove),Y.removeEventListener(window,"mouseup",this.mouseup),Y.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),Y.removeEventListener(window,"touchend",this.touchend)}}let _c;function qp(d,t,n){const s=new u.N(d.lng,d.lat);if(d=new u.N(d.lng,d.lat),t){const a=new u.N(d.lng-360,d.lat),h=new u.N(d.lng+360,d.lat),_=n.locationPoint(d).distSqr(t);n.locationPoint(a).distSqr(t)<_?d=a:n.locationPoint(h).distSqr(t)<_&&(d=h)}for(;Math.abs(d.lng-n.center.lng)>180;){const a=n.locationPoint(d);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;d.lng>n.center.lng?d.lng-=360:d.lng+=360}return d.lng!==s.lng&&n.locationPoint(d).y>n.height/2-n.getHorizon()?d:s}const $d={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function vc(d,t,n){const s=d.classList;for(const a in $d)s.remove(`maplibregl-${n}-anchor-${a}`);s.add(`maplibregl-${n}-anchor-${t}`)}class vs extends u.E{constructor(t){if(super(),this._onKeyPress=n=>{const s=n.code,a=n.charCode||n.keyCode;s!=="Space"&&s!=="Enter"&&a!==32&&a!==13||this.togglePopup()},this._onMapClick=n=>{const s=n.originalEvent.target,a=this._element;this._popup&&(s===a||a.contains(s))&&this.togglePopup()},this._update=n=>{var s;if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?qp(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let _="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?_="rotateX(0deg)":this._pitchAlignment==="map"&&(_=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),Y.setTransform(this._element,`${$d[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${_} ${h}`),H.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new u.k("dragstart"))),this.fire(new u.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new u.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=u.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=Y.create("div");const n=Y.createNS("http://www.w3.org/2000/svg","svg"),s=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${s}px`),n.setAttributeNS(null,"width",`${a}px`),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${s}`);const h=Y.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const _=Y.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const w=Y.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"transform","translate(3.0, 29.0)"),w.setAttributeNS(null,"fill","#000000");const E=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const Re of E){const Ke=Y.createNS("http://www.w3.org/2000/svg","ellipse");Ke.setAttributeNS(null,"opacity","0.04"),Ke.setAttributeNS(null,"cx","10.5"),Ke.setAttributeNS(null,"cy","5.80029008"),Ke.setAttributeNS(null,"rx",Re.rx),Ke.setAttributeNS(null,"ry",Re.ry),w.appendChild(Ke)}const C=Y.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill",this._color);const z=Y.createNS("http://www.w3.org/2000/svg","path");z.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),C.appendChild(z);const D=Y.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"opacity","0.25"),D.setAttributeNS(null,"fill","#000000");const $=Y.createNS("http://www.w3.org/2000/svg","path");$.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),D.appendChild($);const U=Y.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"transform","translate(6.0, 7.0)"),U.setAttributeNS(null,"fill","#FFFFFF");const ee=Y.createNS("http://www.w3.org/2000/svg","g");ee.setAttributeNS(null,"transform","translate(8.0, 8.0)");const de=Y.createNS("http://www.w3.org/2000/svg","circle");de.setAttributeNS(null,"fill","#000000"),de.setAttributeNS(null,"opacity","0.25"),de.setAttributeNS(null,"cx","5.5"),de.setAttributeNS(null,"cy","5.5"),de.setAttributeNS(null,"r","5.4999962");const re=Y.createNS("http://www.w3.org/2000/svg","circle");re.setAttributeNS(null,"fill","#FFFFFF"),re.setAttributeNS(null,"cx","5.5"),re.setAttributeNS(null,"cy","5.5"),re.setAttributeNS(null,"r","5.4999962"),ee.appendChild(de),ee.appendChild(re),_.appendChild(w),_.appendChild(C),_.appendChild(D),_.appendChild(U),_.appendChild(ee),n.appendChild(_),n.setAttributeNS(null,"height",s*this._scale+"px"),n.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(n),this._offset=u.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),vc(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),Y.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=u.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const a=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[a,-1*(38.1-13.5+a)],"bottom-right":[-a,-1*(38.1-13.5+a)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,s;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,h=a.terrain.depthAtPoint(this._pos),_=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,_)-h<.006)return void(this._element.style.opacity=this._opacity);const w=-this._offset.y/a.transform._pixelPerMeter,E=Math.sin(a.getPitch()*Math.PI/180)*w,C=a.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),z=a.transform.lngLatToCameraDepth(this._lngLat,_+E)-C>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=u.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return t===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const Ih={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let au=0,lu=!1;const Zp={maxWidth:100,unit:"metric"};function jd(d,t,n){const s=n&&n.maxWidth||100,a=d._container.clientHeight/2,h=d.unproject([0,a]),_=d.unproject([s,a]),w=h.distanceTo(_);if(n&&n.unit==="imperial"){const E=3.2808*w;E>5280?Hu(t,s,E/5280,d._getUIString("ScaleControl.Miles")):Hu(t,s,E,d._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Hu(t,s,w/1852,d._getUIString("ScaleControl.NauticalMiles")):w>=1e3?Hu(t,s,w/1e3,d._getUIString("ScaleControl.Kilometers")):Hu(t,s,w,d._getUIString("ScaleControl.Meters"))}function Hu(d,t,n,s){const a=function(h){const _=Math.pow(10,`${Math.floor(h)}`.length-1);let w=h/_;return w=w>=10?10:w>=5?5:w>=3?3:w>=2?2:w>=1?1:function(E){const C=Math.pow(10,Math.ceil(-Math.log(E)/Math.LN10));return Math.round(E*C)/C}(w),_*w}(n);d.style.width=t*(a/n)+"px",d.innerHTML=`${a} ${s}`}const Hl={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Mh=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function $i(d){if(d){if(typeof d=="number"){const t=Math.round(Math.abs(d)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,d),"top-left":new u.P(t,t),"top-right":new u.P(-t,t),bottom:new u.P(0,-d),"bottom-left":new u.P(t,-t),"bottom-right":new u.P(-t,-t),left:new u.P(d,0),right:new u.P(-d,0)}}if(d instanceof u.P||Array.isArray(d)){const t=u.P.convert(d);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:u.P.convert(d.center||[0,0]),top:u.P.convert(d.top||[0,0]),"top-left":u.P.convert(d["top-left"]||[0,0]),"top-right":u.P.convert(d["top-right"]||[0,0]),bottom:u.P.convert(d.bottom||[0,0]),"bottom-left":u.P.convert(d["bottom-left"]||[0,0]),"bottom-right":u.P.convert(d["bottom-right"]||[0,0]),left:u.P.convert(d.left||[0,0]),right:u.P.convert(d.right||[0,0])}}return $i(new u.P(0,0))}const Gi=J;S.AJAXError=u.bg,S.Evented=u.E,S.LngLat=u.N,S.MercatorCoordinate=u.Z,S.Point=u.P,S.addProtocol=u.bh,S.config=u.a,S.removeProtocol=u.bi,S.AttributionControl=su,S.BoxZoomHandler=wd,S.CanvasSource=Da,S.CooperativeGesturesHandler=$a,S.DoubleClickZoomHandler=Bd,S.DragPanHandler=Ra,S.DragRotateHandler=Na,S.EdgeInsets=Sh,S.FullscreenControl=class extends u.E{constructor(d={}){super(),this._onFullscreenChange=()=>{var t;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=n==null?void 0:n.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.container:u.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){Y.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const d=this._fullscreenButton=Y.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);Y.create("span","maplibregl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new u.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},S.GeoJSONSource=wu,S.GeolocateControl=class extends u.E{constructor(d){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new u.N(t.coords.longitude,t.coords.latitude),s=t.coords.accuracy,a=this._map.getBearing(),h=u.e({bearing:a},this.options.fitBoundsOptions),_=ui.fromLngLat(n,s);this._map.fitBounds(_,h,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new u.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&lu)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Y.create("button","maplibregl-ctrl-geolocate",this._container),Y.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Y.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new vs({element:this._dotElement}),this._circleElement=Y.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new vs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new u.k("trackuserlocationend")),this.fire(new u.k("userlocationlostfocus")))})}},this.options=u.e({},Ih,d)}onAdd(d){return this._map=d,this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return u._(this,arguments,void 0,function*(t=!1){if(_c!==void 0&&!t)return _c;if(window.navigator.permissions===void 0)return _c=!!window.navigator.geolocation,_c;try{_c=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{_c=!!window.navigator.geolocation}return _c})}().then(t=>this._finishSetupUI(t)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),Y.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,au=0,lu=!1}_isOutOfMapMaxBounds(d){const t=this._map.getMaxBounds(),n=d.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const d=this._map.getBounds(),t=d.getSouthEast(),n=d.getNorthEast(),s=t.distanceTo(n),a=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}trigger(){if(!this._setup)return u.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":au--,lu=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new u.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new u.k("trackuserlocationstart")),this.fire(new u.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),au++,au>1?(d={maximumAge:6e5,timeout:0},lu=!0):(d=this.options.positionOptions,lu=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},S.Hash=Vu,S.ImageSource=Ql,S.KeyboardHandler=Md,S.LngLatBounds=ui,S.LogoControl=Zl,S.Map=class extends Rf{constructor(d){u.be.mark(u.bf.create);const t=Object.assign(Object.assign({},Lf),d);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new yd(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Li,this._controls=[],this._mapId=u.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Mi),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=si.addThrottleControl(()=>this.isMoving()),this._requestManager=new ci(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;const s=kh(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{n?s(a):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Bf(this,t),this._hash=t.hash&&new Vu(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,u.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new su(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new Zl,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new u.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new u.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new u.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(d,t){if(t===void 0&&(t=d.getDefaultPosition?d.getDefaultPosition():"top-right"),!d||!d.onAdd)return this.fire(new u.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=d.onAdd(this);this._controls.push(d);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(d){if(!d||!d.onRemove)return this.fire(new u.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(d);return t>-1&&this._controls.splice(t,1),d.onRemove(this),this}hasControl(d){return this._controls.indexOf(d)>-1}calculateCameraOptionsFromTo(d,t,n,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(d,t,n,s)}resize(d){var t;const n=this._containerDimensions(),s=n[0],a=n[1],h=this._getClampedPixelRatio(s,a);if(this._resizeCanvas(s,a,h),this.painter.resize(s,a,h),this.painter.overLimit()){const w=this.painter.context.gl;this._maxCanvasSize=[w.drawingBufferWidth,w.drawingBufferHeight];const E=this._getClampedPixelRatio(s,a);this._resizeCanvas(s,a,E),this.painter.resize(s,a,E)}this.transform.resize(s,a),(t=this._requestedCameraState)===null||t===void 0||t.resize(s,a);const _=!this._moving;return _&&(this.stop(),this.fire(new u.k("movestart",d)).fire(new u.k("move",d))),this.fire(new u.k("resize",d)),_&&this.fire(new u.k("moveend",d)),this}_getClampedPixelRatio(d,t){const{0:n,1:s}=this._maxCanvasSize,a=this.getPixelRatio(),h=d*a,_=t*a;return Math.min(h>n?n/h:1,_>s?s/_:1)*a}getPixelRatio(){var d;return(d=this._overridePixelRatio)!==null&&d!==void 0?d:devicePixelRatio}setPixelRatio(d){this._overridePixelRatio=d,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(d){return this.transform.setMaxBounds(ui.convert(d)),this._update()}setMinZoom(d){if((d=d??-2)>=-2&&d<=this.transform.maxZoom)return this.transform.minZoom=d,this._update(),this.getZoom()<d&&this.setZoom(d),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(d){if((d=d??22)>=this.transform.minZoom)return this.transform.maxZoom=d,this._update(),this.getZoom()>d&&this.setZoom(d),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(d){if((d=d??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(d>=0&&d<=this.transform.maxPitch)return this.transform.minPitch=d,this._update(),this.getPitch()<d&&this.setPitch(d),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(d){if((d=d??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(d>=this.transform.minPitch)return this.transform.maxPitch=d,this._update(),this.getPitch()>d&&this.setPitch(d),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(d){return this.transform.renderWorldCopies=d,this._update()}project(d){return this.transform.locationPoint(u.N.convert(d),this.style&&this.terrain)}unproject(d){return this.transform.pointLocation(u.P.convert(d),this.terrain)}isMoving(){var d;return this._moving||((d=this.handlers)===null||d===void 0?void 0:d.isMoving())}isZooming(){var d;return this._zooming||((d=this.handlers)===null||d===void 0?void 0:d.isZooming())}isRotating(){var d;return this._rotating||((d=this.handlers)===null||d===void 0?void 0:d.isRotating())}_createDelegatedListener(d,t,n){if(d==="mouseenter"||d==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:h=>{const _=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];_.length?s||(s=!0,n.call(this,new ha(d,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(d==="mouseleave"||d==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:_=>{(this.getLayer(t)?this.queryRenderedFeatures(_.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new ha(d,this,_.originalEvent)))},mouseout:_=>{s&&(s=!1,n.call(this,new ha(d,this,_.originalEvent)))}}}}{const s=a=>{const h=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];h.length&&(a.features=h,n.call(this,a),delete a.features)};return{layer:t,listener:n,delegates:{[d]:s}}}}on(d,t,n){if(n===void 0)return super.on(d,t);const s=this._createDelegatedListener(d,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[d]=this._delegatedListeners[d]||[],this._delegatedListeners[d].push(s);for(const a in s.delegates)this.on(a,s.delegates[a]);return this}once(d,t,n){if(n===void 0)return super.once(d,t);const s=this._createDelegatedListener(d,t,n);for(const a in s.delegates)this.once(a,s.delegates[a]);return this}off(d,t,n){return n===void 0?super.off(d,t):(this._delegatedListeners&&this._delegatedListeners[d]&&(s=>{const a=this._delegatedListeners[d];for(let h=0;h<a.length;h++){const _=a[h];if(_.layer===t&&_.listener===n){for(const w in _.delegates)this.off(w,_.delegates[w]);return a.splice(h,1),this}}})(),this)}queryRenderedFeatures(d,t){if(!this.style)return[];let n;const s=d instanceof u.P||Array.isArray(d),a=s?d:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(s?{}:d)||{},a instanceof u.P||typeof a[0]=="number")n=[u.P.convert(a)];else{const h=u.P.convert(a[0]),_=u.P.convert(a[1]);n=[h,new u.P(_.x,h.y),_,new u.P(h.x,_.y),h]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(d,t){return this.style.querySourceFeatures(d,t)}setStyle(d,t){return(t=u.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&d?(this._diffStyle(d,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(d,t))}setTransformRequest(d){return this._requestManager.setTransformRequest(d),this}_getUIString(d){const t=this._locale[d];if(t==null)throw new Error(`Missing UI string '${d}'`);return t}_updateStyle(d,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(d,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!d)),d?(this.style=new Jh(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof d=="string"?this.style.loadURL(d,t,n):this.style.loadJSON(d,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Jh(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(d,t){if(typeof d=="string"){const n=this._requestManager.transformRequest(d,"Style");u.h(n,new AbortController).then(s=>{this._updateDiff(s.data,t)}).catch(s=>{s&&this.fire(new u.j(s))})}else typeof d=="object"&&this._updateDiff(d,t)}_updateDiff(d,t){try{this.style.setState(d,t)&&this._update(!0)}catch(n){u.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(d,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(d,t){return this._lazyInitEmptyStyle(),this.style.addSource(d,t),this._update(!0)}isSourceLoaded(d){const t=this.style&&this.style.sourceCaches[d];if(t!==void 0)return t.loaded();this.fire(new u.j(new Error(`There is no source with ID '${d}'`)))}setTerrain(d){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),d){const t=this.style.sourceCaches[d.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${d.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const s=this.style._layers[n];s.type==="hillshade"&&s.source===d.source&&u.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Np(this.painter,t,d),this.painter.renderToTexture=new $p(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==d.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.k("terrain",{terrain:d})),this}getTerrain(){var d,t;return(t=(d=this.terrain)===null||d===void 0?void 0:d.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const d=this.style&&this.style.sourceCaches;for(const t in d){const n=d[t]._tiles;for(const s in n){const a=n[s];if(a.state!=="loaded"&&a.state!=="errored")return!1}}return!0}removeSource(d){return this.style.removeSource(d),this._update(!0)}getSource(d){return this.style.getSource(d)}addImage(d,t,n={}){const{pixelRatio:s=1,sdf:a=!1,stretchX:h,stretchY:_,content:w,textFitWidth:E,textFitHeight:C}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||u.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:z,height:D,data:$}=t,U=t;return this.style.addImage(d,{data:new u.R({width:z,height:D},new Uint8Array($)),pixelRatio:s,stretchX:h,stretchY:_,content:w,textFitWidth:E,textFitHeight:C,sdf:a,version:0,userImage:U}),U.onAdd&&U.onAdd(this,d),this}}{const{width:z,height:D,data:$}=H.getImageData(t);this.style.addImage(d,{data:new u.R({width:z,height:D},$),pixelRatio:s,stretchX:h,stretchY:_,content:w,textFitWidth:E,textFitHeight:C,sdf:a,version:0})}}updateImage(d,t){const n=this.style.getImage(d);if(!n)return this.fire(new u.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||u.b(t)?H.getImageData(t):t,{width:a,height:h,data:_}=s;if(a===void 0||h===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==n.data.width||h!==n.data.height)return this.fire(new u.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const w=!(t instanceof HTMLImageElement||u.b(t));return n.data.replace(_,w),this.style.updateImage(d,n),this}getImage(d){return this.style.getImage(d)}hasImage(d){return d?!!this.style.getImage(d):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(d){this.style.removeImage(d)}loadImage(d){return si.getImage(this._requestManager.transformRequest(d,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(d,t){return this._lazyInitEmptyStyle(),this.style.addLayer(d,t),this._update(!0)}moveLayer(d,t){return this.style.moveLayer(d,t),this._update(!0)}removeLayer(d){return this.style.removeLayer(d),this._update(!0)}getLayer(d){return this.style.getLayer(d)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(d,t,n){return this.style.setLayerZoomRange(d,t,n),this._update(!0)}setFilter(d,t,n={}){return this.style.setFilter(d,t,n),this._update(!0)}getFilter(d){return this.style.getFilter(d)}setPaintProperty(d,t,n,s={}){return this.style.setPaintProperty(d,t,n,s),this._update(!0)}getPaintProperty(d,t){return this.style.getPaintProperty(d,t)}setLayoutProperty(d,t,n,s={}){return this.style.setLayoutProperty(d,t,n,s),this._update(!0)}getLayoutProperty(d,t){return this.style.getLayoutProperty(d,t)}setGlyphs(d,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(d,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(d,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(d,t,n,s=>{s||this._update(!0)}),this}removeSprite(d){return this._lazyInitEmptyStyle(),this.style.removeSprite(d),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(d,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(d,t,n=>{n||this._update(!0)}),this}setLight(d,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(d,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(d){return this._lazyInitEmptyStyle(),this.style.setSky(d),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(d,t){return this.style.setFeatureState(d,t),this._update()}removeFeatureState(d,t){return this.style.removeFeatureState(d,t),this._update()}getFeatureState(d){return this.style.getFeatureState(d)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let d=0,t=0;return this._container&&(d=this._container.clientWidth||400,t=this._container.clientHeight||300),[d,t]}_setupContainer(){const d=this._container;d.classList.add("maplibregl-map");const t=this._canvasContainer=Y.create("div","maplibregl-canvas-container",d);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=Y.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),s=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],s);const a=this._controlContainer=Y.create("div","maplibregl-control-container",d),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(_=>{h[_]=Y.create("div",`maplibregl-ctrl-${_} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(d,t,n){this._canvas.width=Math.floor(n*d),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${d}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const d={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{t={requestedAttributes:d},s&&(t.statusMessage=s.statusMessage,t.type=s.type)},{once:!0});const n=this._canvas.getContext("webgl2",d)||this._canvas.getContext("webgl",d);if(!n){const s="Failed to initialize WebGL";throw t?(t.message=s,new Error(JSON.stringify(t))):new Error(s)}this.painter=new Dp(n,this.transform),oi.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(d){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||d,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(d){return this._update(),this._renderTaskQueue.add(d)}_cancelRenderFrame(d){this._renderTaskQueue.remove(d)}_render(d){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(d),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const a=this.transform.zoom,h=H.now();this.style.zoomHistory.update(a,h);const _=new u.a9(a,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),w=_.crossFadingFactor();w===1&&w===this._crossFadingFactor||(n=!0,this._crossFadingFactor=w),this.style.update(_)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.be.mark(u.bf.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,u.be.mark(u.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var d;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),si.removeThrottleControl(this._imageQueueHandle),(d=this._resizeObserver)===null||d===void 0||d.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),Y.remove(this._canvasContainer),Y.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.be.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,H.frameAsync(this._frameRequest).then(d=>{u.be.frame(d),this._frameRequest=null,this._render(d)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(d){this._showTileBoundaries!==d&&(this._showTileBoundaries=d,this._update())}get showPadding(){return!!this._showPadding}set showPadding(d){this._showPadding!==d&&(this._showPadding=d,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(d){this._showCollisionBoxes!==d&&(this._showCollisionBoxes=d,d?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(d){this._showOverdrawInspector!==d&&(this._showOverdrawInspector=d,this._update())}get repaint(){return!!this._repaint}set repaint(d){this._repaint!==d&&(this._repaint=d,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(d){this._vertices=d,this._update()}get version(){return Vd}getCameraTargetElevation(){return this.transform.elevation}},S.MapMouseEvent=ha,S.MapTouchEvent=Nu,S.MapWheelEvent=xd,S.Marker=vs,S.NavigationControl=class{constructor(d){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),s=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const s=this._map._getUIString(`NavigationControl.${n}`);t.title=s,t.setAttribute("aria-label",s)},this.options=u.e({},Nd,d),this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),Y.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),Y.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=Y.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(d){return this._map=d,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Up(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){Y.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(d,t){const n=Y.create("button",d,this._container);return n.type="button",n.addEventListener("click",t),n}},S.Popup=class extends u.E{constructor(d){super(),this.remove=()=>(this._content&&Y.remove(this._content),this._container&&(Y.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new u.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=Y.create("div","maplibregl-popup",this._map.getContainer()),this._tip=Y.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const w of this.options.className.split(" "))this._container.classList.add(w);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?qp(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!t)return;const s=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const h=$i(this.options.offset);if(!a){const w=this._container.offsetWidth,E=this._container.offsetHeight;let C;C=s.y+h.bottom.y<E?["top"]:s.y>this._map.transform.height-E?["bottom"]:[],s.x<w/2?C.push("left"):s.x>this._map.transform.width-w/2&&C.push("right"),a=C.length===0?"bottom":C.join("-")}let _=s.add(h[a]);this.options.subpixelPositioning||(_=_.round()),Y.setTransform(this._container,`${$d[a]} translate(${_.x}px,${_.y}px)`),vc(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(Hl),d)}addTo(d){return this._map&&this.remove(),this._map=d,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=u.N.convert(d),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=d;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){var d;return(d=this._container)===null||d===void 0?void 0:d.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=Y.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){return this._container&&this._container.classList.add(d),this}removeClassName(d){return this._container&&this._container.classList.remove(d),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}setSubpixelPositioning(d){this.options.subpixelPositioning=d}_createCloseButton(){this.options.closeButton&&(this._closeButton=Y.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const d=this._container.querySelector(Mh);d&&d.focus()}},S.RasterDEMTileSource=Is,S.RasterTileSource=us,S.ScaleControl=class{constructor(d){this._onMove=()=>{jd(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,jd(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Zp),d)}getDefaultPosition(){return"bottom-left"}onAdd(d){return this._map=d,this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-scale",d.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){Y.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=Dd,S.Style=Jh,S.TerrainControl=class{constructor(d){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=d}onAdd(d){return this._map=d,this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Y.create("button","maplibregl-ctrl-terrain",this._container),Y.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){Y.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=Id,S.TwoFingersTouchRotateHandler=Pd,S.TwoFingersTouchZoomHandler=Cd,S.TwoFingersTouchZoomRotateHandler=Rd,S.VectorTileSource=bu,S.VideoSource=Jc,S.addSourceType=(d,t)=>u._(void 0,void 0,void 0,function*(){if(ku(d))throw new Error(`A source type called "${d}" already exists.`);((n,s)=>{Su[n]=s})(d,t)}),S.clearPrewarmedResources=function(){const d=ka;d&&(d.isPreloaded()&&d.numActive()===1?(d.release(lc),ka=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},S.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return Qa().getRTLTextPluginStatus()},S.getVersion=function(){return Gi},S.getWorkerCount=function(){return Ja.workerCount},S.getWorkerUrl=function(){return u.a.WORKER_URL},S.importScriptInWorkers=function(d){return xu().broadcast("IS",d)},S.prewarm=function(){Cc().acquire(lc)},S.setMaxParallelImageRequests=function(d){u.a.MAX_PARALLEL_IMAGE_REQUESTS=d},S.setRTLTextPlugin=function(d,t){return Qa().setRTLTextPlugin(d,t)},S.setWorkerCount=function(d){Ja.workerCount=d},S.setWorkerUrl=function(d){u.a.WORKER_URL=d}});var B=x;return B})})(maplibreGl);var maplibreGlExports=maplibreGl.exports;const maplibregl=getDefaultExportFromCjs(maplibreGlExports);function bind(c,g){return function(){return c.apply(g,arguments)}}const{toString}=Object.prototype,{getPrototypeOf}=Object,kindOf=(c=>g=>{const x=toString.call(g);return c[x]||(c[x]=x.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=c=>(c=c.toLowerCase(),g=>kindOf(g)===c),typeOfTest=c=>g=>typeof g===c,{isArray}=Array,isUndefined=typeOfTest("undefined");function isBuffer(c){return c!==null&&!isUndefined(c)&&c.constructor!==null&&!isUndefined(c.constructor)&&isFunction(c.constructor.isBuffer)&&c.constructor.isBuffer(c)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(c){let g;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?g=ArrayBuffer.isView(c):g=c&&c.buffer&&isArrayBuffer(c.buffer),g}const isString=typeOfTest("string"),isFunction=typeOfTest("function"),isNumber$1=typeOfTest("number"),isObject=c=>c!==null&&typeof c=="object",isBoolean=c=>c===!0||c===!1,isPlainObject=c=>{if(kindOf(c)!=="object")return!1;const g=getPrototypeOf(c);return(g===null||g===Object.prototype||Object.getPrototypeOf(g)===null)&&!(Symbol.toStringTag in c)&&!(Symbol.iterator in c)},isDate=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=c=>isObject(c)&&isFunction(c.pipe),isFormData=c=>{let g;return c&&(typeof FormData=="function"&&c instanceof FormData||isFunction(c.append)&&((g=kindOf(c))==="formdata"||g==="object"&&isFunction(c.toString)&&c.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim=c=>c.trim?c.trim():c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(c,g,{allOwnKeys:x=!1}={}){if(c===null||typeof c>"u")return;let v,T;if(typeof c!="object"&&(c=[c]),isArray(c))for(v=0,T=c.length;v<T;v++)g.call(null,c[v],v,c);else{const B=x?Object.getOwnPropertyNames(c):Object.keys(c),S=B.length;let u;for(v=0;v<S;v++)u=B[v],g.call(null,c[u],u,c)}}function findKey(c,g){g=g.toLowerCase();const x=Object.keys(c);let v=x.length,T;for(;v-- >0;)if(T=x[v],g===T.toLowerCase())return T;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,isContextDefined=c=>!isUndefined(c)&&c!==_global;function merge(){const{caseless:c}=isContextDefined(this)&&this||{},g={},x=(v,T)=>{const B=c&&findKey(g,T)||T;isPlainObject(g[B])&&isPlainObject(v)?g[B]=merge(g[B],v):isPlainObject(v)?g[B]=merge({},v):isArray(v)?g[B]=v.slice():g[B]=v};for(let v=0,T=arguments.length;v<T;v++)arguments[v]&&forEach(arguments[v],x);return g}const extend=(c,g,x,{allOwnKeys:v}={})=>(forEach(g,(T,B)=>{x&&isFunction(T)?c[B]=bind(T,x):c[B]=T},{allOwnKeys:v}),c),stripBOM=c=>(c.charCodeAt(0)===65279&&(c=c.slice(1)),c),inherits=(c,g,x,v)=>{c.prototype=Object.create(g.prototype,v),c.prototype.constructor=c,Object.defineProperty(c,"super",{value:g.prototype}),x&&Object.assign(c.prototype,x)},toFlatObject=(c,g,x,v)=>{let T,B,S;const u={};if(g=g||{},c==null)return g;do{for(T=Object.getOwnPropertyNames(c),B=T.length;B-- >0;)S=T[B],(!v||v(S,c,g))&&!u[S]&&(g[S]=c[S],u[S]=!0);c=x!==!1&&getPrototypeOf(c)}while(c&&(!x||x(c,g))&&c!==Object.prototype);return g},endsWith=(c,g,x)=>{c=String(c),(x===void 0||x>c.length)&&(x=c.length),x-=g.length;const v=c.indexOf(g,x);return v!==-1&&v===x},toArray=c=>{if(!c)return null;if(isArray(c))return c;let g=c.length;if(!isNumber$1(g))return null;const x=new Array(g);for(;g-- >0;)x[g]=c[g];return x},isTypedArray=(c=>g=>c&&g instanceof c)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(c,g)=>{const v=(c&&c[Symbol.iterator]).call(c);let T;for(;(T=v.next())&&!T.done;){const B=T.value;g.call(c,B[0],B[1])}},matchAll=(c,g)=>{let x;const v=[];for(;(x=c.exec(g))!==null;)v.push(x);return v},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=c=>c.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(x,v,T){return v.toUpperCase()+T}),hasOwnProperty=(({hasOwnProperty:c})=>(g,x)=>c.call(g,x))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(c,g)=>{const x=Object.getOwnPropertyDescriptors(c),v={};forEach(x,(T,B)=>{let S;(S=g(T,B,c))!==!1&&(v[B]=S||T)}),Object.defineProperties(c,v)},freezeMethods=c=>{reduceDescriptors(c,(g,x)=>{if(isFunction(c)&&["arguments","caller","callee"].indexOf(x)!==-1)return!1;const v=c[x];if(isFunction(v)){if(g.enumerable=!1,"writable"in g){g.writable=!1;return}g.set||(g.set=()=>{throw Error("Can not rewrite read-only method '"+x+"'")})}})},toObjectSet=(c,g)=>{const x={},v=T=>{T.forEach(B=>{x[B]=!0})};return isArray(c)?v(c):v(String(c).split(g)),x},noop=()=>{},toFiniteNumber=(c,g)=>c!=null&&Number.isFinite(c=+c)?c:g,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(c=16,g=ALPHABET.ALPHA_DIGIT)=>{let x="";const{length:v}=g;for(;c--;)x+=g[Math.random()*v|0];return x};function isSpecCompliantForm(c){return!!(c&&isFunction(c.append)&&c[Symbol.toStringTag]==="FormData"&&c[Symbol.iterator])}const toJSONObject=c=>{const g=new Array(10),x=(v,T)=>{if(isObject(v)){if(g.indexOf(v)>=0)return;if(!("toJSON"in v)){g[T]=v;const B=isArray(v)?[]:{};return forEach(v,(S,u)=>{const J=x(S,T+1);!isUndefined(J)&&(B[u]=J)}),g[T]=void 0,B}}return v};return x(c,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable=c=>c&&(isObject(c)||isFunction(c))&&isFunction(c.then)&&isFunction(c.catch),_setImmediate=((c,g)=>c?setImmediate:g?((x,v)=>(_global.addEventListener("message",({source:T,data:B})=>{T===_global&&B===x&&v.length&&v.shift()()},!1),T=>{v.push(T),_global.postMessage(x,"*")}))(`axios@${Math.random()}`,[]):x=>setTimeout(x))(typeof setImmediate=="function",isFunction(_global.postMessage)),asap=typeof queueMicrotask<"u"?queueMicrotask.bind(_global):typeof process<"u"&&process.nextTick||_setImmediate,utils$1={isArray,isArrayBuffer,isBuffer,isFormData,isArrayBufferView,isString,isNumber:isNumber$1,isBoolean,isObject,isPlainObject,isReadableStream,isRequest,isResponse,isHeaders,isUndefined,isDate,isFile,isBlob,isRegExp,isFunction,isStream,isURLSearchParams,isTypedArray,isFileList,forEach,merge,extend,trim,stripBOM,inherits,toFlatObject,kindOf,kindOfTest,endsWith,toArray,forEachEntry,matchAll,isHTMLForm,hasOwnProperty,hasOwnProp:hasOwnProperty,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop,toFiniteNumber,findKey,global:_global,isContextDefined,ALPHABET,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable,setImmediate:_setImmediate,asap};function AxiosError(c,g,x,v,T){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=c,this.name="AxiosError",g&&(this.code=g),x&&(this.config=x),v&&(this.request=v),T&&(this.response=T)}utils$1.inherits(AxiosError,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$1.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const prototype$1=AxiosError.prototype,descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(c=>{descriptors[c]={value:c}}),Object.defineProperties(AxiosError,descriptors),Object.defineProperty(prototype$1,"isAxiosError",{value:!0}),AxiosError.from=(c,g,x,v,T,B)=>{const S=Object.create(prototype$1);return utils$1.toFlatObject(c,S,function(J){return J!==Error.prototype},u=>u!=="isAxiosError"),AxiosError.call(S,c.message,g,x,v,T),S.cause=c,S.name=c.name,B&&Object.assign(S,B),S};const httpAdapter=null;function isVisitable(c){return utils$1.isPlainObject(c)||utils$1.isArray(c)}function removeBrackets(c){return utils$1.endsWith(c,"[]")?c.slice(0,-2):c}function renderKey(c,g,x){return c?c.concat(g).map(function(T,B){return T=removeBrackets(T),!x&&B?"["+T+"]":T}).join(x?".":""):g}function isFlatArray(c){return utils$1.isArray(c)&&!c.some(isVisitable)}const predicates=utils$1.toFlatObject(utils$1,{},null,function(g){return/^is[A-Z]/.test(g)});function toFormData(c,g,x){if(!utils$1.isObject(c))throw new TypeError("target must be an object");g=g||new FormData,x=utils$1.toFlatObject(x,{metaTokens:!0,dots:!1,indexes:!1},!1,function(bt,mi){return!utils$1.isUndefined(mi[bt])});const v=x.metaTokens,T=x.visitor||ae,B=x.dots,S=x.indexes,J=(x.Blob||typeof Blob<"u"&&Blob)&&utils$1.isSpecCompliantForm(g);if(!utils$1.isFunction(T))throw new TypeError("visitor must be a function");function te(li){if(li===null)return"";if(utils$1.isDate(li))return li.toISOString();if(!J&&utils$1.isBlob(li))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return utils$1.isArrayBuffer(li)||utils$1.isTypedArray(li)?J&&typeof Blob=="function"?new Blob([li]):Buffer.from(li):li}function ae(li,bt,mi){let Ii=li;if(li&&!mi&&typeof li=="object"){if(utils$1.endsWith(bt,"{}"))bt=v?bt:bt.slice(0,-2),li=JSON.stringify(li);else if(utils$1.isArray(li)&&isFlatArray(li)||(utils$1.isFileList(li)||utils$1.endsWith(bt,"[]"))&&(Ii=utils$1.toArray(li)))return bt=removeBrackets(bt),Ii.forEach(function(si,ci){!(utils$1.isUndefined(si)||si===null)&&g.append(S===!0?renderKey([bt],ci,B):S===null?bt:bt+"[]",te(si))}),!1}return isVisitable(li)?!0:(g.append(renderKey(mi,bt,B),te(li)),!1)}const H=[],Y=Object.assign(predicates,{defaultVisitor:ae,convertValue:te,isVisitable});function oi(li,bt){if(!utils$1.isUndefined(li)){if(H.indexOf(li)!==-1)throw Error("Circular reference detected in "+bt.join("."));H.push(li),utils$1.forEach(li,function(Ii,pi){(!(utils$1.isUndefined(Ii)||Ii===null)&&T.call(g,Ii,utils$1.isString(pi)?pi.trim():pi,bt,Y))===!0&&oi(Ii,bt?bt.concat(pi):[pi])}),H.pop()}}if(!utils$1.isObject(c))throw new TypeError("data must be an object");return oi(c),g}function encode$1(c){const g={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(c).replace(/[!'()~]|%20|%00/g,function(v){return g[v]})}function AxiosURLSearchParams(c,g){this._pairs=[],c&&toFormData(c,this,g)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function(g,x){this._pairs.push([g,x])},prototype.toString=function(g){const x=g?function(v){return g.call(this,v,encode$1)}:encode$1;return this._pairs.map(function(T){return x(T[0])+"="+x(T[1])},"").join("&")};function encode(c){return encodeURIComponent(c).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(c,g,x){if(!g)return c;const v=x&&x.encode||encode,T=x&&x.serialize;let B;if(T?B=T(g,x):B=utils$1.isURLSearchParams(g)?g.toString():new AxiosURLSearchParams(g,x).toString(v),B){const S=c.indexOf("#");S!==-1&&(c=c.slice(0,S)),c+=(c.indexOf("?")===-1?"?":"&")+B}return c}class InterceptorManager{constructor(){this.handlers=[]}use(g,x,v){return this.handlers.push({fulfilled:g,rejected:x,synchronous:v?v.synchronous:!1,runWhen:v?v.runWhen:null}),this.handlers.length-1}eject(g){this.handlers[g]&&(this.handlers[g]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(g){utils$1.forEach(this.handlers,function(v){v!==null&&g(v)})}}const transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData<"u"?FormData:null,Blob$1=typeof Blob<"u"?Blob:null,platform$1={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$1},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window<"u"&&typeof document<"u",hasStandardBrowserEnv=(c=>hasBrowserEnv&&["ReactNative","NativeScript","NS"].indexOf(c)<0)(typeof navigator<"u"&&navigator.product),hasStandardBrowserWebWorkerEnv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",origin=hasBrowserEnv&&window.location.href||"http://localhost",utils=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,origin},Symbol.toStringTag,{value:"Module"})),platform={...utils,...platform$1};function toURLEncodedForm(c,g){return toFormData(c,new platform.classes.URLSearchParams,Object.assign({visitor:function(x,v,T,B){return platform.isNode&&utils$1.isBuffer(x)?(this.append(v,x.toString("base64")),!1):B.defaultVisitor.apply(this,arguments)}},g))}function parsePropPath(c){return utils$1.matchAll(/\w+|\[(\w*)]/g,c).map(g=>g[0]==="[]"?"":g[1]||g[0])}function arrayToObject(c){const g={},x=Object.keys(c);let v;const T=x.length;let B;for(v=0;v<T;v++)B=x[v],g[B]=c[B];return g}function formDataToJSON(c){function g(x,v,T,B){let S=x[B++];if(S==="__proto__")return!0;const u=Number.isFinite(+S),J=B>=x.length;return S=!S&&utils$1.isArray(T)?T.length:S,J?(utils$1.hasOwnProp(T,S)?T[S]=[T[S],v]:T[S]=v,!u):((!T[S]||!utils$1.isObject(T[S]))&&(T[S]=[]),g(x,v,T[S],B)&&utils$1.isArray(T[S])&&(T[S]=arrayToObject(T[S])),!u)}if(utils$1.isFormData(c)&&utils$1.isFunction(c.entries)){const x={};return utils$1.forEachEntry(c,(v,T)=>{g(parsePropPath(v),T,x,0)}),x}return null}function stringifySafely(c,g,x){if(utils$1.isString(c))try{return(g||JSON.parse)(c),utils$1.trim(c)}catch(v){if(v.name!=="SyntaxError")throw v}return(x||JSON.stringify)(c)}const defaults={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function(g,x){const v=x.getContentType()||"",T=v.indexOf("application/json")>-1,B=utils$1.isObject(g);if(B&&utils$1.isHTMLForm(g)&&(g=new FormData(g)),utils$1.isFormData(g))return T?JSON.stringify(formDataToJSON(g)):g;if(utils$1.isArrayBuffer(g)||utils$1.isBuffer(g)||utils$1.isStream(g)||utils$1.isFile(g)||utils$1.isBlob(g)||utils$1.isReadableStream(g))return g;if(utils$1.isArrayBufferView(g))return g.buffer;if(utils$1.isURLSearchParams(g))return x.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),g.toString();let u;if(B){if(v.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(g,this.formSerializer).toString();if((u=utils$1.isFileList(g))||v.indexOf("multipart/form-data")>-1){const J=this.env&&this.env.FormData;return toFormData(u?{"files[]":g}:g,J&&new J,this.formSerializer)}}return B||T?(x.setContentType("application/json",!1),stringifySafely(g)):g}],transformResponse:[function(g){const x=this.transitional||defaults.transitional,v=x&&x.forcedJSONParsing,T=this.responseType==="json";if(utils$1.isResponse(g)||utils$1.isReadableStream(g))return g;if(g&&utils$1.isString(g)&&(v&&!this.responseType||T)){const S=!(x&&x.silentJSONParsing)&&T;try{return JSON.parse(g)}catch(u){if(S)throw u.name==="SyntaxError"?AxiosError.from(u,AxiosError.ERR_BAD_RESPONSE,this,null,this.response):u}}return g}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform.classes.FormData,Blob:platform.classes.Blob},validateStatus:function(g){return g>=200&&g<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$1.forEach(["delete","get","head","post","put","patch"],c=>{defaults.headers[c]={}});const ignoreDuplicateOf=utils$1.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders=c=>{const g={};let x,v,T;return c&&c.split(`
|
586
|
-
`).forEach(function(S){T=S.indexOf(":"),x=S.substring(0,T).trim().toLowerCase(),v=S.substring(T+1).trim(),!(!x||g[x]&&ignoreDuplicateOf[x])&&(x==="set-cookie"?g[x]?g[x].push(v):g[x]=[v]:g[x]=g[x]?g[x]+", "+v:v)}),g},$internals=Symbol("internals");function normalizeHeader(c){return c&&String(c).trim().toLowerCase()}function normalizeValue(c){return c===!1||c==null?c:utils$1.isArray(c)?c.map(normalizeValue):String(c)}function parseTokens(c){const g=Object.create(null),x=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let v;for(;v=x.exec(c);)g[v[1]]=v[2];return g}const isValidHeaderName=c=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(c.trim());function matchHeaderValue(c,g,x,v,T){if(utils$1.isFunction(v))return v.call(this,g,x);if(T&&(g=x),!!utils$1.isString(g)){if(utils$1.isString(v))return g.indexOf(v)!==-1;if(utils$1.isRegExp(v))return v.test(g)}}function formatHeader(c){return c.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(g,x,v)=>x.toUpperCase()+v)}function buildAccessors(c,g){const x=utils$1.toCamelCase(" "+g);["get","set","has"].forEach(v=>{Object.defineProperty(c,v+x,{value:function(T,B,S){return this[v].call(this,g,T,B,S)},configurable:!0})})}class AxiosHeaders{constructor(g){g&&this.set(g)}set(g,x,v){const T=this;function B(u,J,te){const ae=normalizeHeader(J);if(!ae)throw new Error("header name must be a non-empty string");const H=utils$1.findKey(T,ae);(!H||T[H]===void 0||te===!0||te===void 0&&T[H]!==!1)&&(T[H||J]=normalizeValue(u))}const S=(u,J)=>utils$1.forEach(u,(te,ae)=>B(te,ae,J));if(utils$1.isPlainObject(g)||g instanceof this.constructor)S(g,x);else if(utils$1.isString(g)&&(g=g.trim())&&!isValidHeaderName(g))S(parseHeaders(g),x);else if(utils$1.isHeaders(g))for(const[u,J]of g.entries())B(J,u,v);else g!=null&&B(x,g,v);return this}get(g,x){if(g=normalizeHeader(g),g){const v=utils$1.findKey(this,g);if(v){const T=this[v];if(!x)return T;if(x===!0)return parseTokens(T);if(utils$1.isFunction(x))return x.call(this,T,v);if(utils$1.isRegExp(x))return x.exec(T);throw new TypeError("parser must be boolean|regexp|function")}}}has(g,x){if(g=normalizeHeader(g),g){const v=utils$1.findKey(this,g);return!!(v&&this[v]!==void 0&&(!x||matchHeaderValue(this,this[v],v,x)))}return!1}delete(g,x){const v=this;let T=!1;function B(S){if(S=normalizeHeader(S),S){const u=utils$1.findKey(v,S);u&&(!x||matchHeaderValue(v,v[u],u,x))&&(delete v[u],T=!0)}}return utils$1.isArray(g)?g.forEach(B):B(g),T}clear(g){const x=Object.keys(this);let v=x.length,T=!1;for(;v--;){const B=x[v];(!g||matchHeaderValue(this,this[B],B,g,!0))&&(delete this[B],T=!0)}return T}normalize(g){const x=this,v={};return utils$1.forEach(this,(T,B)=>{const S=utils$1.findKey(v,B);if(S){x[S]=normalizeValue(T),delete x[B];return}const u=g?formatHeader(B):String(B).trim();u!==B&&delete x[B],x[u]=normalizeValue(T),v[u]=!0}),this}concat(...g){return this.constructor.concat(this,...g)}toJSON(g){const x=Object.create(null);return utils$1.forEach(this,(v,T)=>{v!=null&&v!==!1&&(x[T]=g&&utils$1.isArray(v)?v.join(", "):v)}),x}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([g,x])=>g+": "+x).join(`
|
587
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(g){return g instanceof this?g:new this(g)}static concat(g,...x){const v=new this(g);return x.forEach(T=>v.set(T)),v}static accessor(g){const v=(this[$internals]=this[$internals]={accessors:{}}).accessors,T=this.prototype;function B(S){const u=normalizeHeader(S);v[u]||(buildAccessors(T,S),v[u]=!0)}return utils$1.isArray(g)?g.forEach(B):B(g),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),utils$1.reduceDescriptors(AxiosHeaders.prototype,({value:c},g)=>{let x=g[0].toUpperCase()+g.slice(1);return{get:()=>c,set(v){this[x]=v}}}),utils$1.freezeMethods(AxiosHeaders);function transformData(c,g){const x=this||defaults,v=g||x,T=AxiosHeaders.from(v.headers);let B=v.data;return utils$1.forEach(c,function(u){B=u.call(x,B,T.normalize(),g?g.status:void 0)}),T.normalize(),B}function isCancel(c){return!!(c&&c.__CANCEL__)}function CanceledError(c,g,x){AxiosError.call(this,c??"canceled",AxiosError.ERR_CANCELED,g,x),this.name="CanceledError"}utils$1.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(c,g,x){const v=x.config.validateStatus;!x.status||!v||v(x.status)?c(x):g(new AxiosError("Request failed with status code "+x.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(x.status/100)-4],x.config,x.request,x))}function parseProtocol(c){const g=/^([-+\w]{1,25})(:?\/\/|:)/.exec(c);return g&&g[1]||""}function speedometer(c,g){c=c||10;const x=new Array(c),v=new Array(c);let T=0,B=0,S;return g=g!==void 0?g:1e3,function(J){const te=Date.now(),ae=v[B];S||(S=te),x[T]=J,v[T]=te;let H=B,Y=0;for(;H!==T;)Y+=x[H++],H=H%c;if(T=(T+1)%c,T===B&&(B=(B+1)%c),te-S<g)return;const oi=ae&&te-ae;return oi?Math.round(Y*1e3/oi):void 0}}function throttle(c,g){let x=0,v=1e3/g,T,B;const S=(te,ae=Date.now())=>{x=ae,T=null,B&&(clearTimeout(B),B=null),c.apply(null,te)};return[(...te)=>{const ae=Date.now(),H=ae-x;H>=v?S(te,ae):(T=te,B||(B=setTimeout(()=>{B=null,S(T)},v-H)))},()=>T&&S(T)]}const progressEventReducer=(c,g,x=3)=>{let v=0;const T=speedometer(50,250);return throttle(B=>{const S=B.loaded,u=B.lengthComputable?B.total:void 0,J=S-v,te=T(J),ae=S<=u;v=S;const H={loaded:S,total:u,progress:u?S/u:void 0,bytes:J,rate:te||void 0,estimated:te&&u&&ae?(u-S)/te:void 0,event:B,lengthComputable:u!=null,[g?"download":"upload"]:!0};c(H)},x)},progressEventDecorator=(c,g)=>{const x=c!=null;return[v=>g[0]({lengthComputable:x,total:c,loaded:v}),g[1]]},asyncDecorator=c=>(...g)=>utils$1.asap(()=>c(...g)),isURLSameOrigin=platform.hasStandardBrowserEnv?function(){const g=/(msie|trident)/i.test(navigator.userAgent),x=document.createElement("a");let v;function T(B){let S=B;return g&&(x.setAttribute("href",S),S=x.href),x.setAttribute("href",S),{href:x.href,protocol:x.protocol?x.protocol.replace(/:$/,""):"",host:x.host,search:x.search?x.search.replace(/^\?/,""):"",hash:x.hash?x.hash.replace(/^#/,""):"",hostname:x.hostname,port:x.port,pathname:x.pathname.charAt(0)==="/"?x.pathname:"/"+x.pathname}}return v=T(window.location.href),function(S){const u=utils$1.isString(S)?T(S):S;return u.protocol===v.protocol&&u.host===v.host}}():function(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(c,g,x,v,T,B){const S=[c+"="+encodeURIComponent(g)];utils$1.isNumber(x)&&S.push("expires="+new Date(x).toGMTString()),utils$1.isString(v)&&S.push("path="+v),utils$1.isString(T)&&S.push("domain="+T),B===!0&&S.push("secure"),document.cookie=S.join("; ")},read(c){const g=document.cookie.match(new RegExp("(^|;\\s*)("+c+")=([^;]*)"));return g?decodeURIComponent(g[3]):null},remove(c){this.write(c,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(c){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(c)}function combineURLs(c,g){return g?c.replace(/\/?\/$/,"")+"/"+g.replace(/^\/+/,""):c}function buildFullPath(c,g){return c&&!isAbsoluteURL(g)?combineURLs(c,g):g}const headersToObject=c=>c instanceof AxiosHeaders?{...c}:c;function mergeConfig(c,g){g=g||{};const x={};function v(te,ae,H){return utils$1.isPlainObject(te)&&utils$1.isPlainObject(ae)?utils$1.merge.call({caseless:H},te,ae):utils$1.isPlainObject(ae)?utils$1.merge({},ae):utils$1.isArray(ae)?ae.slice():ae}function T(te,ae,H){if(utils$1.isUndefined(ae)){if(!utils$1.isUndefined(te))return v(void 0,te,H)}else return v(te,ae,H)}function B(te,ae){if(!utils$1.isUndefined(ae))return v(void 0,ae)}function S(te,ae){if(utils$1.isUndefined(ae)){if(!utils$1.isUndefined(te))return v(void 0,te)}else return v(void 0,ae)}function u(te,ae,H){if(H in g)return v(te,ae);if(H in c)return v(void 0,te)}const J={url:B,method:B,data:B,baseURL:S,transformRequest:S,transformResponse:S,paramsSerializer:S,timeout:S,timeoutMessage:S,withCredentials:S,withXSRFToken:S,adapter:S,responseType:S,xsrfCookieName:S,xsrfHeaderName:S,onUploadProgress:S,onDownloadProgress:S,decompress:S,maxContentLength:S,maxBodyLength:S,beforeRedirect:S,transport:S,httpAgent:S,httpsAgent:S,cancelToken:S,socketPath:S,responseEncoding:S,validateStatus:u,headers:(te,ae)=>T(headersToObject(te),headersToObject(ae),!0)};return utils$1.forEach(Object.keys(Object.assign({},c,g)),function(ae){const H=J[ae]||T,Y=H(c[ae],g[ae],ae);utils$1.isUndefined(Y)&&H!==u||(x[ae]=Y)}),x}const resolveConfig=c=>{const g=mergeConfig({},c);let{data:x,withXSRFToken:v,xsrfHeaderName:T,xsrfCookieName:B,headers:S,auth:u}=g;g.headers=S=AxiosHeaders.from(S),g.url=buildURL(buildFullPath(g.baseURL,g.url),c.params,c.paramsSerializer),u&&S.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):"")));let J;if(utils$1.isFormData(x)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv)S.setContentType(void 0);else if((J=S.getContentType())!==!1){const[te,...ae]=J?J.split(";").map(H=>H.trim()).filter(Boolean):[];S.setContentType([te||"multipart/form-data",...ae].join("; "))}}if(platform.hasStandardBrowserEnv&&(v&&utils$1.isFunction(v)&&(v=v(g)),v||v!==!1&&isURLSameOrigin(g.url))){const te=T&&B&&cookies.read(B);te&&S.set(T,te)}return g},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(c){return new Promise(function(x,v){const T=resolveConfig(c);let B=T.data;const S=AxiosHeaders.from(T.headers).normalize();let{responseType:u,onUploadProgress:J,onDownloadProgress:te}=T,ae,H,Y,oi,li;function bt(){oi&&oi(),li&&li(),T.cancelToken&&T.cancelToken.unsubscribe(ae),T.signal&&T.signal.removeEventListener("abort",ae)}let mi=new XMLHttpRequest;mi.open(T.method.toUpperCase(),T.url,!0),mi.timeout=T.timeout;function Ii(){if(!mi)return;const si=AxiosHeaders.from("getAllResponseHeaders"in mi&&mi.getAllResponseHeaders()),ri={data:!u||u==="text"||u==="json"?mi.responseText:mi.response,status:mi.status,statusText:mi.statusText,headers:si,config:c,request:mi};settle(function(tn){x(tn),bt()},function(tn){v(tn),bt()},ri),mi=null}"onloadend"in mi?mi.onloadend=Ii:mi.onreadystatechange=function(){!mi||mi.readyState!==4||mi.status===0&&!(mi.responseURL&&mi.responseURL.indexOf("file:")===0)||setTimeout(Ii)},mi.onabort=function(){mi&&(v(new AxiosError("Request aborted",AxiosError.ECONNABORTED,c,mi)),mi=null)},mi.onerror=function(){v(new AxiosError("Network Error",AxiosError.ERR_NETWORK,c,mi)),mi=null},mi.ontimeout=function(){let ci=T.timeout?"timeout of "+T.timeout+"ms exceeded":"timeout exceeded";const ri=T.transitional||transitionalDefaults;T.timeoutErrorMessage&&(ci=T.timeoutErrorMessage),v(new AxiosError(ci,ri.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,c,mi)),mi=null},B===void 0&&S.setContentType(null),"setRequestHeader"in mi&&utils$1.forEach(S.toJSON(),function(ci,ri){mi.setRequestHeader(ri,ci)}),utils$1.isUndefined(T.withCredentials)||(mi.withCredentials=!!T.withCredentials),u&&u!=="json"&&(mi.responseType=T.responseType),te&&([Y,li]=progressEventReducer(te,!0),mi.addEventListener("progress",Y)),J&&mi.upload&&([H,oi]=progressEventReducer(J),mi.upload.addEventListener("progress",H),mi.upload.addEventListener("loadend",oi)),(T.cancelToken||T.signal)&&(ae=si=>{mi&&(v(!si||si.type?new CanceledError(null,c,mi):si),mi.abort(),mi=null)},T.cancelToken&&T.cancelToken.subscribe(ae),T.signal&&(T.signal.aborted?ae():T.signal.addEventListener("abort",ae)));const pi=parseProtocol(T.url);if(pi&&platform.protocols.indexOf(pi)===-1){v(new AxiosError("Unsupported protocol "+pi+":",AxiosError.ERR_BAD_REQUEST,c));return}mi.send(B||null)})},composeSignals=(c,g)=>{let x=new AbortController,v;const T=function(J){if(!v){v=!0,S();const te=J instanceof Error?J:this.reason;x.abort(te instanceof AxiosError?te:new CanceledError(te instanceof Error?te.message:te))}};let B=g&&setTimeout(()=>{T(new AxiosError(`timeout ${g} of ms exceeded`,AxiosError.ETIMEDOUT))},g);const S=()=>{c&&(B&&clearTimeout(B),B=null,c.forEach(J=>{J&&(J.removeEventListener?J.removeEventListener("abort",T):J.unsubscribe(T))}),c=null)};c.forEach(J=>J&&J.addEventListener&&J.addEventListener("abort",T));const{signal:u}=x;return u.unsubscribe=S,[u,()=>{B&&clearTimeout(B),B=null}]},streamChunk=function*(c,g){let x=c.byteLength;if(!g||x<g){yield c;return}let v=0,T;for(;v<x;)T=v+g,yield c.slice(v,T),v=T},readBytes=async function*(c,g,x){for await(const v of c)yield*streamChunk(ArrayBuffer.isView(v)?v:await x(String(v)),g)},trackStream=(c,g,x,v,T)=>{const B=readBytes(c,g,T);let S=0,u,J=te=>{u||(u=!0,v&&v(te))};return new ReadableStream({async pull(te){try{const{done:ae,value:H}=await B.next();if(ae){J(),te.close();return}let Y=H.byteLength;if(x){let oi=S+=Y;x(oi)}te.enqueue(new Uint8Array(H))}catch(ae){throw J(ae),ae}},cancel(te){return J(te),B.return()}},{highWaterMark:2})},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(c=>g=>c.encode(g))(new TextEncoder):async c=>new Uint8Array(await new Response(c).arrayBuffer())),test=(c,...g)=>{try{return!!c(...g)}catch{return!1}},supportsRequestStream=isReadableStreamSupported&&test(()=>{let c=!1;const g=new Request(platform.origin,{body:new ReadableStream,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!g}),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&test(()=>utils$1.isReadableStream(new Response("").body)),resolvers={stream:supportsResponseStream&&(c=>c.body)};isFetchSupported&&(c=>{["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!resolvers[g]&&(resolvers[g]=utils$1.isFunction(c[g])?x=>x[g]():(x,v)=>{throw new AxiosError(`Response type '${g}' is not supported`,AxiosError.ERR_NOT_SUPPORT,v)})})})(new Response);const getBodyLength=async c=>{if(c==null)return 0;if(utils$1.isBlob(c))return c.size;if(utils$1.isSpecCompliantForm(c))return(await new Request(c).arrayBuffer()).byteLength;if(utils$1.isArrayBufferView(c)||utils$1.isArrayBuffer(c))return c.byteLength;if(utils$1.isURLSearchParams(c)&&(c=c+""),utils$1.isString(c))return(await encodeText(c)).byteLength},resolveBodyLength=async(c,g)=>{const x=utils$1.toFiniteNumber(c.getContentLength());return x??getBodyLength(g)},fetchAdapter=isFetchSupported&&(async c=>{let{url:g,method:x,data:v,signal:T,cancelToken:B,timeout:S,onDownloadProgress:u,onUploadProgress:J,responseType:te,headers:ae,withCredentials:H="same-origin",fetchOptions:Y}=resolveConfig(c);te=te?(te+"").toLowerCase():"text";let[oi,li]=T||B||S?composeSignals([T,B],S):[],bt,mi;const Ii=()=>{!bt&&setTimeout(()=>{oi&&oi.unsubscribe()}),bt=!0};let pi;try{if(J&&supportsRequestStream&&x!=="get"&&x!=="head"&&(pi=await resolveBodyLength(ae,v))!==0){let gi=new Request(g,{method:"POST",body:v,duplex:"half"}),tn;if(utils$1.isFormData(v)&&(tn=gi.headers.get("content-type"))&&ae.setContentType(tn),gi.body){const[Ws,Ji]=progressEventDecorator(pi,progressEventReducer(asyncDecorator(J)));v=trackStream(gi.body,DEFAULT_CHUNK_SIZE,Ws,Ji,encodeText)}}utils$1.isString(H)||(H=H?"include":"omit"),mi=new Request(g,{...Y,signal:oi,method:x.toUpperCase(),headers:ae.normalize().toJSON(),body:v,duplex:"half",credentials:H});let si=await fetch(mi);const ci=supportsResponseStream&&(te==="stream"||te==="response");if(supportsResponseStream&&(u||ci)){const gi={};["status","statusText","headers"].forEach($s=>{gi[$s]=si[$s]});const tn=utils$1.toFiniteNumber(si.headers.get("content-length")),[Ws,Ji]=u&&progressEventDecorator(tn,progressEventReducer(asyncDecorator(u),!0))||[];si=new Response(trackStream(si.body,DEFAULT_CHUNK_SIZE,Ws,()=>{Ji&&Ji(),ci&&Ii()},encodeText),gi)}te=te||"text";let ri=await resolvers[utils$1.findKey(resolvers,te)||"text"](si,c);return!ci&&Ii(),li&&li(),await new Promise((gi,tn)=>{settle(gi,tn,{data:ri,headers:AxiosHeaders.from(si.headers),status:si.status,statusText:si.statusText,config:c,request:mi})})}catch(si){throw Ii(),si&&si.name==="TypeError"&&/fetch/i.test(si.message)?Object.assign(new AxiosError("Network Error",AxiosError.ERR_NETWORK,c,mi),{cause:si.cause||si}):AxiosError.from(si,si&&si.code,c,mi)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$1.forEach(knownAdapters,(c,g)=>{if(c){try{Object.defineProperty(c,"name",{value:g})}catch{}Object.defineProperty(c,"adapterName",{value:g})}});const renderReason=c=>`- ${c}`,isResolvedHandle=c=>utils$1.isFunction(c)||c===null||c===!1,adapters={getAdapter:c=>{c=utils$1.isArray(c)?c:[c];const{length:g}=c;let x,v;const T={};for(let B=0;B<g;B++){x=c[B];let S;if(v=x,!isResolvedHandle(x)&&(v=knownAdapters[(S=String(x)).toLowerCase()],v===void 0))throw new AxiosError(`Unknown adapter '${S}'`);if(v)break;T[S||"#"+B]=v}if(!v){const B=Object.entries(T).map(([u,J])=>`adapter ${u} `+(J===!1?"is not supported by the environment":"is not available in the build"));let S=g?B.length>1?`since :
|
588
|
-
`+B.map(renderReason).join(`
|
589
|
-
`):" "+renderReason(B[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+S,"ERR_NOT_SUPPORT")}return v},adapters:knownAdapters};function throwIfCancellationRequested(c){if(c.cancelToken&&c.cancelToken.throwIfRequested(),c.signal&&c.signal.aborted)throw new CanceledError(null,c)}function dispatchRequest(c){return throwIfCancellationRequested(c),c.headers=AxiosHeaders.from(c.headers),c.data=transformData.call(c,c.transformRequest),["post","put","patch"].indexOf(c.method)!==-1&&c.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(c.adapter||defaults.adapter)(c).then(function(v){return throwIfCancellationRequested(c),v.data=transformData.call(c,c.transformResponse,v),v.headers=AxiosHeaders.from(v.headers),v},function(v){return isCancel(v)||(throwIfCancellationRequested(c),v&&v.response&&(v.response.data=transformData.call(c,c.transformResponse,v.response),v.response.headers=AxiosHeaders.from(v.response.headers))),Promise.reject(v)})}const VERSION="1.7.4",validators$1={};["object","boolean","number","function","string","symbol"].forEach((c,g)=>{validators$1[c]=function(v){return typeof v===c||"a"+(g<1?"n ":" ")+c}});const deprecatedWarnings={};validators$1.transitional=function(g,x,v){function T(B,S){return"[Axios v"+VERSION+"] Transitional option '"+B+"'"+S+(v?". "+v:"")}return(B,S,u)=>{if(g===!1)throw new AxiosError(T(S," has been removed"+(x?" in "+x:"")),AxiosError.ERR_DEPRECATED);return x&&!deprecatedWarnings[S]&&(deprecatedWarnings[S]=!0,console.warn(T(S," has been deprecated since v"+x+" and will be removed in the near future"))),g?g(B,S,u):!0}};function assertOptions(c,g,x){if(typeof c!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const v=Object.keys(c);let T=v.length;for(;T-- >0;){const B=v[T],S=g[B];if(S){const u=c[B],J=u===void 0||S(u,B,c);if(J!==!0)throw new AxiosError("option "+B+" must be "+J,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(x!==!0)throw new AxiosError("Unknown option "+B,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(g){this.defaults=g,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(g,x){try{return await this._request(g,x)}catch(v){if(v instanceof Error){let T;Error.captureStackTrace?Error.captureStackTrace(T={}):T=new Error;const B=T.stack?T.stack.replace(/^.+\n/,""):"";try{v.stack?B&&!String(v.stack).endsWith(B.replace(/^.+\n.+\n/,""))&&(v.stack+=`
|
590
|
-
`+B):v.stack=B}catch{}}throw v}}_request(g,x){typeof g=="string"?(x=x||{},x.url=g):x=g||{},x=mergeConfig(this.defaults,x);const{transitional:v,paramsSerializer:T,headers:B}=x;v!==void 0&&validator.assertOptions(v,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),T!=null&&(utils$1.isFunction(T)?x.paramsSerializer={serialize:T}:validator.assertOptions(T,{encode:validators.function,serialize:validators.function},!0)),x.method=(x.method||this.defaults.method||"get").toLowerCase();let S=B&&utils$1.merge(B.common,B[x.method]);B&&utils$1.forEach(["delete","get","head","post","put","patch","common"],li=>{delete B[li]}),x.headers=AxiosHeaders.concat(S,B);const u=[];let J=!0;this.interceptors.request.forEach(function(bt){typeof bt.runWhen=="function"&&bt.runWhen(x)===!1||(J=J&&bt.synchronous,u.unshift(bt.fulfilled,bt.rejected))});const te=[];this.interceptors.response.forEach(function(bt){te.push(bt.fulfilled,bt.rejected)});let ae,H=0,Y;if(!J){const li=[dispatchRequest.bind(this),void 0];for(li.unshift.apply(li,u),li.push.apply(li,te),Y=li.length,ae=Promise.resolve(x);H<Y;)ae=ae.then(li[H++],li[H++]);return ae}Y=u.length;let oi=x;for(H=0;H<Y;){const li=u[H++],bt=u[H++];try{oi=li(oi)}catch(mi){bt.call(this,mi);break}}try{ae=dispatchRequest.call(this,oi)}catch(li){return Promise.reject(li)}for(H=0,Y=te.length;H<Y;)ae=ae.then(te[H++],te[H++]);return ae}getUri(g){g=mergeConfig(this.defaults,g);const x=buildFullPath(g.baseURL,g.url);return buildURL(x,g.params,g.paramsSerializer)}}utils$1.forEach(["delete","get","head","options"],function(g){Axios.prototype[g]=function(x,v){return this.request(mergeConfig(v||{},{method:g,url:x,data:(v||{}).data}))}}),utils$1.forEach(["post","put","patch"],function(g){function x(v){return function(B,S,u){return this.request(mergeConfig(u||{},{method:g,headers:v?{"Content-Type":"multipart/form-data"}:{},url:B,data:S}))}}Axios.prototype[g]=x(),Axios.prototype[g+"Form"]=x(!0)});class CancelToken{constructor(g){if(typeof g!="function")throw new TypeError("executor must be a function.");let x;this.promise=new Promise(function(B){x=B});const v=this;this.promise.then(T=>{if(!v._listeners)return;let B=v._listeners.length;for(;B-- >0;)v._listeners[B](T);v._listeners=null}),this.promise.then=T=>{let B;const S=new Promise(u=>{v.subscribe(u),B=u}).then(T);return S.cancel=function(){v.unsubscribe(B)},S},g(function(B,S,u){v.reason||(v.reason=new CanceledError(B,S,u),x(v.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(g){if(this.reason){g(this.reason);return}this._listeners?this._listeners.push(g):this._listeners=[g]}unsubscribe(g){if(!this._listeners)return;const x=this._listeners.indexOf(g);x!==-1&&this._listeners.splice(x,1)}static source(){let g;return{token:new CancelToken(function(T){g=T}),cancel:g}}}function spread(c){return function(x){return c.apply(null,x)}}function isAxiosError(c){return utils$1.isObject(c)&&c.isAxiosError===!0}const HttpStatusCode={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(HttpStatusCode).forEach(([c,g])=>{HttpStatusCode[g]=c});function createInstance(c){const g=new Axios(c),x=bind(Axios.prototype.request,g);return utils$1.extend(x,Axios.prototype,g,{allOwnKeys:!0}),utils$1.extend(x,g,null,{allOwnKeys:!0}),x.create=function(T){return createInstance(mergeConfig(c,T))},x}const axios=createInstance(defaults);axios.Axios=Axios,axios.CanceledError=CanceledError,axios.CancelToken=CancelToken,axios.isCancel=isCancel,axios.VERSION=VERSION,axios.toFormData=toFormData,axios.AxiosError=AxiosError,axios.Cancel=axios.CanceledError,axios.all=function(g){return Promise.all(g)},axios.spread=spread,axios.isAxiosError=isAxiosError,axios.mergeConfig=mergeConfig,axios.AxiosHeaders=AxiosHeaders,axios.formToJSON=c=>formDataToJSON(utils$1.isHTMLForm(c)?new FormData(c):c),axios.getAdapter=adapters.getAdapter,axios.HttpStatusCode=HttpStatusCode,axios.default=axios;function polygon$1(c){const g=[{type:"fill",minzoom:c.pointZoom||0,paint:{"fill-color":c.color||"#ccc","fill-outline-color":c.stroke||"#blue","fill-opacity":c.opacity||1}}];return c.pointZoom&&g.push({type:"circle",maxzoom:c.pointZoom,paint:{"circle-color":c.color||"#ccc","circle-stroke-color":c.stroke||"#ccc","circle-stroke-width":c.width||1,"circle-opacity":c.opacity||1}}),c.label&&g.push({type:"symbol",layout:{"text-field":["get",c.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),g}function line(c){const g=[{type:"line",paint:{"line-color":c.color||"#ccc","line-opacity":c.opacity||1}}];return c.label&&g.push({type:"symbol",layout:{"text-field":["get",c.label],"text-font":["Open Sans Regular"],"text-size":12,"symbol-placement":"line-center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),g}function point$1(c){const g=[{type:"circle",maxzoom:c.icon&&+c.iconZoom||22,paint:{"circle-radius":c.radius||6,"circle-stroke-color":c.stroke||"#ccc","circle-stroke-width":c.width||1,"circle-color":c.color||"blue","circle-opacity":c.opacity||1}}];return c!=null&&c.clusterZoom&&(g.push({type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}}),g.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),c.icon&&g.push({type:"symbol",minzoom:+c.iconZoom||16,layout:{"icon-image":c.icon,"icon-allow-overlap":!0}}),c.label&&g.push({type:"symbol",layout:{"text-field":["get",c.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"top"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),g}function style2layers(c){if(!c)return null;const g=c.type||"point";return g==="polygon"?polygon$1(c):g==="line"?line(c):point$1(c)}const colorPalette=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],iconPalette=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],loadedImages={};async function getAttrs(c,g,x="api"){const v=await fetch(`${x}/gis-layer/${c}/${g}`),{rows:T}=await v.json();return T}async function style2layersExtend(c,g,x,v){if(!c)return null;const T=JSON.parse(JSON.stringify(c)),B=T.colorAttr?await getAttrs(g,T.colorAttr,v):null;B==null||B.forEach((u,J)=>{var te,ae;u.color=u.color||((te=T.colorSet)==null?void 0:te[u.id])||((ae=T.colorSet)==null?void 0:ae[J])||colorPalette[J%colorPalette.length],u.icon=T.icon?T.icon.split("+")[0]+"+"+u.color.replace("#","")+".png":null});const S=T.iconAttr?await getAttrs(g,T.iconAttr,v):null;if(S==null||S.forEach((u,J)=>{var oi,li,bt,mi;const te=u.icon||((oi=T.iconSet)==null?void 0:oi[u.id])||((li=T.iconPattern)==null?void 0:li.replace("{id}",u.id))||((bt=T.iconSet)==null?void 0:bt[J])||(T.iconPrefix?null:iconPalette[J]);if(!te)return;const ae=u.color||((mi=T.color)==null?void 0:mi.replace("#",""))||"red",[H="pin6",Y="m"]=T.icon?T.icon.split("-"):[];u.icon=T.iconPrefix||te!=null&&te.includes("/")?(T.iconPrefix||"")+te:`${H}-${Y}-${te}+${ae}.png`}),T.colorAttr&&B){const u=["match",["get",T.colorAttr]];B.filter(J=>J.id).forEach(J=>{u.push(J.id),u.push(J.color)}),u.push(T.color||"gray"),T.color=u}if(T.icon&&T.iconAttr&&S){const u=["match",["get",T.iconAttr]];S.filter(J=>J.icon).forEach(({id:J,icon:te})=>{if(T.colorAttr&&B){u.push(J);const ae=["match",["get",T.colorAttr]];B.forEach(H=>{ae.push(H.id);const Y=te.split("+")[0]+"+"+H.color.replace("#","")+".png";ae.push(Y),loadImage(Y,x,v)}),ae.push(T.icon),u.push(ae)}else u.push(J),u.push(te),loadImage(te,x,v)}),u.push((T.iconPrefix||"")+T.icon),loadImage((T.iconPrefix||"")+T.icon,x,v),T.icon=u}else if(T.icon&&T.colorAttr&&B){const u=["match",["get",T.colorAttr]];B.forEach(J=>{u.push(J.id),u.push(J.icon),loadImage(J.icon,x,v)}),u.push(T.icon),loadImage(T.icon,x,v),T.icon=u}else T.icon&&await loadImage(T.icon,x,v);return legend({style:c,colors:B,icons:S,map:x,id:g}),style2layers(T)}async function loadImage(c="pin4-sm-mi-plumber+f45942.png",g=null,x){if(loadedImages[c])return null;loadedImages[c]=!0;const v=await(g==null?void 0:g.loadImage(c!=null&&c.startsWith("/")||c!=null&&c.includes("//")?c:`${x}/marker_icon/${c.replace(".png","")}.png`));g==null||g.addImage(c,v.data)}function legend({style:c,colors:g,icons:x,map:v,id:T}){v.legend||Object.assign(v,{legend:{}}),window.map||(window.map=v),Object.assign(v.legend,{[T]:{icon:c.icon,colors:g,icons:x,color:c.color||"blue",type:c.type||"point"}})}const layerMixin={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(c=>c==null?void 0:c.interactive).map(c=>c.id)}},methods:{moveLayer(c,g=this.map){g.getStyle().layers.forEach(x=>{x.id.match(c)&&g.moveLayer(x.id)})},async setVisible(c,g=!0,x=this.map){if(!c)return;const v=(c==null?void 0:c.id)||c,T=this.layerList.find(S=>S.id===c)||c;if(!(T!=null&&T.id))throw new Error("MixinError: Layer has no id");x.getStyle().layers.filter(S=>S.id.match(v)).forEach(S=>{x.setLayoutProperty(S.id,"visibility",g?"visible":"none")}),g&&await this.addLayer(T)},async addLayer(c,g=this==null?void 0:this.map){var T,B;const x=this.layerList.find(S=>S.id===c)||c;!this.map.getStyle()||this.map.getStyle().layers.find(S=>S.id===x.id)||(this.layerList.find(S=>S.id===x.id)||this.layerList.push(x),(x.service==="vtile"||x.service==="vector"||(T=x.url)!=null&&T.includes(".vmt"))&&this.addVtileLayer(x,g),x.service==="geojson"&&this.addGeoJsonLayer(x,g),((B=x.url)!=null&&B.includes(".png")||["tms","raster"].includes(x.service))&&await this.addRasterLayer(x,g))},async addRasterLayer(c,g=this==null?void 0:this.map){var x;g.getSource(c.id)||(typeof c.bounds=="string"&&Object.assign(c,{bounds:c.bounds.split(",")}),await g.addSource(c.id,{type:"raster",tiles:[(x=c==null?void 0:c.url)!=null&&x.startsWith("http")?c==null?void 0:c.url:`${this.prefix?c==null?void 0:c.url.replace(/(\/api[^\/]*)/,this.prefix):c==null?void 0:c.url}${c!=null&&c.url.includes("?")?"&":"?"}dt=${new Date().toISOString().split("T")[0]}`],tileSize:256,...Array.isArray(c.bounds)&&c.bounds.length===4?{bounds:c.bounds}:{},...c!=null&&c.scheme?{scheme:c==null?void 0:c.scheme}:{}}),await g.addLayer({id:c.id,type:"raster",source:c.id,minzoom:0,maxzoom:(c==null?void 0:c.maxzoom)||22}))},async updateStyle(c,g=this==null?void 0:this.map){const x=c.id;g.getStyle().layers.forEach(async T=>{T.source===x&&g.getLayer(T.id)&&await g.removeLayer(T.id)}),(await style2layersExtend(c.style,c.source||c.id,g,this.prefix)||c.layers||[]).forEach((T,B)=>{const S={...T,id:`${c.id}-${B}`,source:c.id,"source-layer":T["source-layer"]||c.source||c.id,maxzoom:+T.maxzoom||24,minzoom:+T.minzoom||0};g.addLayer(S)})},async addVtileLayer(c,g=this==null?void 0:this.map){var B;const x=["props","pointZoom","clusterZoom"].filter(S=>c[S]).map(S=>`&${S}=${c[S]}`),v={type:"vector",tiles:[`${(B=c==null?void 0:c.url)!=null&&B.startsWith("http")?"":window.location.origin}${c==null?void 0:c.url}${x}`],minzoom:c.minzoom||5,maxzoom:c.maxzoom||24};g.addSource(c.id,v),(c.layers||await style2layersExtend(c.style,c.source||c.id,g,this.prefix)||[]).forEach((S,u)=>{const J={...S,id:`${c.id}-${u}`,source:c.id,"source-layer":S["source-layer"]||c.source||c.id,maxzoom:+S.maxzoom||24,minzoom:+S.minzoom||0};g.addLayer(J)})},async addGeoJsonLayer(c,g=this.map){var T;const x=c.data||((T=c==null?void 0:c.url)!=null&&T.startsWith("http")?"":window.location.origin)+c.url;g.addSource(c.id,{type:"geojson",data:x}),(await style2layersExtend(c.style,x.source||x.id,g,this.prefix)||c.layers||[]).forEach(B=>{const S={...B,source:c.id,id:B.id||c.id,maxzoom:+B.maxzoom||24,minzoom:+B.minzoom||0,type:B.type||"circle"};g.addLayer(S)})},setLayerData(c,g){this.layerList=this.layerList.map(x=>x.id===c?{...x,...g}:x)},async removeLayer(c,g=this.map){g.getSource(c)&&(await g.getStyle().layers.forEach(async x=>{x.source===c&&await g.removeLayer(x.id)}),g.getSource(c)&&await g.removeSource(c))},async setFilter(c,g){const x=this.layerList.find(T=>T.id===c);await(await this.map.getSource(c)).setTiles([`${window.location.origin}${x.url}${x.url.includes("?")?"&":"?"}filter=${g}${x.props?`&props=${x.props}`:""}`])},async changeBaseLayer(c){c!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(c,!0),this.map.getStyle().layers.forEach(g=>{g.source!==c&&g.type!=="background"&&this.map.moveLayer(g.id)}),this.activeLayer=c)},async refreshLayer(c,g=this.map){await g.getStyle().layers.forEach(x=>{x.source===c&&g.removeLayer(x.id)}),g.getSource(c)&&await g.removeSource(c),this.setVisible(c)}}},_export_sfc=(c,g)=>{const x=c.__vccOpts||c;for(const[v,T]of g)x[v]=T;return x},_sfc_main$b={},_hoisted_1$a={class:"w-48 mx-auto mb-4",width:"178",height:"90",viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"},_hoisted_2$a=vue.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter2)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter2" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12),_hoisted_14$1=[_hoisted_2$a];function _sfc_render$a(c,g){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$a,_hoisted_14$1)}const NoData=_export_sfc(_sfc_main$b,[["render",_sfc_render$a]]),debounce=(c,g=300)=>{let x;return function(...T){clearTimeout(x),x=setTimeout(()=>{c.apply(this,T)},g)}},_sfc_main$a={mixins:[layerMixin],props:{map:{type:Object},baseLayers:{type:Array,default:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",category:"Національна інфраструктура геопросторових даних",scale:1e4,year:2020,bounds:"ua",maxzoom:18,owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png",basemap:!0},{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0},{id:"darkmap_carto",name:"Темна карта України",image:"https://basemaps.cartocdn.com/dark_all/13/4791/2762.png?ver=2023-04-14",url:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",active:!1}]},selectedLayer:{type:String,required:!0}},watch:{map(c){c&&c.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var c;this.baseLayers.forEach(g=>{this.layerList.push(g)}),this.toggleLayerVisibility((c=this.baseLayers[0])==null?void 0:c.id)},toggleLayerVisibility(c){this.$emit("update:selectedLayer",c),this.changeBaseLayer(c)}}},_hoisted_1$9={class:"vs-map-slot-layers z-10 select-none"},_hoisted_2$9=["onClick"],_hoisted_3$7=["src"];function _sfc_render$9(c,g,x,v,T,B){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$9,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(x.baseLayers,(S,u)=>(vue.openBlock(),vue.createElementBlock("div",{key:S.id,class:vue.normalizeClass(["vs-map-slot-layers__layer relative",{focused:S.id==x.selectedLayer}]),onClick:J=>B.toggleLayerVisibility(S.id)},[vue.createElementVNode("img",{src:S.image,class:"vs-map-slot-layers__image"},null,8,_hoisted_3$7),vue.createElementVNode("div",{class:vue.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[u===0?"left-[-10px]":"left-[50%] translate-x-[-50%]"]])},vue.toDisplayString(S==null?void 0:S.name),3)],10,_hoisted_2$9))),128))])}const MapSlotLayers=_export_sfc(_sfc_main$a,[["render",_sfc_render$9],["__scopeId","data-v-8959e540"]]),_sfc_main$9={props:["colors","strokes","title"],methods:{capitalizeFirstLetter(c){return c?c.charAt(0).toUpperCase()+c.slice(1):""}}},_hoisted_1$8={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border"},_hoisted_2$8={key:0,class:"mb-[10px] text-[1rem]"},_hoisted_3$6={key:1},_hoisted_4$6={class:"legend-item flex items-center gap-2 mb-[10px]"},_hoisted_5$5={class:"ml-1 text-[0.875rem]"},_hoisted_6$5={class:"legend-item"},_hoisted_7$1={key:0,class:"flex justify-start items-center gap-2"},_hoisted_8$1={class:"ml-1 text-[0.875rem]"};function _sfc_render$8(c,g,x,v,T,B){var S;return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$8,[x.title?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$8,vue.toDisplayString(x.title),1)):vue.createCommentVNode("",!0),(S=x.strokes)!=null&&S.length?(vue.openBlock(),vue.createElementBlock("div",_hoisted_3$6,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(x.strokes,u=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_4$6,[vue.createElementVNode("div",{class:"w-[15px] h-[4px]",style:vue.normalizeStyle({background:`repeating-linear-gradient(to right, ${u.color}, ${u.color} 5px, transparent 5px, transparent 8px)`})},null,4),vue.createElementVNode("div",_hoisted_5$5,vue.toDisplayString(B.capitalizeFirstLetter(u.text)),1)]))),256))])):vue.createCommentVNode("",!0),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(x.colors,u=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_6$5,[u.id>0?(vue.openBlock(),vue.createElementBlock("div",_hoisted_7$1,[vue.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:vue.normalizeStyle({backgroundColor:u.color})},null,4),vue.createElementVNode("div",_hoisted_8$1,vue.toDisplayString(B.capitalizeFirstLetter(u.text)),1)])):vue.createCommentVNode("",!0)]))),256))])}const MapLegend=_export_sfc(_sfc_main$9,[["render",_sfc_render$8]]);function coordEach(c,g,x){if(c!==null)for(var v,T,B,S,u,J,te,ae=0,H=0,Y,oi=c.type,li=oi==="FeatureCollection",bt=oi==="Feature",mi=li?c.features.length:1,Ii=0;Ii<mi;Ii++){te=li?c.features[Ii].geometry:bt?c.geometry:c,Y=te?te.type==="GeometryCollection":!1,u=Y?te.geometries.length:1;for(var pi=0;pi<u;pi++){var si=0,ci=0;if(S=Y?te.geometries[pi]:te,S!==null){J=S.coordinates;var ri=S.type;switch(ae=0,ri){case null:break;case"Point":if(g(J,H,Ii,si,ci)===!1)return!1;H++,si++;break;case"LineString":case"MultiPoint":for(v=0;v<J.length;v++){if(g(J[v],H,Ii,si,ci)===!1)return!1;H++,ri==="MultiPoint"&&si++}ri==="LineString"&&si++;break;case"Polygon":case"MultiLineString":for(v=0;v<J.length;v++){for(T=0;T<J[v].length-ae;T++){if(g(J[v][T],H,Ii,si,ci)===!1)return!1;H++}ri==="MultiLineString"&&si++,ri==="Polygon"&&ci++}ri==="Polygon"&&si++;break;case"MultiPolygon":for(v=0;v<J.length;v++){for(ci=0,T=0;T<J[v].length;T++){for(B=0;B<J[v][T].length-ae;B++){if(g(J[v][T][B],H,Ii,si,ci)===!1)return!1;H++}ci++}si++}break;case"GeometryCollection":for(v=0;v<S.geometries.length;v++)if(coordEach(S.geometries[v],g)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function bbox(c,g={}){if(c.bbox!=null&&g.recompute!==!0)return c.bbox;const x=[1/0,1/0,-1/0,-1/0];return coordEach(c,v=>{x[0]>v[0]&&(x[0]=v[0]),x[1]>v[1]&&(x[1]=v[1]),x[2]<v[0]&&(x[2]=v[0]),x[3]<v[1]&&(x[3]=v[1])}),x}function feature$1(c,g,x={}){const v={type:"Feature"};return(x.id===0||x.id)&&(v.id=x.id),x.bbox&&(v.bbox=x.bbox),v.properties=g||{},v.geometry=c,v}function point(c,g,x={}){if(!c)throw new Error("coordinates is required");if(!Array.isArray(c))throw new Error("coordinates must be an Array");if(c.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!isNumber(c[0])||!isNumber(c[1]))throw new Error("coordinates must contain numbers");return feature$1({type:"Point",coordinates:c},g,x)}function isNumber(c){return!isNaN(c)&&c!==null&&!Array.isArray(c)}function center(c,g={}){const x=bbox(c),v=(x[0]+x[2])/2,T=(x[1]+x[3])/2;return point([v,T],g.properties,g)}function feature(c,g,x={}){const v={type:"Feature"};return(x.id===0||x.id)&&(v.id=x.id),x.bbox&&(v.bbox=x.bbox),v.properties={},v.geometry=c,v}function polygon(c,g,x={}){for(const T of c){if(T.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(T[T.length-1].length!==T[0].length)throw new Error("First and last Position are not equivalent.");for(let B=0;B<T[T.length-1].length;B++)if(T[T.length-1][B]!==T[0][B])throw new Error("First and last Position are not equivalent.")}return feature({type:"Polygon",coordinates:c},g,x)}function multiPoint(c,g,x={}){return feature({type:"MultiPoint",coordinates:c},g,x)}function multiPolygon(c,g,x={}){return feature({type:"MultiPolygon",coordinates:c},g,x)}const _sfc_main$8={components:{MapSlotLayers,MapLegend},props:{isMapCompare:{type:Boolean,default:!0},polygonOpacity:{type:Number,default:()=>null},polygonStrokeWidth:{type:Number,default:()=>4},dashedLine:{type:Boolean,default:()=>!1},colorAttr:null,strokeAttr:null,zoom:{type:Array,default:()=>8},defaultColor:{type:String,default:"blue"},selectedBaseLayer:{type:String,required:!0},legendname:{type:String,default:()=>""},height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:13},minZoom:{type:[String,Number],default:1},basemap:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0}},mixins:[layerMixin],inject:["prefix"],data(){return{map:null,hoverObject:null,hoverData:null,popup:null,colors:[],strokes:null}},async mounted(){var c,g,x,v;try{if(await this.createMap(),(c=this.row)!=null&&c.geom){const{type:T,coordinates:B}=this.row.geom;let S;switch(T){case"Polygon":S=polygon(B);break;case"MultiPolygon":S=multiPolygon(B);break;case"MultiPoint":S=multiPoint(B);break;default:(g=this.map)==null||g.fitBounds([B,B],{maxZoom:this.zoom,padding:30,duration:0}),this.isSelectObj=!0;return}const u=center(S).geometry.coordinates;(x=this.map)==null||x.fitBounds([u,u],{maxZoom:this.zoom,padding:30,duration:0})}(v=this.map)==null||v.fitBounds(this.center,{duration:0})}catch{}},watch:{filtersParam(c){this.setFilter(this.table,c)},selectedBaseLayer(c){this.$emit("update:selectedBaseLayer",c)},row:{handler(c){c!=null&&c.geom&&this.fitToBounds(c.geom),this.map&&this.map.getStyle()&&this.map.getStyle().layers.filter(v=>v.source===this.table&&v.type==="line").forEach(v=>{var T;this.map.setPaintProperty(v.id,"line-width",((T=this.row)==null?void 0:T.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5)})},immediate:!0}},computed:{basemapIds(){return this.basemap.map(c=>c==null?void 0:c.id)}},methods:{async getColorStyle(){var c=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:g}}=await axios.get(`${this.prefix}/data/${this.table}/${this.colorAttr}`),x=g.reduce((v,T,B)=>T!=null&&T.id?[...v,T.id.toString(),T.color||c[0][B%5]]:v,["match",["get",this.colorAttr]]);return this.colors=[...g],x.push("gray"),x}catch(g){console.log(g)}},async getStrokeStyle(){if(!this.strokeAttr)return"transparent";try{const{data:{rows:c}}=await axios.get(`${this.prefix}/data/${this.table}/${this.strokeAttr}`),g=c.reduce((x,v,T)=>v!=null&&v.id?[...x,{id:v.id.toString(),color:v.color||"#000000",dash:v.dash||[2,2],text:v.text||v.id.toString()}]:x,[]);return this.strokes=[...g],["match",["get",this.strokeAttr],...g.flatMap(({id:x,color:v})=>[x,v]),"transparent"]}catch(c){return console.log(c),"transparent"}},async handleMapLoad(){var v,T,B,S,u;(v=this.row)!=null&&v.geom&&this.fitToBounds(this.row.geom),this.$emit("map",this.map),this.map.on("mousemove",this.handleMapHover);const c=await this.getStrokeStyle(),g=await this.getColorStyle(),x=((B=(T=location.search.split("&").find(J=>J.includes("filter=")))==null?void 0:T.split("filter="))==null?void 0:B[1])||"";await this.addLayer({id:this.table,service:"vector",url:`${this.prefix}/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":g,"fill-opacity":this.polygonOpacity??.5,"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":this.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":g}},{type:"line",paint:{"line-color":g,"line-width":((S=this.row)==null?void 0:S.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5}},...this.dashedLine?[{type:"line",paint:{"line-color":c,"line-width":((u=this.row)==null?void 0:u.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5,"line-dasharray":[2,2]}}]:[]]}),x&&this.setFilter(this.table,x)},async createMap(){const c={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new maplibregl.Map({container:"maplibre-map",style:c,zoom:this.zoom,center:this.center,minZoom:this.minZoom}),this.$parent.map=this.map,this.map.addControl(new maplibregl.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)},fitToBounds(c){if(!this.map)return;const{type:g,coordinates:x}=c;let v,T;switch(g){case"Polygon":v=polygon(x),T=bbox(v),this.map.fitBounds(T,{padding:30,maxZoom:15,duration:0});break;case"MultiPolygon":v=multiPolygon(x),T=bbox(v),this.map.fitBounds(T,{padding:30,maxZoom:15,duration:0});break;case"MultiPoint":v=multiPoint(x),T=bbox(v),this.map.fitBounds(T,{padding:30,maxZoom:15,duration:0});break;case"Point":this.map.flyTo({center:x,zoom:15,duration:0,essential:!0});break;default:console.warn("Невідомий тип геометрії:",g)}},async handleMapHover(c){var S,u,J;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new maplibregl.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const g=this.map.queryRenderedFeatures(c.point);if(this.map.getCanvas().style.cursor="pointer",!(g!=null&&g.length)||((S=g==null?void 0:g[0])==null?void 0:S.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const x=["route-line"];if(!g.filter(te=>!x.some(ae=>{var H;return(H=te.layer)==null?void 0:H.source.includes(ae)})).length)return;const T=g[0].geometry.coordinates.slice();g[0].source==="highlighted-polygon"&&g[1]?this.hoverData=(u=g[1])==null?void 0:u.properties:this.hoverData=(J=g[0])==null?void 0:J.properties;const B={source:g[0].source,sourceLayer:g[0].sourceLayer,id:g[0].id};if(B.source!=="region-search-id"){for(this.map.setFeatureState(B,{hover:!0}),this.hoverObject=B;Math.abs(c.lngLat.lng-T[0])>180;)T[0]+=c.lngLat.lng>T[0]?360:-360;this.popup.setLngLat(c.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}}}},_hoisted_1$7={class:"vs-map-portal relative z-1 mt-2",id:"mapwrapper"},_hoisted_2$7={ref:"popup",style:{display:"none"}};function _sfc_render$7(c,g,x,v,T,B){const S=vue.resolveComponent("MapLegend"),u=vue.resolveComponent("MapSlotLayers");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$7,[vue.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full compare_main_map",style:vue.normalizeStyle({height:x.height})},null,4),vue.withDirectives(vue.createVNode(S,{colors:T.colors,strokes:T.strokes,title:x.legendname},null,8,["colors","strokes","title"]),[[vue.vShow,x.legend]]),vue.createVNode(u,{map:T.map,baseLayers:x.basemap,selectedLayer:x.selectedBaseLayer,"onUpdate:selectedLayer":g[0]||(g[0]=J=>c.$emit("update:selectedBaseLayer",J))},null,8,["map","baseLayers","selectedLayer"]),vue.createElementVNode("div",_hoisted_2$7,[vue.renderSlot(c.$slots,"default",{hoverData:T.hoverData})],512)])}const MapPortal=_export_sfc(_sfc_main$8,[["render",_sfc_render$7]]),_sfc_main$7={},_hoisted_1$6={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},_hoisted_2$6=vue.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9),_hoisted_11$1=[_hoisted_2$6];function _sfc_render$6(c,g){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$6,_hoisted_11$1)}const FilterIcon=_export_sfc(_sfc_main$7,[["render",_sfc_render$6]]),_sfc_main$6={},_hoisted_1$5={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"},_hoisted_2$5=vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),_hoisted_3$5=vue.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),_hoisted_4$5=vue.createElementVNode("path",{d:"M15 4v16"},null,-1),_hoisted_5$4=vue.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1),_hoisted_6$4=[_hoisted_2$5,_hoisted_3$5,_hoisted_4$5,_hoisted_5$4];function _sfc_render$5(c,g){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$5,_hoisted_6$4)}const VisibleMapIcon=_export_sfc(_sfc_main$6,[["render",_sfc_render$5]]),_sfc_main$5={},_hoisted_1$4={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"},_hoisted_2$4=vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),_hoisted_3$4=vue.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),_hoisted_4$4=vue.createElementVNode("path",{d:"M15 4v16"},null,-1),_hoisted_5$3=vue.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1),_hoisted_6$3=[_hoisted_2$4,_hoisted_3$4,_hoisted_4$4,_hoisted_5$3];function _sfc_render$4(c,g){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$4,_hoisted_6$3)}const HiddenMapIcon=_export_sfc(_sfc_main$5,[["render",_sfc_render$4]]),_sfc_main$4={},_hoisted_1$3={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},_hoisted_2$3=vue.createElementVNode("path",{d:"M18 6 6 18"},null,-1),_hoisted_3$3=vue.createElementVNode("path",{d:"m6 6 12 12"},null,-1),_hoisted_4$3=[_hoisted_2$3,_hoisted_3$3];function _sfc_render$3(c,g){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$3,_hoisted_4$3)}const CloseIcon=_export_sfc(_sfc_main$4,[["render",_sfc_render$3]]),_sfc_main$3={__name:"vs-partsmap-search",props:{modelValue:null,maskForSearch:null,searchShow:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(c,{emit:g}){const x=g;return(v,T)=>{const B=vue.resolveComponent("VsTextMask"),S=vue.resolveComponent("vs-text");return c.maskForSearch?(vue.openBlock(),vue.createBlock(B,{key:0,"model-value":c.modelValue,"onUpdate:modelValue":T[0]||(T[0]=u=>x("update:modelValue",u)),class:"w-full table-interface-search",placeholder:"Пошук",mask:c.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"}},null,8,["model-value","mask"])):c.searchShow?(vue.openBlock(),vue.createBlock(S,{key:1,"model-value":c.modelValue,"onUpdate:modelValue":T[1]||(T[1]=u=>x("update:modelValue",u)),class:"[&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:w-[220px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"}},null,8,["model-value"])):vue.createCommentVNode("",!0)}}},_sfc_main$2={},_hoisted_1$2={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map"},_hoisted_2$2=vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),_hoisted_3$2=vue.createElementVNode("path",{d:"M3 7l6 -3l6 3l6 -3v13l-6 3l-6 -3l-6 3v-13"},null,-1),_hoisted_4$2=vue.createElementVNode("path",{d:"M9 4v13"},null,-1),_hoisted_5$2=vue.createElementVNode("path",{d:"M15 7v13"},null,-1),_hoisted_6$2=[_hoisted_2$2,_hoisted_3$2,_hoisted_4$2,_hoisted_5$2];function _sfc_render$2(c,g){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$2,_hoisted_6$2)}const IconMap=_export_sfc(_sfc_main$2,[["render",_sfc_render$2]]),_sfc_main$1={},_hoisted_1$1={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},_hoisted_2$1=vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),_hoisted_3$1=vue.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},null,-1),_hoisted_4$1=vue.createElementVNode("path",{d:"M3 10h18"},null,-1),_hoisted_5$1=vue.createElementVNode("path",{d:"M10 3v18"},null,-1),_hoisted_6$1=[_hoisted_2$1,_hoisted_3$1,_hoisted_4$1,_hoisted_5$1];function _sfc_render$1(c,g){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$1,_hoisted_6$1)}const IconTable=_export_sfc(_sfc_main$1,[["render",_sfc_render$1]]);function formatFilter(c){return Object.entries(c).filter(([,x])=>x!=null).map(([x,v])=>`${x}=${v}`).join("|")}const _sfc_main=vue.defineComponent({props:{prefix:{type:String,default:"/api"},applyVueRouter:{type:Boolean,default:!0},dashedLine:{type:Boolean,default:!1},title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},strokeAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},zoom:{type:[Number,String],default:()=>"13"},minZoom:{type:[Number,String],default:()=>"1"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"},polygonOpacity:{type:Number,default:()=>null},history:{type:Boolean,default:!0}},mixins:[layerMixin],components:{Filter:Pl,MapPortal,NoData,FilterIcon,VisibleMapIcon,HiddenMapIcon,CloseIcon,VsPartsmapSearch:_sfc_main$3,IconTable,IconMap},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",map:null,selectedBaseLayer:"",marker:null,selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,isFilterVisible:!1,tableData:null,map:null,legendName:null,total:null,filtered:null,activeFiltersCount:"",regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},isCompareOpen:!1,windowWidth:0,handleDebouncedUpdateValue:debounce(c=>{this.handleSearchValue(c)},300)}},provide(){return{prefix:this.prefix}},watch:{map(){this.map.on("click",this.handleMapClick),this.$emit("update:map",this.map)},activeFiltersCount(){var c,g;return(g=(c=this.$refs)==null?void 0:c.filter)==null?void 0:g.filteredActiveFiltersLength},activeFilters(){var c,g;return(g=(c=this.$refs)==null?void 0:c.filter)==null?void 0:g.activeFilters}},created(){this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.windowWidth=window.innerWidth,parseInt(this.windowWidth)<1e3&&(this.isMapVisible=!1),this.rows||this.getData();const g=new URLSearchParams(window.location.search).get("filter"),x=g==null?void 0:g.split("|");x==null||x.forEach(T=>{const[B,S]=T.split("=");S!=null&&S.includes(",")?this.mountedFilter[B]=S==null?void 0:S.split(","):this.mountedFilter[B]=[S],this.activeFilters=this.mountedFilter});const v=new URLSearchParams(window.location.search);this.currentPage=v.get("page")||1,this.getFilter(),addEventListener("resize",this.changeWidth)},updated(){this.checkFilterLength()},methods:{async getData(){try{const c={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};c.filter=this.filtersParam;const{data:g}=await axios.get(`${this.prefix}/data/${this.table}`,{params:c});this.tableData=g==null?void 0:g.rows,this.total=g.filtered,this.filtered=g.filtered}catch(c){console.error(c.message)}},moveToDefaultPage(){var g;new URLSearchParams(window.location.search).delete("id"),(g=this.map)==null||g.fitBounds(this.maxBounds,{duration:0}),this.history&&window.history.pushState({},"",newUrl),this.isSelectObj=!1},regionFullName(c){return c.region?`${c.text} / ${c.region}`:c.text},getLabelById(c){var x;const g=(x=this.filters||[])==null?void 0:x.find(v=>v.id===c);return g?g.label:c},getOptionsLabelById(id,option){var c;const filter=(c=this.filters||[])==null?void 0:c.find(g=>g.id===id);if(filter!=null&&filter.formatter){const func=eval(filter==null?void 0:filter.formatter);return func(option)}return Array.isArray(option)?filter!=null&&filter.options?filter==null?void 0:filter.options.filter(g=>option.includes(String(g.id))).map(g=>g.text).join(", "):option==null?void 0:option.length:option},async clearFilter(c){var g,x,v;await((x=(g=this.$refs)==null?void 0:g.filter)==null?void 0:x.clear()),this.filterUrl=(v=this.$refs)==null?void 0:v.filter.filterUrl,(c==="region_katottg"||c==="katottg")&&this.$emit("update:filterState",{}),await this.updateTableAndMap(),await this.getData()},handlePageChange(c){this.currentPage=c;const g=new URL(window.location.href),x=new URLSearchParams(window.location.search);x.set("page",c),g.search=decodeURI(x.toString()),window.history.pushState({},"",g),this.getData()},async getFilter(){var g;if(this.filters.length)return;this.filters=[];const{data:c}=await axios.get(`/api/filter/${this.table}`);this.filters.push(...(g=c==null?void 0:c.list)==null?void 0:g.map(x=>{const v={...x,label:(x==null?void 0:x.label)||(x==null?void 0:x.ua),id:(x==null?void 0:x.id)||(x==null?void 0:x.name)};return v.type==="Autocomplete"&&(v.api=`/api/suggest/${v.data}`),v.id==="katottg"&&(v.multi=!1),v}))},async handleSearchValue(c){this.search=c,await this.getData()},closeObjCard(){var v;const c=new URLSearchParams(window.location.search);c.delete("id"),this.deletePulsePoint();const x=`${window.location.pathname}?${c.toString()}`;(this.currentBbox||this.center)&&((v=this.map)==null||v.fitBounds(this.currentBbox||[this.center,this.center],{maxZoom:this.zoom,duration:0})),window.history.pushState({},"",x),this.isSelectObj=!1,this.selectedRow=null,this.getData()},handleFilterChange(c){const g=formatFilter(c.data);this.$emit("update:filterState",g),this.filterUrl=g.split("|").filter(x=>!x.includes("page=")).join("|"),this.updateTableAndMap(),this.$emit("change:filter",c)},async updateTableAndMap(){var c,g;this.selectedRow||(console.log(this.filtersParam),this.filtersParam=this.filterUrl,this.activeFilters=(g=(c=this.$refs)==null?void 0:c.filter)==null?void 0:g.activeFilters,this.isFilterVisible=!1,this.getData())},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(c=!0){const g=new URLSearchParams(window.location.search);g.has("id")?(this.isSelectObj=!0,this.isMapVisible=parseInt(this.windowWidth)<1e3?!1:c,this.selectedId=g.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(c){this.limit=c,this.currentPage=1,this.getData()},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1)},checkFilterLength(){var g,x;const c=(x=(g=this.$refs)==null?void 0:g.filter)==null?void 0:x.filteredActiveFiltersLength;c!==this.previousLength&&(this.previousLength=c,this.activeFiltersCount=c)},async handleMapClick(c){var B,S,u,J,te,ae,H,Y,oi,li;const g=this.map.queryRenderedFeatures(c.point);if((g==null?void 0:g.length)<1||((B=g[0])==null?void 0:B.source)==="region-search-id"||((S=g[0])==null?void 0:S.source)==="route-line")return;const x=window.location.pathname,v=new URLSearchParams(window.location.search);v.set("id",`${(u=g[0])==null?void 0:u.properties.id}`),this.getObjectData((te=(J=g[0])==null?void 0:J.properties)==null?void 0:te.id);const T=`${x}?${v.toString()}`;this.history&&window.history.pushState({},"",T),this.isSelectObj=!0,c.lngLat&&((li=this.map)==null||li.fitBounds([[(ae=c.lngLat)==null?void 0:ae.lng,(H=c.lngLat)==null?void 0:H.lat],[(Y=c.lngLat)==null?void 0:Y.lng,(oi=c.lngLat)==null?void 0:oi.lat]],{padding:30,duration:0})),this.checkUrl()},async getObjectData(c){var g,x;try{const{data:v}=await axios.get(`${this.prefix}/data/${this.table}/${c}`);this.selectRow((g=v==null?void 0:v.rows)==null?void 0:g[0]),((x=v==null?void 0:v.rows)==null?void 0:x.lenght)<1&&this.deletePulsePoint()}catch(v){console.error(v.message)}},async selectRow(c,g=!0){var u;this.isMapVisible=parseInt(this.windowWidth)<1e3?!1:g;const v=await(await fetch(`${this.prefix}/data/${this.table}/${c.id}`)).json();this.selectedRow=((u=v==null?void 0:v.rows)==null?void 0:u[0])||c;const T=window.location.pathname,B=new URLSearchParams(window.location.search);B.set("id",`${c.id}`);const S=`${T}?${B.toString()}`;this.history&&window.history.pushState({},"",S),this.checkUrl(g),this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(c){this.deletePulsePoint();const g=document.createElement("div");g.className="gps-marker",g.style.width="10px",g.style.height="10px",g.style.position="relative";const x=document.createElement("div");x.className="gps-wave",g.appendChild(x),this.marker=new maplibregl.Marker({element:g,anchor:"center"}).setLngLat(c).addTo(this.map)}}}),_hoisted_1={class:"pt-[20px]"},_hoisted_2=vue.createElementVNode("div",null,null,-1),_hoisted_3={key:0,class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},_hoisted_4={class:"flex items-center gap-2 max-h-[38px] pt-[4px]"},_hoisted_5={class:"flex items-center"},_hoisted_6=["title"],_hoisted_7=vue.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),_hoisted_8={class:"max-[1000px]:flex gap-2 min-[1001px]:hidden"},_hoisted_9={class:"flex"},_hoisted_10={key:0,class:"py-[15px] pb-[24px] pl-2"},_hoisted_11={class:"font-bold text-2xl mr-[10px]"},_hoisted_12={class:"text-sm text-stone-500 font-medium"},_hoisted_13=vue.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),_hoisted_14={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},_hoisted_15={key:0,class:"flex gap-x-2 flex-wrap"},_hoisted_16={class:"font-medium"},_hoisted_17=vue.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),_hoisted_18={class:"text-gray-500"},_hoisted_19=["onClick"],_hoisted_20={key:0,class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full"},_hoisted_21=vue.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),_hoisted_22={key:2,class:"text-center py-28"},_hoisted_23=vue.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),_hoisted_24=vue.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),_hoisted_25={key:1},_hoisted_26={key:2,class:"my-5 pr-2"},_hoisted_27={class:"flex justify-between"},_hoisted_28={class:"w-full lg:w-1/2 relative"},_hoisted_29={class:"map-section relative"};function _sfc_render(c,g,x,v,T,B){var bt,mi,Ii;const S=vue.resolveComponent("VsPartsmapSearch"),u=vue.resolveComponent("VisibleMapIcon"),J=vue.resolveComponent("HiddenMapIcon"),te=vue.resolveComponent("IconTable"),ae=vue.resolveComponent("IconMap"),H=vue.resolveComponent("CloseIcon"),Y=vue.resolveComponent("NoData"),oi=vue.resolveComponent("VsPagination"),li=vue.resolveComponent("MapPortal");return vue.openBlock(),vue.createElementBlock("section",_hoisted_1,[vue.renderSlot(c.$slots,"header",{title:c.title,total:c.total,selectedRow:c.selectedRow}),_hoisted_2,vue.createElementVNode("div",null,[vue.renderSlot(c.$slots,"filters",{selectedRow:c.selectedRow}),(bt=c.$slots)!=null&&bt.filters?vue.createCommentVNode("",!0):(vue.openBlock(),vue.createElementBlock("div",_hoisted_3,[vue.createElementVNode("div",_hoisted_4,[vue.createVNode(S,{"model-value":c.search,"onUpdate:modelValue":c.handleDebouncedUpdateValue,maskForSearch:c.maskForSearch,searchShow:c.searchShow},null,8,["model-value","onUpdate:modelValue","maskForSearch","searchShow"])]),vue.createElementVNode("div",_hoisted_5,[vue.renderSlot(c.$slots,"buttons"),vue.createElementVNode("button",{type:"button",class:"map-visible-button py-2 px-2 hidden min-[1001px]:inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",title:c.isMapVisible?"Приховати карту":"Показати карту",onClick:g[0]||(g[0]=(...pi)=>c.toggleMapVisible&&c.toggleMapVisible(...pi))},[c.isMapVisible?(vue.openBlock(),vue.createBlock(u,{key:0})):(vue.openBlock(),vue.createBlock(J,{key:1})),_hoisted_7],8,_hoisted_6),vue.createElementVNode("div",_hoisted_8,[vue.createElementVNode("button",{onClick:g[1]||(g[1]=pi=>c.isMapVisible=!1),class:"py-2 px-2 h-[38px] inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"},[vue.createVNode(te)]),vue.createElementVNode("button",{onClick:g[2]||(g[2]=pi=>c.isMapVisible=!0),class:"py-2 px-2 h-[38px] inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"},[vue.createVNode(ae)])])])])),vue.createElementVNode("div",_hoisted_9,[vue.withDirectives(vue.createElementVNode("div",{class:vue.normalizeClass(["relative overflow-hidden shrink-0",c.isMapVisible?"w-2/4 mr-0":"w-full mr-3",c.isSelectObj?"hidden":""])},[(mi=c.$slots)!=null&&mi.header?vue.createCommentVNode("",!0):(vue.openBlock(),vue.createElementBlock("h1",_hoisted_10,[vue.createElementVNode("span",_hoisted_11,vue.toDisplayString(c.title),1),vue.createElementVNode("span",_hoisted_12,vue.toDisplayString(c.total),1),_hoisted_13])),vue.createElementVNode("div",_hoisted_14,[c.activeFilters?(vue.openBlock(),vue.createElementBlock("div",_hoisted_15,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(c.activeFilters,(pi,si,ci)=>(vue.openBlock(),vue.createElementBlock("span",{class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full",key:ci},[vue.createElementVNode("span",_hoisted_16,vue.toDisplayString(c.getLabelById(si)),1),_hoisted_17,vue.createElementVNode("span",_hoisted_18,vue.toDisplayString(c.getOptionsLabelById(si,pi)),1),vue.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:ri=>c.clearFilter(si)},[vue.createVNode(H)],8,_hoisted_19)]))),128)),((Ii=Object.keys(c.activeFilters))==null?void 0:Ii.length)>=2?(vue.openBlock(),vue.createElementBlock("span",_hoisted_20,[_hoisted_21,vue.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:g[3]||(g[3]=pi=>c.mountedFilter={})},[vue.createVNode(H)])])):vue.createCommentVNode("",!0)])):vue.createCommentVNode("",!0),c.total>=1?vue.renderSlot(c.$slots,"table",{key:1,rows:c.tableData,map:c.map,marker:c.marker,selectRow:c.selectRow,getData:c.getData,isMapVisible:c.isMapVisible}):(vue.openBlock(),vue.createElementBlock("div",_hoisted_22,[vue.createVNode(Y),_hoisted_23,_hoisted_24,vue.createElementVNode("button",{type:"button",class:"mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",onClick:g[4]||(g[4]=(...pi)=>c.resetFilters&&c.resetFilters(...pi))}," Очистити дані пошуку ")]))]),c.total>=1?(vue.openBlock(),vue.createElementBlock("hr",_hoisted_25)):vue.createCommentVNode("",!0),c.total>=1?(vue.openBlock(),vue.createElementBlock("div",_hoisted_26,[vue.createElementVNode("div",_hoisted_27,[vue.createVNode(oi,{total:c.total,maxPages:7,defaultPage:c.currentPage,pageSize:c.limit,goTo:!1,size:"medium",onPageChange:c.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:c.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):vue.createCommentVNode("",!0)],2),[[vue.vShow,parseInt(c.windowWidth)>=1e3?!0:!c.isMapVisible]]),c.isSelectObj?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(c.isMapVisible?"w-full fixed lg:static lg:w-1/2 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[vue.renderSlot(c.$slots,"details",{table:c.table,selectedId:c.selectedId,selectedRow:c.selectedRow,map:c.map,closeObjCard:c.closeObjCard,isMapVisible:c.isMapVisible})],2)):vue.createCommentVNode("",!0),vue.withDirectives(vue.createElementVNode("div",_hoisted_28,[vue.createElementVNode("section",_hoisted_29,[vue.renderSlot(c.$slots,"default",{map:c.map,removeSelectedBaseLayer:()=>c.selectedBaseLayer="",selectedBaseLayer:c.selectedBaseLayer,selectedRow:c.selectedRow}),vue.createVNode(li,{height:"calc(100vh - 152px)",width:"w-2/4",table:c.table,filtersParam:c.filtersParam,row:c.selectedRow,legendname:c.legendname,legend:c.legend,colorAttr:c.colorAttr,strokeAttr:c.strokeAttr,polygonOpacity:c.polygonOpacity,maxBounds:c.maxBounds,center:c.center,zoom:c.zoom,dashedLine:c.dashedLine,minZoom:c.minZoom,basemap:c.basemap,pointZoom:c.pointZoom,defaultColor:c.defaultColor,onMap:g[5]||(g[5]=pi=>c.map=pi),selectedBaseLayer:c.selectedBaseLayer,"onUpdate:selectedBaseLayer":g[6]||(g[6]=pi=>c.selectedBaseLayer=pi),onIsCompareOpen:g[7]||(g[7]=pi=>c.isCompareOpen=pi)},{default:vue.withCtx(({hoverData:pi})=>[vue.renderSlot(c.$slots,"popup",{data:pi})]),_:3},8,["table","filtersParam","row","legendname","legend","colorAttr","strokeAttr","polygonOpacity","maxBounds","center","zoom","dashedLine","minZoom","basemap","pointZoom","defaultColor","selectedBaseLayer"])])],512),[[vue.vShow,c.isMapVisible]])])])])}const VsPartsMap=_export_sfc(_sfc_main,[["render",_sfc_render]]),install=c=>{c.component("VsPartsMap",VsPartsMap)},PartsMap={install,components:{VsPartsMap}};return typeof window<"u"&&(window.PartsMap=PartsMap),PartsMap});
|