1?p-1:0),v=1;v=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var s=gl("Patches").$;return qh(n)?s(n,r):this.produce(n,function(a){return s(a,r)})},e}(),za=new UX,jX=za.produce;za.produceWithPatches.bind(za);za.setAutoFreeze.bind(za);za.setUseProxies.bind(za);za.applyPatches.bind(za);za.createDraft.bind(za);za.finishDraft.bind(za);/**
+ * @remix-run/router v1.3.2
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function Z1(){return Z1=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function KX(){return Math.random().toString(36).substr(2,8)}function vA(e,t){return{usr:e.state,key:e.key,idx:t}}function US(e,t,n,r){return n===void 0&&(n=null),Z1({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?u_(t):t,{state:n,key:t&&t.key||r||KX()})}function cz(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function u_(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function WX(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,a=nc.Pop,u=null,d=p();d==null&&(d=0,s.replaceState(Z1({},s.state,{idx:d}),""));function p(){return(s.state||{idx:null}).idx}function m(){a=nc.Pop;let k=p(),T=k==null?null:k-d;d=k,u&&u({action:a,location:P.location,delta:T})}function v(k,T){a=nc.Push;let M=US(P.location,k,T);n&&n(M,k),d=p()+1;let O=vA(M,d),N=P.createHref(M);try{s.pushState(O,"",N)}catch{i.location.assign(N)}o&&u&&u({action:a,location:P.location,delta:1})}function x(k,T){a=nc.Replace;let M=US(P.location,k,T);n&&n(M,k),d=p();let O=vA(M,d),N=P.createHref(M);s.replaceState(O,"",N),o&&u&&u({action:a,location:P.location,delta:0})}function _(k){let T=i.location.origin!=="null"?i.location.origin:i.location.href,M=typeof k=="string"?k:cz(k);return ma(T,"No window.location.(origin|href) available to create URL for href: "+M),new URL(M,T)}let P={get action(){return a},get location(){return e(i,s)},listen(k){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(gA,m),u=k,()=>{i.removeEventListener(gA,m),u=null}},createHref(k){return t(i,k)},createURL:_,encodeLocation(k){let T=_(k);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:v,replace:x,go(k){return s.go(k)}};return P}var yA;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(yA||(yA={}));function GX(e,t,n){n===void 0&&(n="/");let r=typeof t=="string"?u_(t):t,i=hz(r.pathname||"/",n);if(i==null)return null;let o=dz(e);qX(o);let s=null;for(let a=0;s==null&&a{let u={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};u.relativePath.startsWith("/")&&(ma(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let d=Ah([r,u.relativePath]),p=n.concat(u);o.children&&o.children.length>0&&(ma(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),dz(o.children,t,p,d)),!(o.path==null&&!o.index)&&t.push({path:d,score:tY(d,o.index),routesMeta:p})};return e.forEach((o,s)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))i(o,s);else for(let u of fz(o.path))i(o,s,u)}),t}function fz(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let s=fz(r.join("/")),a=[];return a.push(...s.map(u=>u===""?o:[o,u].join("/"))),i&&a.push(...s),a.map(u=>e.startsWith("/")&&u===""?"/":u)}function qX(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:nY(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const ZX=/^:\w+$/,XX=3,YX=2,QX=1,JX=10,eY=-2,xA=e=>e==="*";function tY(e,t){let n=e.split("/"),r=n.length;return n.some(xA)&&(r+=eY),t&&(r+=YX),n.filter(i=>!xA(i)).reduce((i,o)=>i+(ZX.test(o)?XX:o===""?QX:JX),r)}function nY(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function rY(e,t){let{routesMeta:n}=e,r={},i="/",o=[];for(let s=0;s{if(p==="*"){let v=a[m]||"";s=o.slice(0,o.length-v.length).replace(/(.)\/+$/,"$1")}return d[p]=sY(a[m]||"",p),d},{}),pathname:o,pathnameBase:s,pattern:e}}function oY(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),jP(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(s,a)=>(r.push(a),"/([^\\/]+)"));return e.endsWith("*")?(r.push("*"),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function aY(e){try{return decodeURI(e)}catch(t){return jP(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function sY(e,t){try{return decodeURIComponent(e)}catch(n){return jP(!1,'The value for the URL param "'+t+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+n+").")),e}}function hz(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function jP(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}const Ah=e=>e.join("/").replace(/\/\/+/g,"/"),lY=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/");function uY(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const cY=["post","put","patch","delete"];[...cY];/**
+ * React Router v6.8.1
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function jS(){return jS=Object.assign?Object.assign.bind():function(e){for(var t=1;t{i.value=r,i.getSnapshot=t,sC(i)&&o({inst:i})},[e,r,t]),pY(()=>(sC(i)&&o({inst:i}),e(()=>{sC(i)&&o({inst:i})})),[e]),gY(r),r}function sC(e){const t=e.getSnapshot,n=e.value;try{const r=t();return!fY(n,r)}catch{return!0}}function yY(e,t,n){return t()}const xY=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",bY=!xY,_Y=bY?yY:vY;"useSyncExternalStore"in v1&&(e=>e.useSyncExternalStore)(v1);const pz=w.exports.createContext(null),mz=w.exports.createContext(null),gz=w.exports.createContext(null),c_=w.exports.createContext(null),d_=w.exports.createContext({outlet:null,matches:[]}),vz=w.exports.createContext(null);function HP(){return w.exports.useContext(c_)!=null}function wY(){return HP()||ma(!1),w.exports.useContext(c_).location}function CY(e,t){HP()||ma(!1);let{navigator:n}=w.exports.useContext(gz),r=w.exports.useContext(mz),{matches:i}=w.exports.useContext(d_),o=i[i.length-1],s=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let u=wY(),d;if(t){var p;let P=typeof t=="string"?u_(t):t;a==="/"||((p=P.pathname)==null?void 0:p.startsWith(a))||ma(!1),d=P}else d=u;let m=d.pathname||"/",v=a==="/"?m:m.slice(a.length)||"/",x=GX(e,{pathname:v}),_=IY(x&&x.map(P=>Object.assign({},P,{params:Object.assign({},s,P.params),pathname:Ah([a,n.encodeLocation?n.encodeLocation(P.pathname).pathname:P.pathname]),pathnameBase:P.pathnameBase==="/"?a:Ah([a,n.encodeLocation?n.encodeLocation(P.pathnameBase).pathname:P.pathnameBase])})),i,r||void 0);return t&&_?I(c_.Provider,{value:{location:jS({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:nc.Pop},children:_}):_}function SY(){let e=RY(),t=uY(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return $e(Tn,{children:[I("h2",{children:"Unexpected Application Error!"}),I("h3",{style:{fontStyle:"italic"},children:t}),n?I("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},children:n}):null,null]})}class EY extends w.exports.Component{constructor(t){super(t),this.state={location:t.location,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location?{error:t.error,location:t.location}:{error:t.error||n.error,location:n.location}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error?I(d_.Provider,{value:this.props.routeContext,children:I(vz.Provider,{value:this.state.error,children:this.props.component})}):this.props.children}}function PY(e){let{routeContext:t,match:n,children:r}=e,i=w.exports.useContext(pz);return i&&i.static&&i.staticContext&&n.route.errorElement&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),I(d_.Provider,{value:t,children:r})}function IY(e,t,n){if(t===void 0&&(t=[]),e==null)if(n!=null&&n.errors)e=n.matches;else return null;let r=e,i=n==null?void 0:n.errors;if(i!=null){let o=r.findIndex(s=>s.route.id&&(i==null?void 0:i[s.route.id]));o>=0||ma(!1),r=r.slice(0,Math.min(r.length,o+1))}return r.reduceRight((o,s,a)=>{let u=s.route.id?i==null?void 0:i[s.route.id]:null,d=n?s.route.errorElement||I(SY,{}):null,p=t.concat(r.slice(0,a+1)),m=()=>I(PY,{match:s,routeContext:{outlet:o,matches:p},children:u?d:s.route.element!==void 0?s.route.element:o});return n&&(s.route.errorElement||a===0)?I(EY,{location:n.location,component:d,error:u,children:m(),routeContext:{outlet:null,matches:p}}):m()},null)}var bA;(function(e){e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator"})(bA||(bA={}));var X1;(function(e){e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator"})(X1||(X1={}));function TY(e){let t=w.exports.useContext(mz);return t||ma(!1),t}function kY(e){let t=w.exports.useContext(d_);return t||ma(!1),t}function MY(e){let t=kY(),n=t.matches[t.matches.length-1];return n.route.id||ma(!1),n.route.id}function RY(){var e;let t=w.exports.useContext(vz),n=TY(X1.UseRouteError),r=MY(X1.UseRouteError);return t||((e=n.errors)==null?void 0:e[r])}function yz(e){ma(!1)}function AY(e){let{basename:t="/",children:n=null,location:r,navigationType:i=nc.Pop,navigator:o,static:s=!1}=e;HP()&&ma(!1);let a=t.replace(/^\/*/,"/"),u=w.exports.useMemo(()=>({basename:a,navigator:o,static:s}),[a,o,s]);typeof r=="string"&&(r=u_(r));let{pathname:d="/",search:p="",hash:m="",state:v=null,key:x="default"}=r,_=w.exports.useMemo(()=>{let P=hz(d,a);return P==null?null:{pathname:P,search:p,hash:m,state:v,key:x}},[a,d,p,m,v,x]);return _==null?null:I(gz.Provider,{value:u,children:I(c_.Provider,{children:n,value:{location:_,navigationType:i}})})}function DY(e){let{children:t,location:n}=e,r=w.exports.useContext(pz),i=r&&!t?r.router.routes:HS(t);return CY(i,n)}var _A;(function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"})(_A||(_A={}));new Promise(()=>{});function HS(e,t){t===void 0&&(t=[]);let n=[];return w.exports.Children.forEach(e,(r,i)=>{if(!w.exports.isValidElement(r))return;if(r.type===w.exports.Fragment){n.push.apply(n,HS(r.props.children,t));return}r.type!==yz&&ma(!1),!r.props.index||!r.props.children||ma(!1);let o=[...t,i],s={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,hasErrorBoundary:r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle};r.props.children&&(s.children=HS(r.props.children,o)),n.push(s)}),n}/**
+ * React Router DOM v6.8.1
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function OY(e){let{basename:t,children:n,window:r}=e,i=w.exports.useRef();i.current==null&&(i.current=HX({window:r,v5Compat:!0}));let o=i.current,[s,a]=w.exports.useState({action:o.action,location:o.location});return w.exports.useLayoutEffect(()=>o.listen(a),[o]),I(AY,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:o})}var wA;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"})(wA||(wA={}));var CA;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(CA||(CA={}));const iv=(e,t)=>{const[n,r]=w.exports.useState(()=>{let i;try{i=JSON.parse(localStorage.getItem(e)||String(t))}catch{i=t}return i});return w.exports.useEffect(()=>{localStorage.setItem(e,JSON.stringify(n))},[n,e]),[n,r]};var NY="Expected a function",SA=0/0,LY="[object Symbol]",FY=/^\s+|\s+$/g,zY=/^[-+]0x[0-9a-f]+$/i,$Y=/^0b[01]+$/i,BY=/^0o[0-7]+$/i,VY=parseInt,UY=typeof ru=="object"&&ru&&ru.Object===Object&&ru,jY=typeof self=="object"&&self&&self.Object===Object&&self,HY=UY||jY||Function("return this")(),KY=Object.prototype,WY=KY.toString,GY=Math.max,qY=Math.min,lC=function(){return HY.Date.now()};function ZY(e,t,n){var r,i,o,s,a,u,d=0,p=!1,m=!1,v=!0;if(typeof e!="function")throw new TypeError(NY);t=EA(t)||0,KS(n)&&(p=!!n.leading,m="maxWait"in n,o=m?GY(EA(n.maxWait)||0,t):o,v="trailing"in n?!!n.trailing:v);function x(F){var V=r,B=i;return r=i=void 0,d=F,s=e.apply(B,V),s}function _(F){return d=F,a=setTimeout(T,t),p?x(F):s}function P(F){var V=F-u,B=F-d,H=t-V;return m?qY(H,o-B):H}function k(F){var V=F-u,B=F-d;return u===void 0||V>=t||V<0||m&&B>=o}function T(){var F=lC();if(k(F))return M(F);a=setTimeout(T,P(F))}function M(F){return a=void 0,v&&r?x(F):(r=i=void 0,s)}function O(){a!==void 0&&clearTimeout(a),d=0,r=u=i=a=void 0}function N(){return a===void 0?s:M(lC())}function L(){var F=lC(),V=k(F);if(r=arguments,i=this,u=F,V){if(a===void 0)return _(u);if(m)return a=setTimeout(T,t),x(u)}return a===void 0&&(a=setTimeout(T,t)),s}return L.cancel=O,L.flush=N,L}function KS(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function XY(e){return!!e&&typeof e=="object"}function YY(e){return typeof e=="symbol"||XY(e)&&WY.call(e)==LY}function EA(e){if(typeof e=="number")return e;if(YY(e))return SA;if(KS(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=KS(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(FY,"");var n=$Y.test(e);return n||BY.test(e)?VY(e.slice(2),n?2:8):zY.test(e)?SA:+e}var QY=ZY,xz={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(ru,function(){var n,r,i;function o(a,u){if(!n)n=u;else if(!r)r=u;else{var d="var sharedChunk = {}; ("+n+")(sharedChunk); ("+r+")(sharedChunk);",p={};n(p),i=u(p),typeof window<"u"&&(i.workerUrl=window.URL.createObjectURL(new Blob([d],{type:"text/javascript"})))}}o(["exports"],function(a){var u=d;function d(f,l,h,y){this.cx=3*f,this.bx=3*(h-f)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*l,this.by=3*(y-l)-this.cy,this.ay=1-this.cy-this.by,this.p1x=f,this.p1y=l,this.p2x=h,this.p2y=y}function p(f,l,h,y){const S=new u(f,l,h,y);return function(R){return S.solve(R)}}d.prototype={sampleCurveX:function(f){return((this.ax*f+this.bx)*f+this.cx)*f},sampleCurveY:function(f){return((this.ay*f+this.by)*f+this.cy)*f},sampleCurveDerivativeX:function(f){return(3*this.ax*f+2*this.bx)*f+this.cx},solveCurveX:function(f,l){if(l===void 0&&(l=1e-6),f<0)return 0;if(f>1)return 1;for(var h=f,y=0;y<8;y++){var S=this.sampleCurveX(h)-f;if(Math.abs(S)S?D=h:$=h,h=.5*($-D)+D;return h},solve:function(f,l){return this.sampleCurveY(this.solveCurveX(f,l))}};const m=p(.25,.1,.25,1);function v(f,l,h){return Math.min(h,Math.max(l,f))}function x(f,l,h){const y=h-l,S=((f-l)%y+y)%y+l;return S===l?h:S}function _(f,...l){for(const h of l)for(const y in h)f[y]=h[y];return f}let P=1;function k(f,l){f.forEach(h=>{l[h]&&(l[h]=l[h].bind(l))})}function T(f,l,h){const y={};for(const S in f)y[S]=l.call(h||this,f[S],S,f);return y}function M(f,l,h){const y={};for(const S in f)l.call(h||this,f[S],S,f)&&(y[S]=f[S]);return y}function O(f){return Array.isArray(f)?f.map(O):typeof f=="object"&&f?T(f,O):f}const N={};function L(f){N[f]||(typeof console<"u"&&console.warn(f),N[f]=!0)}function F(f,l,h){return(h.y-f.y)*(l.x-f.x)>(l.y-f.y)*(h.x-f.x)}function V(f){let l=0;for(let h,y,S=0,R=f.length,D=R-1;S@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,y,S,R)=>{const D=S||R;return l[y]=!D||D.toLowerCase(),""}),l["max-age"]){const h=parseInt(l["max-age"],10);isNaN(h)?delete l["max-age"]:l["max-age"]=h}return l}let G,ee,X=null;function Z(f){if(X==null){const l=f.navigator?f.navigator.userAgent:null;X=!!f.safari||!(!l||!(/\b(iPad|iPhone|iPod)\b/.test(l)||l.match("Safari")&&!l.match("Chrome")))}return X}function Q(f){return typeof ImageBitmap<"u"&&f instanceof ImageBitmap}const le={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(f){const l=requestAnimationFrame(f);return{cancel:()=>cancelAnimationFrame(l)}},getImageData(f,l=0){const h=window.document.createElement("canvas"),y=h.getContext("2d");if(!y)throw new Error("failed to create canvas 2d context");return h.width=f.width,h.height=f.height,y.drawImage(f,0,0,f.width,f.height),y.getImageData(-l,-l,f.width+2*l,f.height+2*l)},resolveURL:f=>(G||(G=document.createElement("a")),G.href=f,G.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ee==null&&(ee=matchMedia("(prefers-reduced-motion: reduce)")),ee.matches)}};var ne=se;function se(f,l){this.x=f,this.y=l}se.prototype={clone:function(){return new se(this.x,this.y)},add:function(f){return this.clone()._add(f)},sub:function(f){return this.clone()._sub(f)},multByPoint:function(f){return this.clone()._multByPoint(f)},divByPoint:function(f){return this.clone()._divByPoint(f)},mult:function(f){return this.clone()._mult(f)},div:function(f){return this.clone()._div(f)},rotate:function(f){return this.clone()._rotate(f)},rotateAround:function(f,l){return this.clone()._rotateAround(f,l)},matMult:function(f){return this.clone()._matMult(f)},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(f){return this.x===f.x&&this.y===f.y},dist:function(f){return Math.sqrt(this.distSqr(f))},distSqr:function(f){var l=f.x-this.x,h=f.y-this.y;return l*l+h*h},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(f){return Math.atan2(this.y-f.y,this.x-f.x)},angleWith:function(f){return this.angleWithSep(f.x,f.y)},angleWithSep:function(f,l){return Math.atan2(this.x*l-this.y*f,this.x*f+this.y*l)},_matMult:function(f){var l=f[2]*this.x+f[3]*this.y;return this.x=f[0]*this.x+f[1]*this.y,this.y=l,this},_add:function(f){return this.x+=f.x,this.y+=f.y,this},_sub:function(f){return this.x-=f.x,this.y-=f.y,this},_mult:function(f){return this.x*=f,this.y*=f,this},_div:function(f){return this.x/=f,this.y/=f,this},_multByPoint:function(f){return this.x*=f.x,this.y*=f.y,this},_divByPoint:function(f){return this.x/=f.x,this.y/=f.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var f=this.y;return this.y=this.x,this.x=-f,this},_rotate:function(f){var l=Math.cos(f),h=Math.sin(f),y=h*this.x+l*this.y;return this.x=l*this.x-h*this.y,this.y=y,this},_rotateAround:function(f,l){var h=Math.cos(f),y=Math.sin(f),S=l.y+y*(this.x-l.x)+h*(this.y-l.y);return this.x=l.x+h*(this.x-l.x)-y*(this.y-l.y),this.y=S,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},se.convert=function(f){return f instanceof se?f:Array.isArray(f)?new se(f[0],f[1]):f};const oe={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},he="mapbox-tiles";let _e,be,xe=500,Te=50;function Ee(){typeof caches>"u"||_e||(_e=caches.open(he))}let Ce=1/0;const ke={supported:!1,testSupport:function(f){!Ue&&Ke&&(tt?lt(f):De=f)}};let De,Ke,Ue=!1,tt=!1;function lt(f){const l=f.createTexture();f.bindTexture(f.TEXTURE_2D,l);try{if(f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,Ke),f.isContextLost())return;ke.supported=!0}catch{}f.deleteTexture(l),Ue=!0}typeof document<"u"&&(Ke=document.createElement("img"),Ke.onload=function(){De&<(De),De=null,tt=!0},Ke.onerror=function(){Ue=!0,De=null},Ke.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const St={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(St);class We extends Error{constructor(l,h,y,S){super(`AJAXError: ${h} (${l}): ${y}`),this.status=l,this.statusText=h,this.url=y,this.body=S}}const bt=B()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Qe(f,l){const h=new AbortController,y=new Request(f.url,{method:f.method||"GET",body:f.body,credentials:f.credentials,headers:f.headers,referrer:bt(),signal:h.signal});let S=!1,R=!1;return f.type==="json"&&y.headers.set("Accept","application/json"),((D,$,U)=>{if(R)return;const W=Date.now();fetch(y).then(te=>te.ok?((ae,de,ge)=>{(f.type==="arrayBuffer"?ae.arrayBuffer():f.type==="json"?ae.json():ae.text()).then(ve=>{R||(de&&ge&&function(Fe,Ne,it){if(Ee(),!_e)return;const yt={status:Ne.status,statusText:Ne.statusText,headers:new Headers};Ne.headers.forEach((pt,Ot)=>yt.headers.set(Ot,pt));const Ye=H(Ne.headers.get("Cache-Control")||"");Ye["no-store"]||(Ye["max-age"]&&yt.headers.set("Expires",new Date(it+1e3*Ye["max-age"]).toUTCString()),new Date(yt.headers.get("Expires")).getTime()-it<42e4||function(pt,Ot){if(be===void 0)try{new Response(new ReadableStream),be=!0}catch{be=!1}be?Ot(pt.body):pt.blob().then(Ot)}(Ne,pt=>{const Ot=new Response(pt,yt);Ee(),_e&&_e.then(At=>At.put(function(gn){const _n=gn.indexOf("?");return _n<0?gn:gn.slice(0,_n)}(Fe.url),Ot)).catch(At=>L(At.message))}))}(y,de,ge),S=!0,l(null,ve,ae.headers.get("Cache-Control"),ae.headers.get("Expires")))}).catch(ve=>{R||l(new Error(ve.message))})})(te,null,W):te.blob().then(ae=>l(new We(te.status,te.statusText,f.url,ae)))).catch(te=>{te.code!==20&&l(new Error(te.message))})})(),{cancel:()=>{R=!0,S||h.abort()}}}const mt=function(f,l){if(/:\/\//.test(f.url)&&!/^https?:|^file:/.test(f.url)){if(B()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",f,l);if(!B()){const y=f.url.substring(0,f.url.indexOf("://"));return(oe.REGISTERED_PROTOCOLS[y]||Qe)(f,l)}}if(!(/^file:/.test(h=f.url)||/^file:/.test(bt())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Qe(f,l);if(B()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",f,l,void 0,!0)}var h;return function(y,S){const R=new XMLHttpRequest;R.open(y.method||"GET",y.url,!0),y.type==="arrayBuffer"&&(R.responseType="arraybuffer");for(const D in y.headers)R.setRequestHeader(D,y.headers[D]);return y.type==="json"&&(R.responseType="text",R.setRequestHeader("Accept","application/json")),R.withCredentials=y.credentials==="include",R.onerror=()=>{S(new Error(R.statusText))},R.onload=()=>{if((R.status>=200&&R.status<300||R.status===0)&&R.response!==null){let D=R.response;if(y.type==="json")try{D=JSON.parse(R.response)}catch($){return S($)}S(null,D,R.getResponseHeader("Cache-Control"),R.getResponseHeader("Expires"))}else{const D=new Blob([R.response],{type:R.getResponseHeader("Content-Type")});S(new We(R.status,R.statusText,y.url,D))}},R.send(y.body),{cancel:()=>R.abort()}}(f,l)},ct=function(f,l){return mt(_(f,{type:"arrayBuffer"}),l)};function wt(f){const l=window.document.createElement("a");return l.href=f,l.protocol===window.document.location.protocol&&l.host===window.document.location.host}const rt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let ut,nt;ut=[],nt=0;const qe=function(f,l){if(ke.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),nt>=oe.MAX_PARALLEL_IMAGE_REQUESTS){const R={requestParameters:f,callback:l,cancelled:!1,cancel(){this.cancelled=!0}};return ut.push(R),R}nt++;let h=!1;const y=()=>{if(!h)for(h=!0,nt--;ut.length&&nt{y(),R?l(R):D&&function(W,te){typeof createImageBitmap=="function"?function(ae,de){const ge=new Blob([new Uint8Array(ae)],{type:"image/png"});createImageBitmap(ge).then(ve=>{de(null,ve)}).catch(ve=>{de(new Error(`Could not load image because of ${ve.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(W,te):function(ae,de){const ge=new Image;ge.onload=()=>{de(null,ge),URL.revokeObjectURL(ge.src),ge.onload=null,window.requestAnimationFrame(()=>{ge.src=rt})},ge.onerror=()=>de(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 ve=new Blob([new Uint8Array(ae)],{type:"image/png"});ge.src=ae.byteLength?URL.createObjectURL(ve):rt}(W,te)}(D,(W,te)=>{W!=null?l(W):te!=null&&l(null,te,{cacheControl:$,expires:U})})});return{cancel:()=>{S.cancel(),y()}}};function dt(f,l,h){h[f]&&h[f].indexOf(l)!==-1||(h[f]=h[f]||[],h[f].push(l))}function _t(f,l,h){if(h&&h[f]){const y=h[f].indexOf(l);y!==-1&&h[f].splice(y,1)}}class Dt{constructor(l,h={}){_(this,h),this.type=l}}class Nt extends Dt{constructor(l,h={}){super("error",_({error:l},h))}}class jt{on(l,h){return this._listeners=this._listeners||{},dt(l,h,this._listeners),this}off(l,h){return _t(l,h,this._listeners),_t(l,h,this._oneTimeListeners),this}once(l,h){return this._oneTimeListeners=this._oneTimeListeners||{},dt(l,h,this._oneTimeListeners),this}fire(l,h){typeof l=="string"&&(l=new Dt(l,h||{}));const y=l.type;if(this.listens(y)){l.target=this;const S=this._listeners&&this._listeners[y]?this._listeners[y].slice():[];for(const $ of S)$.call(this,l);const R=this._oneTimeListeners&&this._oneTimeListeners[y]?this._oneTimeListeners[y].slice():[];for(const $ of R)_t(y,$,this._oneTimeListeners),$.call(this,l);const D=this._eventedParent;D&&(_(l,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),D.fire(l))}else l instanceof Nt&&console.error(l.error);return this}listens(l){return this._listeners&&this._listeners[l]&&this._listeners[l].length>0||this._oneTimeListeners&&this._oneTimeListeners[l]&&this._oneTimeListeners[l].length>0||this._eventedParent&&this._eventedParent.listens(l)}setEventedParent(l,h){return this._eventedParent=l,this._eventedParentData=h,this}}var Ve={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class Ze{constructor(l,h,y,S){this.message=(l?`${l}: `:"")+y,S&&(this.identifier=S),h!=null&&h.__line__&&(this.line=h.__line__)}}function Yt(f){const l=f.value;return l?[new Ze(f.key,l,"constants have been deprecated as of v8")]:[]}function sn(f,...l){for(const h of l)for(const y in h)f[y]=h[y];return f}function Gt(f){return f instanceof Number||f instanceof String||f instanceof Boolean?f.valueOf():f}function zt(f){if(Array.isArray(f))return f.map(zt);if(f instanceof Object&&!(f instanceof Number||f instanceof String||f instanceof Boolean)){const l={};for(const h in f)l[h]=zt(f[h]);return l}return Gt(f)}class Rt extends Error{constructor(l,h){super(h),this.message=h,this.key=l}}class Qt{constructor(l,h=[]){this.parent=l,this.bindings={};for(const[y,S]of h)this.bindings[y]=S}concat(l){return new Qt(this,l)}get(l){if(this.bindings[l])return this.bindings[l];if(this.parent)return this.parent.get(l);throw new Error(`${l} not found in scope.`)}has(l){return!!this.bindings[l]||!!this.parent&&this.parent.has(l)}}const pn={kind:"null"},ot={kind:"number"},Lt={kind:"string"},Tt={kind:"boolean"},Kt={kind:"color"},Zt={kind:"object"},ht={kind:"value"},xn={kind:"collator"},bn={kind:"formatted"},tn={kind:"padding"},Bt={kind:"resolvedImage"};function gt(f,l){return{kind:"array",itemType:f,N:l}}function xt(f){if(f.kind==="array"){const l=xt(f.itemType);return typeof f.N=="number"?`array<${l}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${l}>`}return f.kind}const Vt=[pn,ot,Lt,Tt,Kt,bn,Zt,gt(ht),tn,Bt];function qt(f,l){if(l.kind==="error")return null;if(f.kind==="array"){if(l.kind==="array"&&(l.N===0&&l.itemType.kind==="value"||!qt(f.itemType,l.itemType))&&(typeof f.N!="number"||f.N===l.N))return null}else{if(f.kind===l.kind)return null;if(f.kind==="value"){for(const h of Vt)if(!qt(h,l))return null}}return`Expected ${xt(f)} but found ${xt(l)} instead.`}function vn(f,l){return l.some(h=>h.kind===f.kind)}function Fn(f,l){return l.some(h=>h==="null"?f===null:h==="array"?Array.isArray(f):h==="object"?f&&!Array.isArray(f)&&typeof f=="object":h===typeof f)}var tr,nr={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function ye(f){return(f=Math.round(f))<0?0:f>255?255:f}function q(f){return ye(f[f.length-1]==="%"?parseFloat(f)/100*255:parseInt(f))}function J(f){return(l=f[f.length-1]==="%"?parseFloat(f)/100:parseFloat(f))<0?0:l>1?1:l;var l}function pe(f,l,h){return h<0?h+=1:h>1&&(h-=1),6*h<1?f+(l-f)*h*6:2*h<1?l:3*h<2?f+(l-f)*(2/3-h)*6:f}try{tr={}.parseCSSColor=function(f){var l,h=f.replace(/ /g,"").toLowerCase();if(h in nr)return nr[h].slice();if(h[0]==="#")return h.length===4?(l=parseInt(h.substr(1),16))>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null:h.length===7&&(l=parseInt(h.substr(1),16))>=0&&l<=16777215?[(16711680&l)>>16,(65280&l)>>8,255&l,1]:null;var y=h.indexOf("("),S=h.indexOf(")");if(y!==-1&&S+1===h.length){var R=h.substr(0,y),D=h.substr(y+1,S-(y+1)).split(","),$=1;switch(R){case"rgba":if(D.length!==4)return null;$=J(D.pop());case"rgb":return D.length!==3?null:[q(D[0]),q(D[1]),q(D[2]),$];case"hsla":if(D.length!==4)return null;$=J(D.pop());case"hsl":if(D.length!==3)return null;var U=(parseFloat(D[0])%360+360)%360/360,W=J(D[1]),te=J(D[2]),ae=te<=.5?te*(W+1):te+W-te*W,de=2*te-ae;return[ye(255*pe(de,ae,U+1/3)),ye(255*pe(de,ae,U)),ye(255*pe(de,ae,U-1/3)),$];default:return null}}return null}}catch{}class ce{constructor(l,h,y,S=1){this.r=l,this.g=h,this.b=y,this.a=S}static parse(l){if(!l)return;if(l instanceof ce)return l;if(typeof l!="string")return;const h=tr(l);return h?new ce(h[0]/255*h[3],h[1]/255*h[3],h[2]/255*h[3],h[3]):void 0}toString(){const[l,h,y,S]=this.toArray();return`rgba(${Math.round(l)},${Math.round(h)},${Math.round(y)},${S})`}toArray(){const{r:l,g:h,b:y,a:S}=this;return S===0?[0,0,0,0]:[255*l/S,255*h/S,255*y/S,S]}}ce.black=new ce(0,0,0,1),ce.white=new ce(1,1,1,1),ce.transparent=new ce(0,0,0,0),ce.red=new ce(1,0,0,1);class we{constructor(l,h,y){this.sensitivity=l?h?"variant":"case":h?"accent":"base",this.locale=y,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(l,h){return this.collator.compare(l,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Ae{constructor(l,h,y,S,R){this.text=l,this.image=h,this.scale=y,this.fontStack=S,this.textColor=R}}class Pe{constructor(l){this.sections=l}static fromString(l){return new Pe([new Ae(l,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(l=>l.text.length!==0||l.image&&l.image.name.length!==0)}static factory(l){return l instanceof Pe?l:Pe.fromString(l)}toString(){return this.sections.length===0?"":this.sections.map(l=>l.text).join("")}}class Me{constructor(l){this.values=l.slice()}static parse(l){if(l instanceof Me)return l;if(typeof l=="number")return new Me([l,l,l,l]);if(Array.isArray(l)&&!(l.length<1||l.length>4)){for(const h of l)if(typeof h!="number")return;switch(l.length){case 1:l=[l[0],l[0],l[0],l[0]];break;case 2:l=[l[0],l[1],l[0],l[1]];break;case 3:l=[l[0],l[1],l[2],l[1]]}return new Me(l)}}toString(){return JSON.stringify(this.values)}}class Be{constructor(l){this.name=l.name,this.available=l.available}toString(){return this.name}static fromString(l){return l?new Be({name:l,available:!1}):null}}function Je(f,l,h,y){return typeof f=="number"&&f>=0&&f<=255&&typeof l=="number"&&l>=0&&l<=255&&typeof h=="number"&&h>=0&&h<=255?y===void 0||typeof y=="number"&&y>=0&&y<=1?null:`Invalid rgba value [${[f,l,h,y].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof y=="number"?[f,l,h,y]:[f,l,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function et(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof ce||f instanceof we||f instanceof Pe||f instanceof Me||f instanceof Be)return!0;if(Array.isArray(f)){for(const l of f)if(!et(l))return!1;return!0}if(typeof f=="object"){for(const l in f)if(!et(f[l]))return!1;return!0}return!1}function Ge(f){if(f===null)return pn;if(typeof f=="string")return Lt;if(typeof f=="boolean")return Tt;if(typeof f=="number")return ot;if(f instanceof ce)return Kt;if(f instanceof we)return xn;if(f instanceof Pe)return bn;if(f instanceof Me)return tn;if(f instanceof Be)return Bt;if(Array.isArray(f)){const l=f.length;let h;for(const y of f){const S=Ge(y);if(h){if(h===S)continue;h=ht;break}h=S}return gt(h||ht,l)}return Zt}function Ut(f){const l=typeof f;return f===null?"":l==="string"||l==="number"||l==="boolean"?String(f):f instanceof ce||f instanceof Pe||f instanceof Me||f instanceof Be?f.toString():JSON.stringify(f)}class Mt{constructor(l,h){this.type=l,this.value=h}static parse(l,h){if(l.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${l.length-1} instead.`);if(!et(l[1]))return h.error("invalid value");const y=l[1];let S=Ge(y);const R=h.expectedType;return S.kind!=="array"||S.N!==0||!R||R.kind!=="array"||typeof R.N=="number"&&R.N!==0||(S=R),new Mt(S,y)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class at{constructor(l){this.name="ExpressionEvaluationError",this.message=l}toJSON(){return this.message}}const $t={string:Lt,number:ot,boolean:Tt,object:Zt};class Xt{constructor(l,h){this.type=l,this.args=h}static parse(l,h){if(l.length<2)return h.error("Expected at least one argument.");let y,S=1;const R=l[0];if(R==="array"){let $,U;if(l.length>2){const W=l[1];if(typeof W!="string"||!(W in $t)||W==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);$=$t[W],S++}else $=ht;if(l.length>3){if(l[2]!==null&&(typeof l[2]!="number"||l[2]<0||l[2]!==Math.floor(l[2])))return h.error('The length argument to "array" must be a positive integer literal',2);U=l[2],S++}y=gt($,U)}else{if(!$t[R])throw new Error(`Types doesn't contain name = ${R}`);y=$t[R]}const D=[];for(;Sl.outputDefined())}}const En={"to-boolean":Tt,"to-color":Kt,"to-number":ot,"to-string":Lt};class hn{constructor(l,h){this.type=l,this.args=h}static parse(l,h){if(l.length<2)return h.error("Expected at least one argument.");const y=l[0];if(!En[y])throw new Error(`Can't parse ${y} as it is not part of the known types`);if((y==="to-boolean"||y==="to-string")&&l.length!==2)return h.error("Expected one argument.");const S=En[y],R=[];for(let D=1;D4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:Je(h[0],h[1],h[2],h[3]),!y))return new ce(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new at(y||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}if(this.type.kind==="padding"){let h;for(const y of this.args){h=y.evaluate(l);const S=Me.parse(h);if(S)return S}throw new at(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}if(this.type.kind==="number"){let h=null;for(const y of this.args){if(h=y.evaluate(l),h===null)return 0;const S=Number(h);if(!isNaN(S))return S}throw new at(`Could not convert ${JSON.stringify(h)} to number.`)}return this.type.kind==="formatted"?Pe.fromString(Ut(this.args[0].evaluate(l))):this.type.kind==="resolvedImage"?Be.fromString(Ut(this.args[0].evaluate(l))):Ut(this.args[0].evaluate(l))}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}}const Pn=["Unknown","Point","LineString","Polygon"];class Gn{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"?Pn[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(l){let h=this._parseColorCache[l];return h||(h=this._parseColorCache[l]=ce.parse(l)),h}}class lr{constructor(l,h,y,S){this.name=l,this.type=h,this._evaluate=y,this.args=S}evaluate(l){return this._evaluate(l,this.args)}eachChild(l){this.args.forEach(l)}outputDefined(){return!1}static parse(l,h){const y=l[0],S=lr.definitions[y];if(!S)return h.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0);const R=Array.isArray(S)?S[0]:S.type,D=Array.isArray(S)?[[S[1],S[2]]]:S.overloads,$=D.filter(([W])=>!Array.isArray(W)||W.length===l.length-1);let U=null;for(const[W,te]of $){U=new Gs(h.registry,h.path,null,h.scope);const ae=[];let de=!1;for(let ge=1;ge{return de=ae,Array.isArray(de)?`(${de.map(xt).join(", ")})`:`(${xt(de.type)}...)`;var de}).join(" | "),te=[];for(let ae=1;ae=l[2]||f[1]<=l[1]||f[3]>=l[3])}function An(f,l){const h=(180+f[0])/360,y=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+f[1]*Math.PI/360)))/360,S=Math.pow(2,l.z);return[Math.round(h*S*hr),Math.round(y*S*hr)]}function zn(f,l,h){const y=f[0]-l[0],S=f[1]-l[1],R=f[0]-h[0],D=f[1]-h[1];return y*D-R*S==0&&y*R<=0&&S*D<=0}function ri(f,l){let h=!1;for(let D=0,$=l.length;D<$;D++){const U=l[D];for(let W=0,te=U.length;W(y=f)[1]!=(R=U[W+1])[1]>y[1]&&y[0]<(R[0]-S[0])*(y[1]-S[1])/(R[1]-S[1])+S[0]&&(h=!h)}}var y,S,R;return h}function Er(f,l){for(let h=0;h0&&$<0||D<0&&$>0}function Kn(f,l,h){for(const W of h)for(let te=0;teh[2]){const S=.5*y;let R=f[0]-h[0]>S?-y:h[0]-f[0]>S?y:0;R===0&&(R=f[0]-h[2]>S?-y:h[2]-f[0]>S?y:0),f[0]+=R}Vr(l,f)}function Eu(f,l,h,y){const S=Math.pow(2,y.z)*hr,R=[y.x*hr,y.y*hr],D=[];for(const $ of f)for(const U of $){const W=[U.x+R[0],U.y+R[1]];Oo(W,l,h,S),D.push(W)}return D}function Pf(f,l,h,y){const S=Math.pow(2,y.z)*hr,R=[y.x*hr,y.y*hr],D=[];for(const U of f){const W=[];for(const te of U){const ae=[te.x+R[0],te.y+R[1]];Vr(l,ae),W.push(ae)}D.push(W)}if(l[2]-l[0]<=S/2){($=l)[0]=$[1]=1/0,$[2]=$[3]=-1/0;for(const U of D)for(const W of U)Oo(W,l,h,S)}var $;return D}class xs{constructor(l,h){this.type=Tt,this.geojson=l,this.geometries=h}static parse(l,h){if(l.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${l.length-1} instead.`);if(et(l[1])){const y=l[1];if(y.type==="FeatureCollection")for(let S=0;S{l&&!Wn(h)&&(l=!1)}),l}function rr(f){if(f instanceof lr&&f.name==="feature-state")return!1;let l=!0;return f.eachChild(h=>{l&&!rr(h)&&(l=!1)}),l}function Ur(f,l){if(f instanceof lr&&l.indexOf(f.name)>=0)return!1;let h=!0;return f.eachChild(y=>{h&&!Ur(y,l)&&(h=!1)}),h}class Ui{constructor(l,h){this.type=h.type,this.name=l,this.boundExpression=h}static parse(l,h){if(l.length!==2||typeof l[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const y=l[1];return h.scope.has(y)?new Ui(y,h.scope.get(y)):h.error(`Unknown variable "${y}". Make sure "${y}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(l){return this.boundExpression.evaluate(l)}eachChild(){}outputDefined(){return!1}}class Gs{constructor(l,h=[],y,S=new Qt,R=[]){this.registry=l,this.path=h,this.key=h.map(D=>`[${D}]`).join(""),this.scope=S,this.errors=R,this.expectedType=y}parse(l,h,y,S,R={}){return h?this.concat(h,y,S)._parse(l,R):this._parse(l,R)}_parse(l,h){function y(S,R,D){return D==="assert"?new Xt(R,[S]):D==="coerce"?new hn(R,[S]):S}if(l!==null&&typeof l!="string"&&typeof l!="boolean"&&typeof l!="number"||(l=["literal",l]),Array.isArray(l)){if(l.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const S=l[0];if(typeof S!="string")return this.error(`Expression name must be a string, but found ${typeof S} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const R=this.registry[S];if(R){let D=R.parse(l,this);if(!D)return null;if(this.expectedType){const $=this.expectedType,U=D.type;if($.kind!=="string"&&$.kind!=="number"&&$.kind!=="boolean"&&$.kind!=="object"&&$.kind!=="array"||U.kind!=="value")if($.kind!=="color"&&$.kind!=="formatted"&&$.kind!=="resolvedImage"||U.kind!=="value"&&U.kind!=="string")if($.kind!=="padding"||U.kind!=="value"&&U.kind!=="number"&&U.kind!=="array"){if(this.checkSubtype($,U))return null}else D=y(D,$,h.typeAnnotation||"coerce");else D=y(D,$,h.typeAnnotation||"coerce");else D=y(D,$,h.typeAnnotation||"assert")}if(!(D instanceof Mt)&&D.type.kind!=="resolvedImage"&&Jo(D)){const $=new Gn;try{D=new Mt(D.type,D.evaluate($))}catch(U){return this.error(U.message),null}}return D}return this.error(`Unknown expression "${S}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(l===void 0?"'undefined' value invalid. Use null instead.":typeof l=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof l} instead.`)}concat(l,h,y){const S=typeof l=="number"?this.path.concat(l):this.path,R=y?this.scope.concat(y):this.scope;return new Gs(this.registry,S,h||null,R,this.errors)}error(l,...h){const y=`${this.key}${h.map(S=>`[${S}]`).join("")}`;this.errors.push(new Rt(y,l))}checkSubtype(l,h){const y=qt(l,h);return y&&this.error(y),y}}function Jo(f){if(f instanceof Ui)return Jo(f.boundExpression);if(f instanceof lr&&f.name==="error"||f instanceof Zr||f instanceof xs)return!1;const l=f instanceof hn||f instanceof Xt;let h=!0;return f.eachChild(y=>{h=l?h&&Jo(y):h&&y instanceof Mt}),!!h&&Wn(f)&&Ur(f,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Rl(f,l){const h=f.length-1;let y,S,R=0,D=h,$=0;for(;R<=D;)if($=Math.floor((R+D)/2),y=f[$],S=f[$+1],y<=l){if($===h||ll))throw new at("Input is not a number.");D=$-1}return 0}class bs{constructor(l,h,y){this.type=l,this.input=h,this.labels=[],this.outputs=[];for(const[S,R]of y)this.labels.push(S),this.outputs.push(R)}static parse(l,h){if(l.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return h.error("Expected an even number of arguments.");const y=h.parse(l[1],1,ot);if(!y)return null;const S=[];let R=null;h.expectedType&&h.expectedType.kind!=="value"&&(R=h.expectedType);for(let D=1;D=$)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',W);const ae=h.parse(U,te,R);if(!ae)return null;R=R||ae.type,S.push([$,ae])}return new bs(R,y,S)}evaluate(l){const h=this.labels,y=this.outputs;if(h.length===1)return y[0].evaluate(l);const S=this.input.evaluate(l);if(S<=h[0])return y[0].evaluate(l);const R=h.length;return S>=h[R-1]?y[R-1].evaluate(l):y[Rl(h,S)].evaluate(l)}eachChild(l){l(this.input);for(const h of this.outputs)l(h)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}}function Pr(f,l,h){return f*(1-h)+l*h}var _s=Object.freeze({__proto__:null,number:Pr,color:function(f,l,h){return new ce(Pr(f.r,l.r,h),Pr(f.g,l.g,h),Pr(f.b,l.b,h),Pr(f.a,l.a,h))},array:function(f,l,h){return f.map((y,S)=>Pr(y,l[S],h))},padding:function(f,l,h){const y=f.values,S=l.values;return new Me([Pr(y[0],S[0],h),Pr(y[1],S[1],h),Pr(y[2],S[2],h),Pr(y[3],S[3],h)])}});const w0=.95047,C0=1.08883,Np=4/29,If=6/29,S0=3*If*If,Iw=Math.PI/180,Tw=180/Math.PI;function Lp(f){return f>.008856451679035631?Math.pow(f,1/3):f/S0+Np}function Fp(f){return f>If?f*f*f:S0*(f-Np)}function zp(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function $p(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function pr(f){const l=$p(f.r),h=$p(f.g),y=$p(f.b),S=Lp((.4124564*l+.3575761*h+.1804375*y)/w0),R=Lp((.2126729*l+.7151522*h+.072175*y)/1);return{l:116*R-16,a:500*(S-R),b:200*(R-Lp((.0193339*l+.119192*h+.9503041*y)/C0)),alpha:f.a}}function E0(f){let l=(f.l+16)/116,h=isNaN(f.a)?l:l+f.a/500,y=isNaN(f.b)?l:l-f.b/200;return l=1*Fp(l),h=w0*Fp(h),y=C0*Fp(y),new ce(zp(3.2404542*h-1.5371385*l-.4985314*y),zp(-.969266*h+1.8760108*l+.041556*y),zp(.0556434*h-.2040259*l+1.0572252*y),f.alpha)}function kw(f,l,h){const y=l-f;return f+h*(y>180||y<-180?y-360*Math.round(y/360):y)}const Uc={forward:pr,reverse:E0,interpolate:function(f,l,h){return{l:Pr(f.l,l.l,h),a:Pr(f.a,l.a,h),b:Pr(f.b,l.b,h),alpha:Pr(f.alpha,l.alpha,h)}}},jc={forward:function(f){const{l,a:h,b:y}=pr(f),S=Math.atan2(y,h)*Tw;return{h:S<0?S+360:S,c:Math.sqrt(h*h+y*y),l,alpha:f.a}},reverse:function(f){const l=f.h*Iw,h=f.c;return E0({l:f.l,a:Math.cos(l)*h,b:Math.sin(l)*h,alpha:f.alpha})},interpolate:function(f,l,h){return{h:kw(f.h,l.h,h),c:Pr(f.c,l.c,h),l:Pr(f.l,l.l,h),alpha:Pr(f.alpha,l.alpha,h)}}};var P0=Object.freeze({__proto__:null,lab:Uc,hcl:jc});class No{constructor(l,h,y,S,R){this.type=l,this.operator=h,this.interpolation=y,this.input=S,this.labels=[],this.outputs=[];for(const[D,$]of R)this.labels.push(D),this.outputs.push($)}static interpolationFactor(l,h,y,S){let R=0;if(l.name==="exponential")R=Bp(h,l.base,y,S);else if(l.name==="linear")R=Bp(h,1,y,S);else if(l.name==="cubic-bezier"){const D=l.controlPoints;R=new u(D[0],D[1],D[2],D[3]).solve(Bp(h,1,y,S))}return R}static parse(l,h){let[y,S,R,...D]=l;if(!Array.isArray(S)||S.length===0)return h.error("Expected an interpolation type expression.",1);if(S[0]==="linear")S={name:"linear"};else if(S[0]==="exponential"){const W=S[1];if(typeof W!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);S={name:"exponential",base:W}}else{if(S[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(S[0])}`,1,0);{const W=S.slice(1);if(W.length!==4||W.some(te=>typeof te!="number"||te<0||te>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);S={name:"cubic-bezier",controlPoints:W}}}if(l.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(R=h.parse(R,2,ot),!R)return null;const $=[];let U=null;y==="interpolate-hcl"||y==="interpolate-lab"?U=Kt:h.expectedType&&h.expectedType.kind!=="value"&&(U=h.expectedType);for(let W=0;W=te)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',de);const ve=h.parse(ae,ge,U);if(!ve)return null;U=U||ve.type,$.push([te,ve])}return U.kind==="number"||U.kind==="color"||U.kind==="padding"||U.kind==="array"&&U.itemType.kind==="number"&&typeof U.N=="number"?new No(U,y,S,R,$):h.error(`Type ${xt(U)} is not interpolatable.`)}evaluate(l){const h=this.labels,y=this.outputs;if(h.length===1)return y[0].evaluate(l);const S=this.input.evaluate(l);if(S<=h[0])return y[0].evaluate(l);const R=h.length;if(S>=h[R-1])return y[R-1].evaluate(l);const D=Rl(h,S),$=No.interpolationFactor(this.interpolation,S,h[D],h[D+1]),U=y[D].evaluate(l),W=y[D+1].evaluate(l);return this.operator==="interpolate"?_s[this.type.kind.toLowerCase()](U,W,$):this.operator==="interpolate-hcl"?jc.reverse(jc.interpolate(jc.forward(U),jc.forward(W),$)):Uc.reverse(Uc.interpolate(Uc.forward(U),Uc.forward(W),$))}eachChild(l){l(this.input);for(const h of this.outputs)l(h)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}}function Bp(f,l,h,y){const S=y-h,R=f-h;return S===0?0:l===1?R/S:(Math.pow(l,R)-1)/(Math.pow(l,S)-1)}class Tf{constructor(l,h){this.type=l,this.args=h}static parse(l,h){if(l.length<2)return h.error("Expectected at least one argument.");let y=null;const S=h.expectedType;S&&S.kind!=="value"&&(y=S);const R=[];for(const $ of l.slice(1)){const U=h.parse($,1+R.length,y,void 0,{typeAnnotation:"omit"});if(!U)return null;y=y||U.type,R.push(U)}if(!y)throw new Error("No output type");const D=S&&R.some($=>qt(S,$.type));return new Tf(D?ht:y,R)}evaluate(l){let h,y=null,S=0;for(const R of this.args)if(S++,y=R.evaluate(l),y&&y instanceof Be&&!y.available&&(h||(h=y.name),y=null,S===this.args.length&&(y=h)),y!==null)break;return y}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}}class kf{constructor(l,h){this.type=h.type,this.bindings=[].concat(l),this.result=h}evaluate(l){return this.result.evaluate(l)}eachChild(l){for(const h of this.bindings)l(h[1]);l(this.result)}static parse(l,h){if(l.length<4)return h.error(`Expected at least 3 arguments, but found ${l.length-1} instead.`);const y=[];for(let R=1;R=y.length)throw new at(`Array index out of bounds: ${h} > ${y.length-1}.`);if(h!==Math.floor(h))throw new at(`Array index must be an integer, but found ${h} instead.`);return y[h]}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}}class Up{constructor(l,h){this.type=Tt,this.needle=l,this.haystack=h}static parse(l,h){if(l.length!==3)return h.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const y=h.parse(l[1],1,ht),S=h.parse(l[2],2,ht);return y&&S?vn(y.type,[Tt,Lt,ot,pn,ht])?new Up(y,S):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(y.type)} instead`):null}evaluate(l){const h=this.needle.evaluate(l),y=this.haystack.evaluate(l);if(!y)return!1;if(!Fn(h,["boolean","string","number","null"]))throw new at(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Ge(h))} instead.`);if(!Fn(y,["string","array"]))throw new at(`Expected second argument to be of type array or string, but found ${xt(Ge(y))} instead.`);return y.indexOf(h)>=0}eachChild(l){l(this.needle),l(this.haystack)}outputDefined(){return!0}}class Mf{constructor(l,h,y){this.type=ot,this.needle=l,this.haystack=h,this.fromIndex=y}static parse(l,h){if(l.length<=2||l.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const y=h.parse(l[1],1,ht),S=h.parse(l[2],2,ht);if(!y||!S)return null;if(!vn(y.type,[Tt,Lt,ot,pn,ht]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(y.type)} instead`);if(l.length===4){const R=h.parse(l[3],3,ot);return R?new Mf(y,S,R):null}return new Mf(y,S)}evaluate(l){const h=this.needle.evaluate(l),y=this.haystack.evaluate(l);if(!Fn(h,["boolean","string","number","null"]))throw new at(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Ge(h))} instead.`);if(!Fn(y,["string","array"]))throw new at(`Expected second argument to be of type array or string, but found ${xt(Ge(y))} instead.`);if(this.fromIndex){const S=this.fromIndex.evaluate(l);return y.indexOf(h,S)}return y.indexOf(h)}eachChild(l){l(this.needle),l(this.haystack),this.fromIndex&&l(this.fromIndex)}outputDefined(){return!1}}class jp{constructor(l,h,y,S,R,D){this.inputType=l,this.type=h,this.input=y,this.cases=S,this.outputs=R,this.otherwise=D}static parse(l,h){if(l.length<5)return h.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length%2!=1)return h.error("Expected an even number of arguments.");let y,S;h.expectedType&&h.expectedType.kind!=="value"&&(S=h.expectedType);const R={},D=[];for(let W=2;WNumber.MAX_SAFE_INTEGER)return de.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ve=="number"&&Math.floor(ve)!==ve)return de.error("Numeric branch labels must be integer values.");if(y){if(de.checkSubtype(y,Ge(ve)))return null}else y=Ge(ve);if(R[String(ve)]!==void 0)return de.error("Branch labels must be unique.");R[String(ve)]=D.length}const ge=h.parse(ae,W,S);if(!ge)return null;S=S||ge.type,D.push(ge)}const $=h.parse(l[1],1,ht);if(!$)return null;const U=h.parse(l[l.length-1],l.length-1,S);return U?$.type.kind!=="value"&&h.concat(1).checkSubtype(y,$.type)?null:new jp(y,S,$,R,D,U):null}evaluate(l){const h=this.input.evaluate(l);return(Ge(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(l)}eachChild(l){l(this.input),this.outputs.forEach(l),l(this.otherwise)}outputDefined(){return this.outputs.every(l=>l.outputDefined())&&this.otherwise.outputDefined()}}class Hp{constructor(l,h,y){this.type=l,this.branches=h,this.otherwise=y}static parse(l,h){if(l.length<4)return h.error(`Expected at least 3 arguments, but found only ${l.length-1}.`);if(l.length%2!=0)return h.error("Expected an odd number of arguments.");let y;h.expectedType&&h.expectedType.kind!=="value"&&(y=h.expectedType);const S=[];for(let D=1;Dh.outputDefined())&&this.otherwise.outputDefined()}}class Rf{constructor(l,h,y,S){this.type=l,this.input=h,this.beginIndex=y,this.endIndex=S}static parse(l,h){if(l.length<=2||l.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const y=h.parse(l[1],1,ht),S=h.parse(l[2],2,ot);if(!y||!S)return null;if(!vn(y.type,[gt(ht),Lt,ht]))return h.error(`Expected first argument to be of type array or string, but found ${xt(y.type)} instead`);if(l.length===4){const R=h.parse(l[3],3,ot);return R?new Rf(y.type,y,S,R):null}return new Rf(y.type,y,S)}evaluate(l){const h=this.input.evaluate(l),y=this.beginIndex.evaluate(l);if(!Fn(h,["string","array"]))throw new at(`Expected first argument to be of type array or string, but found ${xt(Ge(h))} instead.`);if(this.endIndex){const S=this.endIndex.evaluate(l);return h.slice(y,S)}return h.slice(y)}eachChild(l){l(this.input),l(this.beginIndex),this.endIndex&&l(this.endIndex)}outputDefined(){return!1}}function I0(f,l){return f==="=="||f==="!="?l.kind==="boolean"||l.kind==="string"||l.kind==="number"||l.kind==="null"||l.kind==="value":l.kind==="string"||l.kind==="number"||l.kind==="value"}function T0(f,l,h,y){return y.compare(l,h)===0}function Pu(f,l,h){const y=f!=="=="&&f!=="!=";return class bz{constructor(R,D,$){this.type=Tt,this.lhs=R,this.rhs=D,this.collator=$,this.hasUntypedArgument=R.type.kind==="value"||D.type.kind==="value"}static parse(R,D){if(R.length!==3&&R.length!==4)return D.error("Expected two or three arguments.");const $=R[0];let U=D.parse(R[1],1,ht);if(!U)return null;if(!I0($,U.type))return D.concat(1).error(`"${$}" comparisons are not supported for type '${xt(U.type)}'.`);let W=D.parse(R[2],2,ht);if(!W)return null;if(!I0($,W.type))return D.concat(2).error(`"${$}" comparisons are not supported for type '${xt(W.type)}'.`);if(U.type.kind!==W.type.kind&&U.type.kind!=="value"&&W.type.kind!=="value")return D.error(`Cannot compare types '${xt(U.type)}' and '${xt(W.type)}'.`);y&&(U.type.kind==="value"&&W.type.kind!=="value"?U=new Xt(W.type,[U]):U.type.kind!=="value"&&W.type.kind==="value"&&(W=new Xt(U.type,[W])));let te=null;if(R.length===4){if(U.type.kind!=="string"&&W.type.kind!=="string"&&U.type.kind!=="value"&&W.type.kind!=="value")return D.error("Cannot use collator to compare non-string types.");if(te=D.parse(R[3],3,xn),!te)return null}return new bz(U,W,te)}evaluate(R){const D=this.lhs.evaluate(R),$=this.rhs.evaluate(R);if(y&&this.hasUntypedArgument){const U=Ge(D),W=Ge($);if(U.kind!==W.kind||U.kind!=="string"&&U.kind!=="number")throw new at(`Expected arguments for "${f}" to be (string, string) or (number, number), but found (${U.kind}, ${W.kind}) instead.`)}if(this.collator&&!y&&this.hasUntypedArgument){const U=Ge(D),W=Ge($);if(U.kind!=="string"||W.kind!=="string")return l(R,D,$)}return this.collator?h(R,D,$,this.collator.evaluate(R)):l(R,D,$)}eachChild(R){R(this.lhs),R(this.rhs),this.collator&&R(this.collator)}outputDefined(){return!0}}}const Mw=Pu("==",function(f,l,h){return l===h},T0),Rw=Pu("!=",function(f,l,h){return l!==h},function(f,l,h,y){return!T0(0,l,h,y)}),Aw=Pu("<",function(f,l,h){return l",function(f,l,h){return l>h},function(f,l,h,y){return y.compare(l,h)>0}),Ow=Pu("<=",function(f,l,h){return l<=h},function(f,l,h,y){return y.compare(l,h)<=0}),Nw=Pu(">=",function(f,l,h){return l>=h},function(f,l,h,y){return y.compare(l,h)>=0});class Kp{constructor(l,h,y,S,R){this.type=Lt,this.number=l,this.locale=h,this.currency=y,this.minFractionDigits=S,this.maxFractionDigits=R}static parse(l,h){if(l.length!==3)return h.error("Expected two arguments.");const y=h.parse(l[1],1,ot);if(!y)return null;const S=l[2];if(typeof S!="object"||Array.isArray(S))return h.error("NumberFormat options argument must be an object.");let R=null;if(S.locale&&(R=h.parse(S.locale,1,Lt),!R))return null;let D=null;if(S.currency&&(D=h.parse(S.currency,1,Lt),!D))return null;let $=null;if(S["min-fraction-digits"]&&($=h.parse(S["min-fraction-digits"],1,ot),!$))return null;let U=null;return S["max-fraction-digits"]&&(U=h.parse(S["max-fraction-digits"],1,ot),!U)?null:new Kp(y,R,D,$,U)}evaluate(l){return new Intl.NumberFormat(this.locale?this.locale.evaluate(l):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(l):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(l):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(l):void 0}).format(this.number.evaluate(l))}eachChild(l){l(this.number),this.locale&&l(this.locale),this.currency&&l(this.currency),this.minFractionDigits&&l(this.minFractionDigits),this.maxFractionDigits&&l(this.maxFractionDigits)}outputDefined(){return!1}}class Af{constructor(l){this.type=bn,this.sections=l}static parse(l,h){if(l.length<2)return h.error("Expected at least one argument.");const y=l[1];if(!Array.isArray(y)&&typeof y=="object")return h.error("First argument must be an image or text section.");const S=[];let R=!1;for(let D=1;D<=l.length-1;++D){const $=l[D];if(R&&typeof $=="object"&&!Array.isArray($)){R=!1;let U=null;if($["font-scale"]&&(U=h.parse($["font-scale"],1,ot),!U))return null;let W=null;if($["text-font"]&&(W=h.parse($["text-font"],1,gt(Lt)),!W))return null;let te=null;if($["text-color"]&&(te=h.parse($["text-color"],1,Kt),!te))return null;const ae=S[S.length-1];ae.scale=U,ae.font=W,ae.textColor=te}else{const U=h.parse(l[D],1,ht);if(!U)return null;const W=U.type.kind;if(W!=="string"&&W!=="value"&&W!=="null"&&W!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");R=!0,S.push({content:U,scale:null,font:null,textColor:null})}}return new Af(S)}evaluate(l){return new Pe(this.sections.map(h=>{const y=h.content.evaluate(l);return Ge(y)===Bt?new Ae("",y,null,null,null):new Ae(Ut(y),null,h.scale?h.scale.evaluate(l):null,h.font?h.font.evaluate(l).join(","):null,h.textColor?h.textColor.evaluate(l):null)}))}eachChild(l){for(const h of this.sections)l(h.content),h.scale&&l(h.scale),h.font&&l(h.font),h.textColor&&l(h.textColor)}outputDefined(){return!1}}class Wp{constructor(l){this.type=Bt,this.input=l}static parse(l,h){if(l.length!==2)return h.error("Expected two arguments.");const y=h.parse(l[1],1,Lt);return y?new Wp(y):h.error("No image name provided.")}evaluate(l){const h=this.input.evaluate(l),y=Be.fromString(h);return y&&l.availableImages&&(y.available=l.availableImages.indexOf(h)>-1),y}eachChild(l){l(this.input)}outputDefined(){return!1}}class Gp{constructor(l){this.type=ot,this.input=l}static parse(l,h){if(l.length!==2)return h.error(`Expected 1 argument, but found ${l.length-1} instead.`);const y=h.parse(l[1],1);return y?y.type.kind!=="array"&&y.type.kind!=="string"&&y.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${xt(y.type)} instead.`):new Gp(y):null}evaluate(l){const h=this.input.evaluate(l);if(typeof h=="string"||Array.isArray(h))return h.length;throw new at(`Expected value to be of type string or array, but found ${xt(Ge(h))} instead.`)}eachChild(l){l(this.input)}outputDefined(){return!1}}const Iu={"==":Mw,"!=":Rw,">":Dw,"<":Aw,">=":Nw,"<=":Ow,array:Xt,at:Vp,boolean:Xt,case:Hp,coalesce:Tf,collator:Zr,format:Af,image:Wp,in:Up,"index-of":Mf,interpolate:No,"interpolate-hcl":No,"interpolate-lab":No,length:Gp,let:kf,literal:Mt,match:jp,number:Xt,"number-format":Kp,object:Xt,slice:Rf,step:bs,string:Xt,"to-boolean":hn,"to-color":hn,"to-number":hn,"to-string":hn,var:Ui,within:xs};function k0(f,[l,h,y,S]){l=l.evaluate(f),h=h.evaluate(f),y=y.evaluate(f);const R=S?S.evaluate(f):1,D=Je(l,h,y,R);if(D)throw new at(D);return new ce(l/255*R,h/255*R,y/255*R,R)}function M0(f,l){return f in l}function Df(f,l){const h=l[f];return h===void 0?null:h}function Al(f){return{type:f}}function R0(f){return{result:"success",value:f}}function Tu(f){return{result:"error",value:f}}function zr(f){return f["property-type"]==="data-driven"||f["property-type"]==="cross-faded-data-driven"}function A0(f){return!!f.expression&&f.expression.parameters.indexOf("zoom")>-1}function ir(f){return!!f.expression&&f.expression.interpolated}function mr(f){return f instanceof Number?"number":f instanceof String?"string":f instanceof Boolean?"boolean":Array.isArray(f)?"array":f===null?"null":typeof f}function Rr(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)}function jr(f){return f}function Hc(f,l){const h=l.type==="color",y=f.stops&&typeof f.stops[0][0]=="object",S=y||!(y||f.property!==void 0),R=f.type||(ir(l)?"exponential":"interval");if(h||l.type==="padding"){const W=h?ce.parse:Me.parse;(f=sn({},f)).stops&&(f.stops=f.stops.map(te=>[te[0],W(te[1])])),f.default=W(f.default?f.default:l.default)}if(f.colorSpace&&f.colorSpace!=="rgb"&&!P0[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let D,$,U;if(R==="exponential")D=D0;else if(R==="interval")D=Fw;else if(R==="categorical"){D=Lw,$=Object.create(null);for(const W of f.stops)$[W[0]]=W[1];U=typeof f.stops[0][0]}else{if(R!=="identity")throw new Error(`Unknown function type "${R}"`);D=zw}if(y){const W={},te=[];for(let ge=0;gege[0]),evaluate:({zoom:ge},ve)=>D0({stops:ae,base:f.base},l,ge).evaluate(ge,ve)}}if(S){const W=R==="exponential"?{name:"exponential",base:f.base!==void 0?f.base:1}:null;return{kind:"camera",interpolationType:W,interpolationFactor:No.interpolationFactor.bind(void 0,W),zoomStops:f.stops.map(te=>te[0]),evaluate:({zoom:te})=>D(f,l,te,$,U)}}return{kind:"source",evaluate(W,te){const ae=te&&te.properties?te.properties[f.property]:void 0;return ae===void 0?ku(f.default,l.default):D(f,l,ae,$,U)}}}function ku(f,l,h){return f!==void 0?f:l!==void 0?l:h!==void 0?h:void 0}function Lw(f,l,h,y,S){return ku(typeof h===S?y[h]:void 0,f.default,l.default)}function Fw(f,l,h){if(mr(h)!=="number")return ku(f.default,l.default);const y=f.stops.length;if(y===1||h<=f.stops[0][0])return f.stops[0][1];if(h>=f.stops[y-1][0])return f.stops[y-1][1];const S=Rl(f.stops.map(R=>R[0]),h);return f.stops[S][1]}function D0(f,l,h){const y=f.base!==void 0?f.base:1;if(mr(h)!=="number")return ku(f.default,l.default);const S=f.stops.length;if(S===1||h<=f.stops[0][0])return f.stops[0][1];if(h>=f.stops[S-1][0])return f.stops[S-1][1];const R=Rl(f.stops.map(te=>te[0]),h),D=function(te,ae,de,ge){const ve=ge-de,Fe=te-de;return ve===0?0:ae===1?Fe/ve:(Math.pow(ae,Fe)-1)/(Math.pow(ae,ve)-1)}(h,y,f.stops[R][0],f.stops[R+1][0]),$=f.stops[R][1],U=f.stops[R+1][1];let W=_s[l.type]||jr;if(f.colorSpace&&f.colorSpace!=="rgb"){const te=P0[f.colorSpace];W=(ae,de)=>te.reverse(te.interpolate(te.forward(ae),te.forward(de),D))}return typeof $.evaluate=="function"?{evaluate(...te){const ae=$.evaluate.apply(void 0,te),de=U.evaluate.apply(void 0,te);if(ae!==void 0&&de!==void 0)return W(ae,de,D)}}:W($,U,D)}function zw(f,l,h){switch(l.type){case"color":h=ce.parse(h);break;case"formatted":h=Pe.fromString(h.toString());break;case"resolvedImage":h=Be.fromString(h.toString());break;case"padding":h=Me.parse(h);break;default:mr(h)===l.type||l.type==="enum"&&l.values[h]||(h=void 0)}return ku(h,f.default,l.default)}lr.register(Iu,{error:[{kind:"error"},[Lt],(f,[l])=>{throw new at(l.evaluate(f))}],typeof:[Lt,[ht],(f,[l])=>xt(Ge(l.evaluate(f)))],"to-rgba":[gt(ot,4),[Kt],(f,[l])=>l.evaluate(f).toArray()],rgb:[Kt,[ot,ot,ot],k0],rgba:[Kt,[ot,ot,ot,ot],k0],has:{type:Tt,overloads:[[[Lt],(f,[l])=>M0(l.evaluate(f),f.properties())],[[Lt,Zt],(f,[l,h])=>M0(l.evaluate(f),h.evaluate(f))]]},get:{type:ht,overloads:[[[Lt],(f,[l])=>Df(l.evaluate(f),f.properties())],[[Lt,Zt],(f,[l,h])=>Df(l.evaluate(f),h.evaluate(f))]]},"feature-state":[ht,[Lt],(f,[l])=>Df(l.evaluate(f),f.featureState||{})],properties:[Zt,[],f=>f.properties()],"geometry-type":[Lt,[],f=>f.geometryType()],id:[ht,[],f=>f.id()],zoom:[ot,[],f=>f.globals.zoom],"heatmap-density":[ot,[],f=>f.globals.heatmapDensity||0],"line-progress":[ot,[],f=>f.globals.lineProgress||0],accumulated:[ht,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[ot,Al(ot),(f,l)=>{let h=0;for(const y of l)h+=y.evaluate(f);return h}],"*":[ot,Al(ot),(f,l)=>{let h=1;for(const y of l)h*=y.evaluate(f);return h}],"-":{type:ot,overloads:[[[ot,ot],(f,[l,h])=>l.evaluate(f)-h.evaluate(f)],[[ot],(f,[l])=>-l.evaluate(f)]]},"/":[ot,[ot,ot],(f,[l,h])=>l.evaluate(f)/h.evaluate(f)],"%":[ot,[ot,ot],(f,[l,h])=>l.evaluate(f)%h.evaluate(f)],ln2:[ot,[],()=>Math.LN2],pi:[ot,[],()=>Math.PI],e:[ot,[],()=>Math.E],"^":[ot,[ot,ot],(f,[l,h])=>Math.pow(l.evaluate(f),h.evaluate(f))],sqrt:[ot,[ot],(f,[l])=>Math.sqrt(l.evaluate(f))],log10:[ot,[ot],(f,[l])=>Math.log(l.evaluate(f))/Math.LN10],ln:[ot,[ot],(f,[l])=>Math.log(l.evaluate(f))],log2:[ot,[ot],(f,[l])=>Math.log(l.evaluate(f))/Math.LN2],sin:[ot,[ot],(f,[l])=>Math.sin(l.evaluate(f))],cos:[ot,[ot],(f,[l])=>Math.cos(l.evaluate(f))],tan:[ot,[ot],(f,[l])=>Math.tan(l.evaluate(f))],asin:[ot,[ot],(f,[l])=>Math.asin(l.evaluate(f))],acos:[ot,[ot],(f,[l])=>Math.acos(l.evaluate(f))],atan:[ot,[ot],(f,[l])=>Math.atan(l.evaluate(f))],min:[ot,Al(ot),(f,l)=>Math.min(...l.map(h=>h.evaluate(f)))],max:[ot,Al(ot),(f,l)=>Math.max(...l.map(h=>h.evaluate(f)))],abs:[ot,[ot],(f,[l])=>Math.abs(l.evaluate(f))],round:[ot,[ot],(f,[l])=>{const h=l.evaluate(f);return h<0?-Math.round(-h):Math.round(h)}],floor:[ot,[ot],(f,[l])=>Math.floor(l.evaluate(f))],ceil:[ot,[ot],(f,[l])=>Math.ceil(l.evaluate(f))],"filter-==":[Tt,[Lt,ht],(f,[l,h])=>f.properties()[l.value]===h.value],"filter-id-==":[Tt,[ht],(f,[l])=>f.id()===l.value],"filter-type-==":[Tt,[Lt],(f,[l])=>f.geometryType()===l.value],"filter-<":[Tt,[Lt,ht],(f,[l,h])=>{const y=f.properties()[l.value],S=h.value;return typeof y==typeof S&&y{const h=f.id(),y=l.value;return typeof h==typeof y&&h":[Tt,[Lt,ht],(f,[l,h])=>{const y=f.properties()[l.value],S=h.value;return typeof y==typeof S&&y>S}],"filter-id->":[Tt,[ht],(f,[l])=>{const h=f.id(),y=l.value;return typeof h==typeof y&&h>y}],"filter-<=":[Tt,[Lt,ht],(f,[l,h])=>{const y=f.properties()[l.value],S=h.value;return typeof y==typeof S&&y<=S}],"filter-id-<=":[Tt,[ht],(f,[l])=>{const h=f.id(),y=l.value;return typeof h==typeof y&&h<=y}],"filter->=":[Tt,[Lt,ht],(f,[l,h])=>{const y=f.properties()[l.value],S=h.value;return typeof y==typeof S&&y>=S}],"filter-id->=":[Tt,[ht],(f,[l])=>{const h=f.id(),y=l.value;return typeof h==typeof y&&h>=y}],"filter-has":[Tt,[ht],(f,[l])=>l.value in f.properties()],"filter-has-id":[Tt,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[Tt,[gt(Lt)],(f,[l])=>l.value.indexOf(f.geometryType())>=0],"filter-id-in":[Tt,[gt(ht)],(f,[l])=>l.value.indexOf(f.id())>=0],"filter-in-small":[Tt,[Lt,gt(ht)],(f,[l,h])=>h.value.indexOf(f.properties()[l.value])>=0],"filter-in-large":[Tt,[Lt,gt(ht)],(f,[l,h])=>function(y,S,R,D){for(;R<=D;){const $=R+D>>1;if(S[$]===y)return!0;S[$]>y?D=$-1:R=$+1}return!1}(f.properties()[l.value],h.value,0,h.value.length-1)],all:{type:Tt,overloads:[[[Tt,Tt],(f,[l,h])=>l.evaluate(f)&&h.evaluate(f)],[Al(Tt),(f,l)=>{for(const h of l)if(!h.evaluate(f))return!1;return!0}]]},any:{type:Tt,overloads:[[[Tt,Tt],(f,[l,h])=>l.evaluate(f)||h.evaluate(f)],[Al(Tt),(f,l)=>{for(const h of l)if(h.evaluate(f))return!0;return!1}]]},"!":[Tt,[Tt],(f,[l])=>!l.evaluate(f)],"is-supported-script":[Tt,[Lt],(f,[l])=>{const h=f.globals&&f.globals.isSupportedScript;return!h||h(l.evaluate(f))}],upcase:[Lt,[Lt],(f,[l])=>l.evaluate(f).toUpperCase()],downcase:[Lt,[Lt],(f,[l])=>l.evaluate(f).toLowerCase()],concat:[Lt,Al(ht),(f,l)=>l.map(h=>Ut(h.evaluate(f))).join("")],"resolved-locale":[Lt,[xn],(f,[l])=>l.evaluate(f).resolvedLocale()]});class Of{constructor(l,h){this.expression=l,this._warningHistory={},this._evaluator=new Gn,this._defaultValue=h?function(y){return y.type==="color"&&Rr(y.default)?new ce(0,0,0,0):y.type==="color"?ce.parse(y.default)||null:y.type==="padding"?Me.parse(y.default)||null:y.default===void 0?null:y.default}(h):null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(l,h,y,S,R,D){return this._evaluator.globals=l,this._evaluator.feature=h,this._evaluator.featureState=y,this._evaluator.canonical=S,this._evaluator.availableImages=R||null,this._evaluator.formattedSection=D,this.expression.evaluate(this._evaluator)}evaluate(l,h,y,S,R,D){this._evaluator.globals=l,this._evaluator.feature=h||null,this._evaluator.featureState=y||null,this._evaluator.canonical=S,this._evaluator.availableImages=R||null,this._evaluator.formattedSection=D||null;try{const $=this.expression.evaluate(this._evaluator);if($==null||typeof $=="number"&&$!=$)return this._defaultValue;if(this._enumValues&&!($ in this._enumValues))throw new at(`Expected value to be one of ${Object.keys(this._enumValues).map(U=>JSON.stringify(U)).join(", ")}, but found ${JSON.stringify($)} instead.`);return $}catch($){return this._warningHistory[$.message]||(this._warningHistory[$.message]=!0,typeof console<"u"&&console.warn($.message)),this._defaultValue}}}function Kc(f){return Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&f[0]in Iu}function Wc(f,l){const h=new Gs(Iu,[],l?function(S){const R={color:Kt,string:Lt,number:ot,enum:Lt,boolean:Tt,formatted:bn,padding:tn,resolvedImage:Bt};return S.type==="array"?gt(R[S.value]||ht,S.length):R[S.type]}(l):void 0),y=h.parse(f,void 0,void 0,void 0,l&&l.type==="string"?{typeAnnotation:"coerce"}:void 0);return y?R0(new Of(y,l)):Tu(h.errors)}class Gc{constructor(l,h){this.kind=l,this._styleExpression=h,this.isStateDependent=l!=="constant"&&!rr(h.expression)}evaluateWithoutErrorHandling(l,h,y,S,R,D){return this._styleExpression.evaluateWithoutErrorHandling(l,h,y,S,R,D)}evaluate(l,h,y,S,R,D){return this._styleExpression.evaluate(l,h,y,S,R,D)}}class qp{constructor(l,h,y,S){this.kind=l,this.zoomStops=y,this._styleExpression=h,this.isStateDependent=l!=="camera"&&!rr(h.expression),this.interpolationType=S}evaluateWithoutErrorHandling(l,h,y,S,R,D){return this._styleExpression.evaluateWithoutErrorHandling(l,h,y,S,R,D)}evaluate(l,h,y,S,R,D){return this._styleExpression.evaluate(l,h,y,S,R,D)}interpolationFactor(l,h,y){return this.interpolationType?No.interpolationFactor(this.interpolationType,l,h,y):0}}function O0(f,l){const h=Wc(f,l);if(h.result==="error")return h;const y=h.value.expression,S=Wn(y);if(!S&&!zr(l))return Tu([new Rt("","data expressions not supported")]);const R=Ur(y,["zoom"]);if(!R&&!A0(l))return Tu([new Rt("","zoom expressions not supported")]);const D=Lf(y);return D||R?D instanceof Rt?Tu([D]):D instanceof No&&!ir(l)?Tu([new Rt("",'"interpolate" expressions cannot be used with this property')]):R0(D?new qp(S?"camera":"composite",h.value,D.labels,D instanceof No?D.interpolation:void 0):new Gc(S?"constant":"source",h.value)):Tu([new Rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Nf{constructor(l,h){this._parameters=l,this._specification=h,sn(this,Hc(this._parameters,this._specification))}static deserialize(l){return new Nf(l._parameters,l._specification)}static serialize(l){return{_parameters:l._parameters,_specification:l._specification}}}function Lf(f){let l=null;if(f instanceof kf)l=Lf(f.result);else if(f instanceof Tf){for(const h of f.args)if(l=Lf(h),l)break}else(f instanceof bs||f instanceof No)&&f.input instanceof lr&&f.input.name==="zoom"&&(l=f);return l instanceof Rt||f.eachChild(h=>{const y=Lf(h);y instanceof Rt?l=y:!l&&y?l=new Rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):l&&y&&l!==y&&(l=new Rt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),l}function ya(f){const l=f.key,h=f.value,y=f.valueSpec||{},S=f.objectElementValidators||{},R=f.style,D=f.styleSpec;let $=[];const U=mr(h);if(U!=="object")return[new Ze(l,h,`object expected, ${U} found`)];for(const W in h){const te=W.split(".")[0],ae=y[te]||y["*"];let de;if(S[te])de=S[te];else if(y[te])de=Fo;else if(S["*"])de=S["*"];else{if(!y["*"]){$.push(new Ze(l,h[W],`unknown property "${W}"`));continue}de=Fo}$=$.concat(de({key:(l&&`${l}.`)+W,value:h[W],valueSpec:ae,style:R,styleSpec:D,object:h,objectKey:W},h))}for(const W in y)S[W]||y[W].required&&y[W].default===void 0&&h[W]===void 0&&$.push(new Ze(l,h,`missing required property "${W}"`));return $}function N0(f){const l=f.value,h=f.valueSpec,y=f.style,S=f.styleSpec,R=f.key,D=f.arrayElementValidator||Fo;if(mr(l)!=="array")return[new Ze(R,l,`array expected, ${mr(l)} found`)];if(h.length&&l.length!==h.length)return[new Ze(R,l,`array length ${h.length} expected, length ${l.length} found`)];if(h["min-length"]&&l.lengthy.maximum?[new Ze(l,h,`${h} is greater than the maximum value ${y.maximum}`)]:[]}function L0(f){const l=f.valueSpec,h=Gt(f.value.type);let y,S,R,D={};const $=h!=="categorical"&&f.value.property===void 0,U=!$,W=mr(f.value.stops)==="array"&&mr(f.value.stops[0])==="array"&&mr(f.value.stops[0][0])==="object",te=ya({key:f.key,value:f.value,valueSpec:f.styleSpec.function,style:f.style,styleSpec:f.styleSpec,objectElementValidators:{stops:function(ge){if(h==="identity")return[new Ze(ge.key,ge.value,'identity function may not have a "stops" property')];let ve=[];const Fe=ge.value;return ve=ve.concat(N0({key:ge.key,value:Fe,valueSpec:ge.valueSpec,style:ge.style,styleSpec:ge.styleSpec,arrayElementValidator:ae})),mr(Fe)==="array"&&Fe.length===0&&ve.push(new Ze(ge.key,Fe,"array must have at least one stop")),ve},default:function(ge){return Fo({key:ge.key,value:ge.value,valueSpec:l,style:ge.style,styleSpec:ge.styleSpec})}}});return h==="identity"&&$&&te.push(new Ze(f.key,f.value,'missing required property "property"')),h==="identity"||f.value.stops||te.push(new Ze(f.key,f.value,'missing required property "stops"')),h==="exponential"&&f.valueSpec.expression&&!ir(f.valueSpec)&&te.push(new Ze(f.key,f.value,"exponential functions not supported")),f.styleSpec.$version>=8&&(U&&!zr(f.valueSpec)?te.push(new Ze(f.key,f.value,"property functions not supported")):$&&!A0(f.valueSpec)&&te.push(new Ze(f.key,f.value,"zoom functions not supported"))),h!=="categorical"&&!W||f.value.property!==void 0||te.push(new Ze(f.key,f.value,'"property" property is required')),te;function ae(ge){let ve=[];const Fe=ge.value,Ne=ge.key;if(mr(Fe)!=="array")return[new Ze(Ne,Fe,`array expected, ${mr(Fe)} found`)];if(Fe.length!==2)return[new Ze(Ne,Fe,`array length 2 expected, length ${Fe.length} found`)];if(W){if(mr(Fe[0])!=="object")return[new Ze(Ne,Fe,`object expected, ${mr(Fe[0])} found`)];if(Fe[0].zoom===void 0)return[new Ze(Ne,Fe,"object stop key must have zoom")];if(Fe[0].value===void 0)return[new Ze(Ne,Fe,"object stop key must have value")];if(R&&R>Gt(Fe[0].zoom))return[new Ze(Ne,Fe[0].zoom,"stop zoom values must appear in ascending order")];Gt(Fe[0].zoom)!==R&&(R=Gt(Fe[0].zoom),S=void 0,D={}),ve=ve.concat(ya({key:`${Ne}[0]`,value:Fe[0],valueSpec:{zoom:{}},style:ge.style,styleSpec:ge.styleSpec,objectElementValidators:{zoom:Zp,value:de}}))}else ve=ve.concat(de({key:`${Ne}[0]`,value:Fe[0],valueSpec:{},style:ge.style,styleSpec:ge.styleSpec},Fe));return Kc(zt(Fe[1]))?ve.concat([new Ze(`${Ne}[1]`,Fe[1],"expressions are not allowed in function stops.")]):ve.concat(Fo({key:`${Ne}[1]`,value:Fe[1],valueSpec:l,style:ge.style,styleSpec:ge.styleSpec}))}function de(ge,ve){const Fe=mr(ge.value),Ne=Gt(ge.value),it=ge.value!==null?ge.value:ve;if(y){if(Fe!==y)return[new Ze(ge.key,it,`${Fe} stop domain type must match previous stop domain type ${y}`)]}else y=Fe;if(Fe!=="number"&&Fe!=="string"&&Fe!=="boolean")return[new Ze(ge.key,it,"stop domain value must be a number, string, or boolean")];if(Fe!=="number"&&h!=="categorical"){let yt=`number expected, ${Fe} found`;return zr(l)&&h===void 0&&(yt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ze(ge.key,it,yt)]}return h!=="categorical"||Fe!=="number"||isFinite(Ne)&&Math.floor(Ne)===Ne?h!=="categorical"&&Fe==="number"&&S!==void 0&&Nenew Ze(`${f.key}${y.key}`,f.value,y.message));const h=l.value.expression||l.value._styleExpression.expression;if(f.expressionContext==="property"&&f.propertyKey==="text-font"&&!h.outputDefined())return[new Ze(f.key,f.value,`Invalid data expression for "${f.propertyKey}". Output values must be contained as literals within the expression.`)];if(f.expressionContext==="property"&&f.propertyType==="layout"&&!rr(h))return[new Ze(f.key,f.value,'"feature-state" data expressions are not supported with layout properties.')];if(f.expressionContext==="filter"&&!rr(h))return[new Ze(f.key,f.value,'"feature-state" data expressions are not supported with filters.')];if(f.expressionContext&&f.expressionContext.indexOf("cluster")===0){if(!Ur(h,["zoom","feature-state"]))return[new Ze(f.key,f.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(f.expressionContext==="cluster-initial"&&!Wn(h))return[new Ze(f.key,f.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qc(f){const l=f.key,h=f.value,y=f.valueSpec,S=[];return Array.isArray(y.values)?y.values.indexOf(Gt(h))===-1&&S.push(new Ze(l,h,`expected one of [${y.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(y.values).indexOf(Gt(h))===-1&&S.push(new Ze(l,h,`expected one of [${Object.keys(y.values).join(", ")}], ${JSON.stringify(h)} found`)),S}function Mu(f){if(f===!0||f===!1)return!0;if(!Array.isArray(f)||f.length===0)return!1;switch(f[0]){case"has":return f.length>=2&&f[1]!=="$id"&&f[1]!=="$type";case"in":return f.length>=3&&(typeof f[1]!="string"||Array.isArray(f[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return f.length!==3||Array.isArray(f[1])||Array.isArray(f[2]);case"any":case"all":for(const l of f.slice(1))if(!Mu(l)&&typeof l!="boolean")return!1;return!0;default:return!0}}const $w={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ff(f){if(f==null)return{filter:()=>!0,needGeometry:!1};Mu(f)||(f=Zc(f));const l=Wc(f,$w);if(l.result==="error")throw new Error(l.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,y,S)=>l.value.evaluate(h,y,{},S),needGeometry:z0(f)}}function F0(f,l){return fl?1:0}function z0(f){if(!Array.isArray(f))return!1;if(f[0]==="within")return!0;for(let l=1;l"||l==="<="||l===">="?Xp(f[1],f[2],l):l==="any"?(h=f.slice(1),["any"].concat(h.map(Zc))):l==="all"?["all"].concat(f.slice(1).map(Zc)):l==="none"?["all"].concat(f.slice(1).map(Zc).map(Ru)):l==="in"?zf(f[1],f.slice(2)):l==="!in"?Ru(zf(f[1],f.slice(2))):l==="has"?Xc(f[1]):l==="!has"?Ru(Xc(f[1])):l!=="within"||f;var h}function Xp(f,l,h){switch(f){case"$type":return[`filter-type-${h}`,l];case"$id":return[`filter-id-${h}`,l];default:return[`filter-${h}`,f,l]}}function zf(f,l){if(l.length===0)return!1;switch(f){case"$type":return["filter-type-in",["literal",l]];case"$id":return["filter-id-in",["literal",l]];default:return l.length>200&&!l.some(h=>typeof h!=typeof l[0])?["filter-in-large",f,["literal",l.sort(F0)]]:["filter-in-small",f,["literal",l]]}}function Xc(f){switch(f){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",f]}}function Ru(f){return["!",f]}function Yc(f){return Mu(zt(f.value))?Dl(sn({},f,{expressionContext:"filter",valueSpec:{value:"boolean"}})):$0(f)}function $0(f){const l=f.value,h=f.key;if(mr(l)!=="array")return[new Ze(h,l,`array expected, ${mr(l)} found`)];const y=f.styleSpec;let S,R=[];if(l.length<1)return[new Ze(h,l,"filter array must have at least 1 element")];switch(R=R.concat(qc({key:`${h}[0]`,value:l[0],valueSpec:y.filter_operator,style:f.style,styleSpec:f.styleSpec})),Gt(l[0])){case"<":case"<=":case">":case">=":l.length>=2&&Gt(l[1])==="$type"&&R.push(new Ze(h,l,`"$type" cannot be use with operator "${l[0]}"`));case"==":case"!=":l.length!==3&&R.push(new Ze(h,l,`filter array for operator "${l[0]}" must have 3 elements`));case"in":case"!in":l.length>=2&&(S=mr(l[1]),S!=="string"&&R.push(new Ze(`${h}[1]`,l[1],`string expected, ${S} found`)));for(let D=2;D{W in h&&l.push(new Ze(y,h[W],`"${W}" is prohibited for ref layers`))}),S.layers.forEach(W=>{Gt(W.id)===$&&(U=W)}),U?U.ref?l.push(new Ze(y,h.ref,"ref cannot reference another ref layer")):D=Gt(U.type):l.push(new Ze(y,h.ref,`ref layer "${$}" not found`))}else if(D!=="background")if(h.source){const U=S.sources&&S.sources[h.source],W=U&&Gt(U.type);U?W==="vector"&&D==="raster"?l.push(new Ze(y,h.source,`layer "${h.id}" requires a raster source`)):W==="raster"&&D!=="raster"?l.push(new Ze(y,h.source,`layer "${h.id}" requires a vector source`)):W!=="vector"||h["source-layer"]?W==="raster-dem"&&D!=="hillshade"?l.push(new Ze(y,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):D!=="line"||!h.paint||!h.paint["line-gradient"]||W==="geojson"&&U.lineMetrics||l.push(new Ze(y,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):l.push(new Ze(y,h,`layer "${h.id}" must specify a "source-layer"`)):l.push(new Ze(y,h.source,`source "${h.source}" not found`))}else l.push(new Ze(y,h,'missing required property "source"'));return l=l.concat(ya({key:y,value:h,valueSpec:R.layer,style:f.style,styleSpec:f.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Fo({key:`${y}.type`,value:h.type,valueSpec:R.layer.type,style:f.style,styleSpec:f.styleSpec,object:h,objectKey:"type"}),filter:Yc,layout:U=>ya({layer:h,key:U.key,value:U.value,style:U.style,styleSpec:U.styleSpec,objectElementValidators:{"*":W=>V0(sn({layerType:D},W))}}),paint:U=>ya({layer:h,key:U.key,value:U.value,style:U.style,styleSpec:U.styleSpec,objectElementValidators:{"*":W=>B0(sn({layerType:D},W))}})}})),l}function Au(f){const l=f.value,h=f.key,y=mr(l);return y!=="string"?[new Ze(h,l,`string expected, ${y} found`)]:[]}const j0={promoteId:function({key:f,value:l}){if(mr(l)==="string")return Au({key:f,value:l});{const h=[];for(const y in l)h.push(...Au({key:`${f}.${y}`,value:l[y]}));return h}}};function Jc(f){const l=f.value,h=f.key,y=f.styleSpec,S=f.style;if(!l.type)return[new Ze(h,l,'"type" is required')];const R=Gt(l.type);let D;switch(R){case"vector":case"raster":case"raster-dem":return D=ya({key:h,value:l,valueSpec:y[`source_${R.replace("-","_")}`],style:f.style,styleSpec:y,objectElementValidators:j0}),D;case"geojson":if(D=ya({key:h,value:l,valueSpec:y.source_geojson,style:S,styleSpec:y,objectElementValidators:j0}),l.cluster)for(const $ in l.clusterProperties){const[U,W]=l.clusterProperties[$],te=typeof U=="string"?[U,["accumulated"],["get",$]]:U;D.push(...Dl({key:`${h}.${$}.map`,value:W,expressionContext:"cluster-map"})),D.push(...Dl({key:`${h}.${$}.reduce`,value:te,expressionContext:"cluster-reduce"}))}return D;case"video":return ya({key:h,value:l,valueSpec:y.source_video,style:S,styleSpec:y});case"image":return ya({key:h,value:l,valueSpec:y.source_image,style:S,styleSpec:y});case"canvas":return[new Ze(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qc({key:`${h}.type`,value:l.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:S,styleSpec:y})}}function ed(f){const l=f.value,h=f.styleSpec,y=h.light,S=f.style;let R=[];const D=mr(l);if(l===void 0)return R;if(D!=="object")return R=R.concat([new Ze("light",l,`object expected, ${D} found`)]),R;for(const $ in l){const U=$.match(/^(.*)-transition$/);R=R.concat(U&&y[U[1]]&&y[U[1]].transition?Fo({key:$,value:l[$],valueSpec:h.transition,style:S,styleSpec:h}):y[$]?Fo({key:$,value:l[$],valueSpec:y[$],style:S,styleSpec:h}):[new Ze($,l[$],`unknown property "${$}"`)])}return R}function Lo(f){const l=f.value,h=f.styleSpec,y=h.terrain,S=f.style;let R=[];const D=mr(l);if(l===void 0)return R;if(D!=="object")return R=R.concat([new Ze("terrain",l,`object expected, ${D} found`)]),R;for(const $ in l)R=R.concat(y[$]?Fo({key:$,value:l[$],valueSpec:y[$],style:S,styleSpec:h}):[new Ze($,l[$],`unknown property "${$}"`)]);return R}const td={"*":()=>[],array:N0,boolean:function(f){const l=f.value,h=f.key,y=mr(l);return y!=="boolean"?[new Ze(h,l,`boolean expected, ${y} found`)]:[]},number:Zp,color:function(f){const l=f.key,h=f.value,y=mr(h);return y!=="string"?[new Ze(l,h,`color expected, ${y} found`)]:tr(h)===null?[new Ze(l,h,`color expected, "${h}" found`)]:[]},constants:Yt,enum:qc,filter:Yc,function:L0,layer:U0,object:ya,source:Jc,light:ed,terrain:Lo,string:Au,formatted:function(f){return Au(f).length===0?[]:Dl(f)},resolvedImage:function(f){return Au(f).length===0?[]:Dl(f)},padding:function(f){const l=f.key,h=f.value;if(mr(h)==="array"){if(h.length<1||h.length>4)return[new Ze(l,h,`padding requires 1 to 4 values; ${h.length} values found`)];const y={type:"number"};let S=[];for(let R=0;R[]}})),f.constants&&(h=h.concat(Yt({key:"constants",value:f.constants,style:f,styleSpec:l}))),H0(h)}function H0(f){return[].concat(f).sort((l,h)=>l.line-h.line)}function ws(f){return function(...l){return H0(f.apply(this,l))}}qs.source=ws(Jc),qs.light=ws(ed),qs.terrain=ws(Lo),qs.layer=ws(U0),qs.filter=ws(Yc),qs.paintProperty=ws(B0),qs.layoutProperty=ws(V0);const nd=qs,Yp=nd.light,Vw=nd.paintProperty,Uw=nd.layoutProperty;function $f(f,l){let h=!1;if(l&&l.length)for(const y of l)f.fire(new Nt(new Error(y.message))),h=!0;return h}class rd{constructor(l,h,y){const S=this.cells=[];if(l instanceof ArrayBuffer){this.arrayBuffer=l;const D=new Int32Array(this.arrayBuffer);l=D[0],this.d=(h=D[1])+2*(y=D[2]);for(let U=0;U=ae[ve+0]&&S>=ae[ve+1])?($[ge]=!0,D.push(te[ge])):$[ge]=!1}}}}_forEachCell(l,h,y,S,R,D,$,U){const W=this._convertToCellCoord(l),te=this._convertToCellCoord(h),ae=this._convertToCellCoord(y),de=this._convertToCellCoord(S);for(let ge=W;ge<=ae;ge++)for(let ve=te;ve<=de;ve++){const Fe=this.d*ve+ge;if((!U||U(this._convertFromCellCoord(ge),this._convertFromCellCoord(ve),this._convertFromCellCoord(ge+1),this._convertFromCellCoord(ve+1)))&&R.call(this,l,h,y,S,Fe,D,$,U))return}}_convertFromCellCoord(l){return(l-this.padding)/this.scale}_convertToCellCoord(l){return Math.max(0,Math.min(this.d-1,Math.floor(l*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const l=this.cells,h=3+this.cells.length+1+1;let y=0;for(let D=0;D=0)continue;const D=f[R];S[R]=Cs[y].shallow.indexOf(R)>=0?D:Ol(D,l)}f instanceof Error&&(S.message=f.message)}if(S.$name)throw new Error("$name property is reserved for worker serialization logic.");return y!=="Object"&&(S.$name=y),S}throw new Error("can't serialize object of type "+typeof f)}function Zs(f){if(f==null||typeof f=="boolean"||typeof f=="number"||typeof f=="string"||f instanceof Boolean||f instanceof Number||f instanceof String||f instanceof Date||f instanceof RegExp||f instanceof Blob||K0(f)||Q(f)||ArrayBuffer.isView(f)||f instanceof ImageData)return f;if(Array.isArray(f))return f.map(Zs);if(typeof f=="object"){const l=f.$name||"Object";if(!Cs[l])throw new Error(`can't deserialize unregistered class ${l}`);const{klass:h}=Cs[l];if(!h)throw new Error(`can't deserialize unregistered class ${l}`);if(h.deserialize)return h.deserialize(f);const y=Object.create(h.prototype);for(const S of Object.keys(f)){if(S==="$name")continue;const R=f[S];y[S]=Cs[l].shallow.indexOf(S)>=0?R:Zs(R)}return y}throw new Error("can't deserialize object of type "+typeof f)}class Qp{constructor(){this.first=!0}update(l,h){const y=Math.floor(l);return this.first?(this.first=!1,this.lastIntegerZoom=y,this.lastIntegerZoomTime=0,this.lastZoom=l,this.lastFloorZoom=y,!0):(this.lastFloorZoom>y?(this.lastIntegerZoom=y+1,this.lastIntegerZoomTime=h):this.lastFloorZoomf>=128&&f<=255,Arabic:f=>f>=1536&&f<=1791,"Arabic Supplement":f=>f>=1872&&f<=1919,"Arabic Extended-A":f=>f>=2208&&f<=2303,"Hangul Jamo":f=>f>=4352&&f<=4607,"Unified Canadian Aboriginal Syllabics":f=>f>=5120&&f<=5759,Khmer:f=>f>=6016&&f<=6143,"Unified Canadian Aboriginal Syllabics Extended":f=>f>=6320&&f<=6399,"General Punctuation":f=>f>=8192&&f<=8303,"Letterlike Symbols":f=>f>=8448&&f<=8527,"Number Forms":f=>f>=8528&&f<=8591,"Miscellaneous Technical":f=>f>=8960&&f<=9215,"Control Pictures":f=>f>=9216&&f<=9279,"Optical Character Recognition":f=>f>=9280&&f<=9311,"Enclosed Alphanumerics":f=>f>=9312&&f<=9471,"Geometric Shapes":f=>f>=9632&&f<=9727,"Miscellaneous Symbols":f=>f>=9728&&f<=9983,"Miscellaneous Symbols and Arrows":f=>f>=11008&&f<=11263,"CJK Radicals Supplement":f=>f>=11904&&f<=12031,"Kangxi Radicals":f=>f>=12032&&f<=12255,"Ideographic Description Characters":f=>f>=12272&&f<=12287,"CJK Symbols and Punctuation":f=>f>=12288&&f<=12351,Hiragana:f=>f>=12352&&f<=12447,Katakana:f=>f>=12448&&f<=12543,Bopomofo:f=>f>=12544&&f<=12591,"Hangul Compatibility Jamo":f=>f>=12592&&f<=12687,Kanbun:f=>f>=12688&&f<=12703,"Bopomofo Extended":f=>f>=12704&&f<=12735,"CJK Strokes":f=>f>=12736&&f<=12783,"Katakana Phonetic Extensions":f=>f>=12784&&f<=12799,"Enclosed CJK Letters and Months":f=>f>=12800&&f<=13055,"CJK Compatibility":f=>f>=13056&&f<=13311,"CJK Unified Ideographs Extension A":f=>f>=13312&&f<=19903,"Yijing Hexagram Symbols":f=>f>=19904&&f<=19967,"CJK Unified Ideographs":f=>f>=19968&&f<=40959,"Yi Syllables":f=>f>=40960&&f<=42127,"Yi Radicals":f=>f>=42128&&f<=42191,"Hangul Jamo Extended-A":f=>f>=43360&&f<=43391,"Hangul Syllables":f=>f>=44032&&f<=55215,"Hangul Jamo Extended-B":f=>f>=55216&&f<=55295,"Private Use Area":f=>f>=57344&&f<=63743,"CJK Compatibility Ideographs":f=>f>=63744&&f<=64255,"Arabic Presentation Forms-A":f=>f>=64336&&f<=65023,"Vertical Forms":f=>f>=65040&&f<=65055,"CJK Compatibility Forms":f=>f>=65072&&f<=65103,"Small Form Variants":f=>f>=65104&&f<=65135,"Arabic Presentation Forms-B":f=>f>=65136&&f<=65279,"Halfwidth and Fullwidth Forms":f=>f>=65280&&f<=65519};function Bf(f){for(const l of f)if(em(l.charCodeAt(0)))return!0;return!1}function jw(f){for(const l of f)if(!Jp(l.charCodeAt(0)))return!1;return!0}function Jp(f){return!(un.Arabic(f)||un["Arabic Supplement"](f)||un["Arabic Extended-A"](f)||un["Arabic Presentation Forms-A"](f)||un["Arabic Presentation Forms-B"](f))}function em(f){return!(f!==746&&f!==747&&(f<4352||!(un["Bopomofo Extended"](f)||un.Bopomofo(f)||un["CJK Compatibility Forms"](f)&&!(f>=65097&&f<=65103)||un["CJK Compatibility Ideographs"](f)||un["CJK Compatibility"](f)||un["CJK Radicals Supplement"](f)||un["CJK Strokes"](f)||!(!un["CJK Symbols and Punctuation"](f)||f>=12296&&f<=12305||f>=12308&&f<=12319||f===12336)||un["CJK Unified Ideographs Extension A"](f)||un["CJK Unified Ideographs"](f)||un["Enclosed CJK Letters and Months"](f)||un["Hangul Compatibility Jamo"](f)||un["Hangul Jamo Extended-A"](f)||un["Hangul Jamo Extended-B"](f)||un["Hangul Jamo"](f)||un["Hangul Syllables"](f)||un.Hiragana(f)||un["Ideographic Description Characters"](f)||un.Kanbun(f)||un["Kangxi Radicals"](f)||un["Katakana Phonetic Extensions"](f)||un.Katakana(f)&&f!==12540||!(!un["Halfwidth and Fullwidth Forms"](f)||f===65288||f===65289||f===65293||f>=65306&&f<=65310||f===65339||f===65341||f===65343||f>=65371&&f<=65503||f===65507||f>=65512&&f<=65519)||!(!un["Small Form Variants"](f)||f>=65112&&f<=65118||f>=65123&&f<=65126)||un["Unified Canadian Aboriginal Syllabics"](f)||un["Unified Canadian Aboriginal Syllabics Extended"](f)||un["Vertical Forms"](f)||un["Yijing Hexagram Symbols"](f)||un["Yi Syllables"](f)||un["Yi Radicals"](f))))}function W0(f){return!(em(f)||function(l){return!!(un["Latin-1 Supplement"](l)&&(l===167||l===169||l===174||l===177||l===188||l===189||l===190||l===215||l===247)||un["General Punctuation"](l)&&(l===8214||l===8224||l===8225||l===8240||l===8241||l===8251||l===8252||l===8258||l===8263||l===8264||l===8265||l===8273)||un["Letterlike Symbols"](l)||un["Number Forms"](l)||un["Miscellaneous Technical"](l)&&(l>=8960&&l<=8967||l>=8972&&l<=8991||l>=8996&&l<=9e3||l===9003||l>=9085&&l<=9114||l>=9150&&l<=9165||l===9167||l>=9169&&l<=9179||l>=9186&&l<=9215)||un["Control Pictures"](l)&&l!==9251||un["Optical Character Recognition"](l)||un["Enclosed Alphanumerics"](l)||un["Geometric Shapes"](l)||un["Miscellaneous Symbols"](l)&&!(l>=9754&&l<=9759)||un["Miscellaneous Symbols and Arrows"](l)&&(l>=11026&&l<=11055||l>=11088&&l<=11097||l>=11192&&l<=11243)||un["CJK Symbols and Punctuation"](l)||un.Katakana(l)||un["Private Use Area"](l)||un["CJK Compatibility Forms"](l)||un["Small Form Variants"](l)||un["Halfwidth and Fullwidth Forms"](l)||l===8734||l===8756||l===8757||l>=9984&&l<=10087||l>=10102&&l<=10131||l===65532||l===65533)}(f))}function G0(f){return f>=1424&&f<=2303||un["Arabic Presentation Forms-A"](f)||un["Arabic Presentation Forms-B"](f)}function Hw(f,l){return!(!l&&G0(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||un.Khmer(f))}function q0(f){for(const l of f)if(G0(l.charCodeAt(0)))return!0;return!1}const tm="deferred",nm="loading",rm="loaded";let im=null,xo="unavailable",Xs=null;const Z0=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(xo="error"),im&&im(f)};function Du(){om.fire(new Dt("pluginStateChange",{pluginStatus:xo,pluginURL:Xs}))}const om=new jt,id=function(){return xo},X0=function(){if(xo!==tm||!Xs)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");xo=nm,Du(),Xs&&ct({url:Xs},f=>{f?Z0(f):(xo=rm,Du())})},ea={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>xo===rm||ea.applyArabicShaping!=null,isLoading:()=>xo===nm,setState(f){if(!B())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");xo=f.pluginStatus,Xs=f.pluginURL},isParsed(){if(!B())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return ea.applyArabicShaping!=null&&ea.processBidirectionalText!=null&&ea.processStyledBidirectionalText!=null},getPluginURL(){if(!B())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Xs}};class Hr{constructor(l,h){this.zoom=l,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Qp,this.transition={})}isSupportedScript(l){return function(h,y){for(const S of h)if(!Hw(S.charCodeAt(0),y))return!1;return!0}(l,ea.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const l=this.zoom,h=l-Math.floor(l),y=this.crossFadingFactor();return l>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*y}:{fromScale:.5,toScale:1,t:1-(1-y)*h}}}class od{constructor(l,h){this.property=l,this.value=h,this.expression=function(y,S){if(Rr(y))return new Nf(y,S);if(Kc(y)){const R=O0(y,S);if(R.result==="error")throw new Error(R.value.map(D=>`${D.key}: ${D.message}`).join(", "));return R.value}{let R=y;return S.type==="color"&&typeof y=="string"?R=ce.parse(y):S.type!=="padding"||typeof y!="number"&&!Array.isArray(y)||(R=Me.parse(y)),{kind:"constant",evaluate:()=>R}}}(h===void 0?l.specification.default:h,l.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(l,h,y){return this.property.possiblyEvaluate(this,l,h,y)}}class Vf{constructor(l){this.property=l,this.value=new od(l,void 0)}transitioned(l,h){return new Q0(this.property,this.value,h,_({},l.transition,this.transition),l.now)}untransitioned(){return new Q0(this.property,this.value,null,{},0)}}class Y0{constructor(l){this._properties=l,this._values=Object.create(l.defaultTransitionablePropertyValues)}getValue(l){return O(this._values[l].value.value)}setValue(l,h){Object.prototype.hasOwnProperty.call(this._values,l)||(this._values[l]=new Vf(this._values[l].property)),this._values[l].value=new od(this._values[l].property,h===null?void 0:O(h))}getTransition(l){return O(this._values[l].transition)}setTransition(l,h){Object.prototype.hasOwnProperty.call(this._values,l)||(this._values[l]=new Vf(this._values[l].property)),this._values[l].transition=O(h)||void 0}serialize(){const l={};for(const h of Object.keys(this._values)){const y=this.getValue(h);y!==void 0&&(l[h]=y);const S=this.getTransition(h);S!==void 0&&(l[`${h}-transition`]=S)}return l}transitioned(l,h){const y=new J0(this._properties);for(const S of Object.keys(this._values))y._values[S]=this._values[S].transitioned(l,h._values[S]);return y}untransitioned(){const l=new J0(this._properties);for(const h of Object.keys(this._values))l._values[h]=this._values[h].untransitioned();return l}}class Q0{constructor(l,h,y,S,R){this.property=l,this.value=h,this.begin=R+S.delay||0,this.end=this.begin+S.duration||0,l.specification.transition&&(S.delay||S.duration)&&(this.prior=y)}possiblyEvaluate(l,h,y){const S=l.now||0,R=this.value.possiblyEvaluate(l,h,y),D=this.prior;if(D){if(S>this.end)return this.prior=null,R;if(this.value.isDataDriven())return this.prior=null,R;if(S=1)return 1;const W=U*U,te=W*U;return 4*(U<.5?te:3*(U-W)+te-.75)}($))}}return R}}class J0{constructor(l){this._properties=l,this._values=Object.create(l.defaultTransitioningPropertyValues)}possiblyEvaluate(l,h,y){const S=new ad(this._properties);for(const R of Object.keys(this._values))S._values[R]=this._values[R].possiblyEvaluate(l,h,y);return S}hasTransition(){for(const l of Object.keys(this._values))if(this._values[l].prior)return!0;return!1}}class Kw{constructor(l){this._properties=l,this._values=Object.create(l.defaultPropertyValues)}getValue(l){return O(this._values[l].value)}setValue(l,h){this._values[l]=new od(this._values[l].property,h===null?void 0:O(h))}serialize(){const l={};for(const h of Object.keys(this._values)){const y=this.getValue(h);y!==void 0&&(l[h]=y)}return l}possiblyEvaluate(l,h,y){const S=new ad(this._properties);for(const R of Object.keys(this._values))S._values[R]=this._values[R].possiblyEvaluate(l,h,y);return S}}class ja{constructor(l,h,y){this.property=l,this.value=h,this.parameters=y}isConstant(){return this.value.kind==="constant"}constantOr(l){return this.value.kind==="constant"?this.value.value:l}evaluate(l,h,y,S){return this.property.evaluate(this.value,this.parameters,l,h,y,S)}}class ad{constructor(l){this._properties=l,this._values=Object.create(l.defaultPossiblyEvaluatedValues)}get(l){return this._values[l]}}class wn{constructor(l){this.specification=l}possiblyEvaluate(l,h){if(l.isDataDriven())throw new Error("Value should not be data driven");return l.expression.evaluate(h)}interpolate(l,h,y){const S=_s[this.specification.type];return S?S(l,h,y):l}}class Dn{constructor(l,h){this.specification=l,this.overrides=h}possiblyEvaluate(l,h,y,S){return new ja(this,l.expression.kind==="constant"||l.expression.kind==="camera"?{kind:"constant",value:l.expression.evaluate(h,null,{},y,S)}:l.expression,h)}interpolate(l,h,y){if(l.value.kind!=="constant"||h.value.kind!=="constant")return l;if(l.value.value===void 0||h.value.value===void 0)return new ja(this,{kind:"constant",value:void 0},l.parameters);const S=_s[this.specification.type];return S?new ja(this,{kind:"constant",value:S(l.value.value,h.value.value,y)},l.parameters):l}evaluate(l,h,y,S,R,D){return l.kind==="constant"?l.value:l.evaluate(h,y,S,R,D)}}class Ou extends Dn{possiblyEvaluate(l,h,y,S){if(l.value===void 0)return new ja(this,{kind:"constant",value:void 0},h);if(l.expression.kind==="constant"){const R=l.expression.evaluate(h,null,{},y,S),D=l.property.specification.type==="resolvedImage"&&typeof R!="string"?R.name:R,$=this._calculate(D,D,D,h);return new ja(this,{kind:"constant",value:$},h)}if(l.expression.kind==="camera"){const R=this._calculate(l.expression.evaluate({zoom:h.zoom-1}),l.expression.evaluate({zoom:h.zoom}),l.expression.evaluate({zoom:h.zoom+1}),h);return new ja(this,{kind:"constant",value:R},h)}return new ja(this,l.expression,h)}evaluate(l,h,y,S,R,D){if(l.kind==="source"){const $=l.evaluate(h,y,S,R,D);return this._calculate($,$,$,h)}return l.kind==="composite"?this._calculate(l.evaluate({zoom:Math.floor(h.zoom)-1},y,S),l.evaluate({zoom:Math.floor(h.zoom)},y,S),l.evaluate({zoom:Math.floor(h.zoom)+1},y,S),h):l.value}_calculate(l,h,y,S){return S.zoom>S.zoomHistory.lastIntegerZoom?{from:l,to:h}:{from:y,to:h}}interpolate(l){return l}}class am{constructor(l){this.specification=l}possiblyEvaluate(l,h,y,S){if(l.value!==void 0){if(l.expression.kind==="constant"){const R=l.expression.evaluate(h,null,{},y,S);return this._calculate(R,R,R,h)}return this._calculate(l.expression.evaluate(new Hr(Math.floor(h.zoom-1),h)),l.expression.evaluate(new Hr(Math.floor(h.zoom),h)),l.expression.evaluate(new Hr(Math.floor(h.zoom+1),h)),h)}}_calculate(l,h,y,S){return S.zoom>S.zoomHistory.lastIntegerZoom?{from:l,to:h}:{from:y,to:h}}interpolate(l){return l}}class Ys{constructor(l){this.specification=l}possiblyEvaluate(l,h,y,S){return!!l.expression.evaluate(h,null,{},y,S)}interpolate(){return!1}}class ji{constructor(l){this.properties=l,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in l){const y=l[h];y.specification.overridable&&this.overridableProperties.push(h);const S=this.defaultPropertyValues[h]=new od(y,void 0),R=this.defaultTransitionablePropertyValues[h]=new Vf(y);this.defaultTransitioningPropertyValues[h]=R.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=S.possiblyEvaluate({})}}}yn("DataDrivenProperty",Dn),yn("DataConstantProperty",wn),yn("CrossFadedDataDrivenProperty",Ou),yn("CrossFadedProperty",am),yn("ColorRampProperty",Ys);const Qs="-transition";class Ha extends jt{constructor(l,h){if(super(),this.id=l.id,this.type=l.type,this._featureFilter={filter:()=>!0,needGeometry:!1},l.type!=="custom"&&(this.metadata=l.metadata,this.minzoom=l.minzoom,this.maxzoom=l.maxzoom,l.type!=="background"&&(this.source=l.source,this.sourceLayer=l["source-layer"],this.filter=l.filter),h.layout&&(this._unevaluatedLayout=new Kw(h.layout)),h.paint)){this._transitionablePaint=new Y0(h.paint);for(const y in l.paint)this.setPaintProperty(y,l.paint[y],{validate:!1});for(const y in l.layout)this.setLayoutProperty(y,l.layout[y],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ad(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(l){return l==="visibility"?this.visibility:this._unevaluatedLayout.getValue(l)}setLayoutProperty(l,h,y={}){h!=null&&this._validate(Uw,`layers.${this.id}.layout.${l}`,l,h,y)||(l!=="visibility"?this._unevaluatedLayout.setValue(l,h):this.visibility=h)}getPaintProperty(l){return l.endsWith(Qs)?this._transitionablePaint.getTransition(l.slice(0,-Qs.length)):this._transitionablePaint.getValue(l)}setPaintProperty(l,h,y={}){if(h!=null&&this._validate(Vw,`layers.${this.id}.paint.${l}`,l,h,y))return!1;if(l.endsWith(Qs))return this._transitionablePaint.setTransition(l.slice(0,-Qs.length),h||void 0),!1;{const S=this._transitionablePaint._values[l],R=S.property.specification["property-type"]==="cross-faded-data-driven",D=S.value.isDataDriven(),$=S.value;this._transitionablePaint.setValue(l,h),this._handleSpecialPaintPropertyUpdate(l);const U=this._transitionablePaint._values[l].value;return U.isDataDriven()||D||R||this._handleOverridablePaintPropertyUpdate(l,$,U)}}_handleSpecialPaintPropertyUpdate(l){}_handleOverridablePaintPropertyUpdate(l,h,y){return!1}isHidden(l){return!!(this.minzoom&&l=this.maxzoom)||this.visibility==="none"}updateTransitions(l){this._transitioningPaint=this._transitionablePaint.transitioned(l,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(l,h){l.getCrossfadeParameters&&(this._crossfadeParameters=l.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(l,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(l,void 0,h)}serialize(){const l={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&&(l.layout=l.layout||{},l.layout.visibility=this.visibility),M(l,(h,y)=>!(h===void 0||y==="layout"&&!Object.keys(h).length||y==="paint"&&!Object.keys(h).length))}_validate(l,h,y,S,R={}){return(!R||R.validate!==!1)&&$f(this,l.call(nd,{key:h,layerType:this.type,objectKey:y,value:S,styleSpec:Ve,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const l in this.paint._values){const h=this.paint.get(l);if(h instanceof ja&&zr(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const ey={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Js{constructor(l,h){this._structArray=l,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ii{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(l,h){return l._trim(),h&&(l.isTransferred=!0,h.push(l.arrayBuffer)),{length:l.length,arrayBuffer:l.arrayBuffer}}static deserialize(l){const h=Object.create(this.prototype);return h.arrayBuffer=l.arrayBuffer,h.length=l.length,h.capacity=l.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(l){this.reserve(l),this.length=l}reserve(l){if(l>this.capacity){this.capacity=Math.max(l,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function gi(f,l=1){let h=0,y=0;return{members:f.map(S=>{const R=ey[S.type].BYTES_PER_ELEMENT,D=h=sm(h,Math.max(l,R)),$=S.components||1;return y=Math.max(y,R),h+=R*$,{name:S.name,type:S.type,components:$,offset:D}}),size:sm(h,Math.max(y,l)),alignment:l}}function sm(f,l){return Math.ceil(f/l)*l}class Nl extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,h){const y=this.length;return this.resize(y+1),this.emplace(y,l,h)}emplace(l,h,y){const S=2*l;return this.int16[S+0]=h,this.int16[S+1]=y,l}}Nl.prototype.bytesPerElement=4,yn("StructArrayLayout2i4",Nl);class C extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,h,y,S){const R=this.length;return this.resize(R+1),this.emplace(R,l,h,y,S)}emplace(l,h,y,S,R){const D=4*l;return this.int16[D+0]=h,this.int16[D+1]=y,this.int16[D+2]=S,this.int16[D+3]=R,l}}C.prototype.bytesPerElement=8,yn("StructArrayLayout4i8",C);class c extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,h,y,S,R,D){const $=this.length;return this.resize($+1),this.emplace($,l,h,y,S,R,D)}emplace(l,h,y,S,R,D,$){const U=6*l;return this.int16[U+0]=h,this.int16[U+1]=y,this.int16[U+2]=S,this.int16[U+3]=R,this.int16[U+4]=D,this.int16[U+5]=$,l}}c.prototype.bytesPerElement=12,yn("StructArrayLayout2i4i12",c);class g extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,h,y,S,R,D){const $=this.length;return this.resize($+1),this.emplace($,l,h,y,S,R,D)}emplace(l,h,y,S,R,D,$){const U=4*l,W=8*l;return this.int16[U+0]=h,this.int16[U+1]=y,this.uint8[W+4]=S,this.uint8[W+5]=R,this.uint8[W+6]=D,this.uint8[W+7]=$,l}}g.prototype.bytesPerElement=8,yn("StructArrayLayout2i4ub8",g);class b extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,h){const y=this.length;return this.resize(y+1),this.emplace(y,l,h)}emplace(l,h,y){const S=2*l;return this.float32[S+0]=h,this.float32[S+1]=y,l}}b.prototype.bytesPerElement=8,yn("StructArrayLayout2f8",b);class E extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,h,y,S,R,D,$,U,W,te){const ae=this.length;return this.resize(ae+1),this.emplace(ae,l,h,y,S,R,D,$,U,W,te)}emplace(l,h,y,S,R,D,$,U,W,te,ae){const de=10*l;return this.uint16[de+0]=h,this.uint16[de+1]=y,this.uint16[de+2]=S,this.uint16[de+3]=R,this.uint16[de+4]=D,this.uint16[de+5]=$,this.uint16[de+6]=U,this.uint16[de+7]=W,this.uint16[de+8]=te,this.uint16[de+9]=ae,l}}E.prototype.bytesPerElement=20,yn("StructArrayLayout10ui20",E);class A extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,h,y,S,R,D,$,U,W,te,ae,de){const ge=this.length;return this.resize(ge+1),this.emplace(ge,l,h,y,S,R,D,$,U,W,te,ae,de)}emplace(l,h,y,S,R,D,$,U,W,te,ae,de,ge){const ve=12*l;return this.int16[ve+0]=h,this.int16[ve+1]=y,this.int16[ve+2]=S,this.int16[ve+3]=R,this.uint16[ve+4]=D,this.uint16[ve+5]=$,this.uint16[ve+6]=U,this.uint16[ve+7]=W,this.int16[ve+8]=te,this.int16[ve+9]=ae,this.int16[ve+10]=de,this.int16[ve+11]=ge,l}}A.prototype.bytesPerElement=24,yn("StructArrayLayout4i4ui4i24",A);class z extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,h,y){const S=this.length;return this.resize(S+1),this.emplace(S,l,h,y)}emplace(l,h,y,S){const R=3*l;return this.float32[R+0]=h,this.float32[R+1]=y,this.float32[R+2]=S,l}}z.prototype.bytesPerElement=12,yn("StructArrayLayout3f12",z);class j extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(l){const h=this.length;return this.resize(h+1),this.emplace(h,l)}emplace(l,h){return this.uint32[1*l+0]=h,l}}j.prototype.bytesPerElement=4,yn("StructArrayLayout1ul4",j);class K extends ii{_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(l,h,y,S,R,D,$,U,W){const te=this.length;return this.resize(te+1),this.emplace(te,l,h,y,S,R,D,$,U,W)}emplace(l,h,y,S,R,D,$,U,W,te){const ae=10*l,de=5*l;return this.int16[ae+0]=h,this.int16[ae+1]=y,this.int16[ae+2]=S,this.int16[ae+3]=R,this.int16[ae+4]=D,this.int16[ae+5]=$,this.uint32[de+3]=U,this.uint16[ae+8]=W,this.uint16[ae+9]=te,l}}K.prototype.bytesPerElement=20,yn("StructArrayLayout6i1ul2ui20",K);class Y extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,h,y,S,R,D){const $=this.length;return this.resize($+1),this.emplace($,l,h,y,S,R,D)}emplace(l,h,y,S,R,D,$){const U=6*l;return this.int16[U+0]=h,this.int16[U+1]=y,this.int16[U+2]=S,this.int16[U+3]=R,this.int16[U+4]=D,this.int16[U+5]=$,l}}Y.prototype.bytesPerElement=12,yn("StructArrayLayout2i2i2i12",Y);class ie extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,h,y,S,R){const D=this.length;return this.resize(D+1),this.emplace(D,l,h,y,S,R)}emplace(l,h,y,S,R,D){const $=4*l,U=8*l;return this.float32[$+0]=h,this.float32[$+1]=y,this.float32[$+2]=S,this.int16[U+6]=R,this.int16[U+7]=D,l}}ie.prototype.bytesPerElement=16,yn("StructArrayLayout2f1f2i16",ie);class ue extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,h,y,S){const R=this.length;return this.resize(R+1),this.emplace(R,l,h,y,S)}emplace(l,h,y,S,R){const D=12*l,$=3*l;return this.uint8[D+0]=h,this.uint8[D+1]=y,this.float32[$+1]=S,this.float32[$+2]=R,l}}ue.prototype.bytesPerElement=12,yn("StructArrayLayout2ub2f12",ue);class me extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,h,y){const S=this.length;return this.resize(S+1),this.emplace(S,l,h,y)}emplace(l,h,y,S){const R=3*l;return this.uint16[R+0]=h,this.uint16[R+1]=y,this.uint16[R+2]=S,l}}me.prototype.bytesPerElement=6,yn("StructArrayLayout3ui6",me);class Re extends ii{_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(l,h,y,S,R,D,$,U,W,te,ae,de,ge,ve,Fe,Ne,it){const yt=this.length;return this.resize(yt+1),this.emplace(yt,l,h,y,S,R,D,$,U,W,te,ae,de,ge,ve,Fe,Ne,it)}emplace(l,h,y,S,R,D,$,U,W,te,ae,de,ge,ve,Fe,Ne,it,yt){const Ye=24*l,pt=12*l,Ot=48*l;return this.int16[Ye+0]=h,this.int16[Ye+1]=y,this.uint16[Ye+2]=S,this.uint16[Ye+3]=R,this.uint32[pt+2]=D,this.uint32[pt+3]=$,this.uint32[pt+4]=U,this.uint16[Ye+10]=W,this.uint16[Ye+11]=te,this.uint16[Ye+12]=ae,this.float32[pt+7]=de,this.float32[pt+8]=ge,this.uint8[Ot+36]=ve,this.uint8[Ot+37]=Fe,this.uint8[Ot+38]=Ne,this.uint32[pt+10]=it,this.int16[Ye+22]=yt,l}}Re.prototype.bytesPerElement=48,yn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Re);class Se extends ii{_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(l,h,y,S,R,D,$,U,W,te,ae,de,ge,ve,Fe,Ne,it,yt,Ye,pt,Ot,At,gn,_n,cn,on,en,dn){const an=this.length;return this.resize(an+1),this.emplace(an,l,h,y,S,R,D,$,U,W,te,ae,de,ge,ve,Fe,Ne,it,yt,Ye,pt,Ot,At,gn,_n,cn,on,en,dn)}emplace(l,h,y,S,R,D,$,U,W,te,ae,de,ge,ve,Fe,Ne,it,yt,Ye,pt,Ot,At,gn,_n,cn,on,en,dn,an){const Wt=34*l,Mn=17*l;return this.int16[Wt+0]=h,this.int16[Wt+1]=y,this.int16[Wt+2]=S,this.int16[Wt+3]=R,this.int16[Wt+4]=D,this.int16[Wt+5]=$,this.int16[Wt+6]=U,this.int16[Wt+7]=W,this.uint16[Wt+8]=te,this.uint16[Wt+9]=ae,this.uint16[Wt+10]=de,this.uint16[Wt+11]=ge,this.uint16[Wt+12]=ve,this.uint16[Wt+13]=Fe,this.uint16[Wt+14]=Ne,this.uint16[Wt+15]=it,this.uint16[Wt+16]=yt,this.uint16[Wt+17]=Ye,this.uint16[Wt+18]=pt,this.uint16[Wt+19]=Ot,this.uint16[Wt+20]=At,this.uint16[Wt+21]=gn,this.uint16[Wt+22]=_n,this.uint32[Mn+12]=cn,this.float32[Mn+13]=on,this.float32[Mn+14]=en,this.float32[Mn+15]=dn,this.float32[Mn+16]=an,l}}Se.prototype.bytesPerElement=68,yn("StructArrayLayout8i15ui1ul4f68",Se);class Ie extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l){const h=this.length;return this.resize(h+1),this.emplace(h,l)}emplace(l,h){return this.float32[1*l+0]=h,l}}Ie.prototype.bytesPerElement=4,yn("StructArrayLayout1f4",Ie);class je extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,h,y){const S=this.length;return this.resize(S+1),this.emplace(S,l,h,y)}emplace(l,h,y,S){const R=3*l;return this.int16[R+0]=h,this.int16[R+1]=y,this.int16[R+2]=S,l}}je.prototype.bytesPerElement=6,yn("StructArrayLayout3i6",je);class Xe extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,h,y){const S=this.length;return this.resize(S+1),this.emplace(S,l,h,y)}emplace(l,h,y,S){const R=4*l;return this.uint32[2*l+0]=h,this.uint16[R+2]=y,this.uint16[R+3]=S,l}}Xe.prototype.bytesPerElement=8,yn("StructArrayLayout1ul2ui8",Xe);class st extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,h){const y=this.length;return this.resize(y+1),this.emplace(y,l,h)}emplace(l,h,y){const S=2*l;return this.uint16[S+0]=h,this.uint16[S+1]=y,l}}st.prototype.bytesPerElement=4,yn("StructArrayLayout2ui4",st);class Oe extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l){const h=this.length;return this.resize(h+1),this.emplace(h,l)}emplace(l,h){return this.uint16[1*l+0]=h,l}}Oe.prototype.bytesPerElement=2,yn("StructArrayLayout1ui2",Oe);class vt extends ii{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,h,y,S){const R=this.length;return this.resize(R+1),this.emplace(R,l,h,y,S)}emplace(l,h,y,S,R){const D=4*l;return this.float32[D+0]=h,this.float32[D+1]=y,this.float32[D+2]=S,this.float32[D+3]=R,l}}vt.prototype.bytesPerElement=16,yn("StructArrayLayout4f16",vt);class ft extends Js{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 ne(this.anchorPointX,this.anchorPointY)}}ft.prototype.size=20;class Et extends K{get(l){return new ft(this,l)}}yn("CollisionBoxArray",Et);class It extends Js{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(l){this._structArray.uint8[this._pos1+37]=l}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(l){this._structArray.uint8[this._pos1+38]=l}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(l){this._structArray.uint32[this._pos4+10]=l}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}It.prototype.size=48;class Ht extends Re{get(l){return new It(this,l)}}yn("PlacedSymbolArray",Ht);class Ct extends Js{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(l){this._structArray.uint32[this._pos4+12]=l}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Ct.prototype.size=68;class fn extends Se{get(l){return new Ct(this,l)}}yn("SymbolInstanceArray",fn);class rn extends Ie{getoffsetX(l){return this.float32[1*l+0]}}yn("GlyphOffsetArray",rn);class mn extends je{getx(l){return this.int16[3*l+0]}gety(l){return this.int16[3*l+1]}gettileUnitDistanceFromAnchor(l){return this.int16[3*l+2]}}yn("SymbolLineVertexArray",mn);class Hn extends Js{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]}}Hn.prototype.size=8;class qn extends Xe{get(l){return new Hn(this,l)}}yn("FeatureIndexArray",qn);class kn extends Nl{}class vr extends Nl{}class yr extends Nl{}class sr extends c{}class ur extends g{}class Cr extends b{}class Ri extends E{}class Ka extends A{}class xa extends z{}class Wa extends j{}class el extends Y{}class ta extends ue{}class bo extends me{}class Ss extends st{}const Uf=gi([{name:"a_pos",components:2,type:"Int16"}],4),{members:Si}=Uf;class Jn{constructor(l=[]){this.segments=l}prepareSegment(l,h,y,S){let R=this.segments[this.segments.length-1];return l>Jn.MAX_VERTEX_ARRAY_LENGTH&&L(`Max vertices per segment is ${Jn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${l}`),(!R||R.vertexLength+l>Jn.MAX_VERTEX_ARRAY_LENGTH||R.sortKey!==S)&&(R={vertexOffset:h.length,primitiveOffset:y.length,vertexLength:0,primitiveLength:0},S!==void 0&&(R.sortKey=S),this.segments.push(R)),R}get(){return this.segments}destroy(){for(const l of this.segments)for(const h in l.vaos)l.vaos[h].destroy()}static simpleSegment(l,h,y,S){return new Jn([{vertexOffset:l,primitiveOffset:h,vertexLength:y,primitiveLength:S,vaos:{},sortKey:0}])}}function gr(f,l){return 256*(f=v(Math.floor(f),0,255))+v(Math.floor(l),0,255)}Jn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,yn("SegmentVector",Jn);const Ai=gi([{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 Di={exports:{}},Kr={exports:{}};Kr.exports=function(f,l){var h,y,S,R,D,$,U,W;for(y=f.length-(h=3&f.length),S=l,D=3432918353,$=461845907,W=0;W>>16)*D&65535)<<16)&4294967295)<<15|U>>>17))*$+(((U>>>16)*$&65535)<<16)&4294967295)<<13|S>>>19))+((5*(S>>>16)&65535)<<16)&4294967295))+((58964+(R>>>16)&65535)<<16);switch(U=0,h){case 3:U^=(255&f.charCodeAt(W+2))<<16;case 2:U^=(255&f.charCodeAt(W+1))<<8;case 1:S^=U=(65535&(U=(U=(65535&(U^=255&f.charCodeAt(W)))*D+(((U>>>16)*D&65535)<<16)&4294967295)<<15|U>>>17))*$+(((U>>>16)*$&65535)<<16)&4294967295}return S^=f.length,S=2246822507*(65535&(S^=S>>>16))+((2246822507*(S>>>16)&65535)<<16)&4294967295,S=3266489909*(65535&(S^=S>>>13))+((3266489909*(S>>>16)&65535)<<16)&4294967295,(S^=S>>>16)>>>0};var na={exports:{}};na.exports=function(f,l){for(var h,y=f.length,S=l^y,R=0;y>=4;)h=1540483477*(65535&(h=255&f.charCodeAt(R)|(255&f.charCodeAt(++R))<<8|(255&f.charCodeAt(++R))<<16|(255&f.charCodeAt(++R))<<24))+((1540483477*(h>>>16)&65535)<<16),S=1540483477*(65535&S)+((1540483477*(S>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),y-=4,++R;switch(y){case 3:S^=(255&f.charCodeAt(R+2))<<16;case 2:S^=(255&f.charCodeAt(R+1))<<8;case 1:S=1540483477*(65535&(S^=255&f.charCodeAt(R)))+((1540483477*(S>>>16)&65535)<<16)}return S=1540483477*(65535&(S^=S>>>13))+((1540483477*(S>>>16)&65535)<<16),(S^=S>>>15)>>>0};var Ll=Kr.exports,lm=na.exports;Di.exports=Ll,Di.exports.murmur3=Ll,Di.exports.murmur2=lm;class Nu{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(l,h,y,S){this.ids.push(ty(l)),this.positions.push(h,y,S)}getPositions(l){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=ty(l);let y=0,S=this.ids.length-1;for(;y>1;this.ids[D]>=h?S=D:y=D+1}const R=[];for(;this.ids[y]===h;)R.push({index:this.positions[3*y],start:this.positions[3*y+1],end:this.positions[3*y+2]}),y++;return R}static serialize(l,h){const y=new Float64Array(l.ids),S=new Uint32Array(l.positions);return um(y,S,0,y.length-1),h&&h.push(y.buffer,S.buffer),{ids:y,positions:S}}static deserialize(l){const h=new Nu;return h.ids=l.ids,h.positions=l.positions,h.indexed=!0,h}}function ty(f){const l=+f;return!isNaN(l)&&l<=Number.MAX_SAFE_INTEGER?l:Di.exports(String(f))}function um(f,l,h,y){for(;h>1];let R=h-1,D=y+1;for(;;){do R++;while(f[R]S);if(R>=D)break;tl(f,R,D),tl(l,3*R,3*D),tl(l,3*R+1,3*D+1),tl(l,3*R+2,3*D+2)}D-h`u_${S}`),this.type=y}setUniform(l,h,y){l.set(y.constantOr(this.value))}getBinding(l,h,y){return this.type==="color"?new Ck(l,h):new zl(l,h)}}class Hf{constructor(l,h){this.uniformNames=h.map(y=>`u_${y}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(l,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=l.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=l.tlbr}setUniform(l,h,y,S){const R=S==="u_pattern_to"?this.patternTo:S==="u_pattern_from"?this.patternFrom:S==="u_pixel_ratio_to"?this.pixelRatioTo:S==="u_pixel_ratio_from"?this.pixelRatioFrom:null;R&&l.set(R)}getBinding(l,h,y){return y.substr(0,9)==="u_pattern"?new jf(l,h):new zl(l,h)}}class $l{constructor(l,h,y,S){this.expression=l,this.type=y,this.maxValue=0,this.paintVertexAttributes=h.map(R=>({name:`a_${R}`,type:"Float32",components:y==="color"?2:1,offset:0})),this.paintVertexArray=new S}populatePaintArray(l,h,y,S,R){const D=this.paintVertexArray.length,$=this.expression.evaluate(new Hr(0),h,{},S,[],R);this.paintVertexArray.resize(l),this._setPaintValue(D,l,$)}updatePaintArray(l,h,y,S){const R=this.expression.evaluate({zoom:0},y,S);this._setPaintValue(l,h,R)}_setPaintValue(l,h,y){if(this.type==="color"){const S=Ww(y);for(let R=l;R`u_${$}_t`),this.type=y,this.useIntegerZoom=S,this.zoom=R,this.maxValue=0,this.paintVertexAttributes=h.map($=>({name:`a_${$}`,type:"Float32",components:y==="color"?4:2,offset:0})),this.paintVertexArray=new D}populatePaintArray(l,h,y,S,R){const D=this.expression.evaluate(new Hr(this.zoom),h,{},S,[],R),$=this.expression.evaluate(new Hr(this.zoom+1),h,{},S,[],R),U=this.paintVertexArray.length;this.paintVertexArray.resize(l),this._setPaintValue(U,l,D,$)}updatePaintArray(l,h,y,S){const R=this.expression.evaluate({zoom:this.zoom},y,S),D=this.expression.evaluate({zoom:this.zoom+1},y,S);this._setPaintValue(l,h,R,D)}_setPaintValue(l,h,y,S){if(this.type==="color"){const R=Ww(y),D=Ww(S);for(let $=l;$`#define HAS_UNIFORM_${S}`))}return l}getBinderAttributes(){const l=[];for(const h in this.binders){const y=this.binders[h];if(y instanceof $l||y instanceof Es)for(let S=0;S!0){this.programConfigurations={};for(const S of l)this.programConfigurations[S.id]=new Sk(S,h,y);this.needsUpload=!1,this._featureMap=new Nu,this._bufferOffset=0}populatePaintArrays(l,h,y,S,R,D){for(const $ in this.programConfigurations)this.programConfigurations[$].populatePaintArrays(l,h,S,R,D);h.id!==void 0&&this._featureMap.add(h.id,y,this._bufferOffset,l),this._bufferOffset=l,this.needsUpload=!0}updatePaintArrays(l,h,y,S){for(const R of y)this.needsUpload=this.programConfigurations[R.id].updatePaintArrays(l,this._featureMap,h,R,S)||this.needsUpload}get(l){return this.programConfigurations[l]}upload(l){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(l);this.needsUpload=!1}}destroy(){for(const l in this.programConfigurations)this.programConfigurations[l].destroy()}}function RK(f,l){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"]}[f]||[f.replace(`${l}-`,"").replace(/-/g,"_")]}function Ek(f,l,h){const y={color:{source:b,composite:vt},number:{source:Ie,composite:b}},S=function(R){return{"line-pattern":{source:Ri,composite:Ri},"fill-pattern":{source:Ri,composite:Ri},"fill-extrusion-pattern":{source:Ri,composite:Ri}}[R]}(f);return S&&S[h]||y[l][h]}yn("ConstantBinder",cm),yn("CrossFadedConstantBinder",Hf),yn("SourceExpressionBinder",$l),yn("CrossFadedCompositeBinder",Lu),yn("CompositeExpressionBinder",Es),yn("ProgramConfiguration",Sk,{omit:["_buffers"]}),yn("ProgramConfigurationSet",sd);var Ei=8192;const Gw=Math.pow(2,14)-1,Pk=-Gw-1;function ld(f){const l=Ei/f.extent,h=f.loadGeometry();for(let y=0;yD.x+1||UD.y+1)&&L("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function ud(f,l){return{type:f.type,id:f.id,properties:f.properties,geometry:l?ld(f):[]}}function ny(f,l,h,y,S){f.emplaceBack(2*l+(y+1)/2,2*h+(S+1)/2)}class qw{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(h=>h.id),this.index=l.index,this.hasPattern=!1,this.layoutVertexArray=new vr,this.indexArray=new bo,this.segments=new Jn,this.programConfigurations=new sd(l.layers,l.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(l,h,y){const S=this.layers[0],R=[];let D=null,$=!1;S.type==="circle"&&(D=S.layout.get("circle-sort-key"),$=!D.isConstant());for(const{feature:U,id:W,index:te,sourceLayerIndex:ae}of l){const de=this.layers[0]._featureFilter.needGeometry,ge=ud(U,de);if(!this.layers[0]._featureFilter.filter(new Hr(this.zoom),ge,y))continue;const ve=$?D.evaluate(ge,{},y):void 0,Fe={id:W,properties:U.properties,type:U.type,sourceLayerIndex:ae,index:te,geometry:de?ge.geometry:ld(U),patterns:{},sortKey:ve};R.push(Fe)}$&&R.sort((U,W)=>U.sortKey-W.sortKey);for(const U of R){const{geometry:W,index:te,sourceLayerIndex:ae}=U,de=l[te].feature;this.addFeature(U,W,te,y),h.featureIndex.insert(de,W,te,ae,this.index)}}update(l,h,y){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,h,this.stateDependentLayers,y)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,Si),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(l,h,y,S){for(const R of h)for(const D of R){const $=D.x,U=D.y;if($<0||$>=Ei||U<0||U>=Ei)continue;const W=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,l.sortKey),te=W.vertexLength;ny(this.layoutVertexArray,$,U,-1,-1),ny(this.layoutVertexArray,$,U,1,-1),ny(this.layoutVertexArray,$,U,1,1),ny(this.layoutVertexArray,$,U,-1,1),this.indexArray.emplaceBack(te,te+1,te+2),this.indexArray.emplaceBack(te,te+3,te+2),W.vertexLength+=4,W.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,y,{},S)}}function Ik(f,l){for(let h=0;h1){if(Zw(f,l))return!0;for(let y=0;y1?h:h.sub(l)._mult(S)._add(l))}function Mk(f,l){let h,y,S,R=!1;for(let D=0;Dl.y!=S.y>l.y&&l.x<(S.x-y.x)*(l.y-y.y)/(S.y-y.y)+y.x&&(R=!R)}return R}function Kf(f,l){let h=!1;for(let y=0,S=f.length-1;yl.y!=D.y>l.y&&l.x<(D.x-R.x)*(l.y-R.y)/(D.y-R.y)+R.x&&(h=!h)}return h}function NK(f,l,h){const y=h[0],S=h[2];if(f.xS.x&&l.x>S.x||f.yS.y&&l.y>S.y)return!1;const R=F(f,l,h[0]);return R!==F(f,l,h[1])||R!==F(f,l,h[2])||R!==F(f,l,h[3])}function dm(f,l,h){const y=l.paint.get(f).value;return y.kind==="constant"?y.value:h.programConfigurations.get(l.id).getMaxValue(f)}function ry(f){return Math.sqrt(f[0]*f[0]+f[1]*f[1])}function iy(f,l,h,y,S){if(!l[0]&&!l[1])return f;const R=ne.convert(l)._mult(S);h==="viewport"&&R._rotate(-y);const D=[];for(let $=0;$f.width||S.height>f.height||h.x>f.width-S.width||h.y>f.height-S.height)throw new RangeError("out of range source coordinates for image copy");if(S.width>l.width||S.height>l.height||y.x>l.width-S.width||y.y>l.height-S.height)throw new RangeError("out of range destination coordinates for image copy");const D=f.data,$=l.data;if(D===$)throw new Error("srcData equals dstData, so image is already copied");for(let U=0;U{l[f.evaluationKey]=U;const W=f.expression.evaluate(l);S.data[D+$+0]=Math.floor(255*W.r/W.a),S.data[D+$+1]=Math.floor(255*W.g/W.a),S.data[D+$+2]=Math.floor(255*W.b/W.a),S.data[D+$+3]=Math.floor(255*W.a)};if(f.clips)for(let D=0,$=0;D80*h){y=R=f[0],S=D=f[1];for(var ve=h;veR&&(R=$),U>D&&(D=U);W=(W=Math.max(R-y,D-S))!==0?32767/W:0}return pm(de,ge,h,y,S,W,0),ge}function Bk(f,l,h,y,S){var R,D;if(S===n4(f,l,h,y)>0)for(R=l;R=l;R-=y)D=jk(R,f[R],f[R+1],D);return D&&ly(D,D.next)&&(gm(D),D=D.next),D}function cd(f,l){if(!f)return f;l||(l=f);var h,y=f;do if(h=!1,y.steiner||!ly(y,y.next)&&fi(y.prev,y,y.next)!==0)y=y.next;else{if(gm(y),(y=l=y.prev)===y.next)break;h=!0}while(h||y!==l);return l}function pm(f,l,h,y,S,R,D){if(f){!D&&R&&function(te,ae,de,ge){var ve=te;do ve.z===0&&(ve.z=e4(ve.x,ve.y,ae,de,ge)),ve.prevZ=ve.prev,ve.nextZ=ve.next,ve=ve.next;while(ve!==te);ve.prevZ.nextZ=null,ve.prevZ=null,function(Fe){var Ne,it,yt,Ye,pt,Ot,At,gn,_n=1;do{for(it=Fe,Fe=null,pt=null,Ot=0;it;){for(Ot++,yt=it,At=0,Ne=0;Ne<_n&&(At++,yt=yt.nextZ);Ne++);for(gn=_n;At>0||gn>0&&yt;)At!==0&&(gn===0||!yt||it.z<=yt.z)?(Ye=it,it=it.nextZ,At--):(Ye=yt,yt=yt.nextZ,gn--),pt?pt.nextZ=Ye:Fe=Ye,Ye.prevZ=pt,pt=Ye;it=yt}pt.nextZ=null,_n*=2}while(Ot>1)}(ve)}(f,y,S,R);for(var $,U,W=f;f.prev!==f.next;)if($=f.prev,U=f.next,R?HK(f,y,S,R):jK(f))l.push($.i/h|0),l.push(f.i/h|0),l.push(U.i/h|0),gm(f),f=U.next,W=U.next;else if((f=U)===W){D?D===1?pm(f=KK(cd(f),l,h),l,h,y,S,R,2):D===2&&WK(f,l,h,y,S,R):pm(cd(f),l,h,y,S,R,1);break}}}function jK(f){var l=f.prev,h=f,y=f.next;if(fi(l,h,y)>=0)return!1;for(var S=l.x,R=h.x,D=y.x,$=l.y,U=h.y,W=y.y,te=SR?S>D?S:D:R>D?R:D,ge=$>U?$>W?$:W:U>W?U:W,ve=y.next;ve!==l;){if(ve.x>=te&&ve.x<=de&&ve.y>=ae&&ve.y<=ge&&Wf(S,$,R,U,D,W,ve.x,ve.y)&&fi(ve.prev,ve,ve.next)>=0)return!1;ve=ve.next}return!0}function HK(f,l,h,y){var S=f.prev,R=f,D=f.next;if(fi(S,R,D)>=0)return!1;for(var $=S.x,U=R.x,W=D.x,te=S.y,ae=R.y,de=D.y,ge=$U?$>W?$:W:U>W?U:W,Ne=te>ae?te>de?te:de:ae>de?ae:de,it=e4(ge,ve,l,h,y),yt=e4(Fe,Ne,l,h,y),Ye=f.prevZ,pt=f.nextZ;Ye&&Ye.z>=it&&pt&&pt.z<=yt;){if(Ye.x>=ge&&Ye.x<=Fe&&Ye.y>=ve&&Ye.y<=Ne&&Ye!==S&&Ye!==D&&Wf($,te,U,ae,W,de,Ye.x,Ye.y)&&fi(Ye.prev,Ye,Ye.next)>=0||(Ye=Ye.prevZ,pt.x>=ge&&pt.x<=Fe&&pt.y>=ve&&pt.y<=Ne&&pt!==S&&pt!==D&&Wf($,te,U,ae,W,de,pt.x,pt.y)&&fi(pt.prev,pt,pt.next)>=0))return!1;pt=pt.nextZ}for(;Ye&&Ye.z>=it;){if(Ye.x>=ge&&Ye.x<=Fe&&Ye.y>=ve&&Ye.y<=Ne&&Ye!==S&&Ye!==D&&Wf($,te,U,ae,W,de,Ye.x,Ye.y)&&fi(Ye.prev,Ye,Ye.next)>=0)return!1;Ye=Ye.prevZ}for(;pt&&pt.z<=yt;){if(pt.x>=ge&&pt.x<=Fe&&pt.y>=ve&&pt.y<=Ne&&pt!==S&&pt!==D&&Wf($,te,U,ae,W,de,pt.x,pt.y)&&fi(pt.prev,pt,pt.next)>=0)return!1;pt=pt.nextZ}return!0}function KK(f,l,h){var y=f;do{var S=y.prev,R=y.next.next;!ly(S,R)&&Vk(S,y,y.next,R)&&mm(S,R)&&mm(R,S)&&(l.push(S.i/h|0),l.push(y.i/h|0),l.push(R.i/h|0),gm(y),gm(y.next),y=f=R),y=y.next}while(y!==f);return cd(y)}function WK(f,l,h,y,S,R){var D=f;do{for(var $=D.next.next;$!==D.prev;){if(D.i!==$.i&&YK(D,$)){var U=Uk(D,$);return D=cd(D,D.next),U=cd(U,U.next),pm(D,l,h,y,S,R,0),void pm(U,l,h,y,S,R,0)}$=$.next}D=D.next}while(D!==f)}function GK(f,l){return f.x-l.x}function qK(f,l){var h=function(S,R){var D,$=R,U=S.x,W=S.y,te=-1/0;do{if(W<=$.y&&W>=$.next.y&&$.next.y!==$.y){var ae=$.x+(W-$.y)*($.next.x-$.x)/($.next.y-$.y);if(ae<=U&&ae>te&&(te=ae,D=$.x<$.next.x?$:$.next,ae===U))return D}$=$.next}while($!==R);if(!D)return null;var de,ge=D,ve=D.x,Fe=D.y,Ne=1/0;$=D;do U>=$.x&&$.x>=ve&&U!==$.x&&Wf(WD.x||$.x===D.x&&ZK(D,$)))&&(D=$,Ne=de)),$=$.next;while($!==ge);return D}(f,l);if(!h)return l;var y=Uk(h,f);return cd(y,y.next),cd(h,h.next)}function ZK(f,l){return fi(f.prev,f,l.prev)<0&&fi(l.next,f,f.next)<0}function e4(f,l,h,y,S){return(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-h)*S|0)|f<<8))|f<<4))|f<<2))|f<<1))|(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-y)*S|0)|l<<8))|l<<4))|l<<2))|l<<1))<<1}function XK(f){var l=f,h=f;do(l.x=(f-D)*(R-$)&&(f-D)*(y-$)>=(h-D)*(l-$)&&(h-D)*(R-$)>=(S-D)*(y-$)}function YK(f,l){return f.next.i!==l.i&&f.prev.i!==l.i&&!function(h,y){var S=h;do{if(S.i!==h.i&&S.next.i!==h.i&&S.i!==y.i&&S.next.i!==y.i&&Vk(S,S.next,h,y))return!0;S=S.next}while(S!==h);return!1}(f,l)&&(mm(f,l)&&mm(l,f)&&function(h,y){var S=h,R=!1,D=(h.x+y.x)/2,$=(h.y+y.y)/2;do S.y>$!=S.next.y>$&&S.next.y!==S.y&&D<(S.next.x-S.x)*($-S.y)/(S.next.y-S.y)+S.x&&(R=!R),S=S.next;while(S!==h);return R}(f,l)&&(fi(f.prev,f,l.prev)||fi(f,l.prev,l))||ly(f,l)&&fi(f.prev,f,f.next)>0&&fi(l.prev,l,l.next)>0)}function fi(f,l,h){return(l.y-f.y)*(h.x-l.x)-(l.x-f.x)*(h.y-l.y)}function ly(f,l){return f.x===l.x&&f.y===l.y}function Vk(f,l,h,y){var S=cy(fi(f,l,h)),R=cy(fi(f,l,y)),D=cy(fi(h,y,f)),$=cy(fi(h,y,l));return S!==R&&D!==$||!(S!==0||!uy(f,h,l))||!(R!==0||!uy(f,y,l))||!(D!==0||!uy(h,f,y))||!($!==0||!uy(h,l,y))}function uy(f,l,h){return l.x<=Math.max(f.x,h.x)&&l.x>=Math.min(f.x,h.x)&&l.y<=Math.max(f.y,h.y)&&l.y>=Math.min(f.y,h.y)}function cy(f){return f>0?1:f<0?-1:0}function mm(f,l){return fi(f.prev,f,f.next)<0?fi(f,l,f.next)>=0&&fi(f,f.prev,l)>=0:fi(f,l,f.prev)<0||fi(f,f.next,l)<0}function Uk(f,l){var h=new t4(f.i,f.x,f.y),y=new t4(l.i,l.x,l.y),S=f.next,R=l.prev;return f.next=l,l.prev=f,h.next=S,S.prev=h,y.next=h,h.prev=y,R.next=y,y.prev=R,y}function jk(f,l,h,y){var S=new t4(f,l,h);return y?(S.next=y.next,S.prev=y,y.next.prev=S,y.next=S):(S.prev=S,S.next=S),S}function gm(f){f.next.prev=f.prev,f.prev.next=f.next,f.prevZ&&(f.prevZ.nextZ=f.nextZ),f.nextZ&&(f.nextZ.prevZ=f.prevZ)}function t4(f,l,h){this.i=f,this.x=l,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function n4(f,l,h,y){for(var S=0,R=l,D=h-y;Rh;){if(y-h>600){var R=y-h+1,D=l-h+1,$=Math.log(R),U=.5*Math.exp(2*$/3),W=.5*Math.sqrt($*U*(R-U)/R)*(D-R/2<0?-1:1);Hk(f,l,Math.max(h,Math.floor(l-D*U/R+W)),Math.min(y,Math.floor(l+(R-D)*U/R+W)),S)}var te=f[l],ae=h,de=y;for(vm(f,h,l),S(f[y],te)>0&&vm(f,h,y);ae0;)de--}S(f[h],te)===0?vm(f,h,de):vm(f,++de,y),de<=l&&(h=de+1),l<=de&&(y=de-1)}}function vm(f,l,h){var y=f[l];f[l]=f[h],f[h]=y}function JK(f,l){return fl?1:0}function r4(f,l){const h=f.length;if(h<=1)return[f];const y=[];let S,R;for(let D=0;D1)for(let D=0;D0&&h.holes.push(y+=f[S-1].length)}return h};class a4{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(h=>h.id),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new yr,this.indexArray=new bo,this.indexArray2=new Ss,this.programConfigurations=new sd(l.layers,l.zoom),this.segments=new Jn,this.segments2=new Jn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(l,h,y){this.hasPattern=i4("fill",this.layers,h);const S=this.layers[0].layout.get("fill-sort-key"),R=!S.isConstant(),D=[];for(const{feature:$,id:U,index:W,sourceLayerIndex:te}of l){const ae=this.layers[0]._featureFilter.needGeometry,de=ud($,ae);if(!this.layers[0]._featureFilter.filter(new Hr(this.zoom),de,y))continue;const ge=R?S.evaluate(de,{},y,h.availableImages):void 0,ve={id:U,properties:$.properties,type:$.type,sourceLayerIndex:te,index:W,geometry:ae?de.geometry:ld($),patterns:{},sortKey:ge};D.push(ve)}R&&D.sort(($,U)=>$.sortKey-U.sortKey);for(const $ of D){const{geometry:U,index:W,sourceLayerIndex:te}=$;if(this.hasPattern){const ae=o4("fill",this.layers,$,this.zoom,h);this.patternFeatures.push(ae)}else this.addFeature($,U,W,y,{});h.featureIndex.insert(l[W].feature,U,W,te,this.index)}}update(l,h,y){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,h,this.stateDependentLayers,y)}addFeatures(l,h,y){for(const S of this.patternFeatures)this.addFeature(S,S.geometry,S.index,h,y)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,UK),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.indexBuffer2=l.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(l),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(l,h,y,S,R){for(const D of r4(h,500)){let $=0;for(const ge of D)$+=ge.length;const U=this.segments.prepareSegment($,this.layoutVertexArray,this.indexArray),W=U.vertexLength,te=[],ae=[];for(const ge of D){if(ge.length===0)continue;ge!==D[0]&&ae.push(te.length/2);const ve=this.segments2.prepareSegment(ge.length,this.layoutVertexArray,this.indexArray2),Fe=ve.vertexLength;this.layoutVertexArray.emplaceBack(ge[0].x,ge[0].y),this.indexArray2.emplaceBack(Fe+ge.length-1,Fe),te.push(ge[0].x),te.push(ge[0].y);for(let Ne=1;Ne>3}if(S--,y===1||y===2)R+=f.readSVarint(),D+=f.readSVarint(),y===1&&(l&&$.push(l),l=[]),l.push(new aW(R,D));else{if(y!==7)throw new Error("unknown command "+y);l&&l.push(l[0].clone())}}return l&&$.push(l),$},Gf.prototype.bbox=function(){var f=this._pbf;f.pos=this._geometry;for(var l=f.readVarint()+f.pos,h=1,y=0,S=0,R=0,D=1/0,$=-1/0,U=1/0,W=-1/0;f.pos>3}if(y--,h===1||h===2)(S+=f.readSVarint())$&&($=S),(R+=f.readSVarint())W&&(W=R);else if(h!==7)throw new Error("unknown command "+h)}return[D,U,$,W]},Gf.prototype.toGeoJSON=function(f,l,h){var y,S,R=this.extent*Math.pow(2,h),D=this.extent*f,$=this.extent*l,U=this.loadGeometry(),W=Gf.types[this.type];function te(ge){for(var ve=0;ve>3;S=D===1?y.readString():D===2?y.readFloat():D===3?y.readDouble():D===4?y.readVarint64():D===5?y.readVarint():D===6?y.readSVarint():D===7?y.readBoolean():null}return S}(h))}Gk.prototype.feature=function(f){if(f<0||f>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[f];var l=this._pbf.readVarint()+this._pbf.pos;return new uW(this._pbf,l,this.extent,this._keys,this._values)};var dW=Wk;function fW(f,l,h){if(f===3){var y=new dW(h,h.readVarint()+h.pos);y.length&&(l[y.name]=y)}}Fu.VectorTile=function(f,l){this.layers=f.readFields(fW,{},l)},Fu.VectorTileFeature=Kk,Fu.VectorTileLayer=Wk;const hW=Fu.VectorTileFeature.types,s4=Math.pow(2,13);function ym(f,l,h,y,S,R,D,$){f.emplaceBack(l,h,2*Math.floor(y*s4)+D,S*s4*2,R*s4*2,Math.round($))}class l4{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(h=>h.id),this.index=l.index,this.hasPattern=!1,this.layoutVertexArray=new sr,this.centroidVertexArray=new kn,this.indexArray=new bo,this.programConfigurations=new sd(l.layers,l.zoom),this.segments=new Jn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(l,h,y){this.features=[],this.hasPattern=i4("fill-extrusion",this.layers,h);for(const{feature:S,id:R,index:D,sourceLayerIndex:$}of l){const U=this.layers[0]._featureFilter.needGeometry,W=ud(S,U);if(!this.layers[0]._featureFilter.filter(new Hr(this.zoom),W,y))continue;const te={id:R,sourceLayerIndex:$,index:D,geometry:U?W.geometry:ld(S),properties:S.properties,type:S.type,patterns:{}};this.hasPattern?this.features.push(o4("fill-extrusion",this.layers,te,this.zoom,h)):this.addFeature(te,te.geometry,D,y,{}),h.featureIndex.insert(S,te.geometry,D,$,this.index,!0)}}addFeatures(l,h,y){for(const S of this.features){const{geometry:R}=S;this.addFeature(S,R,S.index,h,y)}}update(l,h,y){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,h,this.stateDependentLayers,y)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,oW),this.centroidVertexBuffer=l.createVertexBuffer(this.centroidVertexArray,iW.members,!0),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(l,h,y,S,R){const D={x:0,y:0,vertexCount:0};for(const $ of r4(h,500)){let U=0;for(const ve of $)U+=ve.length;let W=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const ve of $){if(ve.length===0||mW(ve))continue;let Fe=0;for(let Ne=0;Ne=1){const yt=ve[Ne-1];if(!pW(it,yt)){W.vertexLength+4>Jn.MAX_VERTEX_ARRAY_LENGTH&&(W=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Ye=it.sub(yt)._perp()._unit(),pt=yt.dist(it);Fe+pt>32768&&(Fe=0),ym(this.layoutVertexArray,it.x,it.y,Ye.x,Ye.y,0,0,Fe),ym(this.layoutVertexArray,it.x,it.y,Ye.x,Ye.y,0,1,Fe),D.x+=2*it.x,D.y+=2*it.y,D.vertexCount+=2,Fe+=pt,ym(this.layoutVertexArray,yt.x,yt.y,Ye.x,Ye.y,0,0,Fe),ym(this.layoutVertexArray,yt.x,yt.y,Ye.x,Ye.y,0,1,Fe),D.x+=2*yt.x,D.y+=2*yt.y,D.vertexCount+=2;const Ot=W.vertexLength;this.indexArray.emplaceBack(Ot,Ot+2,Ot+1),this.indexArray.emplaceBack(Ot+1,Ot+2,Ot+3),W.vertexLength+=4,W.primitiveLength+=2}}}}if(W.vertexLength+U>Jn.MAX_VERTEX_ARRAY_LENGTH&&(W=this.segments.prepareSegment(U,this.layoutVertexArray,this.indexArray)),hW[l.type]!=="Polygon")continue;const te=[],ae=[],de=W.vertexLength;for(const ve of $)if(ve.length!==0){ve!==$[0]&&ae.push(te.length/2);for(let Fe=0;FeEi)||f.y===l.y&&(f.y<0||f.y>Ei)}function mW(f){return f.every(l=>l.x<0)||f.every(l=>l.x>Ei)||f.every(l=>l.y<0)||f.every(l=>l.y>Ei)}yn("FillExtrusionBucket",l4,{omit:["layers","features"]});var gW={paint:new ji({"fill-extrusion-opacity":new wn(Ve["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Dn(Ve["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new wn(Ve["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new wn(Ve["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ou(Ve["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Dn(Ve["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Dn(Ve["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new wn(Ve["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function xm(f,l){return f.x*l.x+f.y*l.y}function qk(f,l){if(f.length===1){let h=0;const y=l[h++];let S;for(;!S||y.equals(S);)if(S=l[h++],!S)return 1/0;for(;hh.id),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new ur,this.layoutVertexArray2=new Cr,this.indexArray=new bo,this.programConfigurations=new sd(l.layers,l.zoom),this.segments=new Jn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(l,h,y){this.hasPattern=i4("line",this.layers,h);const S=this.layers[0].layout.get("line-sort-key"),R=!S.isConstant(),D=[];for(const{feature:$,id:U,index:W,sourceLayerIndex:te}of l){const ae=this.layers[0]._featureFilter.needGeometry,de=ud($,ae);if(!this.layers[0]._featureFilter.filter(new Hr(this.zoom),de,y))continue;const ge=R?S.evaluate(de,{},y):void 0,ve={id:U,properties:$.properties,type:$.type,sourceLayerIndex:te,index:W,geometry:ae?de.geometry:ld($),patterns:{},sortKey:ge};D.push(ve)}R&&D.sort(($,U)=>$.sortKey-U.sortKey);for(const $ of D){const{geometry:U,index:W,sourceLayerIndex:te}=$;if(this.hasPattern){const ae=o4("line",this.layers,$,this.zoom,h);this.patternFeatures.push(ae)}else this.addFeature($,U,W,y,{});h.featureIndex.insert(l[W].feature,U,W,te,this.index)}}update(l,h,y){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,h,this.stateDependentLayers,y)}addFeatures(l,h,y){for(const S of this.patternFeatures)this.addFeature(S,S.geometry,S.index,h,y)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=l.createVertexBuffer(this.layoutVertexArray2,bW)),this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,yW),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(l){if(l.properties&&Object.prototype.hasOwnProperty.call(l.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(l.properties,"mapbox_clip_end"))return{start:+l.properties.mapbox_clip_start,end:+l.properties.mapbox_clip_end}}addFeature(l,h,y,S,R){const D=this.layers[0].layout,$=D.get("line-join").evaluate(l,{}),U=D.get("line-cap"),W=D.get("line-miter-limit"),te=D.get("line-round-limit");this.lineClips=this.lineFeatureClips(l);for(const ae of h)this.addLine(ae,l,$,U,W,te);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,y,R,S)}addLine(l,h,y,S,R,D){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let it=0;it=2&&l[U-1].equals(l[U-2]);)U--;let W=0;for(;W0;if(gn&&it>W){const en=de.dist(ge);if(en>2*te){const dn=de.sub(de.sub(ge)._mult(te/en)._round());this.updateDistance(ge,dn),this.addCurrentVertex(dn,Fe,0,0,ae),ge=dn}}const cn=ge&&ve;let on=cn?y:$?"butt":S;if(cn&&on==="round"&&(OtR&&(on="bevel"),on==="bevel"&&(Ot>2&&(on="flipbevel"),Ot100)yt=Ne.mult(-1);else{const en=Ot*Fe.add(Ne).mag()/Fe.sub(Ne).mag();yt._perp()._mult(en*(_n?-1:1))}this.addCurrentVertex(de,yt,0,0,ae),this.addCurrentVertex(de,yt.mult(-1),0,0,ae)}else if(on==="bevel"||on==="fakeround"){const en=-Math.sqrt(Ot*Ot-1),dn=_n?en:0,an=_n?0:en;if(ge&&this.addCurrentVertex(de,Fe,dn,an,ae),on==="fakeround"){const Wt=Math.round(180*At/Math.PI/20);for(let Mn=1;Mn2*te){const dn=de.add(ve.sub(de)._mult(te/en)._round());this.updateDistance(de,dn),this.addCurrentVertex(dn,Ne,0,0,ae),de=dn}}}}addCurrentVertex(l,h,y,S,R,D=!1){const $=h.y*S-h.x,U=-h.y-h.x*S;this.addHalfVertex(l,h.x+h.y*y,h.y-h.x*y,D,!1,y,R),this.addHalfVertex(l,$,U,D,!0,-S,R),this.distance>Zk/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(l,h,y,S,R,D))}addHalfVertex({x:l,y:h},y,S,R,D,$,U){const W=.5*(this.lineClips?this.scaledDistance*(Zk-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((l<<1)+(R?1:0),(h<<1)+(D?1:0),Math.round(63*y)+128,Math.round(63*S)+128,1+($===0?0:$<0?-1:1)|(63&W)<<2,W>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const te=U.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,te),U.primitiveLength++),D?this.e2=te:this.e1=te}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(l,h){this.distance+=l.dist(h),this.updateScaledDistance()}}yn("LineBucket",u4,{omit:["layers","patternFeatures"]});const CW=new ji({"line-cap":new wn(Ve.layout_line["line-cap"]),"line-join":new Dn(Ve.layout_line["line-join"]),"line-miter-limit":new wn(Ve.layout_line["line-miter-limit"]),"line-round-limit":new wn(Ve.layout_line["line-round-limit"]),"line-sort-key":new Dn(Ve.layout_line["line-sort-key"])});var Xk={paint:new ji({"line-opacity":new Dn(Ve.paint_line["line-opacity"]),"line-color":new Dn(Ve.paint_line["line-color"]),"line-translate":new wn(Ve.paint_line["line-translate"]),"line-translate-anchor":new wn(Ve.paint_line["line-translate-anchor"]),"line-width":new Dn(Ve.paint_line["line-width"]),"line-gap-width":new Dn(Ve.paint_line["line-gap-width"]),"line-offset":new Dn(Ve.paint_line["line-offset"]),"line-blur":new Dn(Ve.paint_line["line-blur"]),"line-dasharray":new am(Ve.paint_line["line-dasharray"]),"line-pattern":new Ou(Ve.paint_line["line-pattern"]),"line-gradient":new Ys(Ve.paint_line["line-gradient"])}),layout:CW};const Yk=new class extends Dn{possiblyEvaluate(f,l){return l=new Hr(Math.floor(l.zoom),{now:l.now,fadeDuration:l.fadeDuration,zoomHistory:l.zoomHistory,transition:l.transition}),super.possiblyEvaluate(f,l)}evaluate(f,l,h,y){return l=_({},l,{zoom:Math.floor(l.zoom)}),super.evaluate(f,l,h,y)}}(Xk.paint.properties["line-width"].specification);function Qk(f,l){return l>0?l+2*f:f}Yk.useIntegerZoom=!0;const SW=gi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),EW=gi([{name:"a_projected_pos",components:3,type:"Float32"}],4);gi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const PW=gi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);gi([{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 Jk=gi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),IW=gi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function TW(f,l,h){return f.sections.forEach(y=>{y.text=function(S,R,D){const $=R.layout.get("text-transform").evaluate(D,{});return $==="uppercase"?S=S.toLocaleUpperCase():$==="lowercase"&&(S=S.toLocaleLowerCase()),ea.applyArabicShaping&&(S=ea.applyArabicShaping(S)),S}(y.text,l,h)}),f}gi([{name:"triangle",components:3,type:"Uint16"}]),gi([{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"}]),gi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),gi([{type:"Float32",name:"offsetX"}]),gi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const bm={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var Hi=24,c4=Ir,eM=function(f,l,h,y,S){var R,D,$=8*S-y-1,U=(1<<$)-1,W=U>>1,te=-7,ae=h?S-1:0,de=h?-1:1,ge=f[l+ae];for(ae+=de,R=ge&(1<<-te)-1,ge>>=-te,te+=$;te>0;R=256*R+f[l+ae],ae+=de,te-=8);for(D=R&(1<<-te)-1,R>>=-te,te+=y;te>0;D=256*D+f[l+ae],ae+=de,te-=8);if(R===0)R=1-W;else{if(R===U)return D?NaN:1/0*(ge?-1:1);D+=Math.pow(2,y),R-=W}return(ge?-1:1)*D*Math.pow(2,R-y)},tM=function(f,l,h,y,S,R){var D,$,U,W=8*R-S-1,te=(1<>1,de=S===23?Math.pow(2,-24)-Math.pow(2,-77):0,ge=y?0:R-1,ve=y?1:-1,Fe=l<0||l===0&&1/l<0?1:0;for(l=Math.abs(l),isNaN(l)||l===1/0?($=isNaN(l)?1:0,D=te):(D=Math.floor(Math.log(l)/Math.LN2),l*(U=Math.pow(2,-D))<1&&(D--,U*=2),(l+=D+ae>=1?de/U:de*Math.pow(2,1-ae))*U>=2&&(D++,U/=2),D+ae>=te?($=0,D=te):D+ae>=1?($=(l*U-1)*Math.pow(2,S),D+=ae):($=l*Math.pow(2,ae-1)*Math.pow(2,S),D=0));S>=8;f[h+ge]=255&$,ge+=ve,$/=256,S-=8);for(D=D<0;f[h+ge]=255&D,ge+=ve,D/=256,W-=8);f[h+ge-ve]|=128*Fe};function Ir(f){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(f)?f:new Uint8Array(f||0),this.pos=0,this.type=0,this.length=this.buf.length}Ir.Varint=0,Ir.Fixed64=1,Ir.Bytes=2,Ir.Fixed32=5;var zu,d4=4294967296,nM=1/d4,rM=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Bl(f){return f.type===Ir.Bytes?f.readVarint()+f.pos:f.pos+1}function qf(f,l,h){return h?4294967296*l+(f>>>0):4294967296*(l>>>0)+(f>>>0)}function iM(f,l,h){var y=l<=16383?1:l<=2097151?2:l<=268435455?3:Math.floor(Math.log(l)/(7*Math.LN2));h.realloc(y);for(var S=h.pos-1;S>=f;S--)h.buf[S+y]=h.buf[S]}function kW(f,l){for(var h=0;h>>8,f[h+2]=l>>>16,f[h+3]=l>>>24}function oM(f,l){return(f[l]|f[l+1]<<8|f[l+2]<<16)+(f[l+3]<<24)}function zW(f,l,h){f===1&&h.readMessage($W,l)}function $W(f,l,h){if(f===3){const{id:y,bitmap:S,width:R,height:D,left:$,top:U,advance:W}=h.readMessage(BW,{});l.push({id:y,bitmap:new hm({width:R+6,height:D+6},S),metrics:{width:R,height:D,left:$,top:U,advance:W}})}}function BW(f,l,h){f===1?l.id=h.readVarint():f===2?l.bitmap=h.readBytes():f===3?l.width=h.readVarint():f===4?l.height=h.readVarint():f===5?l.left=h.readSVarint():f===6?l.top=h.readSVarint():f===7&&(l.advance=h.readVarint())}function aM(f){let l=0,h=0;for(const D of f)l+=D.w*D.h,h=Math.max(h,D.w);f.sort((D,$)=>$.h-D.h);const y=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(l/.95)),h),h:1/0}];let S=0,R=0;for(const D of f)for(let $=y.length-1;$>=0;$--){const U=y[$];if(!(D.w>U.w||D.h>U.h)){if(D.x=U.x,D.y=U.y,R=Math.max(R,D.y+D.h),S=Math.max(S,D.x+D.w),D.w===U.w&&D.h===U.h){const W=y.pop();$>3,R=this.pos;this.type=7&y,f(S,l,this),this.pos===R&&this.skip(y)}return l},readMessage:function(f,l){return this.readFields(f,l,this.readVarint()+this.pos)},readFixed32:function(){var f=dy(this.buf,this.pos);return this.pos+=4,f},readSFixed32:function(){var f=oM(this.buf,this.pos);return this.pos+=4,f},readFixed64:function(){var f=dy(this.buf,this.pos)+dy(this.buf,this.pos+4)*d4;return this.pos+=8,f},readSFixed64:function(){var f=dy(this.buf,this.pos)+oM(this.buf,this.pos+4)*d4;return this.pos+=8,f},readFloat:function(){var f=eM(this.buf,this.pos,!0,23,4);return this.pos+=4,f},readDouble:function(){var f=eM(this.buf,this.pos,!0,52,8);return this.pos+=8,f},readVarint:function(f){var l,h,y=this.buf;return l=127&(h=y[this.pos++]),h<128?l:(l|=(127&(h=y[this.pos++]))<<7,h<128?l:(l|=(127&(h=y[this.pos++]))<<14,h<128?l:(l|=(127&(h=y[this.pos++]))<<21,h<128?l:function(S,R,D){var $,U,W=D.buf;if($=(112&(U=W[D.pos++]))>>4,U<128||($|=(127&(U=W[D.pos++]))<<3,U<128)||($|=(127&(U=W[D.pos++]))<<10,U<128)||($|=(127&(U=W[D.pos++]))<<17,U<128)||($|=(127&(U=W[D.pos++]))<<24,U<128)||($|=(1&(U=W[D.pos++]))<<31,U<128))return qf(S,$,R);throw new Error("Expected varint not more than 10 bytes")}(l|=(15&(h=y[this.pos]))<<28,f,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var f=this.readVarint();return f%2==1?(f+1)/-2:f/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var f=this.readVarint()+this.pos,l=this.pos;return this.pos=f,f-l>=12&&rM?function(h,y,S){return rM.decode(h.subarray(y,S))}(this.buf,l,f):function(h,y,S){for(var R="",D=y;D239?4:te>223?3:te>191?2:1;if(D+de>S)break;de===1?te<128&&(ae=te):de===2?(192&($=h[D+1]))==128&&(ae=(31&te)<<6|63&$)<=127&&(ae=null):de===3?(U=h[D+2],(192&($=h[D+1]))==128&&(192&U)==128&&((ae=(15&te)<<12|(63&$)<<6|63&U)<=2047||ae>=55296&&ae<=57343)&&(ae=null)):de===4&&(U=h[D+2],W=h[D+3],(192&($=h[D+1]))==128&&(192&U)==128&&(192&W)==128&&((ae=(15&te)<<18|(63&$)<<12|(63&U)<<6|63&W)<=65535||ae>=1114112)&&(ae=null)),ae===null?(ae=65533,de=1):ae>65535&&(ae-=65536,R+=String.fromCharCode(ae>>>10&1023|55296),ae=56320|1023&ae),R+=String.fromCharCode(ae),D+=de}return R}(this.buf,l,f)},readBytes:function(){var f=this.readVarint()+this.pos,l=this.buf.subarray(this.pos,f);return this.pos=f,l},readPackedVarint:function(f,l){if(this.type!==Ir.Bytes)return f.push(this.readVarint(l));var h=Bl(this);for(f=f||[];this.pos127;);else if(l===Ir.Bytes)this.pos=this.readVarint()+this.pos;else if(l===Ir.Fixed32)this.pos+=4;else{if(l!==Ir.Fixed64)throw new Error("Unimplemented type: "+l);this.pos+=8}},writeTag:function(f,l){this.writeVarint(f<<3|l)},realloc:function(f){for(var l=this.length||16;l268435455||f<0?function(l,h){var y,S;if(l>=0?(y=l%4294967296|0,S=l/4294967296|0):(S=~(-l/4294967296),4294967295^(y=~(-l%4294967296))?y=y+1|0:(y=0,S=S+1|0)),l>=18446744073709552e3||l<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(R,D,$){$.buf[$.pos++]=127&R|128,R>>>=7,$.buf[$.pos++]=127&R|128,R>>>=7,$.buf[$.pos++]=127&R|128,R>>>=7,$.buf[$.pos++]=127&R|128,$.buf[$.pos]=127&(R>>>=7)}(y,0,h),function(R,D){var $=(7&R)<<4;D.buf[D.pos++]|=$|((R>>>=3)?128:0),R&&(D.buf[D.pos++]=127&R|((R>>>=7)?128:0),R&&(D.buf[D.pos++]=127&R|((R>>>=7)?128:0),R&&(D.buf[D.pos++]=127&R|((R>>>=7)?128:0),R&&(D.buf[D.pos++]=127&R|((R>>>=7)?128:0),R&&(D.buf[D.pos++]=127&R)))))}(S,h)}(f,this):(this.realloc(4),this.buf[this.pos++]=127&f|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=f>>>7&127))))},writeSVarint:function(f){this.writeVarint(f<0?2*-f-1:2*f)},writeBoolean:function(f){this.writeVarint(Boolean(f))},writeString:function(f){f=String(f),this.realloc(4*f.length),this.pos++;var l=this.pos;this.pos=function(y,S,R){for(var D,$,U=0;U55295&&D<57344){if(!$){D>56319||U+1===S.length?(y[R++]=239,y[R++]=191,y[R++]=189):$=D;continue}if(D<56320){y[R++]=239,y[R++]=191,y[R++]=189,$=D;continue}D=$-55296<<10|D-56320|65536,$=null}else $&&(y[R++]=239,y[R++]=191,y[R++]=189,$=null);D<128?y[R++]=D:(D<2048?y[R++]=D>>6|192:(D<65536?y[R++]=D>>12|224:(y[R++]=D>>18|240,y[R++]=D>>12&63|128),y[R++]=D>>6&63|128),y[R++]=63&D|128)}return R}(this.buf,f,this.pos);var h=this.pos-l;h>=128&&iM(l,h,this),this.pos=l-1,this.writeVarint(h),this.pos+=h},writeFloat:function(f){this.realloc(4),tM(this.buf,f,this.pos,!0,23,4),this.pos+=4},writeDouble:function(f){this.realloc(8),tM(this.buf,f,this.pos,!0,52,8),this.pos+=8},writeBytes:function(f){var l=f.length;this.writeVarint(l),this.realloc(l);for(var h=0;h=128&&iM(h,y,this),this.pos=h-1,this.writeVarint(y),this.pos+=y},writeMessage:function(f,l,h){this.writeTag(f,Ir.Bytes),this.writeRawMessage(l,h)},writePackedVarint:function(f,l){l.length&&this.writeMessage(f,kW,l)},writePackedSVarint:function(f,l){l.length&&this.writeMessage(f,MW,l)},writePackedBoolean:function(f,l){l.length&&this.writeMessage(f,DW,l)},writePackedFloat:function(f,l){l.length&&this.writeMessage(f,RW,l)},writePackedDouble:function(f,l){l.length&&this.writeMessage(f,AW,l)},writePackedFixed32:function(f,l){l.length&&this.writeMessage(f,OW,l)},writePackedSFixed32:function(f,l){l.length&&this.writeMessage(f,NW,l)},writePackedFixed64:function(f,l){l.length&&this.writeMessage(f,LW,l)},writePackedSFixed64:function(f,l){l.length&&this.writeMessage(f,FW,l)},writeBytesField:function(f,l){this.writeTag(f,Ir.Bytes),this.writeBytes(l)},writeFixed32Field:function(f,l){this.writeTag(f,Ir.Fixed32),this.writeFixed32(l)},writeSFixed32Field:function(f,l){this.writeTag(f,Ir.Fixed32),this.writeSFixed32(l)},writeFixed64Field:function(f,l){this.writeTag(f,Ir.Fixed64),this.writeFixed64(l)},writeSFixed64Field:function(f,l){this.writeTag(f,Ir.Fixed64),this.writeSFixed64(l)},writeVarintField:function(f,l){this.writeTag(f,Ir.Varint),this.writeVarint(l)},writeSVarintField:function(f,l){this.writeTag(f,Ir.Varint),this.writeSVarint(l)},writeStringField:function(f,l){this.writeTag(f,Ir.Bytes),this.writeString(l)},writeFloatField:function(f,l){this.writeTag(f,Ir.Fixed32),this.writeFloat(l)},writeDoubleField:function(f,l){this.writeTag(f,Ir.Fixed64),this.writeDouble(l)},writeBooleanField:function(f,l){this.writeVarintField(f,Boolean(l))}};class f4{constructor(l,{pixelRatio:h,version:y,stretchX:S,stretchY:R,content:D}){this.paddedRect=l,this.pixelRatio=h,this.stretchX=S,this.stretchY=R,this.content=D,this.version=y}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class sM{constructor(l,h){const y={},S={};this.haveRenderCallbacks=[];const R=[];this.addImages(l,y,R),this.addImages(h,S,R);const{w:D,h:$}=aM(R),U=new ba({width:D||1,height:$||1});for(const W in l){const te=l[W],ae=y[W].paddedRect;ba.copy(te.data,U,{x:0,y:0},{x:ae.x+1,y:ae.y+1},te.data)}for(const W in h){const te=h[W],ae=S[W].paddedRect,de=ae.x+1,ge=ae.y+1,ve=te.data.width,Fe=te.data.height;ba.copy(te.data,U,{x:0,y:0},{x:de,y:ge},te.data),ba.copy(te.data,U,{x:0,y:Fe-1},{x:de,y:ge-1},{width:ve,height:1}),ba.copy(te.data,U,{x:0,y:0},{x:de,y:ge+Fe},{width:ve,height:1}),ba.copy(te.data,U,{x:ve-1,y:0},{x:de-1,y:ge},{width:1,height:Fe}),ba.copy(te.data,U,{x:0,y:0},{x:de+ve,y:ge},{width:1,height:Fe})}this.image=U,this.iconPositions=y,this.patternPositions=S}addImages(l,h,y){for(const S in l){const R=l[S],D={x:0,y:0,w:R.data.width+2,h:R.data.height+2};y.push(D),h[S]=new f4(D,R),R.hasRenderCallback&&this.haveRenderCallbacks.push(S)}}patchUpdatedImages(l,h){l.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const y in l.updatedImages)this.patchUpdatedImage(this.iconPositions[y],l.getImage(y),h),this.patchUpdatedImage(this.patternPositions[y],l.getImage(y),h)}patchUpdatedImage(l,h,y){if(!l||!h||l.version===h.version)return;l.version=h.version;const[S,R]=l.tl;y.update(h.data,void 0,{x:S,y:R})}}yn("ImagePosition",f4),yn("ImageAtlas",sM),a.WritingMode=void 0,(zu=a.WritingMode||(a.WritingMode={}))[zu.none=0]="none",zu[zu.horizontal=1]="horizontal",zu[zu.vertical=2]="vertical",zu[zu.horizontalOnly=3]="horizontalOnly";const fy=-17;class _m{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(l,h){const y=new _m;return y.scale=l||1,y.fontStack=h,y}static forImage(l){const h=new _m;return h.imageName=l,h}}class Xf{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(l,h){const y=new Xf;for(let S=0;S=0&&y>=l&&py[this.text.charCodeAt(y)];y--)h--;this.text=this.text.substring(l,h),this.sectionIndex=this.sectionIndex.slice(l,h)}substring(l,h){const y=new Xf;return y.text=this.text.substring(l,h),y.sectionIndex=this.sectionIndex.slice(l,h),y.sections=this.sections,y}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((l,h)=>Math.max(l,this.sections[h].scale),0)}addTextSection(l,h){this.text+=l.text,this.sections.push(_m.forText(l.scale,l.fontStack||h));const y=this.sections.length-1;for(let S=0;S=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hy(f,l,h,y,S,R,D,$,U,W,te,ae,de,ge,ve,Fe){const Ne=Xf.fromFeature(f,S);let it;ae===a.WritingMode.vertical&&Ne.verticalizePunctuation();const{processBidirectionalText:yt,processStyledBidirectionalText:Ye}=ea;if(yt&&Ne.sections.length===1){it=[];const At=yt(Ne.toString(),h4(Ne,W,R,l,y,ge,ve));for(const gn of At){const _n=new Xf;_n.text=gn,_n.sections=Ne.sections;for(let cn=0;cn0&&jl>Bo&&(Bo=jl)}else{const Ca=_n[er.fontStack],Vo=Ca&&Ca[eo];if(Vo&&Vo.rect)Ps=Vo.rect,Ga=Vo.metrics;else{const jl=gn[er.fontStack],Sm=jl&&jl[eo];if(!Sm)continue;Ga=Sm.metrics}co=(Ji-er.scale)*Hi}qa?(At.verticalizable=!0,$o.push({glyph:eo,imageName:Is,x:$r,y:Wr+co,vertical:qa,scale:er.scale,fontStack:er.fontStack,sectionIndex:ra,metrics:Ga,rect:Ps}),$r+=Ul*er.scale+Mn):($o.push({glyph:eo,imageName:Is,x:$r,y:Wr+co,vertical:qa,scale:er.scale,fontStack:er.fontStack,sectionIndex:ra,metrics:Ga,rect:Ps}),$r+=Ga.advance*er.scale+Mn)}$o.length!==0&&(Pi=Math.max($r-Mn,Pi),jW($o,0,$o.length-1,Yi,Bo)),$r=0;const Yr=en*Ji+Bo;Co.lineOffset=Math.max(Bo,uo),Wr+=Yr,wa=Math.max(Yr,wa),++vi}var Oi;const Qi=Wr-fy,{horizontalAlign:lo,verticalAlign:zo}=p4(dn);(function(yi,Ji,uo,Co,$o,Bo,Yr,Ni,er){const ra=(Ji-uo)*$o;let eo=0;eo=Bo!==Yr?-Ni*Co-fy:(-Co*er+.5)*Yr;for(const co of yi)for(const Ga of co.positionedGlyphs)Ga.x+=ra,Ga.y+=eo})(At.positionedLines,Yi,lo,zo,Pi,wa,en,Qi,on.length),At.top+=-zo*Qi,At.bottom=At.top+Qi,At.left+=-lo*Pi,At.right=At.left+Pi}(Ot,l,h,y,it,D,$,U,ae,W,de,Fe),!function(At){for(const gn of At)if(gn.positionedGlyphs.length!==0)return!1;return!0}(pt)&&Ot}const py={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},VW={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function lM(f,l,h,y,S,R){if(l.imageName){const D=y[l.imageName];return D?D.displaySize[0]*l.scale*Hi/R+S:0}{const D=h[l.fontStack],$=D&&D[f];return $?$.metrics.advance*l.scale+S:0}}function uM(f,l,h,y){const S=Math.pow(f-l,2);return y?f=0;let te=0;for(let de=0;de-h/2;){if(D--,D<0)return!1;$-=f[D].dist(R),R=f[D]}$+=f[D].dist(f[D+1]),D++;const U=[];let W=0;for(;$y;)W-=U.shift().angleDelta;if(W>S)return!1;D++,$+=te.dist(ae)}return!0}function mM(f){let l=0;for(let h=0;hW){const ve=(W-U)/ge,Fe=Pr(ae.x,de.x,ve),Ne=Pr(ae.y,de.y,ve),it=new $u(Fe,Ne,de.angleTo(ae),te);return it._round(),!D||pM(f,it,$,D,l)?it:void 0}U+=ge}}function WW(f,l,h,y,S,R,D,$,U){const W=gM(y,R,D),te=vM(y,S),ae=te*D,de=f[0].x===0||f[0].x===U||f[0].y===0||f[0].y===U;return l-ae=0&&pt=0&&Ot=0&&de+W<=te){const At=new $u(pt,Ot,yt,ve);At._round(),y&&!pM(f,At,R,y,S)||ge.push(At)}}ae+=it}return $||ge.length||D||(ge=yM(f,ae/2,h,y,S,R,D,!0,U)),ge}function xM(f,l,h,y,S){const R=[];for(let D=0;D=y&&ae.x>=y||(te.x>=y?te=new ne(y,te.y+(y-te.x)/(ae.x-te.x)*(ae.y-te.y))._round():ae.x>=y&&(ae=new ne(y,te.y+(y-te.x)/(ae.x-te.x)*(ae.y-te.y))._round()),te.y>=S&&ae.y>=S||(te.y>=S?te=new ne(te.x+(S-te.y)/(ae.y-te.y)*(ae.x-te.x),S)._round():ae.y>=S&&(ae=new ne(te.x+(S-te.y)/(ae.y-te.y)*(ae.x-te.x),S)._round()),U&&te.equals(U[U.length-1])||(U=[te],R.push(U)),U.push(ae)))))}}return R}function bM(f,l,h,y){const S=[],R=f.image,D=R.pixelRatio,$=R.paddedRect.w-2,U=R.paddedRect.h-2,W=f.right-f.left,te=f.bottom-f.top,ae=R.stretchX||[[0,$]],de=R.stretchY||[[0,U]],ge=(en,dn)=>en+dn[1]-dn[0],ve=ae.reduce(ge,0),Fe=de.reduce(ge,0),Ne=$-ve,it=U-Fe;let yt=0,Ye=ve,pt=0,Ot=Fe,At=0,gn=Ne,_n=0,cn=it;if(R.content&&y){const en=R.content;yt=my(ae,0,en[0]),pt=my(de,0,en[1]),Ye=my(ae,en[0],en[2]),Ot=my(de,en[1],en[3]),At=en[0]-yt,_n=en[1]-pt,gn=en[2]-en[0]-Ye,cn=en[3]-en[1]-Ot}const on=(en,dn,an,Wt)=>{const Mn=gy(en.stretch-yt,Ye,W,f.left),Sn=vy(en.fixed-At,gn,en.stretch,ve),Zn=gy(dn.stretch-pt,Ot,te,f.top),$r=vy(dn.fixed-_n,cn,dn.stretch,Fe),Wr=gy(an.stretch-yt,Ye,W,f.left),Pi=vy(an.fixed-At,gn,an.stretch,ve),wa=gy(Wt.stretch-pt,Ot,te,f.top),Yi=vy(Wt.fixed-_n,cn,Wt.stretch,Fe),vi=new ne(Mn,Zn),Oi=new ne(Wr,Zn),Qi=new ne(Wr,wa),lo=new ne(Mn,wa),zo=new ne(Sn/D,$r/D),yi=new ne(Pi/D,Yi/D),Ji=l*Math.PI/180;if(Ji){const $o=Math.sin(Ji),Bo=Math.cos(Ji),Yr=[Bo,-$o,$o,Bo];vi._matMult(Yr),Oi._matMult(Yr),lo._matMult(Yr),Qi._matMult(Yr)}const uo=en.stretch+en.fixed,Co=dn.stretch+dn.fixed;return{tl:vi,tr:Oi,bl:lo,br:Qi,tex:{x:R.paddedRect.x+1+uo,y:R.paddedRect.y+1+Co,w:an.stretch+an.fixed-uo,h:Wt.stretch+Wt.fixed-Co},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:zo,pixelOffsetBR:yi,minFontScaleX:gn/D/W,minFontScaleY:cn/D/te,isSDF:h}};if(y&&(R.stretchX||R.stretchY)){const en=_M(ae,Ne,ve),dn=_M(de,it,Fe);for(let an=0;an0&&(ve=Math.max(10,ve),this.circleDiameter=ve)}else{let ae=D.top*$-U[0],de=D.bottom*$+U[2],ge=D.left*$-U[3],ve=D.right*$+U[1];const Fe=D.collisionPadding;if(Fe&&(ge-=Fe[0]*$,ae-=Fe[1]*$,ve+=Fe[2]*$,de+=Fe[3]*$),te){const Ne=new ne(ge,ae),it=new ne(ve,ae),yt=new ne(ge,de),Ye=new ne(ve,de),pt=te*Math.PI/180;Ne._rotate(pt),it._rotate(pt),yt._rotate(pt),Ye._rotate(pt),ge=Math.min(Ne.x,it.x,yt.x,Ye.x),ve=Math.max(Ne.x,it.x,yt.x,Ye.x),ae=Math.min(Ne.y,it.y,yt.y,Ye.y),de=Math.max(Ne.y,it.y,yt.y,Ye.y)}l.emplaceBack(h.x,h.y,ge,ae,ve,de,y,S,R)}this.boxEndIndex=l.length}}class GW{constructor(l=[],h=qW){if(this.data=l,this.length=this.data.length,this.compare=h,this.length>0)for(let y=(this.length>>1)-1;y>=0;y--)this._down(y)}push(l){this.data.push(l),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const l=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),l}peek(){return this.data[0]}_up(l){const{data:h,compare:y}=this,S=h[l];for(;l>0;){const R=l-1>>1,D=h[R];if(y(S,D)>=0)break;h[l]=D,l=R}h[l]=S}_down(l){const{data:h,compare:y}=this,S=this.length>>1,R=h[l];for(;l=0)break;h[l]=$,l=D}h[l]=R}}function qW(f,l){return fl?1:0}function ZW(f,l=1,h=!1){let y=1/0,S=1/0,R=-1/0,D=-1/0;const $=f[0];for(let ge=0;ge<$.length;ge++){const ve=$[ge];(!ge||ve.xR)&&(R=ve.x),(!ge||ve.y>D)&&(D=ve.y)}const U=Math.min(R-y,D-S);let W=U/2;const te=new GW([],XW);if(U===0)return new ne(y,S);for(let ge=y;geae.d||!ae.d)&&(ae=ge,h&&console.log("found best %d after %d probes",Math.round(1e4*ge.d)/1e4,de)),ge.max-ae.d<=l||(W=ge.h/2,te.push(new Yf(ge.p.x-W,ge.p.y-W,W,f)),te.push(new Yf(ge.p.x+W,ge.p.y-W,W,f)),te.push(new Yf(ge.p.x-W,ge.p.y+W,W,f)),te.push(new Yf(ge.p.x+W,ge.p.y+W,W,f)),de+=4)}return h&&(console.log(`num probes: ${de}`),console.log(`best distance: ${ae.d}`)),ae.p}function XW(f,l){return l.max-f.max}function Yf(f,l,h,y){this.p=new ne(f,l),this.h=h,this.d=function(S,R){let D=!1,$=1/0;for(let U=0;US.y!=ve.y>S.y&&S.x<(ve.x-ge.x)*(S.y-ge.y)/(ve.y-ge.y)+ge.x&&(D=!D),$=Math.min($,kk(S,ge,ve))}}return(D?1:-1)*Math.sqrt($)}(this.p,y),this.max=this.d+this.h*Math.SQRT2}const m4=Number.POSITIVE_INFINITY;function wM(f,l){return l[1]!==m4?function(h,y,S){let R=0,D=0;switch(y=Math.abs(y),S=Math.abs(S),h){case"top-right":case"top-left":case"top":D=S-7;break;case"bottom-right":case"bottom-left":case"bottom":D=7-S}switch(h){case"top-right":case"bottom-right":case"right":R=-y;break;case"top-left":case"bottom-left":case"left":R=y}return[R,D]}(f,l[0],l[1]):function(h,y){let S=0,R=0;y<0&&(y=0);const D=y/Math.sqrt(2);switch(h){case"top-right":case"top-left":R=D-7;break;case"bottom-right":case"bottom-left":R=7-D;break;case"bottom":R=7-y;break;case"top":R=y-7}switch(h){case"top-right":case"bottom-right":S=-D;break;case"top-left":case"bottom-left":S=D;break;case"left":S=y;break;case"right":S=-y}return[S,R]}(f,l[0])}function g4(f){switch(f){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function YW(f,l,h,y,S,R,D,$,U,W,te){let ae=R.textMaxSize.evaluate(l,{});ae===void 0&&(ae=D);const de=f.layers[0].layout,ge=de.get("icon-offset").evaluate(l,{},te),ve=SM(h.horizontal),Fe=D/24,Ne=f.tilePixelRatio*Fe,it=f.tilePixelRatio*ae/24,yt=f.tilePixelRatio*$,Ye=f.tilePixelRatio*de.get("symbol-spacing"),pt=de.get("text-padding")*f.tilePixelRatio,Ot=function(Wt,Mn,Sn,Zn=1){const $r=Wt.get("icon-padding").evaluate(Mn,{},Sn),Wr=$r&&$r.values;return[Wr[0]*Zn,Wr[1]*Zn,Wr[2]*Zn,Wr[3]*Zn]}(de,l,te,f.tilePixelRatio),At=de.get("text-max-angle")/180*Math.PI,gn=de.get("text-rotation-alignment")!=="viewport"&&de.get("symbol-placement")!=="point",_n=de.get("icon-rotation-alignment")==="map"&&de.get("symbol-placement")!=="point",cn=de.get("symbol-placement"),on=Ye/2,en=de.get("icon-text-fit");let dn;y&&en!=="none"&&(f.allowVerticalPlacement&&h.vertical&&(dn=fM(y,h.vertical,en,de.get("icon-text-fit-padding"),ge,Fe)),ve&&(y=fM(y,ve,en,de.get("icon-text-fit-padding"),ge,Fe)));const an=(Wt,Mn)=>{Mn.x<0||Mn.x>=Ei||Mn.y<0||Mn.y>=Ei||function(Sn,Zn,$r,Wr,Pi,wa,Yi,vi,Oi,Qi,lo,zo,yi,Ji,uo,Co,$o,Bo,Yr,Ni,er,ra,eo,co,Ga){const Ps=Sn.addToLineVertexArray(Zn,$r);let Is,Ul,qa,Ca,Vo=0,jl=0,Sm=0,BM=0,P4=-1,I4=-1;const Hl={};let VM=Di.exports(""),T4=0,k4=0;if(vi._unevaluatedLayout.getValue("text-radial-offset")===void 0?[T4,k4]=vi.layout.get("text-offset").evaluate(er,{},co).map(Uo=>Uo*Hi):(T4=vi.layout.get("text-radial-offset").evaluate(er,{},co)*Hi,k4=m4),Sn.allowVerticalPlacement&&Wr.vertical){const Uo=vi.layout.get("text-rotate").evaluate(er,{},co)+90;qa=new yy(Oi,Zn,Qi,lo,zo,Wr.vertical,yi,Ji,uo,Uo),Yi&&(Ca=new yy(Oi,Zn,Qi,lo,zo,Yi,$o,Bo,uo,Uo))}if(Pi){const Uo=vi.layout.get("icon-rotate").evaluate(er,{}),nl=vi.layout.get("icon-text-fit")!=="none",Em=bM(Pi,Uo,eo,nl),Pm=Yi?bM(Yi,Uo,eo,nl):void 0;Ul=new yy(Oi,Zn,Qi,lo,zo,Pi,$o,Bo,!1,Uo),Vo=4*Em.length;const HM=Sn.iconSizeData;let fd=null;HM.kind==="source"?(fd=[Vl*vi.layout.get("icon-size").evaluate(er,{})],fd[0]>Bu&&L(`${Sn.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):HM.kind==="composite"&&(fd=[Vl*ra.compositeIconSizes[0].evaluate(er,{},co),Vl*ra.compositeIconSizes[1].evaluate(er,{},co)],(fd[0]>Bu||fd[1]>Bu)&&L(`${Sn.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Sn.addSymbols(Sn.icon,Em,fd,Ni,Yr,er,a.WritingMode.none,Zn,Ps.lineStartIndex,Ps.lineLength,-1,co),P4=Sn.icon.placedSymbolArray.length-1,Pm&&(jl=4*Pm.length,Sn.addSymbols(Sn.icon,Pm,fd,Ni,Yr,er,a.WritingMode.vertical,Zn,Ps.lineStartIndex,Ps.lineLength,-1,co),I4=Sn.icon.placedSymbolArray.length-1)}const UM=Object.keys(Wr.horizontal);for(const Uo of UM){const nl=Wr.horizontal[Uo];if(!Is){VM=Di.exports(nl.text);const Pm=vi.layout.get("text-rotate").evaluate(er,{},co);Is=new yy(Oi,Zn,Qi,lo,zo,nl,yi,Ji,uo,Pm)}const Em=nl.positionedLines.length===1;if(Sm+=CM(Sn,Zn,nl,wa,vi,uo,er,Co,Ps,Wr.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,Em?UM:[Uo],Hl,P4,ra,co),Em)break}Wr.vertical&&(BM+=CM(Sn,Zn,Wr.vertical,wa,vi,uo,er,Co,Ps,a.WritingMode.vertical,["vertical"],Hl,I4,ra,co));const cG=Is?Is.boxStartIndex:Sn.collisionBoxArray.length,dG=Is?Is.boxEndIndex:Sn.collisionBoxArray.length,fG=qa?qa.boxStartIndex:Sn.collisionBoxArray.length,hG=qa?qa.boxEndIndex:Sn.collisionBoxArray.length,pG=Ul?Ul.boxStartIndex:Sn.collisionBoxArray.length,mG=Ul?Ul.boxEndIndex:Sn.collisionBoxArray.length,gG=Ca?Ca.boxStartIndex:Sn.collisionBoxArray.length,vG=Ca?Ca.boxEndIndex:Sn.collisionBoxArray.length;let Ts=-1;const Cy=(Uo,nl)=>Uo&&Uo.circleDiameter?Math.max(Uo.circleDiameter,nl):nl;Ts=Cy(Is,Ts),Ts=Cy(qa,Ts),Ts=Cy(Ul,Ts),Ts=Cy(Ca,Ts);const jM=Ts>-1?1:0;jM&&(Ts*=Ga/Hi),Sn.glyphOffsetArray.length>=Qf.MAX_GLYPHS&&L("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),er.sortKey!==void 0&&Sn.addToSortKeyRanges(Sn.symbolInstances.length,er.sortKey),Sn.symbolInstances.emplaceBack(Zn.x,Zn.y,Hl.right>=0?Hl.right:-1,Hl.center>=0?Hl.center:-1,Hl.left>=0?Hl.left:-1,Hl.vertical||-1,P4,I4,VM,cG,dG,fG,hG,pG,mG,gG,vG,Qi,Sm,BM,Vo,jl,jM,0,yi,T4,k4,Ts)}(f,Mn,Wt,h,y,S,dn,f.layers[0],f.collisionBoxArray,l.index,l.sourceLayerIndex,f.index,Ne,[pt,pt,pt,pt],gn,U,yt,Ot,_n,ge,l,R,W,te,D)};if(cn==="line")for(const Wt of xM(l.geometry,0,0,Ei,Ei)){const Mn=WW(Wt,Ye,At,h.vertical||ve,y,24,it,f.overscaling,Ei);for(const Sn of Mn){const Zn=ve;Zn&&QW(f,Zn.text,on,Sn)||an(Wt,Sn)}}else if(cn==="line-center"){for(const Wt of l.geometry)if(Wt.length>1){const Mn=KW(Wt,At,h.vertical||ve,y,24,it);Mn&&an(Wt,Mn)}}else if(l.type==="Polygon")for(const Wt of r4(l.geometry,0)){const Mn=ZW(Wt,16);an(Wt[0],new $u(Mn.x,Mn.y,0))}else if(l.type==="LineString")for(const Wt of l.geometry)an(Wt,new $u(Wt[0].x,Wt[0].y,0));else if(l.type==="Point")for(const Wt of l.geometry)for(const Mn of Wt)an([Mn],new $u(Mn.x,Mn.y,0))}const Bu=32640;function CM(f,l,h,y,S,R,D,$,U,W,te,ae,de,ge,ve){const Fe=function(yt,Ye,pt,Ot,At,gn,_n,cn){const on=Ot.layout.get("text-rotate").evaluate(gn,{})*Math.PI/180,en=[];for(const dn of Ye.positionedLines)for(const an of dn.positionedGlyphs){if(!an.rect)continue;const Wt=an.rect||{};let Mn=4,Sn=!0,Zn=1,$r=0;const Wr=(At||cn)&&an.vertical,Pi=an.metrics.advance*an.scale/2;if(cn&&Ye.verticalizable){const Yr=(an.scale-1)*Hi,Ni=(Hi-an.metrics.width*an.scale)/2;$r=dn.lineOffset/2-(an.imageName?-Ni:Yr)}if(an.imageName){const Yr=_n[an.imageName];Sn=Yr.sdf,Zn=Yr.pixelRatio,Mn=1/Zn}const wa=At?[an.x+Pi,an.y]:[0,0];let Yi=At?[0,0]:[an.x+Pi+pt[0],an.y+pt[1]-$r],vi=[0,0];Wr&&(vi=Yi,Yi=[0,0]);const Oi=(an.metrics.left-Mn)*an.scale-Pi+Yi[0],Qi=(-an.metrics.top-Mn)*an.scale+Yi[1],lo=Oi+Wt.w*an.scale/Zn,zo=Qi+Wt.h*an.scale/Zn,yi=new ne(Oi,Qi),Ji=new ne(lo,Qi),uo=new ne(Oi,zo),Co=new ne(lo,zo);if(Wr){const Yr=new ne(-Pi,Pi-fy),Ni=-Math.PI/2,er=12-Pi,ra=new ne(22-er,-(an.imageName?er:0)),eo=new ne(...vi);yi._rotateAround(Ni,Yr)._add(ra)._add(eo),Ji._rotateAround(Ni,Yr)._add(ra)._add(eo),uo._rotateAround(Ni,Yr)._add(ra)._add(eo),Co._rotateAround(Ni,Yr)._add(ra)._add(eo)}if(on){const Yr=Math.sin(on),Ni=Math.cos(on),er=[Ni,-Yr,Yr,Ni];yi._matMult(er),Ji._matMult(er),uo._matMult(er),Co._matMult(er)}const $o=new ne(0,0),Bo=new ne(0,0);en.push({tl:yi,tr:Ji,bl:uo,br:Co,tex:Wt,writingMode:Ye.writingMode,glyphOffset:wa,sectionIndex:an.sectionIndex,isSDF:Sn,pixelOffsetTL:$o,pixelOffsetBR:Bo,minFontScaleX:0,minFontScaleY:0})}return en}(0,h,$,S,R,D,y,f.allowVerticalPlacement),Ne=f.textSizeData;let it=null;Ne.kind==="source"?(it=[Vl*S.layout.get("text-size").evaluate(D,{})],it[0]>Bu&&L(`${f.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):Ne.kind==="composite"&&(it=[Vl*ge.compositeTextSizes[0].evaluate(D,{},ve),Vl*ge.compositeTextSizes[1].evaluate(D,{},ve)],(it[0]>Bu||it[1]>Bu)&&L(`${f.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),f.addSymbols(f.text,Fe,it,$,R,D,W,l,U.lineStartIndex,U.lineLength,de,ve);for(const yt of te)ae[yt]=f.text.placedSymbolArray.length-1;return 4*Fe.length}function SM(f){for(const l in f)return f[l];return null}function QW(f,l,h,y){const S=f.compareText;if(l in S){const R=S[l];for(let D=R.length-1;D>=0;D--)if(y.dist(R[D])D.id),this.index=l.index,this.pixelRatio=l.pixelRatio,this.sourceLayerIndex=l.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Yw([]),this.placementViewportMatrix=Yw([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hM(this.zoom,h["text-size"]),this.iconSizeData=hM(this.zoom,h["icon-size"]);const y=this.layers[0].layout,S=y.get("symbol-sort-key"),R=y.get("symbol-z-order");this.canOverlap=_4(y,"text-overlap","text-allow-overlap")!=="never"||_4(y,"icon-overlap","icon-allow-overlap")!=="never"||y.get("text-ignore-placement")||y.get("icon-ignore-placement"),this.sortFeaturesByKey=R!=="viewport-y"&&!S.isConstant(),this.sortFeaturesByY=(R==="viewport-y"||R==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,y.get("symbol-placement")==="point"&&(this.writingModes=y.get("text-writing-mode").map(D=>a.WritingMode[D])),this.stateDependentLayerIds=this.layers.filter(D=>D.isStateDependent()).map(D=>D.id),this.sourceID=l.sourceID}createArrays(){this.text=new y4(new sd(this.layers,this.zoom,l=>/^text/.test(l))),this.icon=new y4(new sd(this.layers,this.zoom,l=>/^icon/.test(l))),this.glyphOffsetArray=new rn,this.lineVertexArray=new mn,this.symbolInstances=new fn}calculateGlyphDependencies(l,h,y,S,R){for(let D=0;D0)&&(D.value.kind!=="constant"||D.value.value.length>0),te=U.value.kind!=="constant"||!!U.value.value||Object.keys(U.parameters).length>0,ae=R.get("symbol-sort-key");if(this.features=[],!W&&!te)return;const de=h.iconDependencies,ge=h.glyphDependencies,ve=h.availableImages,Fe=new Hr(this.zoom);for(const{feature:Ne,id:it,index:yt,sourceLayerIndex:Ye}of l){const pt=S._featureFilter.needGeometry,Ot=ud(Ne,pt);if(!S._featureFilter.filter(Fe,Ot,y))continue;let At,gn;if(pt||(Ot.geometry=ld(Ne)),W){const cn=S.getValueAndResolveTokens("text-field",Ot,y,ve),on=Pe.factory(cn);tG(on)&&(this.hasRTLText=!0),(!this.hasRTLText||id()==="unavailable"||this.hasRTLText&&ea.isParsed())&&(At=TW(on,S,Ot))}if(te){const cn=S.getValueAndResolveTokens("icon-image",Ot,y,ve);gn=cn instanceof Be?cn:Be.fromString(cn)}if(!At&&!gn)continue;const _n=this.sortFeaturesByKey?ae.evaluate(Ot,{},y):void 0;if(this.features.push({id:it,text:At,icon:gn,index:yt,sourceLayerIndex:Ye,geometry:Ot.geometry,properties:Ne.properties,type:JW[Ne.type],sortKey:_n}),gn&&(de[gn.name]=!0),At){const cn=D.evaluate(Ot,{},y).join(","),on=R.get("text-rotation-alignment")!=="viewport"&&R.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(const en of At.sections)if(en.image)de[en.image.name]=!0;else{const dn=Bf(At.toString()),an=en.fontStack||cn,Wt=ge[an]=ge[an]||{};this.calculateGlyphDependencies(en.text,Wt,on,this.allowVerticalPlacement,dn)}}}R.get("symbol-placement")==="line"&&(this.features=function(Ne){const it={},yt={},Ye=[];let pt=0;function Ot(cn){Ye.push(Ne[cn]),pt++}function At(cn,on,en){const dn=yt[cn];return delete yt[cn],yt[on]=dn,Ye[dn].geometry[0].pop(),Ye[dn].geometry[0]=Ye[dn].geometry[0].concat(en[0]),dn}function gn(cn,on,en){const dn=it[on];return delete it[on],it[cn]=dn,Ye[dn].geometry[0].shift(),Ye[dn].geometry[0]=en[0].concat(Ye[dn].geometry[0]),dn}function _n(cn,on,en){const dn=en?on[0][on[0].length-1]:on[0][0];return`${cn}:${dn.x}:${dn.y}`}for(let cn=0;cncn.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Ne,it)=>Ne.sortKey-it.sortKey)}update(l,h,y){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(l,h,this.layers,y),this.icon.programConfigurations.updatePaintArrays(l,h,this.layers,y))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(l){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(l),this.iconCollisionBox.upload(l)),this.text.upload(l,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(l,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(l,h){const y=this.lineVertexArray.length;if(l.segment!==void 0){let S=l.dist(h[l.segment+1]),R=l.dist(h[l.segment]);const D={};for(let $=l.segment+1;$=0;$--)D[$]={x:h[$].x,y:h[$].y,tileUnitDistanceFromAnchor:R},$>0&&(R+=h[$-1].dist(h[$]));for(let $=0;$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(l,h){const y=l.placedSymbolArray.get(h),S=y.vertexStartIndex+4*y.numGlyphs;for(let R=y.vertexStartIndex;RS[$]-S[U]||R[U]-R[$]),D}addToSortKeyRanges(l,h){const y=this.sortKeyRanges[this.sortKeyRanges.length-1];y&&y.sortKey===h?y.symbolInstanceEnd=l+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:l,symbolInstanceEnd:l+1})}sortFeatures(l){if(this.sortFeaturesByY&&this.sortedAngle!==l&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(l),this.sortedAngle=l,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const y=this.symbolInstances.get(h);this.featureSortOrder.push(y.featureIndex),[y.rightJustifiedTextSymbolIndex,y.centerJustifiedTextSymbolIndex,y.leftJustifiedTextSymbolIndex].forEach((S,R,D)=>{S>=0&&D.indexOf(S)===R&&this.addIndicesForPlacedSymbol(this.text,S)}),y.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,y.verticalPlacedTextSymbolIndex),y.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,y.placedIconSymbolIndex),y.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,y.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}yn("SymbolBucket",Qf,{omit:["layers","collisionBoxArray","features","compareText"]}),Qf.MAX_GLYPHS=65535,Qf.addDynamicAttributes=v4;const nG=new ji({"symbol-placement":new wn(Ve.layout_symbol["symbol-placement"]),"symbol-spacing":new wn(Ve.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new wn(Ve.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Dn(Ve.layout_symbol["symbol-sort-key"]),"symbol-z-order":new wn(Ve.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new wn(Ve.layout_symbol["icon-allow-overlap"]),"icon-overlap":new wn(Ve.layout_symbol["icon-overlap"]),"icon-ignore-placement":new wn(Ve.layout_symbol["icon-ignore-placement"]),"icon-optional":new wn(Ve.layout_symbol["icon-optional"]),"icon-rotation-alignment":new wn(Ve.layout_symbol["icon-rotation-alignment"]),"icon-size":new Dn(Ve.layout_symbol["icon-size"]),"icon-text-fit":new wn(Ve.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new wn(Ve.layout_symbol["icon-text-fit-padding"]),"icon-image":new Dn(Ve.layout_symbol["icon-image"]),"icon-rotate":new Dn(Ve.layout_symbol["icon-rotate"]),"icon-padding":new Dn(Ve.layout_symbol["icon-padding"]),"icon-keep-upright":new wn(Ve.layout_symbol["icon-keep-upright"]),"icon-offset":new Dn(Ve.layout_symbol["icon-offset"]),"icon-anchor":new Dn(Ve.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new wn(Ve.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new wn(Ve.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new wn(Ve.layout_symbol["text-rotation-alignment"]),"text-field":new Dn(Ve.layout_symbol["text-field"]),"text-font":new Dn(Ve.layout_symbol["text-font"]),"text-size":new Dn(Ve.layout_symbol["text-size"]),"text-max-width":new Dn(Ve.layout_symbol["text-max-width"]),"text-line-height":new wn(Ve.layout_symbol["text-line-height"]),"text-letter-spacing":new Dn(Ve.layout_symbol["text-letter-spacing"]),"text-justify":new Dn(Ve.layout_symbol["text-justify"]),"text-radial-offset":new Dn(Ve.layout_symbol["text-radial-offset"]),"text-variable-anchor":new wn(Ve.layout_symbol["text-variable-anchor"]),"text-anchor":new Dn(Ve.layout_symbol["text-anchor"]),"text-max-angle":new wn(Ve.layout_symbol["text-max-angle"]),"text-writing-mode":new wn(Ve.layout_symbol["text-writing-mode"]),"text-rotate":new Dn(Ve.layout_symbol["text-rotate"]),"text-padding":new wn(Ve.layout_symbol["text-padding"]),"text-keep-upright":new wn(Ve.layout_symbol["text-keep-upright"]),"text-transform":new Dn(Ve.layout_symbol["text-transform"]),"text-offset":new Dn(Ve.layout_symbol["text-offset"]),"text-allow-overlap":new wn(Ve.layout_symbol["text-allow-overlap"]),"text-overlap":new wn(Ve.layout_symbol["text-overlap"]),"text-ignore-placement":new wn(Ve.layout_symbol["text-ignore-placement"]),"text-optional":new wn(Ve.layout_symbol["text-optional"])});var b4={paint:new ji({"icon-opacity":new Dn(Ve.paint_symbol["icon-opacity"]),"icon-color":new Dn(Ve.paint_symbol["icon-color"]),"icon-halo-color":new Dn(Ve.paint_symbol["icon-halo-color"]),"icon-halo-width":new Dn(Ve.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Dn(Ve.paint_symbol["icon-halo-blur"]),"icon-translate":new wn(Ve.paint_symbol["icon-translate"]),"icon-translate-anchor":new wn(Ve.paint_symbol["icon-translate-anchor"]),"text-opacity":new Dn(Ve.paint_symbol["text-opacity"]),"text-color":new Dn(Ve.paint_symbol["text-color"],{runtimeType:Kt,getOverride:f=>f.textColor,hasOverride:f=>!!f.textColor}),"text-halo-color":new Dn(Ve.paint_symbol["text-halo-color"]),"text-halo-width":new Dn(Ve.paint_symbol["text-halo-width"]),"text-halo-blur":new Dn(Ve.paint_symbol["text-halo-blur"]),"text-translate":new wn(Ve.paint_symbol["text-translate"]),"text-translate-anchor":new wn(Ve.paint_symbol["text-translate-anchor"])}),layout:nG};class EM{constructor(l){if(l.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=l.property.overrides?l.property.overrides.runtimeType:pn,this.defaultValue=l}evaluate(l){if(l.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(l.formattedSection))return h.getOverride(l.formattedSection)}return l.feature&&l.featureState?this.defaultValue.evaluate(l.feature,l.featureState):this.defaultValue.property.specification.default}eachChild(l){this.defaultValue.isConstant()||l(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}yn("FormatSectionOverride",EM,{omit:["defaultValue"]});class by extends Ha{constructor(l){super(l,b4)}recalculate(l,h){if(super.recalculate(l,h),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 y=this.layout.get("text-writing-mode");if(y){const S=[];for(const R of y)S.indexOf(R)<0&&S.push(R);this.layout._values["text-writing-mode"]=S}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(l,h,y,S){const R=this.layout.get(l).evaluate(h,{},y,S),D=this._unevaluatedLayout._values[l];return D.isDataDriven()||Kc(D.value)||!R?R:function($,U){return U.replace(/{([^{}]+)}/g,(W,te)=>te in $?String($[te]):"")}(h.properties,R)}createBucket(l){return new Qf(l)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const l of b4.paint.overridableProperties){if(!by.hasPaintOverride(this.layout,l))continue;const h=this.paint.get(l),y=new EM(h),S=new Of(y,h.property.specification);let R=null;R=h.value.kind==="constant"||h.value.kind==="source"?new Gc("source",S):new qp("composite",S,h.value.zoomStops),this.paint._values[l]=new ja(h.property,R,h.parameters)}}_handleOverridablePaintPropertyUpdate(l,h,y){return!(!this.layout||h.isDataDriven()||y.isDataDriven())&&by.hasPaintOverride(this.layout,l)}static hasPaintOverride(l,h){const y=l.get("text-field"),S=b4.paint.properties[h];let R=!1;const D=$=>{for(const U of $)if(S.overrides&&S.overrides.hasOverride(U))return void(R=!0)};if(y.value.kind==="constant"&&y.value.value instanceof Pe)D(y.value.value.sections);else if(y.value.kind==="source"){const $=W=>{R||(W instanceof Mt&&Ge(W.value)===bn?D(W.value.sections):W instanceof Af?D(W.sections):W.eachChild($))},U=y.value;U._styleExpression&&$(U._styleExpression.expression)}return R}}function _4(f,l,h){let y="never";const S=f.get(l);return S?y=S:f.get(h)&&(y="always"),y}var rG={paint:new ji({"background-color":new wn(Ve.paint_background["background-color"]),"background-pattern":new am(Ve.paint_background["background-pattern"]),"background-opacity":new wn(Ve.paint_background["background-opacity"])})},iG={paint:new ji({"raster-opacity":new wn(Ve.paint_raster["raster-opacity"]),"raster-hue-rotate":new wn(Ve.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new wn(Ve.paint_raster["raster-brightness-min"]),"raster-brightness-max":new wn(Ve.paint_raster["raster-brightness-max"]),"raster-saturation":new wn(Ve.paint_raster["raster-saturation"]),"raster-contrast":new wn(Ve.paint_raster["raster-contrast"]),"raster-resampling":new wn(Ve.paint_raster["raster-resampling"]),"raster-fade-duration":new wn(Ve.paint_raster["raster-fade-duration"])})};class oG extends Ha{constructor(l){super(l,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=l}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const aG={circle:class extends Ha{constructor(f){super(f,FK)}createBucket(f){return new qw(f)}queryRadius(f){const l=f;return dm("circle-radius",this,l)+dm("circle-stroke-width",this,l)+ry(this.paint.get("circle-translate"))}queryIntersectsFeature(f,l,h,y,S,R,D,$){const U=iy(f,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),R.angle,D),W=this.paint.get("circle-radius").evaluate(l,h)+this.paint.get("circle-stroke-width").evaluate(l,h),te=this.paint.get("circle-pitch-alignment")==="map",ae=te?U:function(ge,ve){return ge.map(Fe=>Lk(Fe,ve))}(U,$),de=te?W*D:W;for(const ge of y)for(const ve of ge){const Fe=te?ve:Lk(ve,$);let Ne=de;const it=oy([],[ve.x,ve.y,0,1],$);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Ne*=it[3]/R.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Ne*=R.cameraToCenterDistance/it[3]),AK(ae,Fe,Ne))return!0}return!1}},heatmap:class extends Ha{constructor(f){super(f,$K),this._updateColorRamp()}createBucket(f){return new Fk(f)}_handleSpecialPaintPropertyUpdate(f){f==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=$k({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends Ha{constructor(f){super(f,BK)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends Ha{constructor(f){super(f,nW)}recalculate(f,l){super.recalculate(f,l);const h=this.paint._values["fill-outline-color"];h.value.kind==="constant"&&h.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(f){return new a4(f)}queryRadius(){return ry(this.paint.get("fill-translate"))}queryIntersectsFeature(f,l,h,y,S,R,D){return Tk(iy(f,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),R.angle,D),y)}isTileClipped(){return!0}},"fill-extrusion":class extends Ha{constructor(f){super(f,gW)}createBucket(f){return new l4(f)}queryRadius(){return ry(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(f,l,h,y,S,R,D,$){const U=iy(f,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),R.angle,D),W=this.paint.get("fill-extrusion-height").evaluate(l,h),te=this.paint.get("fill-extrusion-base").evaluate(l,h),ae=function(ge,ve,Fe,Ne){const it=[];for(const yt of ge){const Ye=[yt.x,yt.y,0,1];oy(Ye,Ye,ve),it.push(new ne(Ye[0]/Ye[3],Ye[1]/Ye[3]))}return it}(U,$),de=function(ge,ve,Fe,Ne){const it=[],yt=[],Ye=Ne[8]*ve,pt=Ne[9]*ve,Ot=Ne[10]*ve,At=Ne[11]*ve,gn=Ne[8]*Fe,_n=Ne[9]*Fe,cn=Ne[10]*Fe,on=Ne[11]*Fe;for(const en of ge){const dn=[],an=[];for(const Wt of en){const Mn=Wt.x,Sn=Wt.y,Zn=Ne[0]*Mn+Ne[4]*Sn+Ne[12],$r=Ne[1]*Mn+Ne[5]*Sn+Ne[13],Wr=Ne[2]*Mn+Ne[6]*Sn+Ne[14],Pi=Ne[3]*Mn+Ne[7]*Sn+Ne[15],wa=Wr+Ot,Yi=Pi+At,vi=Zn+gn,Oi=$r+_n,Qi=Wr+cn,lo=Pi+on,zo=new ne((Zn+Ye)/Yi,($r+pt)/Yi);zo.z=wa/Yi,dn.push(zo);const yi=new ne(vi/lo,Oi/lo);yi.z=Qi/lo,an.push(yi)}it.push(dn),yt.push(an)}return[it,yt]}(y,te,W,$);return function(ge,ve,Fe){let Ne=1/0;Tk(Fe,ve)&&(Ne=qk(Fe,ve[0]));for(let it=0;it=3){for(let Fe=0;Fe{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const PM=63710088e-1;class oi{constructor(l,h){if(isNaN(l)||isNaN(h))throw new Error(`Invalid LngLat object: (${l}, ${h})`);if(this.lng=+l,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new oi(x(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(l){const h=Math.PI/180,y=this.lat*h,S=l.lat*h,R=Math.sin(y)*Math.sin(S)+Math.cos(y)*Math.cos(S)*Math.cos((l.lng-this.lng)*h);return PM*Math.acos(Math.min(R,1))}toBounds(l=0){const h=360*l/40075017,y=h/Math.cos(Math.PI/180*this.lat);return new dd(new oi(this.lng-y,this.lat-h),new oi(this.lng+y,this.lat+h))}static convert(l){if(l instanceof oi)return l;if(Array.isArray(l)&&(l.length===2||l.length===3))return new oi(Number(l[0]),Number(l[1]));if(!Array.isArray(l)&&typeof l=="object"&&l!==null)return new oi(Number("lng"in l?l.lng:l.lon),Number(l.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class dd{constructor(l,h){l&&(h?this.setSouthWest(l).setNorthEast(h):l.length===4?this.setSouthWest([l[0],l[1]]).setNorthEast([l[2],l[3]]):this.setSouthWest(l[0]).setNorthEast(l[1]))}setNorthEast(l){return this._ne=l instanceof oi?new oi(l.lng,l.lat):oi.convert(l),this}setSouthWest(l){return this._sw=l instanceof oi?new oi(l.lng,l.lat):oi.convert(l),this}extend(l){const h=this._sw,y=this._ne;let S,R;if(l instanceof oi)S=l,R=l;else{if(!(l instanceof dd))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(dd.convert(l)):this.extend(oi.convert(l)):this;if(S=l._sw,R=l._ne,!S||!R)return this}return h||y?(h.lng=Math.min(S.lng,h.lng),h.lat=Math.min(S.lat,h.lat),y.lng=Math.max(R.lng,y.lng),y.lat=Math.max(R.lat,y.lat)):(this._sw=new oi(S.lng,S.lat),this._ne=new oi(R.lng,R.lat)),this}getCenter(){return new oi((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 oi(this.getWest(),this.getNorth())}getSouthEast(){return new oi(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(l){const{lng:h,lat:y}=oi.convert(l);let S=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(S=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=y&&y<=this._ne.lat&&S}static convert(l){return l instanceof dd?l:l&&new dd(l)}}const IM=2*Math.PI*PM;function TM(f){return IM*Math.cos(f*Math.PI/180)}function kM(f){return(180+f)/360}function MM(f){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+f*Math.PI/360)))/360}function RM(f,l){return f/TM(l)}function w4(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}class _y{constructor(l,h,y=0){this.x=+l,this.y=+h,this.z=+y}static fromLngLat(l,h=0){const y=oi.convert(l);return new _y(kM(y.lng),MM(y.lat),RM(h,y.lat))}toLngLat(){return new oi(360*this.x-180,w4(this.y))}toAltitude(){return this.z*TM(w4(this.y))}meterInMercatorCoordinateUnits(){return 1/IM*(l=w4(this.y),1/Math.cos(l*Math.PI/180));var l}}function AM(f,l,h){var y=2*Math.PI*6378137/256/Math.pow(2,h);return[f*y-2*Math.PI*6378137/2,l*y-2*Math.PI*6378137/2]}class C4{constructor(l,h,y){if(l<0||l>25||y<0||y>=Math.pow(2,l)||h<0||h>=Math.pow(2,l))throw new Error(`x=${h}, y=${y}, z=${l} outside of bounds. 0<=x<${Math.pow(2,l)}, 0<=y<${Math.pow(2,l)} 0<=z<=25 `);this.z=l,this.x=h,this.y=y,this.key=wm(0,l,l,h,y)}equals(l){return this.z===l.z&&this.x===l.x&&this.y===l.y}url(l,h,y){const S=(D=this.y,$=this.z,U=AM(256*(R=this.x),256*(D=Math.pow(2,$)-D-1),$),W=AM(256*(R+1),256*(D+1),$),U[0]+","+U[1]+","+W[0]+","+W[1]);var R,D,$,U,W;const te=function(ae,de,ge){let ve,Fe="";for(let Ne=ae;Ne>0;Ne--)ve=1<1?"@2x":"").replace(/{quadkey}/g,te).replace(/{bbox-epsg-3857}/g,S)}isChildOf(l){const h=this.z-l.z;return h>0&&l.x===this.x>>h&&l.y===this.y>>h}getTilePoint(l){const h=Math.pow(2,this.z);return new ne((l.x*h-this.x)*Ei,(l.y*h-this.y)*Ei)}toString(){return`${this.z}/${this.x}/${this.y}`}}class DM{constructor(l,h){this.wrap=l,this.canonical=h,this.key=wm(l,h.z,h.z,h.x,h.y)}}class _a{constructor(l,h,y,S,R){if(l= z; overscaledZ = ${l}; z = ${y}`);this.overscaledZ=l,this.wrap=h,this.canonical=new C4(y,+S,+R),this.key=wm(h,l,y,S,R)}clone(){return new _a(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(l){return this.overscaledZ===l.overscaledZ&&this.wrap===l.wrap&&this.canonical.equals(l.canonical)}scaledTo(l){if(l>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${l}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-l;return l>this.canonical.z?new _a(l,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new _a(l,this.wrap,l,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(l,h){if(l>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${l}; overscaledZ = ${this.overscaledZ}`);const y=this.canonical.z-l;return l>this.canonical.z?wm(this.wrap*+h,l,this.canonical.z,this.canonical.x,this.canonical.y):wm(this.wrap*+h,l,l,this.canonical.x>>y,this.canonical.y>>y)}isChildOf(l){if(l.wrap!==this.wrap)return!1;const h=this.canonical.z-l.canonical.z;return l.overscaledZ===0||l.overscaledZ>h&&l.canonical.y===this.canonical.y>>h}children(l){if(this.overscaledZ>=l)return[new _a(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,y=2*this.canonical.x,S=2*this.canonical.y;return[new _a(h,this.wrap,h,y,S),new _a(h,this.wrap,h,y+1,S),new _a(h,this.wrap,h,y,S+1),new _a(h,this.wrap,h,y+1,S+1)]}isLessThan(l){return this.wrapl.wrap)&&(this.overscaledZl.overscaledZ)&&(this.canonical.xl.canonical.x)&&this.canonical.ythis.max&&(this.max=$),$=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(l+1)}_unpackMapbox(l,h,y){return(256*l*256+256*h+y)/10-1e4}_unpackTerrarium(l,h,y){return 256*l+h+y/256-32768}getPixels(){return new ba({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(l,h,y){if(this.dim!==l.dim)throw new Error("dem dimension mismatch");let S=h*this.dim,R=h*this.dim+this.dim,D=y*this.dim,$=y*this.dim+this.dim;switch(h){case-1:S=R-1;break;case 1:R=S+1}switch(y){case-1:D=$-1;break;case 1:$=D+1}const U=-h*this.dim,W=-y*this.dim;for(let te=D;te<$;te++)for(let ae=S;ae=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${l} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[l]}}class LM{constructor(l,h,y,S,R){this.type="Feature",this._vectorTileFeature=l,l._z=h,l._x=y,l._y=S,this.properties=l.properties,this.id=R}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(l){this._geometry=l}toJSON(){const l={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(l[h]=this[h]);return l}}class FM{constructor(l,h){this.tileID=l,this.x=l.canonical.x,this.y=l.canonical.y,this.z=l.canonical.z,this.grid=new rd(Ei,16,0),this.grid3D=new rd(Ei,16,0),this.featureIndexArray=new qn,this.promoteId=h}insert(l,h,y,S,R,D){const $=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(y,S,R);const U=D?this.grid3D:this.grid;for(let W=0;W=0&&ae[3]>=0&&U.insert($,ae[0],ae[1],ae[2],ae[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Fu.VectorTile(new c4(this.rawTileData)).layers,this.sourceLayerCoder=new NM(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(l,h,y,S){this.loadVTLayers();const R=l.params||{},D=Ei/l.tileSize/l.scale,$=Ff(R.filter),U=l.queryGeometry,W=l.queryPadding*D,te=$M(U),ae=this.grid.query(te.minX-W,te.minY-W,te.maxX+W,te.maxY+W),de=$M(l.cameraQueryGeometry),ge=this.grid3D.query(de.minX-W,de.minY-W,de.maxX+W,de.maxY+W,(Ne,it,yt,Ye)=>function(pt,Ot,At,gn,_n){for(const on of pt)if(Ot<=on.x&&At<=on.y&&gn>=on.x&&_n>=on.y)return!0;const cn=[new ne(Ot,At),new ne(Ot,_n),new ne(gn,_n),new ne(gn,At)];if(pt.length>2){for(const on of cn)if(Kf(pt,on))return!0}for(let on=0;on(Ye||(Ye=ld(pt)),Ot.queryIntersectsFeature(U,pt,At,Ye,this.z,l.transform,D,l.pixelPosMatrix)))}return ve}loadMatchingFeature(l,h,y,S,R,D,$,U,W,te,ae){const de=this.bucketLayerIDs[h];if(D&&!function(Ne,it){for(let yt=0;yt=0)return!0;return!1}(D,de))return;const ge=this.sourceLayerCoder.decode(y),ve=this.vtLayers[ge].feature(S);if(R.needGeometry){const Ne=ud(ve,!0);if(!R.filter(new Hr(this.tileID.overscaledZ),Ne,this.tileID.canonical))return}else if(!R.filter(new Hr(this.tileID.overscaledZ),ve))return;const Fe=this.getId(ve,ge);for(let Ne=0;Ne{const $=l instanceof ad?l.get(D):null;return $&&$.evaluate?$.evaluate(h,y,S):$})}function $M(f){let l=1/0,h=1/0,y=-1/0,S=-1/0;for(const R of f)l=Math.min(l,R.x),h=Math.min(h,R.y),y=Math.max(y,R.x),S=Math.max(S,R.y);return{minX:l,minY:h,maxX:y,maxY:S}}function lG(f,l){return l-f}var S4;yn("FeatureIndex",FM,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(S4=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",S4.load="load",S4.fullLoad="fullLoad";let wy=null,Cm=[];const E4=1e3/30,uG={mark(f){performance.mark(f)},frame(f){const l=f;wy!=null&&Cm.push(l-wy),wy=l},clearMetrics(){wy=null,Cm=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const f in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[f])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);const f=performance.getEntriesByName("loadTime")[0].duration,l=performance.getEntriesByName("fullLoadTime")[0].duration,h=Cm.length,y=1/(Cm.reduce((R,D)=>R+D,0)/h/1e3),S=Cm.filter(R=>R>E4).reduce((R,D)=>R+(D-E4)/E4,0);return{loadTime:f,fullLoadTime:l,fps:y,percentDroppedFrames:S/(h+S)*100}}};a.AJAXError=We,a.ARRAY_TYPE=wo,a.Actor=class{constructor(f,l,h){this.target=f,this.parent=l,this.mapId=h,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},k(["receive","process"],this),this.invoker=new sG(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=B()?f:window}send(f,l,h,y,S=!1){const R=Math.round(1e18*Math.random()).toString(36).substring(0,10);h&&(this.callbacks[R]=h);const D=Z(this.globalScope)?void 0:[];return this.target.postMessage({id:R,type:f,hasCallback:!!h,targetMapId:y,mustQueue:S,sourceMapId:this.mapId,data:Ol(l,D)},D),{cancel:()=>{h&&delete this.callbacks[R],this.target.postMessage({id:R,type:"",targetMapId:y,sourceMapId:this.mapId})}}}receive(f){const l=f.data,h=l.id;if(h&&(!l.targetMapId||this.mapId===l.targetMapId))if(l.type===""){delete this.tasks[h];const y=this.cancelCallbacks[h];delete this.cancelCallbacks[h],y&&y()}else B()||l.mustQueue?(this.tasks[h]=l,this.taskQueue.push(h),this.invoker.trigger()):this.processTask(h,l)}process(){if(!this.taskQueue.length)return;const f=this.taskQueue.shift(),l=this.tasks[f];delete this.tasks[f],this.taskQueue.length&&this.invoker.trigger(),l&&this.processTask(f,l)}processTask(f,l){if(l.type===""){const h=this.callbacks[f];delete this.callbacks[f],h&&(l.error?h(Zs(l.error)):h(null,Zs(l.data)))}else{let h=!1;const y=Z(this.globalScope)?void 0:[],S=l.hasCallback?($,U)=>{h=!0,delete this.cancelCallbacks[f],this.target.postMessage({id:f,type:"",sourceMapId:this.mapId,error:$?Ol($):null,data:Ol(U,y)},y)}:$=>{h=!0};let R=null;const D=Zs(l.data);if(this.parent[l.type])R=this.parent[l.type](l.sourceMapId,D,S);else if(this.parent.getWorkerSource){const $=l.type.split(".");R=this.parent.getWorkerSource(l.sourceMapId,$[0],D.source)[$[1]](D,S)}else S(new Error(`Could not find function ${l.type}`));!h&&R&&R.cancel&&(this.cancelCallbacks[f]=R.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.AlphaImage=hm,a.CanonicalTileID=C4,a.CollisionBoxArray=Et,a.CollisionCircleLayoutArray=class extends ie{},a.Color=ce,a.DEMData=OM,a.DataConstantProperty=wn,a.DictionaryCoder=NM,a.EXTENT=Ei,a.ErrorEvent=Nt,a.EvaluationParameters=Hr,a.Event=Dt,a.Evented=jt,a.FeatureIndex=FM,a.FillBucket=a4,a.FillExtrusionBucket=l4,a.GeoJSONFeature=LM,a.ImageAtlas=sM,a.ImagePosition=f4,a.LineBucket=u4,a.LineStripIndexArray=class extends Oe{},a.LngLat=oi,a.LngLatBounds=dd,a.MercatorCoordinate=_y,a.ONE_EM=Hi,a.OverscaledTileID=_a,a.PerformanceUtils=uG,a.PosArray=kn,a.Properties=ji,a.QuadTriangleArray=class extends me{},a.RGBAImage=ba,a.RasterBoundsArray=class extends C{},a.RequestPerformance=class{constructor(f){this._marks={start:[f.url,"start"].join("#"),end:[f.url,"end"].join("#"),measure:f.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let f=performance.getEntriesByName(this._marks.measure);return f.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),f=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),f}},a.ResourceType=St,a.SegmentVector=Jn,a.SymbolBucket=Qf,a.Transitionable=Y0,a.TriangleIndexArray=bo,a.Uniform1f=zl,a.Uniform1i=class extends Fl{constructor(f,l){super(f,l),this.current=0}set(f){this.current!==f&&(this.current=f,this.gl.uniform1i(this.location,f))}},a.Uniform2f=class extends Fl{constructor(f,l){super(f,l),this.current=[0,0]}set(f){f[0]===this.current[0]&&f[1]===this.current[1]||(this.current=f,this.gl.uniform2f(this.location,f[0],f[1]))}},a.Uniform3f=class extends Fl{constructor(f,l){super(f,l),this.current=[0,0,0]}set(f){f[0]===this.current[0]&&f[1]===this.current[1]&&f[2]===this.current[2]||(this.current=f,this.gl.uniform3f(this.location,f[0],f[1],f[2]))}},a.Uniform4f=jf,a.UniformColor=Ck,a.UniformMatrix4f=class extends Fl{constructor(f,l){super(f,l),this.current=MK}set(f){if(f[12]!==this.current[12]||f[0]!==this.current[0])return this.current=f,void this.gl.uniformMatrix4fv(this.location,!1,f);for(let l=1;l<16;l++)if(f[l]!==this.current[l]){this.current=f,this.gl.uniformMatrix4fv(this.location,!1,f);break}}},a.UnwrappedTileID=DM,a.ValidationError=Ze,a.ZoomHistory=Qp,a.add=function(f,l,h){return f[0]=l[0]+h[0],f[1]=l[1]+h[1],f[2]=l[2]+h[2],f},a.addDynamicAttributes=v4,a.asyncAll=function(f,l,h){if(!f.length)return h(null,[]);let y=f.length;const S=new Array(f.length);let R=null;f.forEach((D,$)=>{l(D,(U,W)=>{U&&(R=U),S[$]=W,--y==0&&h(R,S)})})},a.bezier=p,a.bindAll=k,a.cacheEntryPossiblyAdded=function(f){Ce++,Ce>Te&&(f.getActor().send("enforceCacheSizeLimit",xe),Ce=0)},a.clamp=v,a.clearTileCache=function(f){const l=caches.delete(he);f&&l.catch(f).then(()=>f())},a.clipLine=xM,a.clone=function(f){var l=new wo(16);return l[0]=f[0],l[1]=f[1],l[2]=f[2],l[3]=f[3],l[4]=f[4],l[5]=f[5],l[6]=f[6],l[7]=f[7],l[8]=f[8],l[9]=f[9],l[10]=f[10],l[11]=f[11],l[12]=f[12],l[13]=f[13],l[14]=f[14],l[15]=f[15],l},a.clone$1=O,a.clone$2=function(f){var l=new wo(3);return l[0]=f[0],l[1]=f[1],l[2]=f[2],l},a.collisionCircleLayout=IW,a.config=oe,a.copy=function(f,l){return f[0]=l[0],f[1]=l[1],f[2]=l[2],f[3]=l[3],f[4]=l[4],f[5]=l[5],f[6]=l[6],f[7]=l[7],f[8]=l[8],f[9]=l[9],f[10]=l[10],f[11]=l[11],f[12]=l[12],f[13]=l[13],f[14]=l[14],f[15]=l[15],f},a.create=function(){var f=new wo(16);return wo!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=0,f[12]=0,f[13]=0,f[14]=0),f[0]=1,f[5]=1,f[10]=1,f[15]=1,f},a.create$1=Rk,a.createExpression=Wc,a.createFilter=Ff,a.createLayout=gi,a.createStyleLayer=function(f){return f.type==="custom"?new oG(f):new aG[f.type](f)},a.cross=function(f,l,h){var y=l[0],S=l[1],R=l[2],D=h[0],$=h[1],U=h[2];return f[0]=S*U-R*$,f[1]=R*D-y*U,f[2]=y*$-S*D,f},a.dot=function(f,l){return f[0]*l[0]+f[1]*l[1]+f[2]*l[2]},a.dot$1=function(f,l){return f[0]*l[0]+f[1]*l[1]+f[2]*l[2]+f[3]*l[3]},a.ease=m,a.emitValidationErrors=$f,a.enforceCacheSizeLimit=function(f){Ee(),_e&&_e.then(l=>{l.keys().then(h=>{for(let y=0;y{}}},a.identity=Yw,a.invert=function(f,l){var h=l[0],y=l[1],S=l[2],R=l[3],D=l[4],$=l[5],U=l[6],W=l[7],te=l[8],ae=l[9],de=l[10],ge=l[11],ve=l[12],Fe=l[13],Ne=l[14],it=l[15],yt=h*$-y*D,Ye=h*U-S*D,pt=h*W-R*D,Ot=y*U-S*$,At=y*W-R*$,gn=S*W-R*U,_n=te*Fe-ae*ve,cn=te*Ne-de*ve,on=te*it-ge*ve,en=ae*Ne-de*Fe,dn=ae*it-ge*Fe,an=de*it-ge*Ne,Wt=yt*an-Ye*dn+pt*en+Ot*on-At*cn+gn*_n;return Wt?(f[0]=($*an-U*dn+W*en)*(Wt=1/Wt),f[1]=(S*dn-y*an-R*en)*Wt,f[2]=(Fe*gn-Ne*At+it*Ot)*Wt,f[3]=(de*At-ae*gn-ge*Ot)*Wt,f[4]=(U*on-D*an-W*cn)*Wt,f[5]=(h*an-S*on+R*cn)*Wt,f[6]=(Ne*pt-ve*gn-it*Ye)*Wt,f[7]=(te*gn-de*pt+ge*Ye)*Wt,f[8]=(D*dn-$*on+W*_n)*Wt,f[9]=(y*on-h*dn-R*_n)*Wt,f[10]=(ve*At-Fe*pt+it*yt)*Wt,f[11]=(ae*pt-te*At-ge*yt)*Wt,f[12]=($*cn-D*en-U*_n)*Wt,f[13]=(h*en-y*cn+S*_n)*Wt,f[14]=(Fe*Ye-ve*Ot-Ne*yt)*Wt,f[15]=(te*Ot-ae*Ye+de*yt)*Wt,f):null},a.isImageBitmap=Q,a.isSafari=Z,a.isWorker=B,a.keysDifference=function(f,l){const h=[];for(const y in f)y in l||h.push(y);return h},a.lazyLoadRTLTextPlugin=function(){ea.isLoading()||ea.isLoaded()||id()!=="deferred"||X0()},a.makeRequest=mt,a.mapObject=T,a.mercatorXfromLng=kM,a.mercatorYfromLat=MM,a.mercatorZfromAltitude=RM,a.mul=zK,a.mul$1=function(f,l,h){return f[0]=l[0]*h[0],f[1]=l[1]*h[1],f[2]=l[2]*h[2],f[3]=l[3]*h[3],f},a.multiply=Ak,a.nextPowerOfTwo=function(f){return f<=1?1:Math.pow(2,Math.ceil(Math.log(f)/Math.LN2))},a.normalize=function(f,l){var h=l[0],y=l[1],S=l[2],R=h*h+y*y+S*S;return R>0&&(R=1/Math.sqrt(R)),f[0]=l[0]*R,f[1]=l[1]*R,f[2]=l[2]*R,f},a.number=Pr,a.ortho=function(f,l,h,y,S,R,D){var $=1/(l-h),U=1/(y-S),W=1/(R-D);return f[0]=-2*$,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=-2*U,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=2*W,f[11]=0,f[12]=(l+h)*$,f[13]=(S+y)*U,f[14]=(D+R)*W,f[15]=1,f},a.parseCacheControl=H,a.parseGlyphPbf=function(f){return new c4(f).readFields(zW,[])},a.pbf=c4,a.performSymbolLayout=function(f){f.bucket.createArrays(),f.bucket.tilePixelRatio=Ei/(512*f.bucket.overscaling),f.bucket.compareText={},f.bucket.iconsNeedLinear=!1;const l=f.bucket.layers[0].layout,h=f.bucket.layers[0]._unevaluatedLayout._values,y={layoutIconSize:h["icon-size"].possiblyEvaluate(new Hr(f.bucket.zoom+1),f.canonical),layoutTextSize:h["text-size"].possiblyEvaluate(new Hr(f.bucket.zoom+1),f.canonical),textMaxSize:h["text-size"].possiblyEvaluate(new Hr(18))};if(f.bucket.textSizeData.kind==="composite"){const{minZoom:U,maxZoom:W}=f.bucket.textSizeData;y.compositeTextSizes=[h["text-size"].possiblyEvaluate(new Hr(U),f.canonical),h["text-size"].possiblyEvaluate(new Hr(W),f.canonical)]}if(f.bucket.iconSizeData.kind==="composite"){const{minZoom:U,maxZoom:W}=f.bucket.iconSizeData;y.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new Hr(U),f.canonical),h["icon-size"].possiblyEvaluate(new Hr(W),f.canonical)]}const S=l.get("text-line-height")*Hi,R=l.get("text-rotation-alignment")!=="viewport"&&l.get("symbol-placement")!=="point",D=l.get("text-keep-upright"),$=l.get("text-size");for(const U of f.bucket.features){const W=l.get("text-font").evaluate(U,{},f.canonical).join(","),te=$.evaluate(U,{},f.canonical),ae=y.layoutTextSize.evaluate(U,{},f.canonical),de=y.layoutIconSize.evaluate(U,{},f.canonical),ge={horizontal:{},vertical:void 0},ve=U.text;let Fe,Ne=[0,0];if(ve){const Ye=ve.toString(),pt=l.get("text-letter-spacing").evaluate(U,{},f.canonical)*Hi,Ot=jw(Ye)?pt:0,At=l.get("text-anchor").evaluate(U,{},f.canonical),gn=l.get("text-variable-anchor");if(!gn){const dn=l.get("text-radial-offset").evaluate(U,{},f.canonical);Ne=dn?wM(At,[dn*Hi,m4]):l.get("text-offset").evaluate(U,{},f.canonical).map(an=>an*Hi)}let _n=R?"center":l.get("text-justify").evaluate(U,{},f.canonical);const cn=l.get("symbol-placement"),on=cn==="point"?l.get("text-max-width").evaluate(U,{},f.canonical)*Hi:0,en=()=>{f.bucket.allowVerticalPlacement&&Bf(Ye)&&(ge.vertical=hy(ve,f.glyphMap,f.glyphPositions,f.imagePositions,W,on,S,At,"left",Ot,Ne,a.WritingMode.vertical,!0,cn,ae,te))};if(!R&&gn){const dn=_n==="auto"?gn.map(Wt=>g4(Wt)):[_n];let an=!1;for(let Wt=0;Wtthis._layers[et.id]),Ae=we[0];if(Ae.visibility==="none")continue;const Pe=Ae.source||"";let Me=this.familiesBySource[Pe];Me||(Me=this.familiesBySource[Pe]={});const Be=Ae.sourceLayer||"_geojsonTileLayer";let Je=Me[Be];Je||(Je=Me[Be]=[]),Je.push(we)}}}class m{constructor(q){const J={},pe=[];for(const Pe in q){const Me=q[Pe],Be=J[Pe]={};for(const Je in Me){const et=Me[+Je];if(!et||et.bitmap.width===0||et.bitmap.height===0)continue;const Ge={x:0,y:0,w:et.bitmap.width+2,h:et.bitmap.height+2};pe.push(Ge),Be[Je]={rect:Ge,metrics:et.metrics}}}const{w:ce,h:we}=a.potpack(pe),Ae=new a.AlphaImage({width:ce||1,height:we||1});for(const Pe in q){const Me=q[Pe];for(const Be in Me){const Je=Me[+Be];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const et=J[Pe][Be].rect;a.AlphaImage.copy(Je.bitmap,Ae,{x:0,y:0},{x:et.x+1,y:et.y+1},Je.bitmap)}}this.image=Ae,this.positions=J}}a.register("GlyphAtlas",m);class v{constructor(q){this.tileID=new a.OverscaledTileID(q.tileID.overscaledZ,q.tileID.wrap,q.tileID.canonical.z,q.tileID.canonical.x,q.tileID.canonical.y),this.uid=q.uid,this.zoom=q.zoom,this.pixelRatio=q.pixelRatio,this.tileSize=q.tileSize,this.source=q.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=q.showCollisionBoxes,this.collectResourceTiming=!!q.collectResourceTiming,this.returnDependencies=!!q.returnDependencies,this.promoteId=q.promoteId}parse(q,J,pe,ce,we){this.status="parsing",this.data=q,this.collisionBoxArray=new a.CollisionBoxArray;const Ae=new a.DictionaryCoder(Object.keys(q.layers).sort()),Pe=new a.FeatureIndex(this.tileID,this.promoteId);Pe.bucketLayerIDs=[];const Me={},Be={featureIndex:Pe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:pe},Je=J.familiesBySource[this.source];for(const hn in Je){const Pn=q.layers[hn];if(!Pn)continue;Pn.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${hn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Gn=Ae.encode(hn),lr=[];for(let Zr=0;Zr=hr.maxzoom||hr.visibility!=="none"&&(x(Zr,this.zoom,pe),(Me[hr.id]=hr.createBucket({index:Pe.bucketLayerIDs.length,layers:Zr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Gn,sourceID:this.source})).populate(lr,Be,this.tileID.canonical),Pe.bucketLayerIDs.push(Zr.map(Vr=>Vr.id)))}}let et,Ge,Ut,Mt;const at=a.mapObject(Be.glyphDependencies,hn=>Object.keys(hn).map(Number));Object.keys(at).length?ce.send("getGlyphs",{uid:this.uid,stacks:at},(hn,Pn)=>{et||(et=hn,Ge=Pn,En.call(this))}):Ge={};const $t=Object.keys(Be.iconDependencies);$t.length?ce.send("getImages",{icons:$t,source:this.source,tileID:this.tileID,type:"icons"},(hn,Pn)=>{et||(et=hn,Ut=Pn,En.call(this))}):Ut={};const Xt=Object.keys(Be.patternDependencies);function En(){if(et)return we(et);if(Ge&&Ut&&Mt){const hn=new m(Ge),Pn=new a.ImageAtlas(Ut,Mt);for(const Gn in Me){const lr=Me[Gn];lr instanceof a.SymbolBucket?(x(lr.layers,this.zoom,pe),a.performSymbolLayout({bucket:lr,glyphMap:Ge,glyphPositions:hn.positions,imageMap:Ut,imagePositions:Pn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):lr.hasPattern&&(lr instanceof a.LineBucket||lr instanceof a.FillBucket||lr instanceof a.FillExtrusionBucket)&&(x(lr.layers,this.zoom,pe),lr.addFeatures(Be,this.tileID.canonical,Pn.patternPositions))}this.status="done",we(null,{buckets:Object.values(Me).filter(Gn=>!Gn.isEmpty()),featureIndex:Pe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:hn.image,imageAtlas:Pn,glyphMap:this.returnDependencies?Ge:null,iconMap:this.returnDependencies?Ut:null,glyphPositions:this.returnDependencies?hn.positions:null})}}Xt.length?ce.send("getImages",{icons:Xt,source:this.source,tileID:this.tileID,type:"patterns"},(hn,Pn)=>{et||(et=hn,Mt=Pn,En.call(this))}):Mt={},En.call(this)}}function x(ye,q,J){const pe=new a.EvaluationParameters(q);for(const ce of ye)ce.recalculate(pe,J)}function _(ye,q){const J=a.getArrayBuffer(ye.request,(pe,ce,we,Ae)=>{pe?q(pe):ce&&q(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(ce)),rawData:ce,cacheControl:we,expires:Ae})});return()=>{J.cancel(),q()}}class P{constructor(q,J,pe,ce){this.actor=q,this.layerIndex=J,this.availableImages=pe,this.loadVectorData=ce||_,this.loading={},this.loaded={}}loadTile(q,J){const pe=q.uid;this.loading||(this.loading={});const ce=!!(q&&q.request&&q.request.collectResourceTiming)&&new a.RequestPerformance(q.request),we=this.loading[pe]=new v(q);we.abort=this.loadVectorData(q,(Ae,Pe)=>{if(delete this.loading[pe],Ae||!Pe)return we.status="done",this.loaded[pe]=we,J(Ae);const Me=Pe.rawData,Be={};Pe.expires&&(Be.expires=Pe.expires),Pe.cacheControl&&(Be.cacheControl=Pe.cacheControl);const Je={};if(ce){const et=ce.finish();et&&(Je.resourceTiming=JSON.parse(JSON.stringify(et)))}we.vectorTile=Pe.vectorTile,we.parse(Pe.vectorTile,this.layerIndex,this.availableImages,this.actor,(et,Ge)=>{if(et||!Ge)return J(et);J(null,a.extend({rawTileData:Me.slice(0)},Ge,Be,Je))}),this.loaded=this.loaded||{},this.loaded[pe]=we})}reloadTile(q,J){const pe=this.loaded,ce=q.uid,we=this;if(pe&&pe[ce]){const Ae=pe[ce];Ae.showCollisionBoxes=q.showCollisionBoxes;const Pe=(Me,Be)=>{const Je=Ae.reloadCallback;Je&&(delete Ae.reloadCallback,Ae.parse(Ae.vectorTile,we.layerIndex,this.availableImages,we.actor,Je)),J(Me,Be)};Ae.status==="parsing"?Ae.reloadCallback=Pe:Ae.status==="done"&&(Ae.vectorTile?Ae.parse(Ae.vectorTile,this.layerIndex,this.availableImages,this.actor,Pe):Pe())}}abortTile(q,J){const pe=this.loading,ce=q.uid;pe&&pe[ce]&&pe[ce].abort&&(pe[ce].abort(),delete pe[ce]),J()}removeTile(q,J){const pe=this.loaded,ce=q.uid;pe&&pe[ce]&&delete pe[ce],J()}}class k{constructor(){this.loaded={}}loadTile(q,J){const{uid:pe,encoding:ce,rawImageData:we}=q,Ae=a.isImageBitmap(we)?this.getImageData(we):we,Pe=new a.DEMData(pe,Ae,ce);this.loaded=this.loaded||{},this.loaded[pe]=Pe,J(null,Pe)}getImageData(q){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(q.width,q.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=q.width,this.offscreenCanvas.height=q.height,this.offscreenCanvasContext.drawImage(q,0,0,q.width,q.height);const J=this.offscreenCanvasContext.getImageData(-1,-1,q.width+2,q.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:J.width,height:J.height},J.data)}removeTile(q){const J=this.loaded,pe=q.uid;J&&J[pe]&&delete J[pe]}}var T=function ye(q,J){var pe,ce=q&&q.type;if(ce==="FeatureCollection")for(pe=0;pe=Math.abs(Pe)?J-Me+Pe:Pe-Me+J,J=Me}J+pe>=0!=!!q&&ye.reverse()}const N=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class L{constructor(q){this._feature=q,this.extent=a.EXTENT,this.type=q.type,this.properties=q.tags,"id"in q&&!isNaN(q.id)&&(this.id=parseInt(q.id,10))}loadGeometry(){if(this._feature.type===1){const q=[];for(const J of this._feature.geometry)q.push([new a.pointGeometry(J[0],J[1])]);return q}{const q=[];for(const J of this._feature.geometry){const pe=[];for(const ce of J)pe.push(new a.pointGeometry(ce[0],ce[1]));q.push(pe)}return q}}toGeoJSON(q,J,pe){return N.call(this,q,J,pe)}}class F{constructor(q){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=q.length,this._features=q}feature(q){return new L(this._features[q])}}var V={exports:{}},B=a.pointGeometry,H=a.vectorTile.VectorTileFeature,G=ee;function ee(ye,q){this.options=q||{},this.features=ye,this.length=ye.length}function X(ye,q){this.id=typeof ye.id=="number"?ye.id:void 0,this.type=ye.type,this.rawGeometry=ye.type===1?[ye.geometry]:ye.geometry,this.properties=ye.tags,this.extent=q||4096}ee.prototype.feature=function(ye){return new X(this.features[ye],this.options.extent)},X.prototype.loadGeometry=function(){var ye=this.rawGeometry;this.geometry=[];for(var q=0;q>31}function be(ye,q){for(var J=ye.loadGeometry(),pe=ye.type,ce=0,we=0,Ae=J.length,Pe=0;Pe>1;Ee(ye,q,Ae,pe,ce,we%2),Te(ye,q,J,pe,Ae-1,we+1),Te(ye,q,J,Ae+1,ce,we+1)}function Ee(ye,q,J,pe,ce,we){for(;ce>pe;){if(ce-pe>600){const Be=ce-pe+1,Je=J-pe+1,et=Math.log(Be),Ge=.5*Math.exp(2*et/3),Ut=.5*Math.sqrt(et*Ge*(Be-Ge)/Be)*(Je-Be/2<0?-1:1);Ee(ye,q,J,Math.max(pe,Math.floor(J-Je*Ge/Be+Ut)),Math.min(ce,Math.floor(J+(Be-Je)*Ge/Be+Ut)),we)}const Ae=q[2*J+we];let Pe=pe,Me=ce;for(Ce(ye,q,pe,J),q[2*ce+we]>Ae&&Ce(ye,q,pe,ce);PeAe;)Me--}q[2*pe+we]===Ae?Ce(ye,q,pe,Me):(Me++,Ce(ye,q,Me,ce)),Me<=J&&(pe=Me+1),J<=Me&&(ce=Me-1)}}function Ce(ye,q,J,pe){ke(ye,J,pe),ke(q,2*J,2*pe),ke(q,2*J+1,2*pe+1)}function ke(ye,q,J){const pe=ye[q];ye[q]=ye[J],ye[J]=pe}function De(ye,q,J,pe){const ce=ye-J,we=q-pe;return ce*ce+we*we}V.exports=le,V.exports.fromVectorTileJs=le,V.exports.fromGeojsonVt=function(ye,q){q=q||{};var J={};for(var pe in ye)J[pe]=new Q(ye[pe].features,q),J[pe].name=pe,J[pe].version=q.version,J[pe].extent=q.extent;return le({layers:J})},V.exports.GeoJSONWrapper=Q;const Ke=ye=>ye[0],Ue=ye=>ye[1];class tt{constructor(q,J=Ke,pe=Ue,ce=64,we=Float64Array){this.nodeSize=ce,this.points=q;const Ae=q.length<65536?Uint16Array:Uint32Array,Pe=this.ids=new Ae(q.length),Me=this.coords=new we(2*q.length);for(let Be=0;Be=Pe&&Mt<=Be&&at>=Me&&at<=Je&&Ut.push(we[Gn]);continue}const hn=Math.floor((En+Xt)/2);Mt=Ae[2*hn],at=Ae[2*hn+1],Mt>=Pe&&Mt<=Be&&at>=Me&&at<=Je&&Ut.push(we[hn]);const Pn=($t+1)%2;($t===0?Pe<=Mt:Me<=at)&&(Ge.push(En),Ge.push(hn-1),Ge.push(Pn)),($t===0?Be>=Mt:Je>=at)&&(Ge.push(hn+1),Ge.push(Xt),Ge.push(Pn))}return Ut}(this.ids,this.coords,q,J,pe,ce,this.nodeSize)}within(q,J,pe){return function(ce,we,Ae,Pe,Me,Be){const Je=[0,ce.length-1,0],et=[],Ge=Me*Me;for(;Je.length;){const Ut=Je.pop(),Mt=Je.pop(),at=Je.pop();if(Mt-at<=Be){for(let Pn=at;Pn<=Mt;Pn++)De(we[2*Pn],we[2*Pn+1],Ae,Pe)<=Ge&&et.push(ce[Pn]);continue}const $t=Math.floor((at+Mt)/2),Xt=we[2*$t],En=we[2*$t+1];De(Xt,En,Ae,Pe)<=Ge&&et.push(ce[$t]);const hn=(Ut+1)%2;(Ut===0?Ae-Me<=Xt:Pe-Me<=En)&&(Je.push(at),Je.push($t-1),Je.push(hn)),(Ut===0?Ae+Me>=Xt:Pe+Me>=En)&&(Je.push($t+1),Je.push(Mt),Je.push(hn))}return et}(this.ids,this.coords,q,J,pe,this.nodeSize)}}const lt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ye=>ye},St=Math.fround||(We=new Float32Array(1),ye=>(We[0]=+ye,We[0]));var We;class bt{constructor(q){this.options=qe(Object.create(lt),q),this.trees=new Array(this.options.maxZoom+1)}load(q){const{log:J,minZoom:pe,maxZoom:ce,nodeSize:we}=this.options;J&&console.time("total time");const Ae=`prepare ${q.length} points`;J&&console.time(Ae),this.points=q;let Pe=[];for(let Me=0;Me=pe;Me--){const Be=+Date.now();Pe=this._cluster(Pe,Me),this.trees[Me]=new tt(Pe,dt,_t,we,Float32Array),J&&console.log("z%d: %d clusters in %dms",Me,Pe.length,+Date.now()-Be)}return J&&console.timeEnd("total time"),this}getClusters(q,J){let pe=((q[0]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,q[1]));let we=q[2]===180?180:((q[2]+180)%360+360)%360-180;const Ae=Math.max(-90,Math.min(90,q[3]));if(q[2]-q[0]>=360)pe=-180,we=180;else if(pe>we){const Je=this.getClusters([pe,ce,180,Ae],J),et=this.getClusters([-180,ce,we,Ae],J);return Je.concat(et)}const Pe=this.trees[this._limitZoom(J)],Me=Pe.range(rt(pe),ut(Ae),rt(we),ut(ce)),Be=[];for(const Je of Me){const et=Pe.points[Je];Be.push(et.numPoints?ct(et):this.points[et.index])}return Be}getChildren(q){const J=this._getOriginId(q),pe=this._getOriginZoom(q),ce="No cluster with the specified id.",we=this.trees[pe];if(!we)throw new Error(ce);const Ae=we.points[J];if(!Ae)throw new Error(ce);const Pe=this.options.radius/(this.options.extent*Math.pow(2,pe-1)),Me=we.within(Ae.x,Ae.y,Pe),Be=[];for(const Je of Me){const et=we.points[Je];et.parentId===q&&Be.push(et.numPoints?ct(et):this.points[et.index])}if(Be.length===0)throw new Error(ce);return Be}getLeaves(q,J,pe){const ce=[];return this._appendLeaves(ce,q,J=J||10,pe=pe||0,0),ce}getTile(q,J,pe){const ce=this.trees[this._limitZoom(q)],we=Math.pow(2,q),{extent:Ae,radius:Pe}=this.options,Me=Pe/Ae,Be=(pe-Me)/we,Je=(pe+1+Me)/we,et={features:[]};return this._addTileFeatures(ce.range((J-Me)/we,Be,(J+1+Me)/we,Je),ce.points,J,pe,we,et),J===0&&this._addTileFeatures(ce.range(1-Me/we,Be,1,Je),ce.points,we,pe,we,et),J===we-1&&this._addTileFeatures(ce.range(0,Be,Me/we,Je),ce.points,-1,pe,we,et),et.features.length?et:null}getClusterExpansionZoom(q){let J=this._getOriginZoom(q)-1;for(;J<=this.options.maxZoom;){const pe=this.getChildren(q);if(J++,pe.length!==1)break;q=pe[0].properties.cluster_id}return J}_appendLeaves(q,J,pe,ce,we){const Ae=this.getChildren(J);for(const Pe of Ae){const Me=Pe.properties;if(Me&&Me.cluster?we+Me.point_count<=ce?we+=Me.point_count:we=this._appendLeaves(q,Me.cluster_id,pe,ce,we):weJ&&(Mt+=$t.numPoints||1)}if(Mt>Ut&&Mt>=Pe){let at=Je.x*Ut,$t=Je.y*Ut,Xt=Ae&&Ut>1?this._map(Je,!0):null;const En=(Be<<5)+(J+1)+this.points.length;for(const hn of Ge){const Pn=et.points[hn];if(Pn.zoom<=J)continue;Pn.zoom=J;const Gn=Pn.numPoints||1;at+=Pn.x*Gn,$t+=Pn.y*Gn,Pn.parentId=En,Ae&&(Xt||(Xt=this._map(Je,!0)),Ae(Xt,this._map(Pn)))}Je.parentId=En,pe.push(Qe(at/Mt,$t/Mt,En,Mt,Xt))}else if(pe.push(Je),Mt>1)for(const at of Ge){const $t=et.points[at];$t.zoom<=J||($t.zoom=J,pe.push($t))}}return pe}_getOriginId(q){return q-this.points.length>>5}_getOriginZoom(q){return(q-this.points.length)%32}_map(q,J){if(q.numPoints)return J?qe({},q.properties):q.properties;const pe=this.points[q.index].properties,ce=this.options.map(pe);return J&&ce===pe?qe({},ce):ce}}function Qe(ye,q,J,pe,ce){return{x:St(ye),y:St(q),zoom:1/0,id:J,parentId:-1,numPoints:pe,properties:ce}}function mt(ye,q){const[J,pe]=ye.geometry.coordinates;return{x:St(rt(J)),y:St(ut(pe)),zoom:1/0,index:q,parentId:-1}}function ct(ye){return{type:"Feature",id:ye.id,properties:wt(ye),geometry:{type:"Point",coordinates:[(q=ye.x,360*(q-.5)),nt(ye.y)]}};var q}function wt(ye){const q=ye.numPoints,J=q>=1e4?`${Math.round(q/1e3)}k`:q>=1e3?Math.round(q/100)/10+"k":q;return qe(qe({},ye.properties),{cluster:!0,cluster_id:ye.id,point_count:q,point_count_abbreviated:J})}function rt(ye){return ye/360+.5}function ut(ye){const q=Math.sin(ye*Math.PI/180),J=.5-.25*Math.log((1+q)/(1-q))/Math.PI;return J<0?0:J>1?1:J}function nt(ye){const q=(180-360*ye)*Math.PI/180;return 360*Math.atan(Math.exp(q))/Math.PI-90}function qe(ye,q){for(const J in q)ye[J]=q[J];return ye}function dt(ye){return ye.x}function _t(ye){return ye.y}function Dt(ye,q,J,pe){for(var ce,we=pe,Ae=J-q>>1,Pe=J-q,Me=ye[q],Be=ye[q+1],Je=ye[J],et=ye[J+1],Ge=q+3;Gewe)ce=Ge,we=Ut;else if(Ut===we){var Mt=Math.abs(Ge-Ae);Mtpe&&(ce-q>3&&Dt(ye,q,ce,pe),ye[ce+2]=we,J-ce>3&&Dt(ye,ce,J,pe))}function Nt(ye,q,J,pe,ce,we){var Ae=ce-J,Pe=we-pe;if(Ae!==0||Pe!==0){var Me=((ye-J)*Ae+(q-pe)*Pe)/(Ae*Ae+Pe*Pe);Me>1?(J=ce,pe=we):Me>0&&(J+=Ae*Me,pe+=Pe*Me)}return(Ae=ye-J)*Ae+(Pe=q-pe)*Pe}function jt(ye,q,J,pe){var ce={id:ye===void 0?null:ye,type:q,geometry:J,tags:pe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(we){var Ae=we.geometry,Pe=we.type;if(Pe==="Point"||Pe==="MultiPoint"||Pe==="LineString")Ve(we,Ae);else if(Pe==="Polygon"||Pe==="MultiLineString")for(var Me=0;Me0&&(Ae+=pe?(ce*Be-Me*we)/2:Math.sqrt(Math.pow(Me-ce,2)+Math.pow(Be-we,2))),ce=Me,we=Be}var Je=q.length-3;q[2]=1,Dt(q,0,Je,J),q[Je+2]=1,q.size=Math.abs(Ae),q.start=0,q.end=q.size}function Gt(ye,q,J,pe){for(var ce=0;ce1?1:J}function Qt(ye,q,J,pe,ce,we,Ae,Pe){if(pe/=q,we>=(J/=q)&&Ae=pe)return null;for(var Me=[],Be=0;Be=J&&Mt=pe)){var at=[];if(Ge==="Point"||Ge==="MultiPoint")pn(et,at,J,pe,ce);else if(Ge==="LineString")ot(et,at,J,pe,ce,!1,Pe.lineMetrics);else if(Ge==="MultiLineString")Tt(et,at,J,pe,ce,!1);else if(Ge==="Polygon")Tt(et,at,J,pe,ce,!0);else if(Ge==="MultiPolygon")for(var $t=0;$t=J&&Ae<=pe&&(q.push(ye[we]),q.push(ye[we+1]),q.push(ye[we+2]))}}function ot(ye,q,J,pe,ce,we,Ae){for(var Pe,Me,Be=Lt(ye),Je=ce===0?Zt:ht,et=ye.start,Ge=0;GeJ&&(Me=Je(Be,Ut,Mt,$t,Xt,J),Ae&&(Be.start=et+Pe*Me)):En>pe?hn=J&&(Me=Je(Be,Ut,Mt,$t,Xt,J),Pn=!0),hn>pe&&En<=pe&&(Me=Je(Be,Ut,Mt,$t,Xt,pe),Pn=!0),!we&&Pn&&(Ae&&(Be.end=et+Pe*Me),q.push(Be),Be=Lt(ye)),Ae&&(et+=Pe)}var Gn=ye.length-3;Ut=ye[Gn],Mt=ye[Gn+1],at=ye[Gn+2],(En=ce===0?Ut:Mt)>=J&&En<=pe&&Kt(Be,Ut,Mt,at),Gn=Be.length-3,we&&Gn>=3&&(Be[Gn]!==Be[0]||Be[Gn+1]!==Be[1])&&Kt(Be,Be[0],Be[1],Be[2]),Be.length&&q.push(Be)}function Lt(ye){var q=[];return q.size=ye.size,q.start=ye.start,q.end=ye.end,q}function Tt(ye,q,J,pe,ce,we){for(var Ae=0;AeAe.maxX&&(Ae.maxX=Je),et>Ae.maxY&&(Ae.maxY=et)}return Ae}function xt(ye,q,J,pe){var ce=q.geometry,we=q.type,Ae=[];if(we==="Point"||we==="MultiPoint")for(var Pe=0;Pe0&&q.size<(ce?Ae:pe))J.numPoints+=q.length/3;else{for(var Pe=[],Me=0;MeAe)&&(J.numSimplified++,Pe.push(q[Me]),Pe.push(q[Me+1])),J.numPoints++;ce&&function(Be,Je){for(var et=0,Ge=0,Ut=Be.length,Mt=Ut-2;Ge0===Je)for(Ge=0,Ut=Be.length;Ge24)throw new Error("maxZoom should be in the 0-24 range");if(q.promoteId&&q.generateId)throw new Error("promoteId and generateId cannot be used together.");var pe=function(ce,we){var Ae=[];if(ce.type==="FeatureCollection")for(var Pe=0;Pe1&&console.time("creation"),Ge=this.tiles[et]=gt(ye,q,J,pe,Me),this.tileCoords.push({z:q,x:J,y:pe}),Be)){Be>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",q,J,pe,Ge.numFeatures,Ge.numPoints,Ge.numSimplified),console.timeEnd("creation"));var Ut="z"+q;this.stats[Ut]=(this.stats[Ut]||0)+1,this.total++}if(Ge.source=ye,ce){if(q===Me.maxZoom||q===ce)continue;var Mt=1<1&&console.time("clipping");var at,$t,Xt,En,hn,Pn,Gn=.5*Me.buffer/Me.extent,lr=.5-Gn,Zr=.5+Gn,hr=1+Gn;at=$t=Xt=En=null,hn=Qt(ye,Je,J-Gn,J+Zr,0,Ge.minX,Ge.maxX,Me),Pn=Qt(ye,Je,J+lr,J+hr,0,Ge.minX,Ge.maxX,Me),ye=null,hn&&(at=Qt(hn,Je,pe-Gn,pe+Zr,1,Ge.minY,Ge.maxY,Me),$t=Qt(hn,Je,pe+lr,pe+hr,1,Ge.minY,Ge.maxY,Me),hn=null),Pn&&(Xt=Qt(Pn,Je,pe-Gn,pe+Zr,1,Ge.minY,Ge.maxY,Me),En=Qt(Pn,Je,pe+lr,pe+hr,1,Ge.minY,Ge.maxY,Me),Pn=null),Be>1&&console.timeEnd("clipping"),Pe.push(at||[],q+1,2*J,2*pe),Pe.push($t||[],q+1,2*J,2*pe+1),Pe.push(Xt||[],q+1,2*J+1,2*pe),Pe.push(En||[],q+1,2*J+1,2*pe+1)}}},qt.prototype.getTile=function(ye,q,J){var pe=this.options,ce=pe.extent,we=pe.debug;if(ye<0||ye>24)return null;var Ae=1<1&&console.log("drilling down to z%d-%d-%d",ye,q,J);for(var Me,Be=ye,Je=q,et=J;!Me&&Be>0;)Be--,Je=Math.floor(Je/2),et=Math.floor(et/2),Me=this.tiles[vn(Be,Je,et)];return Me&&Me.source?(we>1&&console.log("found parent tile z%d-%d-%d",Be,Je,et),we>1&&console.time("drilling down"),this.splitTile(Me.source,Be,Je,et,ye,q,J),we>1&&console.timeEnd("drilling down"),this.tiles[Pe]?tn(this.tiles[Pe],ce):null):null};class tr extends P{constructor(q,J,pe,ce){super(q,J,pe,Fn),ce&&(this.loadGeoJSON=ce)}loadData(q,J){var pe;(pe=this._pendingRequest)===null||pe===void 0||pe.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const ce=!!(q&&q.request&&q.request.collectResourceTiming)&&new a.RequestPerformance(q.request);this._pendingCallback=J,this._pendingRequest=this.loadGeoJSON(q,(we,Ae)=>{if(delete this._pendingCallback,delete this._pendingRequest,we||!Ae)return J(we);if(typeof Ae!="object")return J(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`));{T(Ae,!0);try{if(q.filter){const Me=a.createExpression(q.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Me.result==="error")throw new Error(Me.value.map(Je=>`${Je.key}: ${Je.message}`).join(", "));Ae={type:"FeatureCollection",features:Ae.features.filter(Je=>Me.value.evaluate({zoom:0},Je))}}this._geoJSONIndex=q.cluster?new bt(function({superclusterOptions:Me,clusterProperties:Be}){if(!Be||!Me)return Me;const Je={},et={},Ge={accumulated:null,zoom:0},Ut={properties:null},Mt=Object.keys(Be);for(const at of Mt){const[$t,Xt]=Be[at],En=a.createExpression(Xt),hn=a.createExpression(typeof $t=="string"?[$t,["accumulated"],["get",at]]:$t);Je[at]=En.value,et[at]=hn.value}return Me.map=at=>{Ut.properties=at;const $t={};for(const Xt of Mt)$t[Xt]=Je[Xt].evaluate(Ge,Ut);return $t},Me.reduce=(at,$t)=>{Ut.properties=$t;for(const Xt of Mt)Ge.accumulated=at[Xt],at[Xt]=et[Xt].evaluate(Ge,Ut)},Me}(q)).load(Ae.features):function(Me,Be){return new qt(Me,Be)}(Ae,q.geojsonVtOptions)}catch(Me){return J(Me)}this.loaded={};const Pe={};if(ce){const Me=ce.finish();Me&&(Pe.resourceTiming={},Pe.resourceTiming[q.source]=JSON.parse(JSON.stringify(Me)))}J(null,Pe)}})}reloadTile(q,J){const pe=this.loaded;return pe&&pe[q.uid]?super.reloadTile(q,J):this.loadTile(q,J)}loadGeoJSON(q,J){if(q.request)return a.getJSON(q.request,J);if(typeof q.data=="string")try{J(null,JSON.parse(q.data))}catch{J(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`))}else J(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(q,J){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),J()}getClusterExpansionZoom(q,J){try{J(null,this._geoJSONIndex.getClusterExpansionZoom(q.clusterId))}catch(pe){J(pe)}}getClusterChildren(q,J){try{J(null,this._geoJSONIndex.getChildren(q.clusterId))}catch(pe){J(pe)}}getClusterLeaves(q,J){try{J(null,this._geoJSONIndex.getLeaves(q.clusterId,q.limit,q.offset))}catch(pe){J(pe)}}}class nr{constructor(q){this.self=q,this.actor=new a.Actor(q,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:P,geojson:tr},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(J,pe)=>{if(this.workerSourceTypes[J])throw new Error(`Worker source with name "${J}" already registered.`);this.workerSourceTypes[J]=pe},this.self.registerRTLTextPlugin=J=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=J.applyArabicShaping,a.plugin.processBidirectionalText=J.processBidirectionalText,a.plugin.processStyledBidirectionalText=J.processStyledBidirectionalText}}setReferrer(q,J){this.referrer=J}setImages(q,J,pe){this.availableImages[q]=J;for(const ce in this.workerSources[q]){const we=this.workerSources[q][ce];for(const Ae in we)we[Ae].availableImages=J}pe()}setLayers(q,J,pe){this.getLayerIndex(q).replace(J),pe()}updateLayers(q,J,pe){this.getLayerIndex(q).update(J.layers,J.removedIds),pe()}loadTile(q,J,pe){this.getWorkerSource(q,J.type,J.source).loadTile(J,pe)}loadDEMTile(q,J,pe){this.getDEMWorkerSource(q,J.source).loadTile(J,pe)}reloadTile(q,J,pe){this.getWorkerSource(q,J.type,J.source).reloadTile(J,pe)}abortTile(q,J,pe){this.getWorkerSource(q,J.type,J.source).abortTile(J,pe)}removeTile(q,J,pe){this.getWorkerSource(q,J.type,J.source).removeTile(J,pe)}removeDEMTile(q,J){this.getDEMWorkerSource(q,J.source).removeTile(J)}removeSource(q,J,pe){if(!this.workerSources[q]||!this.workerSources[q][J.type]||!this.workerSources[q][J.type][J.source])return;const ce=this.workerSources[q][J.type][J.source];delete this.workerSources[q][J.type][J.source],ce.removeSource!==void 0?ce.removeSource(J,pe):pe()}loadWorkerSource(q,J,pe){try{this.self.importScripts(J.url),pe()}catch(ce){pe(ce.toString())}}syncRTLPluginState(q,J,pe){try{a.plugin.setState(J);const ce=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&ce!=null){this.self.importScripts(ce);const we=a.plugin.isParsed();pe(we?void 0:new Error(`RTL Text Plugin failed to import scripts from ${ce}`),we)}}catch(ce){pe(ce.toString())}}getAvailableImages(q){let J=this.availableImages[q];return J||(J=[]),J}getLayerIndex(q){let J=this.layerIndexes[q];return J||(J=this.layerIndexes[q]=new p),J}getWorkerSource(q,J,pe){if(this.workerSources[q]||(this.workerSources[q]={}),this.workerSources[q][J]||(this.workerSources[q][J]={}),!this.workerSources[q][J][pe]){const ce={send:(we,Ae,Pe)=>{this.actor.send(we,Ae,Pe,q)}};this.workerSources[q][J][pe]=new this.workerSourceTypes[J](ce,this.getLayerIndex(q),this.getAvailableImages(q))}return this.workerSources[q][J][pe]}getDEMWorkerSource(q,J){return this.demWorkerSources[q]||(this.demWorkerSources[q]={}),this.demWorkerSources[q][J]||(this.demWorkerSources[q][J]=new k),this.demWorkerSources[q][J]}enforceCacheSizeLimit(q,J){a.enforceCacheSizeLimit(J)}}return a.isWorker()&&(self.worker=new nr(self)),nr}),o(["./shared"],function(a){var u=d;function d(C){return!function(c){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var b,E,A=new Blob([""],{type:"text/javascript"}),z=URL.createObjectURL(A);try{E=new Worker(z),b=!0}catch{b=!1}return E&&E.terminate(),URL.revokeObjectURL(z),b}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var b=document.createElement("canvas");b.width=b.height=1;var E=b.getContext("2d");if(!E)return!1;var A=E.getImageData(0,0,1,1);return A&&A.width===b.width}()?(p[g=c&&c.failIfMajorPerformanceCaveat]===void 0&&(p[g]=function(b){var E,A=function(z){var j=document.createElement("canvas"),K=Object.create(d.webGLContextAttributes);return K.failIfMajorPerformanceCaveat=z,j.getContext("webgl",K)||j.getContext("experimental-webgl",K)}(b);if(!A)return!1;try{E=A.createShader(A.VERTEX_SHADER)}catch{return!1}return!(!E||A.isContextLost())&&(A.shaderSource(E,"void main() {}"),A.compileShader(E),A.getShaderParameter(E,A.COMPILE_STATUS)===!0)}(g)),p[g]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var g}(C)}var p={};function m(C,c){if(Array.isArray(C)){if(!Array.isArray(c)||C.length!==c.length)return!1;for(let g=0;g{window.removeEventListener("click",v.suppressClickInternal,!0)},0)}static mousePos(c,g){const b=c.getBoundingClientRect();return new a.pointGeometry(g.clientX-b.left-c.clientLeft,g.clientY-b.top-c.clientTop)}static touchPos(c,g){const b=c.getBoundingClientRect(),E=[];for(let A=0;A-1);K++,A[K]=j,z[K]=Y,z[K+1]=M}for(let j=0,K=0;j{let j=this.entries[E];j||(j=this.entries[E]={glyphs:{},requests:{},ranges:{}});let K=j.glyphs[A];if(K!==void 0)return void z(null,{stack:E,id:A,glyph:K});if(K=this._tinySDF(j,E,A),K)return j.glyphs[A]=K,void z(null,{stack:E,id:A,glyph:K});const Y=Math.floor(A/256);if(256*Y>65535)return void z(new Error("glyphs > 65535 not supported"));if(j.ranges[Y])return void z(null,{stack:E,id:A,glyph:K});let ie=j.requests[Y];ie||(ie=j.requests[Y]=[],L.loadGlyphRange(E,Y,this.url,this.requestManager,(ue,me)=>{if(me){for(const Re in me)this._doesCharSupportLocalGlyph(+Re)||(j.glyphs[+Re]=me[+Re]);j.ranges[Y]=!0}for(const Re of ie)Re(ue,me);delete j.requests[Y]})),ie.push((ue,me)=>{ue?z(ue):me&&z(null,{stack:E,id:A,glyph:me[A]||null})})},(E,A)=>{if(E)g(E);else if(A){const z={};for(const{stack:j,id:K,glyph:Y}of A)(z[j]||(z[j]={}))[K]=Y&&{id:Y.id,bitmap:Y.bitmap.clone(),metrics:Y.metrics};g(null,z)}})}_doesCharSupportLocalGlyph(c){return!!this.localIdeographFontFamily&&(a.unicodeBlockLookup["CJK Unified Ideographs"](c)||a.unicodeBlockLookup["Hangul Syllables"](c)||a.unicodeBlockLookup.Hiragana(c)||a.unicodeBlockLookup.Katakana(c))}_tinySDF(c,g,b){const E=this.localIdeographFontFamily;if(!E||!this._doesCharSupportLocalGlyph(b))return;let A=c.tinySDF;if(!A){let j="400";/bold/i.test(g)?j="900":/medium/i.test(g)?j="500":/light/i.test(g)&&(j="200"),A=c.tinySDF=new L.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:E,fontWeight:j})}const z=A.draw(String.fromCharCode(b));return{id:b,bitmap:new a.AlphaImage({width:z.width||30,height:z.height||30},z.data),metrics:{width:z.glyphWidth||24,height:z.glyphHeight||24,left:z.glyphLeft||0,top:z.glyphTop-27||-8,advance:z.glyphAdvance||24}}}}L.loadGlyphRange=function(C,c,g,b,E){const A=256*c,z=A+255,j=b.transformRequest(g.replace("{fontstack}",C).replace("{range}",`${A}-${z}`),a.ResourceType.Glyphs);a.getArrayBuffer(j,(K,Y)=>{if(K)E(K);else if(Y){const ie={};for(const ue of a.parseGlyphPbf(Y))ie[ue.id]=ue;E(null,ie)}})},L.TinySDF=class{constructor({fontSize:C=24,buffer:c=3,radius:g=8,cutoff:b=.25,fontFamily:E="sans-serif",fontWeight:A="normal",fontStyle:z="normal"}={}){this.buffer=c,this.cutoff=b,this.radius=g;const j=this.size=C+4*c,K=this._createCanvas(j),Y=this.ctx=K.getContext("2d",{willReadFrequently:!0});Y.font=`${z} ${A} ${C}px ${E}`,Y.textBaseline="alphabetic",Y.textAlign="left",Y.fillStyle="black",this.gridOuter=new Float64Array(j*j),this.gridInner=new Float64Array(j*j),this.f=new Float64Array(j),this.z=new Float64Array(j+1),this.v=new Uint16Array(j)}_createCanvas(C){const c=document.createElement("canvas");return c.width=c.height=C,c}draw(C){const{width:c,actualBoundingBoxAscent:g,actualBoundingBoxDescent:b,actualBoundingBoxLeft:E,actualBoundingBoxRight:A}=this.ctx.measureText(C),z=Math.ceil(g),j=Math.min(this.size-this.buffer,Math.ceil(A-E)),K=Math.min(this.size-this.buffer,z+Math.ceil(b)),Y=j+2*this.buffer,ie=K+2*this.buffer,ue=Math.max(Y*ie,0),me=new Uint8ClampedArray(ue),Re={data:me,width:Y,height:ie,glyphWidth:j,glyphHeight:K,glyphTop:z,glyphLeft:0,glyphAdvance:c};if(j===0||K===0)return Re;const{ctx:Se,buffer:Ie,gridInner:je,gridOuter:Xe}=this;Se.clearRect(Ie,Ie,j,K),Se.fillText(C,Ie,Ie+z);const st=Se.getImageData(Ie,Ie,j,K);Xe.fill(M,0,ue),je.fill(0,0,ue);for(let Oe=0;Oe0?It*It:0,je[Et]=It<0?It*It:0}}O(Xe,0,0,Y,ie,Y,this.f,this.v,this.z),O(je,Ie,Ie,j,K,Y,this.f,this.v,this.z);for(let Oe=0;Oe1&&(K=c[++j]);const ie=Math.abs(Y-K.left),ue=Math.abs(Y-K.right),me=Math.min(ie,ue);let Re;const Se=A/b*(E+1);if(K.isDash){const Ie=E-Math.abs(Se);Re=Math.sqrt(me*me+Ie*Ie)}else Re=E-Math.sqrt(me*me+Se*Se);this.data[z+Y]=Math.max(0,Math.min(255,Re+128))}}}addRegularDash(c){for(let j=c.length-1;j>=0;--j){const K=c[j],Y=c[j+1];K.zeroLength?c.splice(j,1):Y&&Y.isDash===K.isDash&&(Y.left=K.left,c.splice(j,1))}const g=c[0],b=c[c.length-1];g.isDash===b.isDash&&(g.left=b.left-this.width,b.right=g.right+this.width);const E=this.width*this.nextRow;let A=0,z=c[A];for(let j=0;j1&&(z=c[++A]);const K=Math.abs(j-z.left),Y=Math.abs(j-z.right),ie=Math.min(K,Y);this.data[E+j]=Math.max(0,Math.min(255,(z.isDash?ie:-ie)+128))}}addDash(c,g){const b=g?7:0,E=2*b+1;if(this.nextRow+E>this.height)return a.warnOnce("LineAtlas out of space"),null;let A=0;for(let j=0;j{E.send(c,g,A)},b=b||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(c=>{c.remove()}),this.actors=[],this.workerPool.release(this.id)}}function ee(C,c,g){const b=function(E,A){if(E)return g(E);if(A){const z=a.pick(a.extend(A,C),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);A.vector_layers&&(z.vectorLayers=A.vector_layers,z.vectorLayerIds=z.vectorLayers.map(j=>j.id)),g(null,z)}};return C.url?a.getJSON(c.transformRequest(C.url,a.ResourceType.Source),b):a.exported.frame(()=>b(null,C))}G.Actor=a.Actor;class X{constructor(c,g,b){this.bounds=a.LngLatBounds.convert(this.validateBounds(c)),this.minzoom=g||0,this.maxzoom=b||24}validateBounds(c){return Array.isArray(c)&&c.length===4?[Math.max(-180,c[0]),Math.max(-90,c[1]),Math.min(180,c[2]),Math.min(90,c[3])]:[-180,-90,180,90]}contains(c){const g=Math.pow(2,c.z),b=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*g),E=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*g),A=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*g),z=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*g);return c.x>=b&&c.x=E&&c.y{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),c?this.fire(new a.ErrorEvent(c)):g&&(a.extend(this,g),g.bounds&&(this.tileBounds=new X(g.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(c){return!this.tileBounds||this.tileBounds.contains(c.canonical)}onAdd(c){this.map=c,this.load()}setSourceProperty(c){this._tileJSONRequest&&this._tileJSONRequest.cancel(),c(),this.load()}setTiles(c){return this.setSourceProperty(()=>{this._options.tiles=c}),this}setUrl(c){return this.setSourceProperty(()=>{this.url=c,this._options.url=c}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(c,g){const b=c.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),E={request:this.map._requestManager.transformRequest(b,a.ResourceType.Tile),uid:c.uid,tileID:c.tileID,zoom:c.tileID.overscaledZ,tileSize:this.tileSize*c.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function A(z,j){return delete c.request,c.aborted?g(null):z&&z.status!==404?g(z):(j&&j.resourceTiming&&(c.resourceTiming=j.resourceTiming),this.map._refreshExpiredTiles&&j&&c.setExpiryData(j),c.loadVectorData(j,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),g(null),void(c.reloadCallback&&(this.loadTile(c,c.reloadCallback),c.reloadCallback=null)))}E.request.collectResourceTiming=this._collectResourceTiming,c.actor&&c.state!=="expired"?c.state==="loading"?c.reloadCallback=g:c.request=c.actor.send("reloadTile",E,A.bind(this)):(c.actor=this.dispatcher.getActor(),c.request=c.actor.send("loadTile",E,A.bind(this)))}abortTile(c){c.request&&(c.request.cancel(),delete c.request),c.actor&&c.actor.send("abortTile",{uid:c.uid,type:this.type,source:this.id},void 0)}unloadTile(c){c.unloadVectorData(),c.actor&&c.actor.send("removeTile",{uid:c.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Q extends a.Evented{constructor(c,g,b,E){super(),this.id=c,this.dispatcher=b,this.setEventedParent(E),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.extend({type:"raster"},g),a.extend(this,a.pick(g,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ee(this._options,this.map._requestManager,(c,g)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new a.ErrorEvent(c)):g&&(a.extend(this,g),g.bounds&&(this.tileBounds=new X(g.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(c){this.map=c,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(c){return!this.tileBounds||this.tileBounds.contains(c.canonical)}loadTile(c,g){const b=c.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);c.request=a.getImage(this.map._requestManager.transformRequest(b,a.ResourceType.Tile),(E,A,z)=>{if(delete c.request,c.aborted)c.state="unloaded",g(null);else if(E)c.state="errored",g(E);else if(A){this.map._refreshExpiredTiles&&c.setExpiryData(z);const j=this.map.painter.context,K=j.gl;c.texture=this.map.painter.getTileTexture(A.width),c.texture?c.texture.update(A,{useMipmap:!0}):(c.texture=new P(j,A,K.RGBA,{useMipmap:!0}),c.texture.bind(K.LINEAR,K.CLAMP_TO_EDGE,K.LINEAR_MIPMAP_NEAREST),j.extTextureFilterAnisotropic&&K.texParameterf(K.TEXTURE_2D,j.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,j.extTextureFilterAnisotropicMax)),c.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),g(null)}})}abortTile(c,g){c.request&&(c.request.cancel(),delete c.request),g()}unloadTile(c,g){c.texture&&this.map.painter.saveTileTexture(c.texture),g()}hasTransition(){return!1}}let le;class ne extends Q{constructor(c,g,b,E){super(c,g,b,E),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},g),this.encoding=g.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(c,g){const b=c.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function E(A,z){A&&(c.state="errored",g(A)),z&&(c.dem=z,c.needsHillshadePrepare=!0,c.needsTerrainPrepare=!0,c.state="loaded",g(null))}c.request=a.getImage(this.map._requestManager.transformRequest(b,a.ResourceType.Tile),function(A,z){if(delete c.request,c.aborted)c.state="unloaded",g(null);else if(A)c.state="errored",g(A);else if(z){this.map._refreshExpiredTiles&&c.setExpiryData(z),delete z.cacheControl,delete z.expires;const j=a.isImageBitmap(z)&&(le==null&&(le=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),le)?z:a.exported.getImageData(z,1),K={uid:c.uid,coord:c.tileID,source:this.id,rawImageData:j,encoding:this.encoding};c.actor&&c.state!=="expired"||(c.actor=this.dispatcher.getActor(),c.actor.send("loadDEMTile",K,E.bind(this)))}}.bind(this)),c.neighboringTiles=this._getNeighboringTiles(c.tileID)}_getNeighboringTiles(c){const g=c.canonical,b=Math.pow(2,g.z),E=(g.x-1+b)%b,A=g.x===0?c.wrap-1:c.wrap,z=(g.x+1+b)%b,j=g.x+1===b?c.wrap+1:c.wrap,K={};return K[new a.OverscaledTileID(c.overscaledZ,A,g.z,E,g.y).key]={backfilled:!1},K[new a.OverscaledTileID(c.overscaledZ,j,g.z,z,g.y).key]={backfilled:!1},g.y>0&&(K[new a.OverscaledTileID(c.overscaledZ,A,g.z,E,g.y-1).key]={backfilled:!1},K[new a.OverscaledTileID(c.overscaledZ,c.wrap,g.z,g.x,g.y-1).key]={backfilled:!1},K[new a.OverscaledTileID(c.overscaledZ,j,g.z,z,g.y-1).key]={backfilled:!1}),g.y+1{if(this._pendingLoads--,this._removed||A&&A.abandoned)return void this.fire(new a.Event("dataabort",{dataType:"source",sourceDataType:c}));let z=null;if(A&&A.resourceTiming&&A.resourceTiming[this.id]&&(z=A.resourceTiming[this.id].slice(0)),E)return void this.fire(new a.ErrorEvent(E));const j={dataType:"source",sourceDataType:c};this._collectResourceTiming&&z&&z.length>0&&a.extend(j,{resourceTiming:z}),this.fire(new a.Event("data",j))})}loaded(){return this._pendingLoads===0}loadTile(c,g){const b=c.actor?"reloadTile":"loadTile";c.actor=this.actor;const E={type:this.type,uid:c.uid,tileID:c.tileID,zoom:c.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};c.request=this.actor.send(b,E,(A,z)=>(delete c.request,c.unloadVectorData(),c.aborted?g(null):A?g(A):(c.loadVectorData(z,this.map.painter,b==="reloadTile"),g(null))))}abortTile(c){c.request&&(c.request.cancel(),delete c.request),c.aborted=!0}unloadTile(c){c.unloadVectorData(),this.actor.send("removeTile",{uid:c.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var oe=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class he extends a.Evented{constructor(c,g,b,E){super(),this.id=c,this.dispatcher=b,this.coordinates=g.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(E),this.options=g}load(c,g){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(b,E)=>{this._loaded=!0,b?this.fire(new a.ErrorEvent(b)):E&&(this.image=E,c&&(this.coordinates=c),g&&g(),this._finishLoading())})}loaded(){return this._loaded}updateImage(c){return this.image&&c.url?(this.options.url=c.url,this.load(c.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(c){this.map=c,this.load()}setCoordinates(c){this.coordinates=c;const g=c.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(E){let A=1/0,z=1/0,j=-1/0,K=-1/0;for(const me of E)A=Math.min(A,me.x),z=Math.min(z,me.y),j=Math.max(j,me.x),K=Math.max(K,me.y);const Y=Math.max(j-A,K-z),ie=Math.max(0,Math.floor(-Math.log(Y)/Math.LN2)),ue=Math.pow(2,ie);return new a.CanonicalTileID(ie,Math.floor((A+j)/2*ue),Math.floor((z+K)/2*ue))}(g),this.minzoom=this.maxzoom=this.tileID.z;const b=g.map(E=>this.tileID.getTilePoint(E)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(b[0].x,b[0].y,0,0),this._boundsArray.emplaceBack(b[1].x,b[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(b[3].x,b[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(b[2].x,b[2].y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const c=this.map.painter.context,g=c.gl;this.boundsBuffer||(this.boundsBuffer=c.createVertexBuffer(this._boundsArray,oe.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new P(c,this.image,g.RGBA),this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE));for(const b in this.tiles){const E=this.tiles[b];E.state!=="loaded"&&(E.state="loaded",E.texture=this.texture)}}loadTile(c,g){this.tileID&&this.tileID.equals(c.tileID.canonical)?(this.tiles[String(c.tileID.wrap)]=c,c.buckets={},g(null)):(c.state="errored",g(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class _e extends he{constructor(c,g,b,E){super(c,g,b,E),this.roundZoom=!0,this.type="video",this.options=g}load(){this._loaded=!1;const c=this.options;this.urls=[];for(const g of c.urls)this.urls.push(this.map._requestManager.transformRequest(g,a.ResourceType.Source).url);a.getVideo(this.urls,(g,b)=>{this._loaded=!0,g?this.fire(new a.ErrorEvent(g)):b&&(this.video=b,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(c){if(this.video){const g=this.video.seekable;cg.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${g.start(0)} and ${g.end(0)}-second mark.`))):this.video.currentTime=c}}getVideo(){return this.video}onAdd(c){this.map||(this.map=c,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 c=this.map.painter.context,g=c.gl;this.boundsBuffer||(this.boundsBuffer=c.createVertexBuffer(this._boundsArray,oe.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE),g.texSubImage2D(g.TEXTURE_2D,0,0,0,g.RGBA,g.UNSIGNED_BYTE,this.video)):(this.texture=new P(c,this.video,g.RGBA),this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE));for(const b in this.tiles){const E=this.tiles[b];E.state!=="loaded"&&(E.state="loaded",E.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class be extends he{constructor(c,g,b,E){super(c,g,b,E),g.coordinates?Array.isArray(g.coordinates)&&g.coordinates.length===4&&!g.coordinates.some(A=>!Array.isArray(A)||A.length!==2||A.some(z=>typeof z!="number"))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'missing required property "coordinates"'))),g.animate&&typeof g.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'optional "animate" property must be a boolean value'))),g.canvas?typeof g.canvas=="string"||g.canvas instanceof HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,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 a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'missing required property "canvas"'))),this.options=g,this.animate=g.animate===void 0||g.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(c){this.map=c,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let c=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,c=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,c=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const g=this.map.painter.context,b=g.gl;this.boundsBuffer||(this.boundsBuffer=g.createVertexBuffer(this._boundsArray,oe.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(c||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new P(g,this.canvas,b.RGBA,{premultiply:!0});for(const E in this.tiles){const A=this.tiles[E];A.state!=="loaded"&&(A.state="loaded",A.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const c of[this.canvas.width,this.canvas.height])if(isNaN(c)||c<=0)return!0;return!1}}const xe={vector:Z,raster:Q,"raster-dem":ne,geojson:se,video:_e,image:he,canvas:be};function Te(C,c){const g=a.create();return a.translate(g,g,[1,1,0]),a.scale(g,g,[.5*C.width,.5*C.height,1]),a.multiply(g,g,C.calculatePosMatrix(c.toUnwrapped()))}function Ee(C,c,g,b,E,A){const z=function(ue,me,Re){if(ue)for(const Se of ue){const Ie=me[Se];if(Ie&&Ie.source===Re&&Ie.type==="fill-extrusion")return!0}else for(const Se in me){const Ie=me[Se];if(Ie.source===Re&&Ie.type==="fill-extrusion")return!0}return!1}(E&&E.layers,c,C.id),j=A.maxPitchScaleFactor(),K=C.tilesIn(b,j,z);K.sort(Ce);const Y=[];for(const ue of K)Y.push({wrappedTileID:ue.tileID.wrapped().key,queryResults:ue.tile.queryRenderedFeatures(c,g,C._state,ue.queryGeometry,ue.cameraQueryGeometry,ue.scale,E,A,j,Te(C.transform,ue.tileID))});const ie=function(ue){const me={},Re={};for(const Se of ue){const Ie=Se.queryResults,je=Se.wrappedTileID,Xe=Re[je]=Re[je]||{};for(const st in Ie){const Oe=Ie[st],vt=Xe[st]=Xe[st]||{},ft=me[st]=me[st]||[];for(const Et of Oe)vt[Et.featureIndex]||(vt[Et.featureIndex]=!0,ft.push(Et))}}return me}(Y);for(const ue in ie)ie[ue].forEach(me=>{const Re=me.feature,Se=C.getFeatureState(Re.layer["source-layer"],Re.id);Re.source=Re.layer.source,Re.layer["source-layer"]&&(Re.sourceLayer=Re.layer["source-layer"]),Re.state=Se});return ie}function Ce(C,c){const g=C.tileID,b=c.tileID;return g.overscaledZ-b.overscaledZ||g.canonical.y-b.canonical.y||g.wrap-b.wrap||g.canonical.x-b.canonical.x}class ke{constructor(c,g){this.tileID=c,this.uid=a.uniqueId(),this.uses=0,this.tileSize=g,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(c){const g=c+this.timeAdded;gc.saveTileTexture(g)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(c,g,b){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",c){c.featureIndex&&(this.latestFeatureIndex=c.featureIndex,c.rawTileData?(this.latestRawTileData=c.rawTileData,this.latestFeatureIndex.rawTileData=c.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=c.collisionBoxArray,this.buckets=function(E,A){const z={};if(!A)return z;for(const j of E){const K=j.layerIds.map(Y=>A.getLayer(Y)).filter(Boolean);if(K.length!==0){j.layers=K,j.stateDependentLayerIds&&(j.stateDependentLayers=j.stateDependentLayerIds.map(Y=>K.filter(ie=>ie.id===Y)[0]));for(const Y of K)z[Y.id]=j}}return z}(c.buckets,g.style),this.hasSymbolBuckets=!1;for(const E in this.buckets){const A=this.buckets[E];if(A instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!b)break;A.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const E in this.buckets){const A=this.buckets[E];if(A instanceof a.SymbolBucket&&A.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const E in this.buckets){const A=this.buckets[E];this.queryPadding=Math.max(this.queryPadding,g.style.getLayer(E).queryRadius(A))}c.imageAtlas&&(this.imageAtlas=c.imageAtlas),c.glyphAtlasImage&&(this.glyphAtlasImage=c.glyphAtlasImage)}else this.collisionBoxArray=new a.CollisionBoxArray}unloadVectorData(){for(const c in this.buckets)this.buckets[c].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(c){return this.buckets[c.id]}upload(c){for(const b in this.buckets){const E=this.buckets[b];E.uploadPending()&&E.upload(c)}const g=c.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new P(c,this.imageAtlas.image,g.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new P(c,this.glyphAtlasImage,g.ALPHA),this.glyphAtlasImage=null)}prepare(c){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(c,this.imageAtlasTexture)}queryRenderedFeatures(c,g,b,E,A,z,j,K,Y,ie){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:E,cameraQueryGeometry:A,scale:z,tileSize:this.tileSize,pixelPosMatrix:ie,transform:K,params:j,queryPadding:this.queryPadding*Y},c,g,b):{}}querySourceFeatures(c,g){const b=this.latestFeatureIndex;if(!b||!b.rawTileData)return;const E=b.loadVTLayers(),A=g?g.sourceLayer:"",z=E._geojsonTileLayer||E[A];if(!z)return;const j=a.createFilter(g&&g.filter),{z:K,x:Y,y:ie}=this.tileID.canonical,ue={z:K,x:Y,y:ie};for(let me=0;meb)E=!1;else if(g)if(this.expirationTime{this.remove(c,A)},b)),this.data[E].push(A),this.order.push(E),this.order.length>this.max){const z=this._getAndRemoveByKey(this.order[0]);z&&this.onRemove(z)}return this}has(c){return c.wrapped().key in this.data}getAndRemove(c){return this.has(c)?this._getAndRemoveByKey(c.wrapped().key):null}_getAndRemoveByKey(c){const g=this.data[c].shift();return g.timeout&&clearTimeout(g.timeout),this.data[c].length===0&&delete this.data[c],this.order.splice(this.order.indexOf(c),1),g.value}getByKey(c){const g=this.data[c];return g?g[0].value:null}get(c){return this.has(c)?this.data[c.wrapped().key][0].value:null}remove(c,g){if(!this.has(c))return this;const b=c.wrapped().key,E=g===void 0?0:this.data[b].indexOf(g),A=this.data[b][E];return this.data[b].splice(E,1),A.timeout&&clearTimeout(A.timeout),this.data[b].length===0&&delete this.data[b],this.onRemove(A.value),this.order.splice(this.order.indexOf(b),1),this}setMaxSize(c){for(this.max=c;this.order.length>this.max;){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}filter(c){const g=[];for(const b in this.data)for(const E of this.data[b])c(E.value)||g.push(E);for(const b of g)this.remove(b.value.tileID,b)}}class Ke{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(c,g,b){const E=String(g);if(this.stateChanges[c]=this.stateChanges[c]||{},this.stateChanges[c][E]=this.stateChanges[c][E]||{},a.extend(this.stateChanges[c][E],b),this.deletedStates[c]===null){this.deletedStates[c]={};for(const A in this.state[c])A!==E&&(this.deletedStates[c][A]=null)}else if(this.deletedStates[c]&&this.deletedStates[c][E]===null){this.deletedStates[c][E]={};for(const A in this.state[c][E])b[A]||(this.deletedStates[c][E][A]=null)}else for(const A in b)this.deletedStates[c]&&this.deletedStates[c][E]&&this.deletedStates[c][E][A]===null&&delete this.deletedStates[c][E][A]}removeFeatureState(c,g,b){if(this.deletedStates[c]===null)return;const E=String(g);if(this.deletedStates[c]=this.deletedStates[c]||{},b&&g!==void 0)this.deletedStates[c][E]!==null&&(this.deletedStates[c][E]=this.deletedStates[c][E]||{},this.deletedStates[c][E][b]=null);else if(g!==void 0)if(this.stateChanges[c]&&this.stateChanges[c][E])for(b in this.deletedStates[c][E]={},this.stateChanges[c][E])this.deletedStates[c][E][b]=null;else this.deletedStates[c][E]=null;else this.deletedStates[c]=null}getState(c,g){const b=String(g),E=a.extend({},(this.state[c]||{})[b],(this.stateChanges[c]||{})[b]);if(this.deletedStates[c]===null)return{};if(this.deletedStates[c]){const A=this.deletedStates[c][g];if(A===null)return{};for(const z in A)delete E[z]}return E}initializeTileState(c,g){c.setFeatureState(this.state,g)}coalesceChanges(c,g){const b={};for(const E in this.stateChanges){this.state[E]=this.state[E]||{};const A={};for(const z in this.stateChanges[E])this.state[E][z]||(this.state[E][z]={}),a.extend(this.state[E][z],this.stateChanges[E][z]),A[z]=this.state[E][z];b[E]=A}for(const E in this.deletedStates){this.state[E]=this.state[E]||{};const A={};if(this.deletedStates[E]===null)for(const z in this.state[E])A[z]={},this.state[E][z]={};else for(const z in this.deletedStates[E]){if(this.deletedStates[E][z]===null)this.state[E][z]={};else for(const j of Object.keys(this.deletedStates[E][z]))delete this.state[E][z][j];A[z]=this.state[E][z]}b[E]=b[E]||{},a.extend(b[E],A)}if(this.stateChanges={},this.deletedStates={},Object.keys(b).length!==0)for(const E in c)c[E].setFeatureState(b,g)}}class Ue extends a.Evented{constructor(c,g,b){super(),this.id=c,this.dispatcher=b,this.on("data",E=>{E.dataType==="source"&&E.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&E.dataType==="source"&&E.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(E,A,z,j){const K=new xe[A.type](E,A,z,j);if(K.id!==E)throw new Error(`Expected Source id to be ${E} instead of ${K.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],K),K}(c,g,b,this),this._tiles={},this._cache=new De(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ke}onAdd(c){this.map=c,this._maxTileCacheSize=c?c._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(c)}onRemove(c){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(c)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const c in this._tiles){const g=this._tiles[c];if(g.state!=="loaded"&&g.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const c=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,c&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(c,g){return this._source.loadTile(c,g)}_unloadTile(c){if(this._source.unloadTile)return this._source.unloadTile(c,()=>{})}_abortTile(c){this._source.abortTile&&this._source.abortTile(c,()=>{}),this._source.fire(new a.Event("dataabort",{tile:c,coord:c.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(c){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const g in this._tiles){const b=this._tiles[g];b.upload(c),b.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(c=>c.tileID).sort(tt).map(c=>c.key)}getRenderableIds(c){const g=[];for(const b in this._tiles)this._isIdRenderable(b,c)&&g.push(this._tiles[b]);return c?g.sort((b,E)=>{const A=b.tileID,z=E.tileID,j=new a.pointGeometry(A.canonical.x,A.canonical.y)._rotate(this.transform.angle),K=new a.pointGeometry(z.canonical.x,z.canonical.y)._rotate(this.transform.angle);return A.overscaledZ-z.overscaledZ||K.y-j.y||K.x-j.x}).map(b=>b.tileID.key):g.map(b=>b.tileID).sort(tt).map(b=>b.key)}hasRenderableParent(c){const g=this.findLoadedParent(c,0);return!!g&&this._isIdRenderable(g.tileID.key)}_isIdRenderable(c,g){return this._tiles[c]&&this._tiles[c].hasData()&&!this._coveredTiles[c]&&(g||!this._tiles[c].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const c in this._tiles)this._tiles[c].state!=="errored"&&this._reloadTile(c,"reloading")}}_reloadTile(c,g){const b=this._tiles[c];b&&(b.state!=="loading"&&(b.state=g),this._loadTile(b,this._tileLoaded.bind(this,b,c,g)))}_tileLoaded(c,g,b,E){if(E)return c.state="errored",void(E.status!==404?this._source.fire(new a.ErrorEvent(E,{tile:c})):this.update(this.transform,this.terrain));c.timeAdded=a.exported.now(),b==="expired"&&(c.refreshedUponExpiration=!0),this._setTileReloadTimer(g,c),this.getSource().type==="raster-dem"&&c.dem&&this._backfillDEM(c),this._state.initializeTileState(c,this.map?this.map.painter:null),c.aborted||this._source.fire(new a.Event("data",{dataType:"source",tile:c,coord:c.tileID}))}_backfillDEM(c){const g=this.getRenderableIds();for(let E=0;E1||(Math.abs(z)>1&&(Math.abs(z+K)===1?z+=K:Math.abs(z-K)===1&&(z-=K)),A.dem&&E.dem&&(E.dem.backfillBorder(A.dem,z,j),E.neighboringTiles&&E.neighboringTiles[Y]&&(E.neighboringTiles[Y].backfilled=!0)))}}getTile(c){return this.getTileByID(c.key)}getTileByID(c){return this._tiles[c]}_retainLoadedChildren(c,g,b,E){for(const A in this._tiles){let z=this._tiles[A];if(E[A]||!z.hasData()||z.tileID.overscaledZ<=g||z.tileID.overscaledZ>b)continue;let j=z.tileID;for(;z&&z.tileID.overscaledZ>g+1;){const Y=z.tileID.scaledTo(z.tileID.overscaledZ-1);z=this._tiles[Y.key],z&&z.hasData()&&(j=Y)}let K=j;for(;K.overscaledZ>g;)if(K=K.scaledTo(K.overscaledZ-1),c[K.key]){E[j.key]=j;break}}}findLoadedParent(c,g){if(c.key in this._loadedParentTiles){const b=this._loadedParentTiles[c.key];return b&&b.tileID.overscaledZ>=g?b:null}for(let b=c.overscaledZ-1;b>=g;b--){const E=c.scaledTo(b),A=this._getLoadedTile(E);if(A)return A}}_getLoadedTile(c){const g=this._tiles[c.key];return g&&g.hasData()?g:this._cache.getByKey(c.wrapped().key)}updateCacheSize(c){const g=Math.ceil(c.width/this._source.tileSize)+1,b=Math.ceil(c.height/this._source.tileSize)+1,E=Math.floor(g*b*5),A=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,E):E;this._cache.setMaxSize(A)}handleWrapJump(c){const g=Math.round((c-(this._prevLng===void 0?c:this._prevLng))/360);if(this._prevLng=c,g){const b={};for(const E in this._tiles){const A=this._tiles[E];A.tileID=A.tileID.unwrapTo(A.tileID.wrap+g),b[A.tileID.key]=A}this._tiles=b;for(const E in this._timers)clearTimeout(this._timers[E]),delete this._timers[E];for(const E in this._tiles)this._setTileReloadTimer(E,this._tiles[E])}}update(c,g){if(this.transform=c,this.terrain=g,!this._sourceLoaded||this._paused)return;let b;this.updateCacheSize(c),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?b=c.getVisibleUnwrappedCoordinates(this._source.tileID).map(Y=>new a.OverscaledTileID(Y.canonical.z,Y.wrap,Y.canonical.z,Y.canonical.x,Y.canonical.y)):(b=c.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:g}),this._source.hasTile&&(b=b.filter(Y=>this._source.hasTile(Y)))):b=[];const E=c.coveringZoomLevel(this._source),A=Math.max(E-Ue.maxOverzooming,this._source.minzoom),z=Math.max(E+Ue.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const Y={};for(const ie of b)if(ie.canonical.z>this._source.minzoom){const ue=ie.scaledTo(ie.canonical.z-1);Y[ue.key]=ue;const me=ie.scaledTo(Math.max(this._source.minzoom,Math.min(ie.canonical.z,5)));Y[me.key]=me}b=b.concat(Object.values(Y))}const j=this._updateRetainedTiles(b,E);if(lt(this._source.type)){const Y={},ie={},ue=Object.keys(j);for(const me of ue){const Re=j[me],Se=this._tiles[me];if(!Se||Se.fadeEndTime&&Se.fadeEndTime<=a.exported.now())continue;const Ie=this.findLoadedParent(Re,A);Ie&&(this._addTile(Ie.tileID),Y[Ie.tileID.key]=Ie.tileID),ie[me]=Re}this._retainLoadedChildren(ie,E,z,j);for(const me in Y)j[me]||(this._coveredTiles[me]=!0,j[me]=Y[me]);if(g){const me={},Re={};for(const Se of b)this._tiles[Se.key].hasData()?me[Se.key]=Se:Re[Se.key]=Se;for(const Se in Re){const Ie=Re[Se].children(this._source.maxzoom);this._tiles[Ie[0].key]&&this._tiles[Ie[1].key]&&this._tiles[Ie[2].key]&&this._tiles[Ie[3].key]&&(me[Ie[0].key]=j[Ie[0].key]=Ie[0],me[Ie[1].key]=j[Ie[1].key]=Ie[1],me[Ie[2].key]=j[Ie[2].key]=Ie[2],me[Ie[3].key]=j[Ie[3].key]=Ie[3],delete Re[Se])}for(const Se in Re){const Ie=this.findLoadedParent(Re[Se],this._source.minzoom);if(Ie){me[Ie.tileID.key]=j[Ie.tileID.key]=Ie.tileID;for(const je in me)me[je].isChildOf(Ie.tileID)&&delete me[je]}}for(const Se in this._tiles)me[Se]||(this._coveredTiles[Se]=!0)}}for(const Y in j)this._tiles[Y].clearFadeHold();const K=a.keysDifference(this._tiles,j);for(const Y of K){const ie=this._tiles[Y];ie.hasSymbolBuckets&&!ie.holdingForFade()?ie.setHoldDuration(this.map._fadeDuration):ie.hasSymbolBuckets&&!ie.symbolFadeFinished()||this._removeTile(Y)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const c in this._tiles)this._tiles[c].holdingForFade()&&this._removeTile(c)}_updateRetainedTiles(c,g){const b={},E={},A=Math.max(g-Ue.maxOverzooming,this._source.minzoom),z=Math.max(g+Ue.maxUnderzooming,this._source.minzoom),j={};for(const K of c){const Y=this._addTile(K);b[K.key]=K,Y.hasData()||gthis._source.maxzoom){const ue=K.children(this._source.maxzoom)[0],me=this.getTile(ue);if(me&&me.hasData()){b[ue.key]=ue;continue}}else{const ue=K.children(this._source.maxzoom);if(b[ue[0].key]&&b[ue[1].key]&&b[ue[2].key]&&b[ue[3].key])continue}let ie=Y.wasRequested();for(let ue=K.overscaledZ-1;ue>=A;--ue){const me=K.scaledTo(ue);if(E[me.key]||(E[me.key]=!0,Y=this.getTile(me),!Y&&ie&&(Y=this._addTile(me)),Y&&(b[me.key]=me,ie=Y.wasRequested(),Y.hasData())))break}}return b}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const c in this._tiles){const g=[];let b,E=this._tiles[c].tileID;for(;E.overscaledZ>0;){if(E.key in this._loadedParentTiles){b=this._loadedParentTiles[E.key];break}g.push(E.key);const A=E.scaledTo(E.overscaledZ-1);if(b=this._getLoadedTile(A),b)break;E=A}for(const A of g)this._loadedParentTiles[A]=b}}_addTile(c){let g=this._tiles[c.key];if(g)return g;g=this._cache.getAndRemove(c),g&&(this._setTileReloadTimer(c.key,g),g.tileID=c,this._state.initializeTileState(g,this.map?this.map.painter:null),this._cacheTimers[c.key]&&(clearTimeout(this._cacheTimers[c.key]),delete this._cacheTimers[c.key],this._setTileReloadTimer(c.key,g)));const b=g;return g||(g=new ke(c,this._source.tileSize*c.overscaleFactor()),this._loadTile(g,this._tileLoaded.bind(this,g,c.key,g.state))),g.uses++,this._tiles[c.key]=g,b||this._source.fire(new a.Event("dataloading",{tile:g,coord:g.tileID,dataType:"source"})),g}_setTileReloadTimer(c,g){c in this._timers&&(clearTimeout(this._timers[c]),delete this._timers[c]);const b=g.getExpiryTimeout();b&&(this._timers[c]=setTimeout(()=>{this._reloadTile(c,"expired"),delete this._timers[c]},b))}_removeTile(c){const g=this._tiles[c];g&&(g.uses--,delete this._tiles[c],this._timers[c]&&(clearTimeout(this._timers[c]),delete this._timers[c]),g.uses>0||(g.hasData()&&g.state!=="reloading"?this._cache.add(g.tileID,g,g.getExpiryTimeout()):(g.aborted=!0,this._abortTile(g),this._unloadTile(g))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const c in this._tiles)this._removeTile(c);this._cache.reset()}tilesIn(c,g,b){const E=[],A=this.transform;if(!A)return E;const z=b?A.getCameraQueryGeometry(c):c,j=c.map(Se=>A.pointCoordinate(Se,this.terrain)),K=z.map(Se=>A.pointCoordinate(Se,this.terrain)),Y=this.getIds();let ie=1/0,ue=1/0,me=-1/0,Re=-1/0;for(const Se of K)ie=Math.min(ie,Se.x),ue=Math.min(ue,Se.y),me=Math.max(me,Se.x),Re=Math.max(Re,Se.y);for(let Se=0;Se=0&&Oe[1].y+st>=0){const vt=j.map(Et=>je.getTilePoint(Et)),ft=K.map(Et=>je.getTilePoint(Et));E.push({tile:Ie,tileID:je,queryGeometry:vt,cameraQueryGeometry:ft,scale:Xe})}}return E}getVisibleCoordinates(c){const g=this.getRenderableIds(c).map(b=>this._tiles[b].tileID);for(const b of g)b.posMatrix=this.transform.calculatePosMatrix(b.toUnwrapped());return g}hasTransition(){if(this._source.hasTransition())return!0;if(lt(this._source.type))for(const c in this._tiles){const g=this._tiles[c];if(g.fadeEndTime!==void 0&&g.fadeEndTime>=a.exported.now())return!0}return!1}setFeatureState(c,g,b){this._state.updateState(c=c||"_geojsonTileLayer",g,b)}removeFeatureState(c,g,b){this._state.removeFeatureState(c=c||"_geojsonTileLayer",g,b)}getFeatureState(c,g){return this._state.getState(c=c||"_geojsonTileLayer",g)}setDependencies(c,g,b){const E=this._tiles[c];E&&E.setDependencies(g,b)}reloadTilesForDependencies(c,g){for(const b in this._tiles)this._tiles[b].hasDependency(c,g)&&this._reloadTile(b,"reloading");this._cache.filter(b=>!b.hasDependency(c,g))}}function tt(C,c){const g=Math.abs(2*C.wrap)-+(C.wrap<0),b=Math.abs(2*c.wrap)-+(c.wrap<0);return C.overscaledZ-c.overscaledZ||b-g||c.canonical.y-C.canonical.y||c.canonical.x-C.canonical.x}function lt(C){return C==="raster"||C==="image"||C==="video"}Ue.maxOverzooming=10,Ue.maxUnderzooming=3;const St="mapboxgl_preloaded_worker_pool";class We{constructor(){this.active={}}acquire(c){if(!this.workers)for(this.workers=[];this.workers.length{g.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[St]}numActive(){return Object.keys(this.active).length}}const bt=Math.floor(a.exported.hardwareConcurrency/2);let Qe;function mt(){return Qe||(Qe=new We),Qe}function ct(C,c){const g={};for(const b in C)b!=="ref"&&(g[b]=C[b]);return a.refProperties.forEach(b=>{b in c&&(g[b]=c[b])}),g}function wt(C){C=C.slice();const c=Object.create(null);for(let g=0;g0?(E-z)/j:0;return this.points[A].mult(1-K).add(this.points[g].mult(K))}}function Ve(C,c){let g=!0;return C==="always"||C!=="never"&&c!=="never"||(g=!1),g}class Ze{constructor(c,g,b){const E=this.boxCells=[],A=this.circleCells=[];this.xCellCount=Math.ceil(c/b),this.yCellCount=Math.ceil(g/b);for(let z=0;zthis.width||E<0||g>this.height)return[];const K=[];if(c<=0&&g<=0&&this.width<=b&&this.height<=E){if(A)return[{key:null,x1:c,y1:g,x2:b,y2:E}];for(let Y=0;Y0}hitTestCircle(c,g,b,E,A){const z=c-b,j=c+b,K=g-b,Y=g+b;if(j<0||z>this.width||Y<0||K>this.height)return!1;const ie=[];return this._forEachCell(z,K,j,Y,this._queryCellCircle,ie,{hitTest:!0,overlapMode:E,circle:{x:c,y:g,radius:b},seenUids:{box:{},circle:{}}},A),ie.length>0}_queryCell(c,g,b,E,A,z,j,K){const{seenUids:Y,hitTest:ie,overlapMode:ue}=j,me=this.boxCells[A];if(me!==null){const Se=this.bboxes;for(const Ie of me)if(!Y.box[Ie]){Y.box[Ie]=!0;const je=4*Ie,Xe=this.boxKeys[Ie];if(c<=Se[je+2]&&g<=Se[je+3]&&b>=Se[je+0]&&E>=Se[je+1]&&(!K||K(Xe))&&(!ie||!Ve(ue,Xe.overlapMode))&&(z.push({key:Xe,x1:Se[je],y1:Se[je+1],x2:Se[je+2],y2:Se[je+3]}),ie))return!0}}const Re=this.circleCells[A];if(Re!==null){const Se=this.circles;for(const Ie of Re)if(!Y.circle[Ie]){Y.circle[Ie]=!0;const je=3*Ie,Xe=this.circleKeys[Ie];if(this._circleAndRectCollide(Se[je],Se[je+1],Se[je+2],c,g,b,E)&&(!K||K(Xe))&&(!ie||!Ve(ue,Xe.overlapMode))){const st=Se[je],Oe=Se[je+1],vt=Se[je+2];if(z.push({key:Xe,x1:st-vt,y1:Oe-vt,x2:st+vt,y2:Oe+vt}),ie)return!0}}}return!1}_queryCellCircle(c,g,b,E,A,z,j,K){const{circle:Y,seenUids:ie,overlapMode:ue}=j,me=this.boxCells[A];if(me!==null){const Se=this.bboxes;for(const Ie of me)if(!ie.box[Ie]){ie.box[Ie]=!0;const je=4*Ie,Xe=this.boxKeys[Ie];if(this._circleAndRectCollide(Y.x,Y.y,Y.radius,Se[je+0],Se[je+1],Se[je+2],Se[je+3])&&(!K||K(Xe))&&!Ve(ue,Xe.overlapMode))return z.push(!0),!0}}const Re=this.circleCells[A];if(Re!==null){const Se=this.circles;for(const Ie of Re)if(!ie.circle[Ie]){ie.circle[Ie]=!0;const je=3*Ie,Xe=this.circleKeys[Ie];if(this._circlesCollide(Se[je],Se[je+1],Se[je+2],Y.x,Y.y,Y.radius)&&(!K||K(Xe))&&!Ve(ue,Xe.overlapMode))return z.push(!0),!0}}}_forEachCell(c,g,b,E,A,z,j,K){const Y=this._convertToXCellCoord(c),ie=this._convertToYCellCoord(g),ue=this._convertToXCellCoord(b),me=this._convertToYCellCoord(E);for(let Re=Y;Re<=ue;Re++)for(let Se=ie;Se<=me;Se++)if(A.call(this,c,g,b,E,this.xCellCount*Se+Re,z,j,K))return}_convertToXCellCoord(c){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(c*this.xScale)))}_convertToYCellCoord(c){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(c*this.yScale)))}_circlesCollide(c,g,b,E,A,z){const j=E-c,K=A-g,Y=b+z;return Y*Y>j*j+K*K}_circleAndRectCollide(c,g,b,E,A,z,j){const K=(z-E)/2,Y=Math.abs(c-(E+K));if(Y>K+b)return!1;const ie=(j-A)/2,ue=Math.abs(g-(A+ie));if(ue>ie+b)return!1;if(Y<=K||ue<=ie)return!0;const me=Y-K,Re=ue-ie;return me*me+Re*Re<=b*b}}function Yt(C,c,g,b,E){const A=a.create();return c?(a.scale(A,A,[1/E,1/E,1]),g||a.rotateZ(A,A,b.angle)):a.multiply(A,b.labelPlaneMatrix,C),A}function sn(C,c,g,b,E){if(c){const A=a.clone(C);return a.scale(A,A,[E,E,1]),g||a.rotateZ(A,A,-b.angle),A}return b.glCoordMatrix}function Gt(C,c,g){let b;g?(b=[C.x,C.y,g(C.x,C.y),1],a.transformMat4(b,b,c)):(b=[C.x,C.y,0,1],xn(b,b,c));const E=b[3];return{point:new a.pointGeometry(b[0]/E,b[1]/E),signedDistanceFromCamera:E}}function zt(C,c){return .5+C/c*.5}function Rt(C,c){const g=C[0]/C[3],b=C[1]/C[3];return g>=-c[0]&&g<=c[0]&&b>=-c[1]&&b<=c[1]}function Qt(C,c,g,b,E,A,z,j,K,Y){const ie=b?C.textSizeData:C.iconSizeData,ue=a.evaluateSizeForZoom(ie,g.transform.zoom),me=[256/g.width*2+1,256/g.height*2+1],Re=b?C.text.dynamicLayoutVertexArray:C.icon.dynamicLayoutVertexArray;Re.clear();const Se=C.lineVertexArray,Ie=b?C.text.placedSymbolArray:C.icon.placedSymbolArray,je=g.transform.width/g.transform.height;let Xe=!1;for(let st=0;stMath.abs(g.x-c.x)*b?{useVertical:!0}:(C===a.WritingMode.vertical?c.yg.x)?{needsFlipping:!0}:null}function Lt(C,c,g,b,E,A,z,j,K,Y,ie,ue,me,Re,Se,Ie){const je=c/24,Xe=C.lineOffsetX*je,st=C.lineOffsetY*je;let Oe;if(C.numGlyphs>1){const vt=C.glyphStartIndex+C.numGlyphs,ft=C.lineStartIndex,Et=C.lineStartIndex+C.lineLength,It=pn(je,j,Xe,st,g,ie,ue,C,K,A,me,Se,Ie);if(!It)return{notEnoughRoom:!0};const Ht=Gt(It.first.point,z,Ie).point,Ct=Gt(It.last.point,z,Ie).point;if(b&&!g){const fn=ot(C.writingMode,Ht,Ct,Re);if(fn)return fn}Oe=[It.first];for(let fn=C.glyphStartIndex+1;fn0?Ht.point:Tt(ue,It,ft,1,E,Ie),fn=ot(C.writingMode,ft,Ct,Re);if(fn)return fn}const vt=Kt(je*j.getoffsetX(C.glyphStartIndex),Xe,st,g,ie,ue,C.segment,C.lineStartIndex,C.lineStartIndex+C.lineLength,K,A,me,Se,Ie);if(!vt)return{notEnoughRoom:!0};Oe=[vt]}for(const vt of Oe)a.addDynamicAttributes(Y,vt.point,vt.angle);return{}}function Tt(C,c,g,b,E,A){const z=Gt(C.add(C.sub(c)._unit()),E,A).point,j=g.sub(z);return g.add(j._mult(b/j.mag()))}function Kt(C,c,g,b,E,A,z,j,K,Y,ie,ue,me,Re){const Se=b?C-c:C+c;let Ie=Se>0?1:-1,je=0;b&&(Ie*=-1,je=Math.PI),Ie<0&&(je+=Math.PI);let Xe=Ie>0?j+z:j+z+1,st=E,Oe=E,vt=0,ft=0;const Et=Math.abs(Se),It=[];for(;vt+ft<=Et;){if(Xe+=Ie,Xe=K)return null;if(Oe=st,It.push(st),st=ue[Xe],st===void 0){const mn=new a.pointGeometry(Y.getx(Xe),Y.gety(Xe)),Hn=Gt(mn,ie,Re);if(Hn.signedDistanceFromCamera>0)st=ue[Xe]=Hn.point;else{const qn=Xe-Ie;st=Tt(vt===0?A:new a.pointGeometry(Y.getx(qn),Y.gety(qn)),mn,Oe,Et-vt+1,ie,Re)}}vt+=ft,ft=Oe.dist(st)}const Ht=(Et-vt)/ft,Ct=st.sub(Oe),fn=Ct.mult(Ht)._add(Oe);fn._add(Ct._unit()._perp()._mult(g*Ie));const rn=je+Math.atan2(st.y-Oe.y,st.x-Oe.x);return It.push(fn),{point:fn,angle:me?rn:0,path:It}}const Zt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ht(C,c){for(let g=0;g=1;sr--)kn.push(Hn.path[sr]);for(let sr=1;srGt(ur,K,Se));kn=sr.some(ur=>ur.signedDistanceFromCamera<=0)?[]:sr.map(ur=>ur.point)}let yr=[];if(kn.length>0){const sr=kn[0].clone(),ur=kn[0].clone();for(let Cr=1;Cr=fn.x&&ur.x<=rn.x&&sr.y>=fn.y&&ur.y<=rn.y?[kn]:ur.xrn.x||ur.yrn.y?[]:a.clipLine([kn],fn.x,fn.y,rn.x,rn.y)}for(const sr of yr){mn.reset(sr,.25*Ct);let ur=0;ur=mn.length<=.5*Ct?1:Math.ceil(mn.paddedLength/vr)+1;for(let Cr=0;Cr=this.screenRightBoundary||Ethis.screenBottomBoundary}isInsideGrid(c,g,b,E){return b>=0&&c=0&&gb.collisionGroupID===g}}return this.collisionGroups[c]}}function tr(C,c,g,b,E){const{horizontalAlign:A,verticalAlign:z}=a.getAnchorAlignment(C),j=-(A-.5)*c,K=-(z-.5)*g,Y=a.evaluateVariableOffset(C,b);return new a.pointGeometry(j+Y[0]*E,K+Y[1]*E)}function nr(C,c,g,b,E,A){const{x1:z,x2:j,y1:K,y2:Y,anchorPointX:ie,anchorPointY:ue}=C,me=new a.pointGeometry(c,g);return b&&me._rotate(E?A:-A),{x1:z+me.x,y1:K+me.y,x2:j+me.x,y2:Y+me.y,anchorPointX:ie,anchorPointY:ue}}class ye{constructor(c,g,b,E,A){this.transform=c.clone(),this.terrain=g,this.collisionIndex=new tn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=b,this.retainedQueryData={},this.collisionGroups=new Fn(E),this.collisionCircleArrays={},this.prevPlacement=A,A&&(A.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(c,g,b,E){const A=b.getBucket(g),z=b.latestFeatureIndex;if(!A||!z||g.id!==A.layerIds[0])return;const j=b.collisionBoxArray,K=A.layers[0].layout,Y=Math.pow(2,this.transform.zoom-b.tileID.overscaledZ),ie=b.tileSize/a.EXTENT,ue=this.transform.calculatePosMatrix(b.tileID.toUnwrapped()),me=K.get("text-pitch-alignment")==="map",Re=K.get("text-rotation-alignment")==="map",Se=Bt(b,1,this.transform.zoom),Ie=Yt(ue,me,Re,this.transform,Se);let je=null;if(me){const st=sn(ue,me,Re,this.transform,Se);je=a.multiply([],this.transform.labelPlaneMatrix,st)}this.retainedQueryData[A.bucketInstanceId]=new vn(A.bucketInstanceId,z,A.sourceLayerIndex,A.index,b.tileID);const Xe={bucket:A,layout:K,posMatrix:ue,textLabelPlaneMatrix:Ie,labelToScreenMatrix:je,scale:Y,textPixelRatio:ie,holdingForFade:b.holdingForFade(),collisionBoxArray:j,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(A.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(A.sourceID)};if(E)for(const st of A.sortKeyRanges){const{sortKey:Oe,symbolInstanceStart:vt,symbolInstanceEnd:ft}=st;c.push({sortKey:Oe,symbolInstanceStart:vt,symbolInstanceEnd:ft,parameters:Xe})}else c.push({symbolInstanceStart:0,symbolInstanceEnd:A.symbolInstances.length,parameters:Xe})}attemptAnchorPlacement(c,g,b,E,A,z,j,K,Y,ie,ue,me,Re,Se,Ie,je){const Xe=[me.textOffset0,me.textOffset1],st=tr(c,b,E,Xe,A),Oe=this.collisionIndex.placeCollisionBox(nr(g,st.x,st.y,z,j,this.transform.angle),ue,K,Y,ie.predicate,je);if((!Ie||this.collisionIndex.placeCollisionBox(nr(Ie,st.x,st.y,z,j,this.transform.angle),ue,K,Y,ie.predicate,je).box.length!==0)&&Oe.box.length>0){let vt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[me.crossTileID]&&this.prevPlacement.placements[me.crossTileID]&&this.prevPlacement.placements[me.crossTileID].text&&(vt=this.prevPlacement.variableOffsets[me.crossTileID].anchor),me.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[me.crossTileID]={textOffset:Xe,width:b,height:E,anchor:c,textBoxScale:A,prevAnchor:vt},this.markUsedJustification(Re,c,me,Se),Re.allowVerticalPlacement&&(this.markUsedOrientation(Re,Se,me),this.placedOrientations[me.crossTileID]=Se),{shift:st,placedGlyphBoxes:Oe}}}placeLayerBucketPart(c,g,b){const{bucket:E,layout:A,posMatrix:z,textLabelPlaneMatrix:j,labelToScreenMatrix:K,textPixelRatio:Y,holdingForFade:ie,collisionBoxArray:ue,partiallyEvaluatedTextSize:me,collisionGroup:Re}=c.parameters,Se=A.get("text-optional"),Ie=A.get("icon-optional"),je=a.getOverlapMode(A,"text-overlap","text-allow-overlap"),Xe=je==="always",st=a.getOverlapMode(A,"icon-overlap","icon-allow-overlap"),Oe=st==="always",vt=A.get("text-rotation-alignment")==="map",ft=A.get("text-pitch-alignment")==="map",Et=A.get("icon-text-fit")!=="none",It=A.get("symbol-z-order")==="viewport-y",Ht=Xe&&(Oe||!E.hasIconData()||Ie),Ct=Oe&&(Xe||!E.hasTextData()||Se);!E.collisionArrays&&ue&&E.deserializeCollisionBoxes(ue);const fn=(rn,mn)=>{if(g[rn.crossTileID])return;if(ie)return void(this.placements[rn.crossTileID]=new Vt(!1,!1,!1));let Hn=!1,qn=!1,kn=!0,vr=null,yr={box:null,offscreen:null},sr={box:null,offscreen:null},ur=null,Cr=null,Ri=null,Ka=0,xa=0,Wa=0;mn.textFeatureIndex?Ka=mn.textFeatureIndex:rn.useRuntimeCollisionCircles&&(Ka=rn.featureIndex),mn.verticalTextFeatureIndex&&(xa=mn.verticalTextFeatureIndex);const el=this.retainedQueryData[E.bucketInstanceId].tileID,ta=this.terrain?(Si,Jn)=>this.terrain.getElevation(el,Si,Jn):null;for(const Si of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const Jn=mn[Si];Jn&&(Jn.elevation=ta?ta(Jn.anchorPointX,Jn.anchorPointY):0)}const bo=mn.textBox;if(bo){const Si=gr=>{let Ai=a.WritingMode.horizontal;if(E.allowVerticalPlacement&&!gr&&this.prevPlacement){const Di=this.prevPlacement.placedOrientations[rn.crossTileID];Di&&(this.placedOrientations[rn.crossTileID]=Di,Ai=Di,this.markUsedOrientation(E,Ai,rn))}return Ai},Jn=(gr,Ai)=>{if(E.allowVerticalPlacement&&rn.numVerticalGlyphVertices>0&&mn.verticalTextBox){for(const Di of E.writingModes)if(Di===a.WritingMode.vertical?(yr=Ai(),sr=yr):yr=gr(),yr&&yr.box&&yr.box.length)break}else yr=gr()};if(A.get("text-variable-anchor")){let gr=A.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[rn.crossTileID]){const Kr=this.prevPlacement.variableOffsets[rn.crossTileID];gr.indexOf(Kr.anchor)>0&&(gr=gr.filter(na=>na!==Kr.anchor),gr.unshift(Kr.anchor))}const Ai=(Kr,na,Ll)=>{const lm=Kr.x2-Kr.x1,Nu=Kr.y2-Kr.y1,ty=rn.textBoxScale,um=Et&&st==="never"?na:null;let tl={box:[],offscreen:!1};const Fl=je!=="never"?2*gr.length:gr.length;for(let zl=0;zl=gr.length?je:"never",rn,E,Ll,um,ta);if(jf&&(tl=jf.placedGlyphBoxes,tl&&tl.box&&tl.box.length)){Hn=!0,vr=jf.shift;break}}return tl};Jn(()=>Ai(bo,mn.iconBox,a.WritingMode.horizontal),()=>{const Kr=mn.verticalTextBox;return E.allowVerticalPlacement&&!(yr&&yr.box&&yr.box.length)&&rn.numVerticalGlyphVertices>0&&Kr?Ai(Kr,mn.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),yr&&(Hn=yr.box,kn=yr.offscreen);const Di=Si(yr&&yr.box);if(!Hn&&this.prevPlacement){const Kr=this.prevPlacement.variableOffsets[rn.crossTileID];Kr&&(this.variableOffsets[rn.crossTileID]=Kr,this.markUsedJustification(E,Kr.anchor,rn,Di))}}else{const gr=(Ai,Di)=>{const Kr=this.collisionIndex.placeCollisionBox(Ai,je,Y,z,Re.predicate,ta);return Kr&&Kr.box&&Kr.box.length&&(this.markUsedOrientation(E,Di,rn),this.placedOrientations[rn.crossTileID]=Di),Kr};Jn(()=>gr(bo,a.WritingMode.horizontal),()=>{const Ai=mn.verticalTextBox;return E.allowVerticalPlacement&&rn.numVerticalGlyphVertices>0&&Ai?gr(Ai,a.WritingMode.vertical):{box:null,offscreen:null}}),Si(yr&&yr.box&&yr.box.length)}}if(ur=yr,Hn=ur&&ur.box&&ur.box.length>0,kn=ur&&ur.offscreen,rn.useRuntimeCollisionCircles){const Si=E.text.placedSymbolArray.get(rn.centerJustifiedTextSymbolIndex),Jn=a.evaluateSizeForFeature(E.textSizeData,me,Si),gr=A.get("text-padding");Cr=this.collisionIndex.placeCollisionCircles(je,Si,E.lineVertexArray,E.glyphOffsetArray,Jn,z,j,K,b,ft,Re.predicate,rn.collisionCircleDiameter,gr,ta),Cr.circles.length&&Cr.collisionDetected&&!b&&a.warnOnce("Collisions detected, but collision boxes are not shown"),Hn=Xe||Cr.circles.length>0&&!Cr.collisionDetected,kn=kn&&Cr.offscreen}if(mn.iconFeatureIndex&&(Wa=mn.iconFeatureIndex),mn.iconBox){const Si=Jn=>{const gr=Et&&vr?nr(Jn,vr.x,vr.y,vt,ft,this.transform.angle):Jn;return this.collisionIndex.placeCollisionBox(gr,st,Y,z,Re.predicate,ta)};sr&&sr.box&&sr.box.length&&mn.verticalIconBox?(Ri=Si(mn.verticalIconBox),qn=Ri.box.length>0):(Ri=Si(mn.iconBox),qn=Ri.box.length>0),kn=kn&&Ri.offscreen}const Ss=Se||rn.numHorizontalGlyphVertices===0&&rn.numVerticalGlyphVertices===0,Uf=Ie||rn.numIconVertices===0;if(Ss||Uf?Uf?Ss||(qn=qn&&Hn):Hn=qn&&Hn:qn=Hn=qn&&Hn,Hn&&ur&&ur.box&&this.collisionIndex.insertCollisionBox(ur.box,je,A.get("text-ignore-placement"),E.bucketInstanceId,sr&&sr.box&&xa?xa:Ka,Re.ID),qn&&Ri&&this.collisionIndex.insertCollisionBox(Ri.box,st,A.get("icon-ignore-placement"),E.bucketInstanceId,Wa,Re.ID),Cr&&(Hn&&this.collisionIndex.insertCollisionCircles(Cr.circles,je,A.get("text-ignore-placement"),E.bucketInstanceId,Ka,Re.ID),b)){const Si=E.bucketInstanceId;let Jn=this.collisionCircleArrays[Si];Jn===void 0&&(Jn=this.collisionCircleArrays[Si]=new qt);for(let gr=0;gr=0;--mn){const Hn=rn[mn];fn(E.symbolInstances.get(Hn),E.collisionArrays[Hn])}}else for(let rn=c.symbolInstanceStart;rn=0&&(c.text.placedSymbolArray.get(j).crossTileID=A>=0&&j!==A?0:b.crossTileID)}markUsedOrientation(c,g,b){const E=g===a.WritingMode.horizontal||g===a.WritingMode.horizontalOnly?g:0,A=g===a.WritingMode.vertical?g:0,z=[b.leftJustifiedTextSymbolIndex,b.centerJustifiedTextSymbolIndex,b.rightJustifiedTextSymbolIndex];for(const j of z)c.text.placedSymbolArray.get(j).placedOrientation=E;b.verticalPlacedTextSymbolIndex&&(c.text.placedSymbolArray.get(b.verticalPlacedTextSymbolIndex).placedOrientation=A)}commit(c){this.commitTime=c,this.zoomAtLastRecencyCheck=this.transform.zoom;const g=this.prevPlacement;let b=!1;this.prevZoomAdjustment=g?g.zoomAdjustment(this.transform.zoom):0;const E=g?g.symbolFadeChange(c):1,A=g?g.opacities:{},z=g?g.variableOffsets:{},j=g?g.placedOrientations:{};for(const K in this.placements){const Y=this.placements[K],ie=A[K];ie?(this.opacities[K]=new xt(ie,E,Y.text,Y.icon),b=b||Y.text!==ie.text.placed||Y.icon!==ie.icon.placed):(this.opacities[K]=new xt(null,E,Y.text,Y.icon,Y.skipFade),b=b||Y.text||Y.icon)}for(const K in A){const Y=A[K];if(!this.opacities[K]){const ie=new xt(Y,E,!1,!1);ie.isHidden()||(this.opacities[K]=ie,b=b||Y.text.placed||Y.icon.placed)}}for(const K in z)this.variableOffsets[K]||!this.opacities[K]||this.opacities[K].isHidden()||(this.variableOffsets[K]=z[K]);for(const K in j)this.placedOrientations[K]||!this.opacities[K]||this.opacities[K].isHidden()||(this.placedOrientations[K]=j[K]);if(g&&g.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");b?this.lastPlacementChangeTime=c:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=g?g.lastPlacementChangeTime:c)}updateLayerOpacities(c,g){const b={};for(const E of g){const A=E.getBucket(c);A&&E.latestFeatureIndex&&c.id===A.layerIds[0]&&this.updateBucketOpacities(A,b,E.collisionBoxArray)}}updateBucketOpacities(c,g,b){c.hasTextData()&&c.text.opacityVertexArray.clear(),c.hasIconData()&&c.icon.opacityVertexArray.clear(),c.hasIconCollisionBoxData()&&c.iconCollisionBox.collisionVertexArray.clear(),c.hasTextCollisionBoxData()&&c.textCollisionBox.collisionVertexArray.clear();const E=c.layers[0].layout,A=new xt(null,0,!1,!1,!0),z=E.get("text-allow-overlap"),j=E.get("icon-allow-overlap"),K=E.get("text-variable-anchor"),Y=E.get("text-rotation-alignment")==="map",ie=E.get("text-pitch-alignment")==="map",ue=E.get("icon-text-fit")!=="none",me=new xt(null,0,z&&(j||!c.hasIconData()||E.get("icon-optional")),j&&(z||!c.hasTextData()||E.get("text-optional")),!0);!c.collisionArrays&&b&&(c.hasIconCollisionBoxData()||c.hasTextCollisionBoxData())&&c.deserializeCollisionBoxes(b);const Re=(Se,Ie,je)=>{for(let Xe=0;Xe0,ft=this.placedOrientations[Ie.crossTileID],Et=ft===a.WritingMode.vertical,It=ft===a.WritingMode.horizontal||ft===a.WritingMode.horizontalOnly;if(je>0||Xe>0){const Ht=Be(Oe.text);Re(c.text,je,Et?Je:Ht),Re(c.text,Xe,It?Je:Ht);const Ct=Oe.text.isHidden();[Ie.rightJustifiedTextSymbolIndex,Ie.centerJustifiedTextSymbolIndex,Ie.leftJustifiedTextSymbolIndex].forEach(mn=>{mn>=0&&(c.text.placedSymbolArray.get(mn).hidden=Ct||Et?1:0)}),Ie.verticalPlacedTextSymbolIndex>=0&&(c.text.placedSymbolArray.get(Ie.verticalPlacedTextSymbolIndex).hidden=Ct||It?1:0);const fn=this.variableOffsets[Ie.crossTileID];fn&&this.markUsedJustification(c,fn.anchor,Ie,ft);const rn=this.placedOrientations[Ie.crossTileID];rn&&(this.markUsedJustification(c,"left",Ie,rn),this.markUsedOrientation(c,rn,Ie))}if(vt){const Ht=Be(Oe.icon),Ct=!(ue&&Ie.verticalPlacedIconSymbolIndex&&Et);Ie.placedIconSymbolIndex>=0&&(Re(c.icon,Ie.numIconVertices,Ct?Ht:Je),c.icon.placedSymbolArray.get(Ie.placedIconSymbolIndex).hidden=Oe.icon.isHidden()),Ie.verticalPlacedIconSymbolIndex>=0&&(Re(c.icon,Ie.numVerticalIconVertices,Ct?Je:Ht),c.icon.placedSymbolArray.get(Ie.verticalPlacedIconSymbolIndex).hidden=Oe.icon.isHidden())}if(c.hasIconCollisionBoxData()||c.hasTextCollisionBoxData()){const Ht=c.collisionArrays[Se];if(Ht){let Ct=new a.pointGeometry(0,0);if(Ht.textBox||Ht.verticalTextBox){let rn=!0;if(K){const mn=this.variableOffsets[st];mn?(Ct=tr(mn.anchor,mn.width,mn.height,mn.textOffset,mn.textBoxScale),Y&&Ct._rotate(ie?this.transform.angle:-this.transform.angle)):rn=!1}Ht.textBox&&q(c.textCollisionBox.collisionVertexArray,Oe.text.placed,!rn||Et,Ct.x,Ct.y),Ht.verticalTextBox&&q(c.textCollisionBox.collisionVertexArray,Oe.text.placed,!rn||It,Ct.x,Ct.y)}const fn=Boolean(!It&&Ht.verticalIconBox);Ht.iconBox&&q(c.iconCollisionBox.collisionVertexArray,Oe.icon.placed,fn,ue?Ct.x:0,ue?Ct.y:0),Ht.verticalIconBox&&q(c.iconCollisionBox.collisionVertexArray,Oe.icon.placed,!fn,ue?Ct.x:0,ue?Ct.y:0)}}}if(c.sortFeatures(this.transform.angle),this.retainedQueryData[c.bucketInstanceId]&&(this.retainedQueryData[c.bucketInstanceId].featureSortOrder=c.featureSortOrder),c.hasTextData()&&c.text.opacityVertexBuffer&&c.text.opacityVertexBuffer.updateData(c.text.opacityVertexArray),c.hasIconData()&&c.icon.opacityVertexBuffer&&c.icon.opacityVertexBuffer.updateData(c.icon.opacityVertexArray),c.hasIconCollisionBoxData()&&c.iconCollisionBox.collisionVertexBuffer&&c.iconCollisionBox.collisionVertexBuffer.updateData(c.iconCollisionBox.collisionVertexArray),c.hasTextCollisionBoxData()&&c.textCollisionBox.collisionVertexBuffer&&c.textCollisionBox.collisionVertexBuffer.updateData(c.textCollisionBox.collisionVertexArray),c.text.opacityVertexArray.length!==c.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${c.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${c.text.layoutVertexArray.length}) / 4`);if(c.icon.opacityVertexArray.length!==c.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${c.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${c.icon.layoutVertexArray.length}) / 4`);if(c.bucketInstanceId in this.collisionCircleArrays){const Se=this.collisionCircleArrays[c.bucketInstanceId];c.placementInvProjMatrix=Se.invProjMatrix,c.placementViewportMatrix=Se.viewportMatrix,c.collisionCircleArray=Se.circles,delete this.collisionCircleArrays[c.bucketInstanceId]}}symbolFadeChange(c){return this.fadeDuration===0?1:(c-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(c){return Math.max(0,(this.transform.zoom-c)/1.5)}hasTransitions(c){return this.stale||c-this.lastPlacementChangeTimec}setStale(){this.stale=!0}}function q(C,c,g,b,E){C.emplaceBack(c?1:0,g?1:0,b||0,E||0),C.emplaceBack(c?1:0,g?1:0,b||0,E||0),C.emplaceBack(c?1:0,g?1:0,b||0,E||0),C.emplaceBack(c?1:0,g?1:0,b||0,E||0)}const J=Math.pow(2,25),pe=Math.pow(2,24),ce=Math.pow(2,17),we=Math.pow(2,16),Ae=Math.pow(2,9),Pe=Math.pow(2,8),Me=Math.pow(2,1);function Be(C){if(C.opacity===0&&!C.placed)return 0;if(C.opacity===1&&C.placed)return 4294967295;const c=C.placed?1:0,g=Math.floor(127*C.opacity);return g*J+c*pe+g*ce+c*we+g*Ae+c*Pe+g*Me+c}const Je=0;class et{constructor(c){this._sortAcrossTiles=c.layout.get("symbol-z-order")!=="viewport-y"&&!c.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(c,g,b,E,A){const z=this._bucketParts;for(;this._currentTileIndexj.sortKey-K.sortKey));this._currentPartIndex{const z=a.exported.now()-E;return!this._forceFullPlacement&&z>2};for(;this._currentPlacementIndex>=0;){const z=g[c[this._currentPlacementIndex]],j=this.placement.collisionIndex.transform.zoom;if(z.type==="symbol"&&(!z.minzoom||z.minzoom<=j)&&(!z.maxzoom||z.maxzoom>j)){if(this._inProgressLayer||(this._inProgressLayer=new et(z)),this._inProgressLayer.continuePlacement(b[z.source],this.placement,this._showCollisionBoxes,z,A))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(c){return this.placement.commit(c),this.placement}}const Ut=512/a.EXTENT/2;class Mt{constructor(c,g,b){this.tileID=c,this.indexedSymbolInstances={},this.bucketInstanceId=b;for(let E=0;Ec.overscaledZ)for(const j in z){const K=z[j];K.tileID.isChildOf(c)&&K.findMatches(g.symbolInstances,c,E)}else{const j=z[c.scaledTo(Number(A)).key];j&&j.findMatches(g.symbolInstances,c,E)}}for(let A=0;A{g[b]=!0});for(const b in this.layerIndexes)g[b]||delete this.layerIndexes[b]}}var En=a.createLayout([{name:"a_pos",type:"Int16",components:2}]);class hn extends a.Evented{constructor(c){super(),this.sourceCache=c,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=c._cache.max,c.usedForTerrain=!0,c.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const c in this._tiles){const g=this._tiles[c];g.textures.forEach(b=>b.destroy()),g.textures=[]}}update(c,g){this.sourceCache.update(c,g),this._renderableTilesKeys=[];for(const b of c.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:g}))this._renderableTilesKeys.push(b.key),this._tiles[b.key]||(b.posMatrix=new Float64Array(16),a.ortho(b.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),this._tiles[b.key]=new ke(b,this.tileSize))}removeOutdated(c){const g={};this.renderHistory=this.renderHistory.filter((b,E)=>this.renderHistory.indexOf(b)===E).slice(0,this.renderHistorySize);for(const b of this._renderableTilesKeys)g[b]=!0;for(const b of this.renderHistory)g[b]=!0;for(const b in this._tiles)g[b]||(this._tiles[b].clearTextures(c),delete this._tiles[b])}getRenderableTiles(){return this._renderableTilesKeys.map(c=>this.getTileByID(c))}getTileByID(c){return this._tiles[c]}getTerrainCoords(c){const g={};for(const b of this._renderableTilesKeys){const E=this._tiles[b].tileID;if(E.canonical.equals(c.canonical)){const A=c.clone();A.posMatrix=new Float64Array(16),a.ortho(A.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),g[b]=A}else if(E.canonical.isChildOf(c.canonical)){const A=c.clone();A.posMatrix=new Float64Array(16);const z=E.canonical.z-c.canonical.z,j=E.canonical.x-(E.canonical.x>>z<>z<>z;a.ortho(A.posMatrix,0,Y,0,Y,0,1),a.translate(A.posMatrix,A.posMatrix,[-j*Y,-K*Y,0]),g[b]=A}else if(c.canonical.isChildOf(E.canonical)){const A=c.clone();A.posMatrix=new Float64Array(16);const z=c.canonical.z-E.canonical.z,j=c.canonical.x-(c.canonical.x>>z<>z<>z;a.ortho(A.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),a.translate(A.posMatrix,A.posMatrix,[j*Y,K*Y,0]),a.scale(A.posMatrix,A.posMatrix,[1/2**z,1/2**z,0]),g[b]=A}}return g}getSourceTile(c,g){const b=this.sourceCache._source;let E=c.overscaledZ-this.deltaZoom;if(E>b.maxzoom&&(E=b.maxzoom),E=b.minzoom&&(!A||!A.dem);)A=this.sourceCache.getTileByID(c.scaledTo(E--).key);return A}tilesAfterTime(c=Date.now()){return Object.values(this._tiles).filter(g=>g.timeLoaded>=c)}}class Pn{constructor(c,g,b){this.style=c,this.sourceCache=new hn(g),this.options=b,this.exaggeration=typeof b.exaggeration=="number"?b.exaggeration:1,this.elevationOffset=typeof b.elevationOffset=="number"?b.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(c,g,b,E=a.EXTENT){if(!(g>=0&&g=0&&bc.canonical.z&&(c.canonical.z>=E?A=c.canonical.z-E:a.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const z=c.canonical.x-(c.canonical.x>>A<>A<>8<<4|A>>8,g[z+3]=0;const b=new a.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(g.buffer)),E=new P(c,b,c.gl.RGBA,{premultiply:!1});return E.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),this._coordsTexture=E,E}pointCoordinate(c){const g=new Uint8Array(4),b=this.style.map.painter,E=b.context,A=E.gl;E.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),A.readPixels(c.x,b.height/devicePixelRatio-c.y-1,1,1,A.RGBA,A.UNSIGNED_BYTE,g),E.bindFramebuffer.set(null);const z=g[0]+(g[2]>>4<<8),j=g[1]+((15&g[2])<<8),K=this.coordsIndex[255-g[3]],Y=K&&this.sourceCache.getTileByID(K);if(!Y)return null;const ie=this._coordsTextureSize,ue=(1<a.emitValidationErrors(C,c&&c.filter(g=>g.identifier!=="source.canvas")),lr=a.pick(rt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Zr=a.pick(rt,["setCenter","setZoom","setBearing","setPitch"]),hr=function(){const C={},c=a.spec.$version;for(const g in a.spec.$root){const b=a.spec.$root[g];if(b.required){let E=null;E=g==="version"?c:b.type==="array"?[]:{},E!=null&&(C[g]=E)}}return C}();class Vr extends a.Evented{constructor(c,g={}){super(),this.map=c,this.dispatcher=new G(mt(),this),this.imageManager=new T,this.imageManager.setEventedParent(this),this.glyphManager=new L(c._requestManager,g.localIdeographFontFamily),this.lineAtlas=new H(256,512),this.crossTileSymbolIndex=new Xt,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const b=this;this._rtlTextPluginCallback=Vr.registerForPluginStateChange(E=>{b.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:E.pluginStatus,pluginURL:E.pluginURL},(A,z)=>{if(a.triggerPluginCompletionEvent(A),z&&z.every(j=>j))for(const j in b.sourceCaches)b.sourceCaches[j].reload()})}),this.on("data",E=>{if(E.dataType!=="source"||E.sourceDataType!=="metadata")return;const A=this.sourceCaches[E.sourceId];if(!A)return;const z=A.getSource();if(z&&z.vectorLayerIds)for(const j in this._layers){const K=this._layers[j];K.source===z.id&&this._validateLayer(K)}})}loadURL(c,g={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const b=typeof g.validate!="boolean"||g.validate,E=this.map._requestManager.transformRequest(c,a.ResourceType.Style);this._request=a.getJSON(E,(A,z)=>{this._request=null,A?this.fire(new a.ErrorEvent(A)):z&&this._load(z,b)})}loadJSON(c,g={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(c,g.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(hr,!1)}_load(c,g){if(g&&Gn(this,a.validateStyle(c)))return;this._loaded=!0,this.stylesheet=c;for(const E in c.sources)this.addSource(E,c.sources[E],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs);const b=wt(this.stylesheet.layers);this._order=b.map(E=>E.id),this._layers={},this._serializedLayers={};for(let E of b)E=a.createStyleLayer(E),E.setEventedParent(this,{layer:{id:E.id}}),this._layers[E.id]=E,this._serializedLayers[E.id]=E.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new B(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(c){this._spriteRequest=function(g,b,E,A){let z,j,K;const Y=E>1?"@2x":"";let ie=a.getJSON(b.transformRequest(b.normalizeSpriteURL(g,Y,".json"),a.ResourceType.SpriteJSON),(Re,Se)=>{ie=null,K||(K=Re,z=Se,me())}),ue=a.getImage(b.transformRequest(b.normalizeSpriteURL(g,Y,".png"),a.ResourceType.SpriteImage),(Re,Se)=>{ue=null,K||(K=Re,j=Se,me())});function me(){if(K)A(K);else if(z&&j){const Re=a.exported.getImageData(j),Se={};for(const Ie in z){const{width:je,height:Xe,x:st,y:Oe,sdf:vt,pixelRatio:ft,stretchX:Et,stretchY:It,content:Ht}=z[Ie],Ct=new a.RGBAImage({width:je,height:Xe});a.RGBAImage.copy(Re,Ct,{x:st,y:Oe},{x:0,y:0},{width:je,height:Xe}),Se[Ie]={data:Ct,pixelRatio:ft,sdf:vt,stretchX:Et,stretchY:It,content:Ht}}A(null,Se)}}return{cancel(){ie&&(ie.cancel(),ie=null),ue&&(ue.cancel(),ue=null)}}}(c,this.map._requestManager,this.map.getPixelRatio(),(g,b)=>{if(this._spriteRequest=null,g)this.fire(new a.ErrorEvent(g));else if(b)for(const E in b)this.imageManager.addImage(E,b[E]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(c){const g=this.sourceCaches[c.source];if(!g)return;const b=c.sourceLayer;if(!b)return;const E=g.getSource();(E.type==="geojson"||E.vectorLayerIds&&E.vectorLayerIds.indexOf(b)===-1)&&this.fire(new a.ErrorEvent(new Error(`Source layer "${b}" does not exist on source "${E.id}" as specified by style layer "${c.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const c in this.sourceCaches)if(!this.sourceCaches[c].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(c){const g=[];for(const b of c){const E=this._layers[b];E.type!=="custom"&&g.push(E.serialize())}return g}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const c in this.sourceCaches)if(this.sourceCaches[c].hasTransition())return!0;for(const c in this._layers)if(this._layers[c].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(c){if(!this._loaded)return;const g=this._changed;if(this._changed){const E=Object.keys(this._updatedLayers),A=Object.keys(this._removedLayers);(E.length||A.length)&&this._updateWorkerLayers(E,A);for(const z in this._updatedSources){const j=this._updatedSources[z];if(j==="reload")this._reloadSource(z);else{if(j!=="clear")throw new Error(`Invalid action ${j}`);this._clearSource(z)}}this._updateTilesForChangedImages();for(const z in this._updatedPaintProps)this._layers[z].updateTransitions(c);this.light.updateTransitions(c),this._resetUpdates()}const b={};for(const E in this.sourceCaches){const A=this.sourceCaches[E];b[E]=A.used,A.used=!1}for(const E of this._order){const A=this._layers[E];A.recalculate(c,this._availableImages),!A.isHidden(c.zoom)&&A.source&&(this.sourceCaches[A.source].used=!0)}for(const E in b){const A=this.sourceCaches[E];b[E]!==A.used&&A.fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:E}))}this.light.recalculate(c),this.z=c.zoom,g&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const c=Object.keys(this._changedImages);if(c.length){for(const g in this.sourceCaches)this.sourceCaches[g].reloadTilesForDependencies(["icons","patterns"],c);this._changedImages={}}}_updateWorkerLayers(c,g){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(c),removedIds:g})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(c){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),c){const g=this.sourceCaches[c.source];if(!g)throw new Error(`cannot load terrain, because there exists no source with ID: ${c.source}`);this.terrain=new Pn(this,g,c),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=b=>{b.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=b=>{b.tile&&(b.sourceId===c.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(b.sourceId,b.tile.tileID)):b.source.type==="geojson"&&this.terrain.rememberForRerender(b.sourceId,b.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new a.Event("terrain",{terrain:c}))}setState(c){if(this._checkLoaded(),Gn(this,a.validateStyle(c)))return!1;(c=a.clone$1(c)).layers=wt(c.layers);const g=function(E,A){if(!E)return[{command:rt.setStyle,args:[A]}];let z=[];try{if(!m(E.version,A.version))return[{command:rt.setStyle,args:[A]}];m(E.center,A.center)||z.push({command:rt.setCenter,args:[A.center]}),m(E.zoom,A.zoom)||z.push({command:rt.setZoom,args:[A.zoom]}),m(E.bearing,A.bearing)||z.push({command:rt.setBearing,args:[A.bearing]}),m(E.pitch,A.pitch)||z.push({command:rt.setPitch,args:[A.pitch]}),m(E.sprite,A.sprite)||z.push({command:rt.setSprite,args:[A.sprite]}),m(E.glyphs,A.glyphs)||z.push({command:rt.setGlyphs,args:[A.glyphs]}),m(E.transition,A.transition)||z.push({command:rt.setTransition,args:[A.transition]}),m(E.light,A.light)||z.push({command:rt.setLight,args:[A.light]});const j={},K=[];(function(ie,ue,me,Re){let Se;for(Se in ue=ue||{},ie=ie||{})Object.prototype.hasOwnProperty.call(ie,Se)&&(Object.prototype.hasOwnProperty.call(ue,Se)||nt(Se,me,Re));for(Se in ue)Object.prototype.hasOwnProperty.call(ue,Se)&&(Object.prototype.hasOwnProperty.call(ie,Se)?m(ie[Se],ue[Se])||(ie[Se].type==="geojson"&&ue[Se].type==="geojson"&&dt(ie,ue,Se)?me.push({command:rt.setGeoJSONSourceData,args:[Se,ue[Se].data]}):qe(Se,ue,me,Re)):ut(Se,ue,me))})(E.sources,A.sources,K,j);const Y=[];E.layers&&E.layers.forEach(ie=>{j[ie.source]?z.push({command:rt.removeLayer,args:[ie.id]}):Y.push(ie)}),z=z.concat(K),function(ie,ue,me){ue=ue||[];const Re=(ie=ie||[]).map(Dt),Se=ue.map(Dt),Ie=ie.reduce(Nt,{}),je=ue.reduce(Nt,{}),Xe=Re.slice(),st=Object.create(null);let Oe,vt,ft,Et,It,Ht,Ct;for(Oe=0,vt=0;Oe!(E.command in Zr));if(g.length===0)return!1;const b=g.filter(E=>!(E.command in lr));if(b.length>0)throw new Error(`Unimplemented: ${b.map(E=>E.command).join(", ")}.`);return g.forEach(E=>{E.command!=="setTransition"&&this[E.command].apply(this,E.args)}),this.stylesheet=c,!0}addImage(c,g){if(this.getImage(c))return this.fire(new a.ErrorEvent(new Error(`An image named "${c}" already exists.`)));this.imageManager.addImage(c,g),this._afterImageUpdated(c)}updateImage(c,g){this.imageManager.updateImage(c,g)}getImage(c){return this.imageManager.getImage(c)}removeImage(c){if(!this.getImage(c))return this.fire(new a.ErrorEvent(new Error(`An image named "${c}" does not exist.`)));this.imageManager.removeImage(c),this._afterImageUpdated(c)}_afterImageUpdated(c){this._availableImages=this.imageManager.listImages(),this._changedImages[c]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(c,g,b={}){if(this._checkLoaded(),this.sourceCaches[c]!==void 0)throw new Error(`Source "${c}" already exists.`);if(!g.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(g).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(g.type)>=0&&this._validate(a.validateStyle.source,`sources.${c}`,g,null,b))return;this.map&&this.map._collectResourceTiming&&(g.collectResourceTiming=!0);const E=this.sourceCaches[c]=new Ue(c,g,this.dispatcher);E.style=this,E.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:E.serialize(),sourceId:c})),E.onAdd(this.map),this._changed=!0}removeSource(c){if(this._checkLoaded(),this.sourceCaches[c]===void 0)throw new Error("There is no source with this ID");for(const b in this._layers)if(this._layers[b].source===c)return this.fire(new a.ErrorEvent(new Error(`Source "${c}" cannot be removed while layer "${b}" is using it.`)));const g=this.sourceCaches[c];delete this.sourceCaches[c],delete this._updatedSources[c],g.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:c})),g.setEventedParent(null),g.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(c,g){if(this._checkLoaded(),this.sourceCaches[c]===void 0)throw new Error(`There is no source with this ID=${c}`);const b=this.sourceCaches[c].getSource();if(b.type!=="geojson")throw new Error(`geojsonSource.type is ${b.type}, which is !== 'geojson`);b.setData(g),this._changed=!0}getSource(c){return this.sourceCaches[c]&&this.sourceCaches[c].getSource()}addLayer(c,g,b={}){this._checkLoaded();const E=c.id;if(this.getLayer(E))return void this.fire(new a.ErrorEvent(new Error(`Layer "${E}" already exists on this map.`)));let A;if(c.type==="custom"){if(Gn(this,a.validateCustomStyleLayer(c)))return;A=a.createStyleLayer(c)}else{if(typeof c.source=="object"&&(this.addSource(E,c.source),c=a.clone$1(c),c=a.extend(c,{source:E})),this._validate(a.validateStyle.layer,`layers.${E}`,c,{arrayIndex:-1},b))return;A=a.createStyleLayer(c),this._validateLayer(A),A.setEventedParent(this,{layer:{id:E}}),this._serializedLayers[A.id]=A.serialize()}const z=g?this._order.indexOf(g):this._order.length;if(g&&z===-1)this.fire(new a.ErrorEvent(new Error(`Cannot add layer "${E}" before non-existing layer "${g}".`)));else{if(this._order.splice(z,0,E),this._layerOrderChanged=!0,this._layers[E]=A,this._removedLayers[E]&&A.source&&A.type!=="custom"){const j=this._removedLayers[E];delete this._removedLayers[E],j.type!==A.type?this._updatedSources[A.source]="clear":(this._updatedSources[A.source]="reload",this.sourceCaches[A.source].pause())}this._updateLayer(A),A.onAdd&&A.onAdd(this.map)}}moveLayer(c,g){if(this._checkLoaded(),this._changed=!0,!this._layers[c])return void this.fire(new a.ErrorEvent(new Error(`The layer '${c}' does not exist in the map's style and cannot be moved.`)));if(c===g)return;const b=this._order.indexOf(c);this._order.splice(b,1);const E=g?this._order.indexOf(g):this._order.length;g&&E===-1?this.fire(new a.ErrorEvent(new Error(`Cannot move layer "${c}" before non-existing layer "${g}".`))):(this._order.splice(E,0,c),this._layerOrderChanged=!0)}removeLayer(c){this._checkLoaded();const g=this._layers[c];if(!g)return void this.fire(new a.ErrorEvent(new Error(`Cannot remove non-existing layer "${c}".`)));g.setEventedParent(null);const b=this._order.indexOf(c);this._order.splice(b,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[c]=g,delete this._layers[c],delete this._serializedLayers[c],delete this._updatedLayers[c],delete this._updatedPaintProps[c],g.onRemove&&g.onRemove(this.map)}getLayer(c){return this._layers[c]}hasLayer(c){return c in this._layers}setLayerZoomRange(c,g,b){this._checkLoaded();const E=this.getLayer(c);E?E.minzoom===g&&E.maxzoom===b||(g!=null&&(E.minzoom=g),b!=null&&(E.maxzoom=b),this._updateLayer(E)):this.fire(new a.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${c}".`)))}setFilter(c,g,b={}){this._checkLoaded();const E=this.getLayer(c);if(E){if(!m(E.filter,g))return g==null?(E.filter=void 0,void this._updateLayer(E)):void(this._validate(a.validateStyle.filter,`layers.${E.id}.filter`,g,null,b)||(E.filter=a.clone$1(g),this._updateLayer(E)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${c}".`)))}getFilter(c){return a.clone$1(this.getLayer(c).filter)}setLayoutProperty(c,g,b,E={}){this._checkLoaded();const A=this.getLayer(c);A?m(A.getLayoutProperty(g),b)||(A.setLayoutProperty(g,b,E),this._updateLayer(A)):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${c}".`)))}getLayoutProperty(c,g){const b=this.getLayer(c);if(b)return b.getLayoutProperty(g);this.fire(new a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${c}".`)))}setPaintProperty(c,g,b,E={}){this._checkLoaded();const A=this.getLayer(c);A?m(A.getPaintProperty(g),b)||(A.setPaintProperty(g,b,E)&&this._updateLayer(A),this._changed=!0,this._updatedPaintProps[c]=!0):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${c}".`)))}getPaintProperty(c,g){return this.getLayer(c).getPaintProperty(g)}setFeatureState(c,g){this._checkLoaded();const b=c.source,E=c.sourceLayer,A=this.sourceCaches[b];if(A===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${b}' does not exist in the map's style.`)));const z=A.getSource().type;z==="geojson"&&E?this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):z!=="vector"||E?(c.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),A.setFeatureState(E,c.id,g)):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(c,g){this._checkLoaded();const b=c.source,E=this.sourceCaches[b];if(E===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${b}' does not exist in the map's style.`)));const A=E.getSource().type,z=A==="vector"?c.sourceLayer:void 0;A!=="vector"||z?g&&typeof c.id!="string"&&typeof c.id!="number"?this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):E.removeFeatureState(z,c.id,g):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(c){this._checkLoaded();const g=c.source,b=c.sourceLayer,E=this.sourceCaches[g];if(E!==void 0)return E.getSource().type!=="vector"||b?(c.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),E.getFeatureState(b,c.id)):void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.ErrorEvent(new Error(`The source '${g}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return a.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:a.mapObject(this.sourceCaches,c=>c.serialize()),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateLayer(c){this._updatedLayers[c.id]=!0,c.source&&!this._updatedSources[c.source]&&this.sourceCaches[c.source].getSource().type!=="raster"&&(this._updatedSources[c.source]="reload",this.sourceCaches[c.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(c){const g=z=>this._layers[z].type==="fill-extrusion",b={},E=[];for(let z=this._order.length-1;z>=0;z--){const j=this._order[z];if(g(j)){b[j]=z;for(const K of c){const Y=K[j];if(Y)for(const ie of Y)E.push(ie)}}}E.sort((z,j)=>j.intersectionZ-z.intersectionZ);const A=[];for(let z=this._order.length-1;z>=0;z--){const j=this._order[z];if(g(j))for(let K=E.length-1;K>=0;K--){const Y=E[K].feature;if(b[Y.layer.id]{const It=je.featureSortOrder;if(It){const Ht=It.indexOf(ft.featureIndex);return It.indexOf(Et.featureIndex)-Ht}return Et.featureIndex-ft.featureIndex});for(const ft of vt)Oe.push(ft)}}for(const je in Re)Re[je].forEach(Xe=>{const st=Xe.feature,Oe=K[z[je].source].getFeatureState(st.layer["source-layer"],st.id);st.source=st.layer.source,st.layer["source-layer"]&&(st.sourceLayer=st.layer["source-layer"]),st.state=Oe});return Re}(this._layers,this._serializedLayers,this.sourceCaches,c,g,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(A)}querySourceFeatures(c,g){g&&g.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",g.filter,null,g);const b=this.sourceCaches[c];return b?function(E,A){const z=E.getRenderableIds().map(Y=>E.getTileByID(Y)),j=[],K={};for(let Y=0;Y